Logo Search packages:      
Sourcecode: darkroom version File versions

Darkroom::Darkroom (  ) 

Default Constructor

Definition at line 101 of file Darkroom.cpp.

    : KXmlGuiWindow(), d(new Private)
{
    KGlobal::mainComponent().dirs()->addResourceType("icc_profiles", 0, "share/color/icc/");
 
    d->view = new DarkroomView(this);
    connect(&d->delayedPreviewUpdate, SIGNAL(timeout()), d->view, SLOT(updatePreview()));
    d->delayedPreviewUpdate.setSingleShot( true );
    d->delayedPreviewUpdate.setInterval(1000);
        
    d->currentRawFile = 0;
    d->listOptionsModel = new ListOptionsModel;
    d->listOptionsModel->loadFromConfigGroup( KConfigGroup(KGlobal::config(), "OptionsBookmark"));
    connect( d->listOptionsModel, SIGNAL(optionsChanged()), this, SLOT(optionsBookmarkChanged()));
    
    d->currentCodec = 0;
    // accept dnd
    setAcceptDrops(true);

    // tell the KXmlGuiWindow that this is indeed the main widget
    setCentralWidget(d->view);

    // then, setup our actions
    setupActions();

    // add a status bar
    statusBar()->show();
    
    // Create the progress bar
    d->progressBar = new QProgressBar(statusBar());
    d->progressBar->setMinimum( 0 );
    d->progressBar->setMaximum( 100 );
    d->progressBar->setVisible( false );
    d->progressBar->setTextVisible( false );
    d->progressBar->setMaximumWidth( 200 );
    d->progressBarTimeLine.setDuration( 10000 );
    d->progressBarTimeLine.setFrameRange( 0, 100 );
    d->progressBarTimeLine.start();
    d->progressBarTimeLine.setLoopCount( 0 );
    connect( &d->progressBarTimeLine, SIGNAL(frameChanged ( int ) ), d->progressBar, SLOT(setValue( int ) ) );
    statusBar()->addPermanentWidget( d->progressBar );

    // a call to KXmlGuiWindow::setupGUI() populates the GUI
    // with actions, using KXMLGUI.
    // It also applies the saved mainwindow settings, if any, and ask the
    // mainwindow to automatically save settings if changed: window size,
    // toolbar position, icon size, etc.
    setupGUI();
    
    // Initialize dockers
    setupDockers();
    setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea );
    setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );
    setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea );
    setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea );
    
    // Initialize weaver observer
    observeWeaver( JobPreview::weaver() );
    observeWeaver( JobExport::weaver() );
    observeWeaver( JobThumbnail::weaver() );
    
    const int scnum = QApplication::desktop()->screenNumber(parentWidget());
    QRect desk = QApplication::desktop()->screenGeometry(scnum);

    // if the desktop is virtual then use virtual screen size
    if (QApplication::desktop()->isVirtualDesktop())
        desk = QApplication::desktop()->screenGeometry(QApplication::desktop()->screen());
    
    // Default size
    const int deskWidth = desk.width();
    if (deskWidth > 1100) // very big desktop ?
        resize( 1000, 800 );
    if (deskWidth > 850) // big desktop ?
        resize( 800, 600 );
    else // small (800x600, 640x480) desktop
        resize( 600, 400 );

    KConfigGroup config ( KGlobal::config(), "Darkroom" );
    if( not config.hasKey( "State" ) )
    {
      QString state = "AAAA/wAAAAD9AAAAAwAAAAAAAAE7AAAEI/wCAAAABPwAAABHAAAAdQAAAHUBAAAe+gAAAAABAAAAAvsAAAAeAFEAdQBhAGwAaQB0AHkAIABPAHAAdABpAG8AbgBzAQAAAAD/////AAAAiQD////7AAAALgBOAG8AaQBzAGUAIABSAGUAZAB1AGMAdABpAG8AbgAgAE8AcAB0AGkAbwBuAHMBAAAAAP////8AAAEgAP////wAAADCAAAAtwAAALcBAAAe+gAAAAABAAAABPsAAAAqAFcAaABpAHQAZQAgAEIAYQBsAGEAbgBjAGUAIABPAHAAdABpAG8AbgBzAQAAAAD/////AAABOwD////7AAAAGgBMAGkAZwBoAHQAIABPAHAAdABpAG8AbgBzAQAAAAD/////AAABIAD////7AAAAFgBSAEEAVwAgAE8AcAB0AGkAbwBuAHMBAAAAAP////8AAAAAAAAAAPsAAAAaAEMAbwBsAG8AcgAgAE8AcAB0AGkAbwBuAHMBAAAAAAAAATsAAAEcAP////wAAAF/AAABoAAAATUBAAAe+gAAAAABAAAAA/sAAAAcAEUAeABwAG8AcgB0ACAATwBwAHQAaQBvAG4AcwEAAAAA/////wAAATQA////+wAAAAwATABlAHYAZQBsAHMBAAAAAP////8AAAEIAP////sAAAASAEgAaQBzAHQAbwBnAHIAYQBtAQAAAAAAAAE7AAAAkAD////8AAADJQAAAUUAAABnAQAAHvoAAAAAAQAAAAT7AAAAHgBMAGkAZwBoAHQAbgBlAHMAcwAgAEMAdQByAHYAZQEAAAAA/////wAAAJYA////+wAAABIAUgBlAGQAIABDAHUAcgB2AGUBAAAAAP////8AAACWAP////sAAAAWAEcAcgBlAGUAbgAgAEMAdQByAHYAZQEAAAAA/////wAAAJYA////+wAAABQAQgBsAHUAZQAgAEMAdQByAHYAZQEAAAAAAAABOwAAAJYA////AAAAAQAAAQgAAAQj/AIAAAAB+wAAACAATwBwAHQAaQBvAG4AcwAgAEIAbwBvAGsAbQBhAHIAawEAAABHAAAEIwAAAHkA////AAAAAgAABTEAAACg/AEAAAAB+wAAABoAQgBhAHQAYwBoACAAUAByAG8AYwBlAHMAcwEAAAFBAAAFMQAAAEcA////AAAFMQAAA30AAAABAAAAAgAAAAEAAAAC/AAAAAEAAAACAAAAAQAAABYAbQBhAGkAbgBUAG8AbwBsAEIAYQByAQAAAAAAAAeAAAAAAAAAAAA=";
      config.writeEntry("State", state);
    }
    
    setAutoSaveSettings( "Darkroom" );
    
    // Dunno why, but  KWindowSystem::setState( winId(), state ); make Darkroom becomes smaller instead of staying big, TODO contact David Faure about this when he is around again.

    const QSize size( config.readEntry( QString::fromLatin1("Width %1").arg(desk.width()), 0 ),
                config.readEntry( QString::fromLatin1("Height %1").arg(desk.height()), 0 ) );
    resize( size );
}


Generated by  Doxygen 1.6.0   Back to index