//--------------------------------------------------------------------------
MainWindow::MainWindow() :
    settings(new Settings(this)),
    scanner(new Scanner(this)),
    engine(new SearchEngine(this)),
    mainMenu(new MainMenu(this)),
    status(new StatusBar(this)),
    stack(new QStackedWidget(this)),
    settingsDialog(new SettingsDialog(this))
{
    // Set up window widgets
    setWindowTitle(tr("Vaultaire"));
    setWindowIcon(QIcon(":/vaultaire.svg"));
    setMenuBar(mainMenu);
    setStatusBar(status);
    setCentralWidget(stack);

    // Connect signals to show scanning in-progress in status bar
    connect(scanner, SIGNAL(started()),
            status, SLOT(startBusyIndicator()));
    connect(scanner, SIGNAL(started()),
            this, SLOT(showScanningMessage()));
    connect(scanner, SIGNAL(finished(Scanner::ScanResult)),
            status, SLOT(stopBusyIndicator()));
    connect(scanner, SIGNAL(finished(Scanner::ScanResult)),
            status, SLOT(clearMessage()));

    // Connect signals to show search in-progress in status bar
    connect(engine, SIGNAL(started()),
            status, SLOT(startBusyIndicator()));
    connect(engine, SIGNAL(finished(QStringList)),
            status, SLOT(stopBusyIndicator()));

    // Create application widgets
    scanView = new ScanView(scanner, this);
    browser = new LibraryBrowser(this);
    search = new SearchView(engine, this);
    stack->addWidget(scanView);
    stack->addWidget(browser);
    stack->addWidget(search);

    // Connect menu signals
    connect(mainMenu, SIGNAL(scanNewFile()), this, SLOT(showScanForm()));
    connect(mainMenu, SIGNAL(browseFiles()), this, SLOT(showFileBrowser()));
    connect(mainMenu, SIGNAL(findFile()), this, SLOT(showSearchForm()));
    connect(mainMenu, SIGNAL(showAboutInfo()), this, SLOT(about()));
    connect(mainMenu, SIGNAL(quit()), this, SLOT(close()));
    connect(mainMenu, SIGNAL(editSettings()), settingsDialog, SLOT(show()));

    readSettings();
}
Exemple #2
0
void EmailAccountWizardAccountPage::enumerationFinished()
{
    Q_D(EmailAccountWizardAccountPage);

    ForgettableWatcherType* watcher = dynamic_cast<ForgettableWatcherType*>(
        sender());
    Q_ASSERT(watcher);
    if (!watcher)
        return;

    SmartList<ServiceProviderInfo*>* result = watcher->result();
    if (!d->m_futureStarted || d->m_futureWatcher != watcher) {
        // Delete QFuture results from the forgotten watchers
        if (result)
            delete result;

        return;
    }

    // Get the result
    EmailAccountWizard* w = static_cast<EmailAccountWizard*>(wizard());
    Q_ASSERT(w);
    if (w)
        w->adoptResult(result);

    d->m_futureWatcher = 0;
    //d->m_futureStarted = false;

    stopBusyIndicator();
    enableButtons();
    next();
}