void DesktopMainWindow::createActions()
{
	_newProjectAction = new QAction(tr("New Project"), this);
	_newProjectAction->setShortcut(QKeySequence::New);
	_newProjectAction->setStatusTip(tr("Start a new project"));
	connect(_newProjectAction, SIGNAL(triggered()), this, SLOT(newProject()));
	
	_openProjectAction = new QAction(QIcon(":/resources/images/open.png"), tr("&Open Project"), this);
	_openProjectAction->setShortcut(QKeySequence::Open);
  _openProjectAction->setStatusTip(tr("Open an existing file"));
  connect(_openProjectAction, SIGNAL(triggered()), this, SLOT(openProject()));

	_saveProjectAction = new QAction(QIcon(":/resources/images/save.png"), tr("&Save Project"), this);
	_saveProjectAction->setShortcut(QKeySequence::Save);
	_saveProjectAction->setStatusTip(tr("Save current project"));
	connect(_saveProjectAction, SIGNAL(triggered()), this, SLOT(saveProject()));

	_exitAction = new QAction(tr("&Exit"), this);
	connect(_exitAction, SIGNAL(triggered()), this, SLOT(close()));

	_undoAction = new QAction(QIcon(":/resources/images/undo.png"), tr("&Undo"), this);
	connect(_undoAction, SIGNAL(triggered()), this, SLOT(undo()));

	_settingsAction = new QAction(QIcon(":/resources/images/gear.png"), tr("&Options"), this);
	connect(_settingsAction, SIGNAL(triggered()), this, SLOT(editSettings()));

  _restoreLayoutAction = new QAction(tr("&Restore Layout"), this);
  connect(_restoreLayoutAction, SIGNAL(triggered()), this, SLOT(restoreLayout()));

	_aboutAction = new QAction(QIcon(":/resources/images/info.png"), tr("&About"), this);
	_aboutAction->setStatusTip(tr("About Godzi"));
	connect(_aboutAction, SIGNAL(triggered()), this, SLOT(showAbout()));
}
Exemple #2
0
void MainWindow::createActions()
{
	openAction = new QAction(tr("&Otevřít seznam..."), this);
	openAction->setIcon(QIcon(":/images/fileopen.svg"));
	openAction->setShortcut(QKeySequence::Open);
	openAction->setStatusTip(tr("Otevřít existující soubor se seznamem"));
	QObject::connect(openAction, SIGNAL(triggered()),
					 mainWidget, SLOT(openDatabase()));

	saveAction = new QAction(QIcon(":/images/filesave.svg"),
							 tr("&Uložit seznam"), this);
	saveAction->setShortcut(QKeySequence::Save);
	QObject::connect(saveAction, SIGNAL(triggered()),
					 mainWidget, SLOT(saveDatabase()));

	saveAsAction = new QAction(QIcon(":/images/filesaveas.svg"),
							   tr("&Uložit seznam jako..."), this);
	saveAsAction->setShortcut(QKeySequence::SaveAs);
	QObject::connect(saveAsAction, SIGNAL(triggered()),
					 mainWidget, SLOT(saveDatabaseAs()));

	findAction = new QAction(tr("&Vyhledat položku..."), this);
	findAction->setIcon(QIcon(":/images/search.svg"));
	findAction->setShortcut(QKeySequence::Find);
	findAction->setStatusTip(tr("Vyhledat položku v otevřeném seznamu"));
	QObject::connect(findAction, SIGNAL(triggered()),
					 mainWidget, SLOT(findFile()));

	exportAction = new QAction(tr("&Exportovat seznam..."), this);
	exportAction->setIcon(QIcon(":/images/export.svg"));
	exportAction->setShortcut(QKeySequence("Ctrl+E"));
	exportAction->setStatusTip(tr("Exportovat seznam do HTML"));
	QObject::connect(exportAction, SIGNAL(triggered()),
					 mainWidget, SLOT(exportDatabase()));

	settingsAction = new QAction(tr("&Nastavení..."), this);
	settingsAction->setIcon(QIcon(":/images/settings.svg"));
	settingsAction->setStatusTip(tr("Upravit nastavení programu"));
	QObject::connect(settingsAction, SIGNAL(triggered()),
					 mainWidget, SLOT(editSettings()));

	viewPhoneListAction = new QAction(tr("&Zobrazit seznam linek..."), this);
	viewPhoneListAction->setIcon(QIcon(":/images/spreadsheet.svg"));
	QObject::connect(viewPhoneListAction, SIGNAL(triggered()),
					 mainWidget, SLOT(viewPhoneList()));

	aboutQtAction = new QAction(tr("O toolkitu &Qt"), this);
	aboutQtAction->setIcon(QIcon(":/images/qt.png"));
	aboutQtAction->setShortcut(QKeySequence(tr("Ctrl+Q")));
	QObject::connect(aboutQtAction, SIGNAL(triggered()),
					 qApp, SLOT(aboutQt()));
}
//--------------------------------------------------------------------------
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 #4
0
void MainWindow::setupActions()
{
    QAction *quitAction = KStandardAction::quit(QCoreApplication::instance(), SLOT(quit()), actionCollection());
    actionCollection()->addAction("file_quit", quitAction);

    QAction *focusSearchAction = KStandardAction::find(this, SLOT(setFocusSearchEdit()), actionCollection());
    actionCollection()->addAction("find", focusSearchAction);

    m_safeUpgradeAction = actionCollection()->addAction("safeupgrade");
    m_safeUpgradeAction->setIcon(QIcon::fromTheme("go-up"));
    m_safeUpgradeAction->setText(i18nc("@action Marks upgradeable packages for upgrade", "Cautious Upgrade"));
    connect(m_safeUpgradeAction, SIGNAL(triggered()), this, SLOT(markUpgrade()));

    m_distUpgradeAction = actionCollection()->addAction("fullupgrade");
    m_distUpgradeAction->setIcon(QIcon::fromTheme("go-top"));
    m_distUpgradeAction->setText(i18nc("@action Marks upgradeable packages, including ones that install/remove new things",
                                       "Full Upgrade"));
    connect(m_distUpgradeAction, SIGNAL(triggered()), this, SLOT(markDistUpgrade()));

    m_autoRemoveAction = actionCollection()->addAction("autoremove");
    m_autoRemoveAction->setIcon(QIcon::fromTheme("trash-empty"));
    m_autoRemoveAction->setText(i18nc("@action Marks packages no longer needed for removal",
                                      "Remove Unnecessary Packages"));
    connect(m_autoRemoveAction, SIGNAL(triggered()), this, SLOT(markAutoRemove()));

    m_previewAction = actionCollection()->addAction("preview");
    m_previewAction->setIcon(QIcon::fromTheme("document-preview-archive"));
    m_previewAction->setText(i18nc("@action Takes the user to the preview page", "Preview Changes"));
    connect(m_previewAction, SIGNAL(triggered()), this, SLOT(previewChanges()));

    m_applyAction = actionCollection()->addAction("apply");
    m_applyAction->setIcon(QIcon::fromTheme("dialog-ok-apply"));
    m_applyAction->setText(i18nc("@action Applys the changes a user has made", "Apply Changes"));
    connect(m_applyAction, SIGNAL(triggered()), this, SLOT(startCommit()));

    QAction* updateAction = actionCollection()->addAction("update");
    updateAction->setIcon(QIcon::fromTheme("system-software-update"));
    updateAction->setText(i18nc("@action Checks the Internet for updates", "Check for Updates"));
    actionCollection()->setDefaultShortcut(updateAction, QKeySequence(Qt::CTRL + Qt::Key_R));
    connect(updateAction, SIGNAL(triggered()), SLOT(checkForUpdates()));
    updateAction->setEnabled(QAptActions::self()->isConnected());
    connect(QAptActions::self(), SIGNAL(shouldConnect(bool)), updateAction, SLOT(setEnabled(bool)));

    KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());

    setActionsEnabled(false);

    setupGUI(StandardWindowOption(KXmlGuiWindow::Default & ~KXmlGuiWindow::StatusBar));
}
Exemple #5
0
BitSplit::BitSplit()
{
    fontDb.addApplicationFont(":/fonts/OpenSans-Light.ttf");
    fontDb.addApplicationFont(":/fonts/OpenSans-Regular.ttf");
    exit = true;
    blockToggle = false;
    searchExisting = false;

    /* Timer setup*/
    guiUpdater  = new QTimer( this );
    guiUpdater->setInterval(25);

    syncAnimator  = new QTimer( this );
    syncAnimator->setInterval(75);

    /* Interface setup */
    fileInterface.debug = false;
    fileInterface.copyDirection = BothDirections;
    actionCreator.fileInterface = &fileInterface;
    smartMatch.fileInterface = &fileInterface;
    actionHandler.fileInterface = &fileInterface;
    updater.fileInterface = &fileInterface;

    /* Set up icons */
    remove  = new QIcon(":images/general/remove.png");

    done    = new QIcon(":images/table/tick.png");
    errorIcon   = new QIcon(":images/table/error.png");
    skip    = new QIcon(":images/table/skip.png");

    sync1   = new QIcon(":images/table/sync1.png");
    syncAnimation.append(sync1);
    sync2   = new QIcon(":images/table/sync2.png");
    syncAnimation.append(sync2);
    sync3   = new QIcon(":images/table/sync3.png");
    syncAnimation.append(sync3);
    sync4   = new QIcon(":images/table/sync4.png");
    syncAnimation.append(sync4);
    sync5   = new QIcon(":images/table/sync5.png");
    syncAnimation.append(sync5);
    sync6   = new QIcon(":images/table/sync6.png");
    syncAnimation.append(sync6);
    sync7   = new QIcon(":images/table/sync7.png");
    syncAnimation.append(sync7);
    sync8   = new QIcon(":images/table/sync8.png");
    syncAnimation.append(sync8);


    ui.setupUi( this );
    ui.runButton->setDisabled(true);

    /* Connect buttons to their dialogs */
    connect(ui.editSettingsButton,  SIGNAL(clicked()),  this,   SLOT(editSettings()));
    connect(ui.newProfileButton,    SIGNAL(clicked()),  this,   SLOT(newProfile()));


    /* Log Connections*/
    connect(ui.actionView_Log,  SIGNAL(triggered()),        this,       SLOT(showLog()));
    connect(ui.exitLog,         SIGNAL(clicked()),          this,       SLOT(showMain()));
    connect(&fileInterface,     SIGNAL(updateLog(QString)), ui.log,     SLOT(append(QString)));
    connect(ui.errorViewLog,    SIGNAL(clicked()),          this,       SLOT(showLog()));

    /* Top Bar connections*/
    connect(&fileInterface, SIGNAL(matchComplete()),            this,               SLOT(matchComplete()));
    connect(&fileInterface, SIGNAL(updateSingle(QString)),      ui.topBarSingle,    SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateTopMP(QString)),       ui.mp_top,          SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateBottomMP(QString)),    ui.mp_bottom,       SLOT(setText(QString)));
    connect(&fileInterface, SIGNAL(updateOperationMP(QString)), ui.mp_operation,    SLOT(setText(QString)));
    connect(guiUpdater,     SIGNAL(timeout()),                  &smartMatch,        SLOT(updateGuiLabels()));
    connect(&smartMatch,    SIGNAL(startTime()),                guiUpdater,         SLOT(start()));
    connect(&smartMatch,    SIGNAL(stopTime()),                 guiUpdater,         SLOT(stop()));
    connect(&smartMatch,    SIGNAL(setTopBarLineStack(int)),    this,               SLOT(setTopBarLineStack(int)));

    /* Unmatched files tree Connections */
    connect(ui.unmatchedTree,   SIGNAL(itemChanged(QTreeWidgetItem*,int)),  this,   SLOT(toggleTree(QTreeWidgetItem*,int)));
    connect(&fileInterface,     SIGNAL(updateFileTree(bool, QTreeWidgetItem *)), this, SLOT(insertTreeItem(bool, QTreeWidgetItem *)));
    connect(&fileInterface,     SIGNAL(pop()),                              this,   SLOT(popParent()));
    connect(&fileInterface,     SIGNAL(expandTree()), this, SLOT(expandTree()));

    /* Matched Table Connections */
    connect(&fileInterface, SIGNAL(insertMatchTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertMatchTableRow(QList<QTableWidgetItem*>*)));

    /* Action Table Connections*/
    connect(&fileInterface, SIGNAL(insertActionTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertActionTableRow(QList<QTableWidgetItem*>*)));

    /* Error connections */
    connect(&smartMatch,    SIGNAL(operationFailed()),  this, SLOT(error()));
    connect(&actionCreator,    SIGNAL(operationFailed()),  this, SLOT(error()));
    connect(&actionHandler,     SIGNAL(exception()), this, SLOT(error()));

    /* Developer Test Connections */
    connect(ui.actionDeveloper_Test, SIGNAL(triggered()), this, SLOT(runDeveloperTest()));
    connect(&smartMatch, SIGNAL(stopTestTime()), this, SLOT(endTimer()));

    /* Action Handler Connections */
    connect(&actionHandler, SIGNAL(updateProgress(int)),            ui.progressBar,         SLOT(setValue(int)));
    connect(&actionHandler, SIGNAL(updateActionLabel(QString)),     ui.actionLabel,         SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(updateSpeedLabel(QString)),      ui.speedLabel,          SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(updatePercentageLabel(QString)), ui.mp_busyIndicator,    SLOT(setText(QString)));
    connect(&actionHandler, SIGNAL(setComplete(int)),               this,                   SLOT(setDone(int)));
    connect(&actionHandler, SIGNAL(setSkipped(int)),                this,                   SLOT(setSkip(int)));
    connect(&actionHandler, SIGNAL(setError(int)),                  this,                   SLOT(setError(int)));
    connect(&actionHandler, SIGNAL(setInProgress(int)),             this,                   SLOT(setSync(int)));

    /* Updater Connections */
    connect(&updater,       SIGNAL(complete()),     this,   SLOT(updaterComplete()));

    /* General Connections & Button Stack Connections */
    connect(syncAnimator,           SIGNAL(timeout()),  this,   SLOT(showSync()));
    connect(ui.finishEditButton,    SIGNAL(clicked()),  this,   SLOT(createActions()));
    connect(&actionCreator,         SIGNAL(complete()), this,   SLOT(actionsComplete()));
    connect(ui.runButton,           SIGNAL(clicked()),  this,   SLOT(runActionHandler()));
    connect(ui.searchButton,        SIGNAL(clicked()),  this,   SLOT(searchForSync()));
    connect(&actionHandler,         SIGNAL(complete()), this,   SLOT(actionHandlerComplete()));

    /* General Setup*/
    frame = 0;
    currentAction = -1;
    actionHandler.table = ui.actionsTable;
    ui.mp_ProfileLabel->fontMetrics().width(ui.mp_ProfileLabel->text());
    createTrayIcon();
    setupTable();
    fileInterface.loadDatabase();
    recentProfiles = fileInterface.loadRecentProfiles();
    if(recentProfiles.size() > 0)
        showRecentProfiles();

}