Example #1
0
void MainWindow::setupActions()
{
    KAction *newDownloadAction = actionCollection()->addAction("new_download");
    newDownloadAction->setText(i18n("&New Download..."));
    newDownloadAction->setIcon(KIcon("document-new"));
    newDownloadAction->setShortcuts(KShortcut("Ctrl+N"));
    newDownloadAction->setHelpText(i18n("Opens a dialog to add a transfer to the list"));
    connect(newDownloadAction, SIGNAL(triggered()), SLOT(slotNewTransfer()));

    KAction *openAction = actionCollection()->addAction("import_transfers");
    openAction->setText(i18n("&Import Transfers..."));
    openAction->setIcon(KIcon("document-open"));
    openAction->setShortcuts(KShortcut("Ctrl+I"));
    openAction->setHelpText(i18n("Imports a list of transfers"));
    connect(openAction, SIGNAL(triggered()), SLOT(slotImportTransfers()));

    KAction *exportAction = actionCollection()->addAction("export_transfers");
    exportAction->setText(i18n("&Export Transfers List..."));
    exportAction->setIcon(KIcon("document-export"));
    exportAction->setShortcuts(KShortcut("Ctrl+E"));
    exportAction->setHelpText(i18n("Exports the current transfers into a file"));
    connect(exportAction, SIGNAL(triggered()), SLOT(slotExportTransfers()));

    KAction *createMetalinkAction = actionCollection()->addAction("create_metalink");
    createMetalinkAction->setText(i18n("&Create a Metalink..."));
    createMetalinkAction->setIcon(KIcon("journal-new"));
    createMetalinkAction->setHelpText(i18n("Creates or modifies a metalink and saves it on disk"));
    connect(createMetalinkAction, SIGNAL(triggered()), SLOT(slotCreateMetalink()));

    KAction *priorityTop = actionCollection()->addAction("priority_top");
    priorityTop->setText(i18n("Top Priority"));
    priorityTop->setIcon(KIcon("arrow-up-double"));
    priorityTop->setShortcuts(KShortcut("Ctrl+PgUp"));
    priorityTop->setHelpText(i18n("Download selected transfer first"));
    connect(priorityTop, SIGNAL(triggered()), this, SLOT(slotPriorityTop()));

    KAction *priorityBottom = actionCollection()->addAction("priority_bottom");
    priorityBottom->setText(i18n("Least Priority"));
    priorityBottom->setIcon(KIcon("arrow-down-double"));
    priorityBottom->setShortcuts(KShortcut("Ctrl+PgDown"));
    priorityBottom->setHelpText(i18n("Download selected transfer last"));
    connect(priorityBottom, SIGNAL(triggered()), this, SLOT(slotPriorityBottom()));

    KAction *priorityUp = actionCollection()->addAction("priority_up");
    priorityUp->setText(i18n("Increase Priority"));
    priorityUp->setIcon(KIcon("arrow-up"));
    priorityUp->setShortcuts(KShortcut("Ctrl+Up"));
    priorityUp->setHelpText(i18n("Increase priority for selected transfer"));
    connect(priorityUp, SIGNAL(triggered()), this, SLOT(slotPriorityUp()));

    KAction *priorityDown = actionCollection()->addAction("priority_down");
    priorityDown->setText(i18n("Decrease Priority"));
    priorityDown->setIcon(KIcon("arrow-down"));
    priorityDown->setShortcuts(KShortcut("Ctrl+Down"));
    priorityDown->setHelpText(i18n("Decrease priority for selected transfer"));
    connect(priorityDown, SIGNAL(triggered()), this, SLOT(slotPriorityDown()));

    //FIXME: Not needed maybe because the normal delete already deletes groups?
    KAction *deleteGroupAction = actionCollection()->addAction("delete_groups");
    deleteGroupAction->setText(i18n("Delete Group"));
    deleteGroupAction->setIcon(KIcon("edit-delete"));
    deleteGroupAction->setHelpText(i18n("Delete selected group"));
    connect(deleteGroupAction, SIGNAL(triggered()), SLOT(slotDeleteGroup()));

    KAction *renameGroupAction = actionCollection()->addAction("rename_groups");
    renameGroupAction->setText(i18n("Rename Group..."));
    renameGroupAction->setIcon(KIcon("edit-rename"));
    connect(renameGroupAction, SIGNAL(triggered()), SLOT(slotRenameGroup()));

    KAction *setIconGroupAction = actionCollection()->addAction("seticon_groups");
    setIconGroupAction->setText(i18n("Set Icon..."));
    setIconGroupAction->setIcon(KIcon("preferences-desktop-icons"));
    setIconGroupAction->setHelpText(i18n("Select a custom icon for the selected group"));
    connect(setIconGroupAction, SIGNAL(triggered()), SLOT(slotSetIconGroup()));

    m_autoPasteAction = new KToggleAction(KIcon("edit-paste"),
                                          i18n("Auto-Paste Mode"), actionCollection());
    actionCollection()->addAction("auto_paste", m_autoPasteAction);
    m_autoPasteAction->setChecked(Settings::autoPaste());
    m_autoPasteAction->setWhatsThis(i18n("<b>Auto paste</b> button toggles the auto-paste mode "
                                         "on and off.\nWhen set, KGet will periodically scan "
                                         "the clipboard for URLs and paste them automatically."));
    connect(m_autoPasteAction, SIGNAL(triggered()), SLOT(slotToggleAutoPaste()));

    m_konquerorIntegration = new KToggleAction(KIcon("konqueror"),
                                               i18n("Use KGet as Konqueror Download Manager"), actionCollection());
    actionCollection()->addAction("konqueror_integration", m_konquerorIntegration);
    connect(m_konquerorIntegration, SIGNAL(triggered(bool)), SLOT(slotTrayKonquerorIntegration(bool)));
    m_konquerorIntegration->setChecked(Settings::konquerorIntegration());

    // local - Destroys all sub-windows and exits
    KStandardAction::quit(this, SLOT(slotQuit()), actionCollection());
    // local - Standard configure actions
    KStandardAction::preferences(this, SLOT(slotPreferences()), actionCollection());

    KStandardAction::configureNotifications(this, SLOT(slotConfigureNotifications()), actionCollection());
    m_menubarAction = KStandardAction::showMenubar(this, SLOT(slotShowMenubar()), actionCollection());
    m_menubarAction->setChecked(!menuBar()->isHidden());

    // Transfer related actions
    actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_viewsContainer, SLOT(selectAll()));

    KAction *deleteSelectedAction = actionCollection()->addAction("delete_selected_download");
    deleteSelectedAction->setText(i18nc("delete selected transfer item", "Remove Selected"));
    deleteSelectedAction->setIcon(KIcon("edit-delete"));
    deleteSelectedAction->setShortcuts(KShortcut("Del"));
    deleteSelectedAction->setHelpText(i18n("Removes selected transfer and deletes files from disk if it's not finished"));
    connect(deleteSelectedAction, SIGNAL(triggered()), SLOT(slotDeleteSelected()));

    KAction *deleteAllFinishedAction = actionCollection()->addAction("delete_all_finished");
    deleteAllFinishedAction->setText(i18nc("delete all finished transfers", "Remove All Finished"));
    deleteAllFinishedAction->setIcon(KIcon("edit-clear-list"));
    deleteAllFinishedAction->setHelpText(i18n("Removes all finished transfers and leaves all files on disk"));
    connect(deleteAllFinishedAction, SIGNAL(triggered()), SLOT(slotDeleteFinished()));
    
    KAction *deleteSelectedIncludingFilesAction = actionCollection()->addAction("delete_selected_download_including_files");
    deleteSelectedIncludingFilesAction->setText(i18nc("delete selected transfer item and files", "Remove Selected and Delete Files"));
    deleteSelectedIncludingFilesAction->setIcon(KIcon("edit-delete"));
    deleteSelectedIncludingFilesAction->setHelpText(i18n("Removes selected transfer and deletes files from disk in any case"));
    connect(deleteSelectedIncludingFilesAction, SIGNAL(triggered()), SLOT(slotDeleteSelectedIncludingFiles()));

    KAction *redownloadSelectedAction = actionCollection()->addAction("redownload_selected_download");
    redownloadSelectedAction->setText(i18nc("redownload selected transfer item", "Redownload Selected"));
    redownloadSelectedAction->setIcon(KIcon("view-refresh"));
    connect(redownloadSelectedAction, SIGNAL(triggered()), SLOT(slotRedownloadSelected()));

    KAction *startAllAction = actionCollection()->addAction("start_all_download");
    startAllAction->setText(i18n("Start All"));
    startAllAction->setIcon(KIcon("media-seek-forward"));
    startAllAction->setShortcuts(KShortcut("Ctrl+R"));
    startAllAction->setHelpText(i18n("Starts / resumes all transfers"));
    connect(startAllAction, SIGNAL(triggered()), SLOT(slotStartAllDownload()));

    KAction *startSelectedAction = actionCollection()->addAction("start_selected_download");
    startSelectedAction->setText(i18n("Start Selected"));
    startSelectedAction->setIcon(KIcon("media-playback-start"));
    startSelectedAction->setHelpText(i18n("Starts / resumes selected transfer"));
    connect(startSelectedAction, SIGNAL(triggered()), SLOT(slotStartSelectedDownload()));

    KAction *stopAllAction = actionCollection()->addAction("stop_all_download");
    stopAllAction->setText(i18n("Pause All"));
    stopAllAction->setIcon(KIcon("media-playback-pause"));
    stopAllAction->setShortcuts(KShortcut("Ctrl+P"));
    stopAllAction->setHelpText(i18n("Pauses all transfers"));
    connect(stopAllAction, SIGNAL(triggered()), SLOT(slotStopAllDownload()));

    KAction *stopSelectedAction = actionCollection()->addAction("stop_selected_download");
    stopSelectedAction->setText(i18n("Stop Selected"));
    stopSelectedAction->setIcon(KIcon("media-playback-pause"));
    stopSelectedAction->setHelpText(i18n("Pauses selected transfer"));
    connect(stopSelectedAction, SIGNAL(triggered()), SLOT(slotStopSelectedDownload()));

    KActionMenu *startActionMenu = new KActionMenu(KIcon("media-playback-start"), i18n("Start"),
                                                     actionCollection());
    actionCollection()->addAction("start_menu", startActionMenu);
    startActionMenu->setDelayed(true);
    startActionMenu->addAction(startSelectedAction);
    startActionMenu->addAction(startAllAction);
    connect(startActionMenu, SIGNAL(triggered()), SLOT(slotStartDownload()));

    KActionMenu *stopActionMenu = new KActionMenu(KIcon("media-playback-pause"), i18n("Pause"),
                                                    actionCollection());
    actionCollection()->addAction("stop_menu", stopActionMenu);
    stopActionMenu->setDelayed(true);
    stopActionMenu->addAction(stopSelectedAction);
    stopActionMenu->addAction(stopAllAction);
    connect(stopActionMenu, SIGNAL(triggered()), SLOT(slotStopDownload()));
    
    KAction *openDestAction = actionCollection()->addAction("transfer_open_dest");
    openDestAction->setText(i18n("Open Destination"));
    openDestAction->setIcon(KIcon("document-open"));
    connect(openDestAction, SIGNAL(triggered()), SLOT(slotTransfersOpenDest()));

    KAction *openFileAction = actionCollection()->addAction("transfer_open_file");
    openFileAction->setText(i18n("Open File"));
    openFileAction->setIcon(KIcon("document-open"));
    connect(openFileAction, SIGNAL(triggered()), SLOT(slotTransfersOpenFile()));

    KAction *showDetailsAction = new KToggleAction(KIcon("document-properties"), i18n("Show Details"), actionCollection());
    actionCollection()->addAction("transfer_show_details", showDetailsAction);
    connect(showDetailsAction, SIGNAL(triggered()), SLOT(slotTransfersShowDetails()));

    KAction *copyUrlAction = actionCollection()->addAction("transfer_copy_source_url");
    copyUrlAction->setText(i18n("Copy URL to Clipboard"));
    copyUrlAction->setIcon(KIcon("edit-copy"));
    connect(copyUrlAction, SIGNAL(triggered()), SLOT(slotTransfersCopySourceUrl()));

    KAction *transferHistoryAction = actionCollection()->addAction("transfer_history");
    transferHistoryAction->setText(i18n("&Transfer History"));
    transferHistoryAction->setIcon(KIcon("view-history"));
    transferHistoryAction->setShortcuts(KShortcut("Ctrl+H"));
    connect(transferHistoryAction, SIGNAL(triggered()), SLOT(slotTransferHistory()));

    KAction *transferGroupSettingsAction = actionCollection()->addAction("transfer_group_settings");
    transferGroupSettingsAction->setText(i18n("&Group Settings"));
    transferGroupSettingsAction->setIcon(KIcon("preferences-system"));
    transferGroupSettingsAction->setShortcuts(KShortcut("Ctrl+G"));
    connect(transferGroupSettingsAction, SIGNAL(triggered()), SLOT(slotTransferGroupSettings()));

    KAction *transferSettingsAction = actionCollection()->addAction("transfer_settings");
    transferSettingsAction->setText(i18n("&Transfer Settings"));
    transferSettingsAction->setIcon(KIcon("preferences-system"));
    transferSettingsAction->setShortcuts(KShortcut("Ctrl+T"));
    connect(transferSettingsAction, SIGNAL(triggered()), SLOT(slotTransferSettings()));

    KAction *listLinksAction = actionCollection()->addAction("import_links");
    listLinksAction->setText(i18n("Import &Links..."));
    listLinksAction->setIcon(KIcon("view-list-text"));
    listLinksAction->setShortcuts(KShortcut("Ctrl+L"));
    connect(listLinksAction, SIGNAL(triggered()), SLOT(slotShowListLinks()));

    //create the download finished actions which can be displayed in the toolbar
    KSelectAction *downloadFinishedActions = new KSelectAction(i18n("After downloads finished action"), this);//TODO maybe with name??
    actionCollection()->addAction("download_finished_actions", downloadFinishedActions);
    downloadFinishedActions->setHelpText(i18n("Choose an action that is executed after all downloads have been finished."));

    KAction *noAction = downloadFinishedActions->addAction(i18n("No Action"));
    connect(noAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions()));
    downloadFinishedActions->addAction(noAction);

    KAction *quitAction = downloadFinishedActions->addAction(i18n("Quit KGet"));
    quitAction->setData(KGet::Quit);
    connect(quitAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions()));
    downloadFinishedActions->addAction(quitAction);

#ifdef HAVE_KWORKSPACE
    KAction *shutdownAction = downloadFinishedActions->addAction(i18n("Turn Off Computer"));
    shutdownAction->setData(KGet::Shutdown);
    connect(shutdownAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions()));
    downloadFinishedActions->addAction(shutdownAction);

    KAction *hibernateAction = downloadFinishedActions->addAction(i18n("Hibernate Computer"));
    hibernateAction->setData(KGet::Hibernate);
    connect(hibernateAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions()));
    downloadFinishedActions->addAction(hibernateAction);

    KAction *suspendAction = downloadFinishedActions->addAction(i18n("Suspend Computer"));
    suspendAction->setData(KGet::Suspend);
    connect(suspendAction, SIGNAL(triggered()), SLOT(slotDownloadFinishedActions()));
    downloadFinishedActions->addAction(suspendAction);
#endif

    if (Settings::afterFinishActionEnabled()) {
        downloadFinishedActions->setCurrentItem(Settings::afterFinishAction() + 1);
    } else {
        downloadFinishedActions->setCurrentItem(0);
    }
}
void UIVisoCreator::prepareWidgets()
{
    m_pCentralWidget = new QWidget;
    if (!m_pCentralWidget)
        return;
    setCentralWidget(m_pCentralWidget);

    m_pMainLayout = new QGridLayout;
    m_pCentralWidget->setLayout(m_pMainLayout);
    if (!m_pMainLayout || !menuBar())
        return;

    /* Configure layout: */
    const int iL = qApp->style()->pixelMetric(QStyle::PM_LayoutLeftMargin) / 2;
    const int iT = qApp->style()->pixelMetric(QStyle::PM_LayoutTopMargin) / 2;
    const int iR = qApp->style()->pixelMetric(QStyle::PM_LayoutRightMargin) / 2;
    const int iB = qApp->style()->pixelMetric(QStyle::PM_LayoutBottomMargin) / 2;
    m_pMainLayout->setContentsMargins(iL, iT, iR, iB);
#ifdef VBOX_WS_MAC
    m_pMainLayout->setSpacing(10);
#else
    m_pMainLayout->setSpacing(qApp->style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing) / 2);
#endif

    m_pMainMenu = menuBar()->addMenu(tr("VISO"));
    if (m_pActionConfiguration)
        m_pMainMenu->addAction(m_pActionConfiguration);
    if (m_pActionOptions)
        m_pMainMenu->addAction(m_pActionOptions);

    m_pToolBar = new UIToolBar;
    if (m_pToolBar)
    {
        /* Configure toolbar: */
        const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_pMainLayout->addWidget(m_pToolBar, 0, 0, 1, 5);
    }

    m_pHostBrowser = new UIVisoHostBrowser;
    if (m_pHostBrowser)
    {
        m_pMainLayout->addWidget(m_pHostBrowser, 1, 0, 1, 2);
        m_pMainLayout->setColumnStretch(m_pMainLayout->indexOf(m_pHostBrowser), 2);
    }

    prepareVerticalToolBar();
    if (m_pVerticalToolBar)
    {
        m_pMainLayout->addWidget(m_pVerticalToolBar, 1, 2, 1, 1);
        m_pMainLayout->setColumnStretch(m_pMainLayout->indexOf(m_pVerticalToolBar), 1);
    }

    m_pVisoBrowser = new UIVisoContentBrowser;
    if (m_pVisoBrowser)
    {
        m_pMainLayout->addWidget(m_pVisoBrowser, 1, 3, 1, 2);
        m_pVisoBrowser->setVisoName(m_visoOptions.m_strVisoName);
        m_pMainLayout->setColumnStretch(m_pMainLayout->indexOf(m_pVisoBrowser), 2);
    }

    m_pConfigurationPanel = new UIVisoConfigurationPanel(this);
    if (m_pConfigurationPanel)
    {
        m_pMainLayout->addWidget(m_pConfigurationPanel, 2, 0, 1, 5);
        m_pConfigurationPanel->hide();
        m_pConfigurationPanel->setVisoName(m_visoOptions.m_strVisoName);
        m_pConfigurationPanel->setVisoCustomOptions(m_visoOptions.m_customOptions);
    }

    m_pCreatorOptionsPanel = new UIVisoCreatorOptionsPanel;
    if (m_pCreatorOptionsPanel)
    {
        m_pCreatorOptionsPanel->setShowHiddenbjects(m_browserOptions.m_fShowHiddenObjects);
        m_pMainLayout->addWidget(m_pCreatorOptionsPanel, 3, 0, 1, 5);
        m_pCreatorOptionsPanel->hide();
    }

    m_pButtonBox = new QIDialogButtonBox;
    if (m_pButtonBox)
    {
        m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
        m_pButtonBox->button(QDialogButtonBox::Cancel)->setShortcut(Qt::Key_Escape);
        m_pMainLayout->addWidget(m_pButtonBox, 4, 3, 1, 5, Qt::AlignRight);
    }

}
Example #3
0
MainWindow::MainWindow()
    : QMainWindow()
    , m_view(new SvgView)
{
    QMenu *fileMenu = new QMenu(tr("&File"), this);
    QAction *openAction = fileMenu->addAction(tr("&Open..."));
    openAction->setShortcut(QKeySequence(tr("Ctrl+O")));
    QAction *quitAction = fileMenu->addAction(tr("E&xit"));
    quitAction->setShortcuts(QKeySequence::Quit);

    menuBar()->addMenu(fileMenu);

    QMenu *viewMenu = new QMenu(tr("&View"), this);
    m_backgroundAction = viewMenu->addAction(tr("&Background"));
    m_backgroundAction->setEnabled(false);
    m_backgroundAction->setCheckable(true);
    m_backgroundAction->setChecked(false);
    connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool)));

    m_outlineAction = viewMenu->addAction(tr("&Outline"));
    m_outlineAction->setEnabled(false);
    m_outlineAction->setCheckable(true);
    m_outlineAction->setChecked(true);
    connect(m_outlineAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewOutline(bool)));

    menuBar()->addMenu(viewMenu);

    QMenu *rendererMenu = new QMenu(tr("&Renderer"), this);
    m_nativeAction = rendererMenu->addAction(tr("&Native"));
    m_nativeAction->setCheckable(true);
    m_nativeAction->setChecked(true);
#ifndef QT_NO_OPENGL
    m_glAction = rendererMenu->addAction(tr("&OpenGL"));
    m_glAction->setCheckable(true);
#endif
    m_imageAction = rendererMenu->addAction(tr("&Image"));
    m_imageAction->setCheckable(true);

#ifndef QT_NO_OPENGL
    rendererMenu->addSeparator();
    m_highQualityAntialiasingAction = rendererMenu->addAction(tr("&High Quality Antialiasing"));
    m_highQualityAntialiasingAction->setEnabled(false);
    m_highQualityAntialiasingAction->setCheckable(true);
    m_highQualityAntialiasingAction->setChecked(false);
    connect(m_highQualityAntialiasingAction, SIGNAL(toggled(bool)), m_view, SLOT(setHighQualityAntialiasing(bool)));
#endif

    QActionGroup *rendererGroup = new QActionGroup(this);
    rendererGroup->addAction(m_nativeAction);
#ifndef QT_NO_OPENGL
    rendererGroup->addAction(m_glAction);
#endif
    rendererGroup->addAction(m_imageAction);

    menuBar()->addMenu(rendererMenu);

    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
    connect(rendererGroup, SIGNAL(triggered(QAction*)),
            this, SLOT(setRenderer(QAction*)));

    setCentralWidget(m_view);
    setWindowTitle(tr("SVG Viewer"));
}
Example #4
0
MainWindow::MainWindow(QWidget* parent)
    : QMainWindow(parent), m_view(0)
{
    m_hostInfoManager = new HostInfoManager;

    m_monitor = new Monitor(m_hostInfoManager, this);

    m_viewMode = new QActionGroup(this);

    QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
    QAction* quitAction = fileMenu->addAction(tr("&Quit"));
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
    QMenu* modeMenu = viewMenu->addMenu(tr("&Mode"));

    m_listView = modeMenu->addAction(tr("&List View"));
    m_listView->setCheckable(true);
    m_viewMode->addAction(m_listView);
    connect(m_listView, SIGNAL(triggered()), this, SLOT(setupListView()));

    m_starView = modeMenu->addAction(tr("&Star View"));
    m_starView->setCheckable(true);
    m_viewMode->addAction(m_starView);
    connect(m_starView, SIGNAL(triggered()), this, SLOT(setupStarView()));

    m_detailedView = modeMenu->addAction(tr("&Detailed Host View"));
    m_detailedView->setCheckable(true);
    m_viewMode->addAction(m_detailedView);
    connect(m_detailedView, SIGNAL(triggered()), this, SLOT(setupDetailedHostView()));


    QAction* actionStart = viewMenu->addAction(tr("&Start"));
    connect(actionStart, SIGNAL(triggered()), this, SLOT(startView()));
    QAction* actionStop = viewMenu->addAction(tr("Stop"));
    connect(actionStop, SIGNAL(triggered()), this, SLOT(stopView()));
    viewMenu->addSeparator();
    QAction* actionCheckNodes = viewMenu->addAction(tr("Check Nodes"));
    connect(actionCheckNodes, SIGNAL(triggered()), this, SLOT(checkNodes()));
    viewMenu->addSeparator();
    m_configView = viewMenu->addAction(tr("Configure View..."));
    connect(m_configView, SIGNAL(triggered()), this, SLOT( configureView()));

    QMenu* helpMenu = menuBar()->addMenu(tr("&Help"));
    helpMenu->addAction(tr("About..."), this, SLOT(showAboutDialog()));

    // Avoid useless creation and connection if the system does not have a systray
    if (QSystemTrayIcon::isSystemTrayAvailable()) {
        systemTrayIcon = new QSystemTrayIcon(this);
        systemTrayIcon->setIcon(QIcon(":bigIcon.png"));
        systemTrayIcon->show();

        systemTrayMenu = new QMenu(this);
        systemTrayMenu->addAction(quitAction);

        systemTrayIcon->setContextMenu(systemTrayMenu);

        connect(systemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                this, SLOT(systemTrayIconActivated(QSystemTrayIcon::ActivationReason)));
    }

    setWindowIcon(QIcon(":bigIcon.png"));

    readSettings();
    m_monitor->checkScheduler();
}
Example #5
0
void GTMainWindow::createMenus() {
	fileMenu = menuBar()->addMenu(tr("&File"));
	fileMenu->addAction(newAct);

	fileMenu->addAction(openAct);

	fileMenu->addAction(saveAct);

	fileMenu->addAction(closeAct);
	fileMenu->addSeparator();
	fileMenu->addAction(exitAct);

	menuBar()->addSeparator();
	menuBar()->addSeparator();
	menuBar()->addSeparator();

	menuBar()->addAction(newAct);
	menuBar()->addSeparator();

	menuBar()->addAction(openAct);
	menuBar()->addSeparator();

	menuBar()->addAction(saveAct);
	menuBar()->addSeparator();

	menuBar()->addAction(closeAct);
	menuBar()->addSeparator();

	/*editMenu = menuBar()->addMenu(tr("&Edit"));
	editMenu->addAction(cutAct);
	editMenu->addAction(copyAct);
	editMenu->addAction(pasteAct);*/

	/*menuBar()->addSeparator();

	helpMenu = menuBar()->addMenu(tr("&Help"));
	helpMenu->addAction(aboutAct);
	helpMenu->addAction(aboutQtAct);*/
}
Example #6
0
void
ColumnEdit::createWidgets()
{
    setCaption("Column Edit");
    menuBar();

    QFrame* main = new QFrame(this);
    QVBox* body = new QVBox(main);
    QFrame* top = new QFrame(body);
    QFrame* mid = new QFrame(body);
    QVBox* right = new QVBox(main);

    QLabel* nameLabel = new QLabel("&Name:", top);
    _name = new LineEdit(top);
    nameLabel->setBuddy(_name);

    QLabel* descLabel = new QLabel("&Description:", top);
    _desc = new MultiLineEdit(top);
    descLabel->setBuddy(_desc);

    QGridLayout* topGrid = new QGridLayout(top);
    topGrid->setSpacing(3);
    topGrid->setMargin(3);
    topGrid->setRowStretch(2, 1);
    topGrid->setColStretch(1, 1);
    topGrid->addWidget(nameLabel, 0, 0);
    topGrid->addWidget(_name, 0, 1, AlignLeft | AlignVCenter);
    topGrid->addWidget(descLabel, 1, 0);
    topGrid->addMultiCellWidget(_desc, 1, 2, 1, 1);

    QLabel* typeLabel = new QLabel("&Type:", mid);
    _type = new ComboBox(mid);
    typeLabel->setBuddy(_type);

    QLabel* lengthLabel = new QLabel("&Length:", mid);
    _length = new LineEdit(mid);
    lengthLabel->setBuddy(_length);

    _manditory = new QCheckBox("Manditory?", mid);
    _unique = new QCheckBox("Unique?", mid);

    QGridLayout* midGrid = new QGridLayout(mid);
    midGrid->setSpacing(3);
    midGrid->setMargin(3);
    midGrid->setColStretch(2, 1);
    midGrid->addColSpacing(2, 20);
    midGrid->addWidget(typeLabel, 0, 0);
    midGrid->addWidget(_type, 0, 1, AlignLeft | AlignVCenter);
    midGrid->addWidget(lengthLabel, 1, 0);
    midGrid->addWidget(_length, 1, 1, AlignLeft | AlignVCenter);
    midGrid->addMultiCellWidget(_manditory, 2, 2, 0, 1,AlignLeft|AlignVCenter);
    midGrid->addMultiCellWidget(_unique, 3, 3, 0, 1,AlignLeft|AlignVCenter);

    QPushButton* ok = new QPushButton("&Ok", right);
    QPushButton* next = new QPushButton("&Next", right);
    QPushButton* reset = new QPushButton("&Reset", right);
    QPushButton* cancel = new QPushButton("&Cancel", right);

    QGridLayout* grid = new QGridLayout(main);
    grid->setSpacing(3);
    grid->setMargin(3);
    grid->setColStretch(0, 1);
    grid->addWidget(body, 0, 0);
    grid->addWidget(right, 0, 1, AlignTop | AlignLeft);

    connect(ok, SIGNAL(clicked()), this, SLOT(slotOk()));
    connect(next, SIGNAL(clicked()), this, SLOT(slotNext()));
    connect(reset, SIGNAL(clicked()), this, SLOT(slotReset()));
    connect(cancel, SIGNAL(clicked()), this, SLOT(slotCancel()));
    connect(_type, SIGNAL(activated(int)), this, SLOT(slotTypeChanged()));

    for (int type = 0; type <= ColumnDefn::TYPE_QUANTITY; ++type)
	_type->insertItem(ColumnDefn::typeName(type));

    setCentralWidget(main);

    QPopupMenu* file = new QPopupMenu(this);
    file->insertItem(tr("&Ok"), this, SLOT(slotOk()));
    file->insertItem(tr("&Next"), this, SLOT(slotNext()));
    file->insertItem(tr("&Reset"), this, SLOT(slotReset()));
    file->insertSeparator();
    file->insertItem(tr("&Cancel"), this, SLOT(slotCancel()), ALT+Key_Q);
    menuBar()->insertItem(tr("&File"), file);
}
Example #7
0
TopWin::TopWin(ToplevelType t, QWidget* parent, const char* name, Qt::WindowFlags f)
                 : QMainWindow(parent, f)
{
	_initalizing = true;
	
	_isDeleting = false;
	if (initInited==false)
		initConfiguration();

	_type=t;

	setObjectName(QString(name));
	//setDockNestingEnabled(true); // Allow multiple rows.	Tim.
	setIconSize(ICON_SIZE);

	subwinAction=new QAction(tr("As subwindow"), this);
	subwinAction->setCheckable(true);
	connect(subwinAction, SIGNAL(toggled(bool)), SLOT(setIsMdiWin(bool)));

	shareAction=new QAction(tr("Shares tools and menu"), this);
	shareAction->setCheckable(true);
	connect(shareAction, SIGNAL(toggled(bool)), SLOT(shareToolsAndMenu(bool)));

	fullscreenAction=new QAction(tr("Fullscreen"), this);
	fullscreenAction->setCheckable(true);
	fullscreenAction->setChecked(false);
	fullscreenAction->setShortcut(shortcuts[SHRT_FULLSCREEN].key);
	connect(fullscreenAction, SIGNAL(toggled(bool)), SLOT(setFullscreen(bool)));

	mdisubwin=NULL;
	if (!MusEGlobal::unityWorkaround)
		_sharesToolsAndMenu=_defaultSubwin[_type] ? _sharesWhenSubwin[_type] : _sharesWhenFree[_type];
	else
		_sharesToolsAndMenu=false;
	
	if (_defaultSubwin[_type] && !MusEGlobal::unityWorkaround)
	{
		setIsMdiWin(true);
		_savedToolbarState=_toolbarNonsharedInit[_type];
	}

	if (_sharesToolsAndMenu)
		menuBar()->hide();

	subwinAction->setChecked(isMdiWin());
	shareAction->setChecked(_sharesToolsAndMenu);
	if (MusEGlobal::unityWorkaround)
	{
		shareAction->setEnabled(false);
		subwinAction->setEnabled(false);
	}
	fullscreenAction->setEnabled(!isMdiWin());
	
	if (mdisubwin)
		mdisubwin->resize(_widthInit[_type], _heightInit[_type]);
	else
		resize(_widthInit[_type], _heightInit[_type]);
	
	 
	QToolBar* undo_tools=addToolBar(tr("Undo/Redo tools"));
	undo_tools->setObjectName("Undo/Redo tools");
	undo_tools->addActions(MusEGlobal::undoRedo->actions());

	QToolBar* panic_toolbar = addToolBar(tr("Panic"));         
	panic_toolbar->setObjectName("panic");
	panic_toolbar->addAction(MusEGlobal::panicAction);

    QToolBar* metronome_toolbar = addToolBar(tr("Metronome"));
    metronome_toolbar->setObjectName("metronome");
    metronome_toolbar->addAction(MusEGlobal::metronomeAction);

    QToolBar* transport_toolbar = addToolBar(tr("Transport"));
	transport_toolbar->setObjectName("transport");
	transport_toolbar->addActions(MusEGlobal::transportAction->actions());

	QToolBar* songpos_tb;
	songpos_tb = addToolBar(tr("Song Position"));
	songpos_tb->setObjectName("Song Position");
	songpos_tb->addWidget(new MusEGui::SongPosToolbarWidget(songpos_tb));
	songpos_tb->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
	songpos_tb->setContextMenuPolicy(Qt::PreventContextMenu);

	QToolBar* tempo_tb;
	tempo_tb = addToolBar(tr("Tempo"));
	tempo_tb->setObjectName("Tempo");
	MusEGui::TempoToolbarWidget* tw = new MusEGui::TempoToolbarWidget(tempo_tb);
	tempo_tb->addWidget(tw);

	QToolBar* sig_tb;
	sig_tb = addToolBar(tr("Signature"));
	sig_tb->setObjectName("Signature");
	MusEGui::SigToolbarWidget* sw = new MusEGui::SigToolbarWidget(tempo_tb);
	sig_tb->addWidget(sw);
	
	connect(tw, SIGNAL(returnPressed()), SLOT(focusCanvas()));
	connect(tw, SIGNAL(escapePressed()), SLOT(focusCanvas()));
	connect(sw, SIGNAL(returnPressed()), SLOT(focusCanvas()));
	connect(sw, SIGNAL(escapePressed()), SLOT(focusCanvas()));
}
Example #8
0
File: mapzoom.cpp Project: BGmot/Qt
MapZoom::MapZoom()
    : QMainWindow(0)
{
    map = new LightMaps(this);
    setCentralWidget(map);
    map->setFocus();

    QAction *osloAction = new QAction(tr("&Oslo"), this);
    QAction *berlinAction = new QAction(tr("&Berlin"), this);
    QAction *jakartaAction = new QAction(tr("&Jakarta"), this);
    QAction *nightModeAction = new QAction(tr("Night Mode"), this);
    nightModeAction->setCheckable(true);
    nightModeAction->setChecked(false);
    QAction *osmAction = new QAction(tr("About OpenStreetMap"), this);
    connect(osloAction, SIGNAL(triggered()), SLOT(chooseOslo()));
    connect(berlinAction, SIGNAL(triggered()), SLOT(chooseBerlin()));
    connect(jakartaAction, SIGNAL(triggered()), SLOT(chooseJakarta()));
    connect(nightModeAction, SIGNAL(triggered()), map, SLOT(toggleNightMode()));
    connect(osmAction, SIGNAL(triggered()), SLOT(aboutOsm()));

#if defined(Q_OS_SYMBIAN) || defined(Q_OS_WINCE_WM)
    menuBar()->addAction(osloAction);
    menuBar()->addAction(berlinAction);
    menuBar()->addAction(jakartaAction);
    menuBar()->addAction(nightModeAction);
    menuBar()->addAction(osmAction);
#else
    QMenu *menu = menuBar()->addMenu(tr("&Options"));
    menu->addAction(osloAction);
    menu->addAction(berlinAction);
    menu->addAction(jakartaAction);
    menu->addSeparator();
    menu->addAction(nightModeAction);
    menu->addAction(osmAction);
#endif

    QNetworkConfigurationManager manager;
    if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) {
        // Get saved network configuration
        QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
        settings.beginGroup(QLatin1String("QtNetwork"));
        const QString id =
            settings.value(QLatin1String("DefaultNetworkConfiguration")).toString();
        settings.endGroup();

        // If the saved network configuration is not currently discovered use the system
        // default
        QNetworkConfiguration config = manager.configurationFromIdentifier(id);
        if ((config.state() & QNetworkConfiguration::Discovered) !=
            QNetworkConfiguration::Discovered) {
            config = manager.defaultConfiguration();
        }

        networkSession = new QNetworkSession(config, this);
        connect(networkSession, SIGNAL(opened()), this, SLOT(sessionOpened()));

        networkSession->open();
    } else {
        networkSession = 0;
    }

    setWindowTitle(tr("Light Maps"));
}
Example #9
0
void
MainWindow::setupFileActions()
{
    QToolBar *tb = new QToolBar(this);
    tb->setWindowTitle(tr("File Actions"));
    addToolBar(tb);

    QMenu *menu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(menu);

    QAction *a;

    QIcon newIcon = QIcon::fromTheme("document-new", QIcon(rsrcPath + "/filenew.png"));
    a = new QAction( newIcon, tr("&New"), this);
    a->setPriority(QAction::LowPriority);
    a->setShortcut(QKeySequence::New);
    connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
    tb->addAction(a);
    menu->addAction(a);

    a = new QAction(QIcon::fromTheme("document-open", QIcon(rsrcPath + "/fileopen.png")), tr("&Open..."), this);
    a->setShortcut(QKeySequence::Open);
    connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
    tb->addAction(a);
    menu->addAction(a);

    menu->addSeparator();

    actionSave = a = new QAction(QIcon::fromTheme("document-save", QIcon(rsrcPath + "/filesave.png")), tr("&Save"), this);
    a->setShortcut(QKeySequence::Save);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
    a->setEnabled(false);
    tb->addAction(a);
    menu->addAction(a);

    a = new QAction(tr("Save &As..."), this);
    a->setPriority(QAction::LowPriority);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
    menu->addAction(a);
    menu->addSeparator();

#ifndef QT_NO_PRINTER
    a = new QAction(QIcon::fromTheme("document-print", QIcon(rsrcPath + "/fileprint.png")), tr("&Print..."), this);
    a->setPriority(QAction::LowPriority);
    a->setShortcut(QKeySequence::Print);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
    tb->addAction(a);
    menu->addAction(a);

    a = new QAction(QIcon::fromTheme("fileprint", QIcon(rsrcPath + "/fileprint.png")),
                    tr("Print Preview..."), this);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
    menu->addAction(a);

    a = new QAction(QIcon::fromTheme("exportpdf", QIcon(rsrcPath + "/exportpdf.png")),
                    tr("&Export PDF..."), this);
    a->setPriority(QAction::LowPriority);
    a->setShortcut(Qt::CTRL + Qt::Key_D);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
    tb->addAction(a);
    menu->addAction(a);

    menu->addSeparator();
#endif

    a = new QAction(tr("&Quit"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_Q);
    //connect(a, SIGNAL(triggered()), this, SLOT(close()));
    connect(a, &QAction::triggered, this, [&](){
            ADDEBUG() << "close...";
            close();
        });
    menu->addAction(a);
}
Example #10
0
MainWindow::MainWindow()
{
    QMenu *fileMenu = new QMenu(tr("&File"));

    QAction *saveAction = fileMenu->addAction(tr("&Save..."));
    saveAction->setShortcut(tr("Ctrl+S"));

    QAction *quitAction = fileMenu->addAction(tr("E&xit"));
    quitAction->setShortcut(tr("Ctrl+Q"));

    menuBar()->addMenu(fileMenu);
    editor = new QTextEdit();

    QTextCursor cursor(editor->textCursor());
    cursor.movePosition(QTextCursor::Start); 

    QTextFrame *mainFrame = cursor.currentFrame();
    
    QTextCharFormat plainCharFormat;
    QTextCharFormat boldCharFormat;
    boldCharFormat.setFontWeight(QFont::Bold);
/*  main frame
//! [0]
    QTextFrame *mainFrame = cursor.currentFrame();
    cursor.insertText(...);
//! [0]
*/
    cursor.insertText("Text documents are represented by the "
                      "QTextDocument class, rather than by QString objects. "
                      "Each QTextDocument object contains information about "
                      "the document's internal representation, its structure, "
                      "and keeps track of modifications to provide undo/redo "
                      "facilities. This approach allows features such as the "
                      "layout management to be delegated to specialized "
                      "classes, but also provides a focus for the framework.",
                      plainCharFormat);

//! [1]
    QTextFrameFormat frameFormat;
    frameFormat.setMargin(32);
    frameFormat.setPadding(8);
    frameFormat.setBorder(4);
//! [1]
    cursor.insertFrame(frameFormat);

/*  insert frame
//! [2]
    cursor.insertFrame(frameFormat);
    cursor.insertText(...);
//! [2]
*/
    cursor.insertText("Documents are either converted from external sources "
                      "or created from scratch using Qt. The creation process "
                      "can done by an editor widget, such as QTextEdit, or by "
                      "explicit calls to the Scribe API.", boldCharFormat);

    cursor = mainFrame->lastCursorPosition();
/*  last cursor
//! [3]
    cursor = mainFrame->lastCursorPosition();
    cursor.insertText(...);
//! [3]
*/
    cursor.insertText("There are two complementary ways to visualize the "
                      "contents of a document: as a linear buffer that is "
                      "used by editors to modify the contents, and as an "
                      "object hierarchy containing structural information "
                      "that is useful to layout engines. In the hierarchical "
                      "model, the objects generally correspond to visual "
                      "elements such as frames, tables, and lists. At a lower "
                      "level, these elements describe properties such as the "
                      "style of text used and its alignment. The linear "
                      "representation of the document is used for editing and "
                      "manipulation of the document's contents.",
                      plainCharFormat);


    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));

    setCentralWidget(editor);
    setWindowTitle(tr("Text Document Frames"));
}
Example #11
0
MainWindow::MainWindow()
  : m_settings(QString::fromAscii("Doxygen.org"), QString::fromAscii("Doxywizard"))
{
  QMenu *file = menuBar()->addMenu(tr("File"));
  file->addAction(tr("Open..."), 
                  this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O);
  m_recentMenu = file->addMenu(tr("Open recent"));
  file->addAction(tr("Save"), 
                  this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S);
  file->addAction(tr("Save as..."), 
                  this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S);
  file->addAction(tr("Quit"),  
                  this, SLOT(quit()), Qt::CTRL+Qt::Key_Q);

  QMenu *settings = menuBar()->addMenu(tr("Settings"));
  settings->addAction(tr("Reset to factory defaults"),
                  this,SLOT(resetToDefaults()));
  settings->addAction(tr("Use current settings at startup"),
                  this,SLOT(makeDefaults()));

  QMenu *help = menuBar()->addMenu(tr("Help"));
  help->addAction(tr("Online manual"), 
                  this, SLOT(manual()), Qt::Key_F1);
  help->addAction(tr("About"), 
                  this, SLOT(about()) );

  m_expert = new Expert;
  m_wizard = new Wizard(m_expert->modelData());

  // ----------- top part ------------------
  QWidget *topPart = new QWidget;
  QVBoxLayout *rowLayout = new QVBoxLayout(topPart);

  // select working directory
  QHBoxLayout *dirLayout = new QHBoxLayout;
  m_workingDir = new QLineEdit;
  m_selWorkingDir = new QPushButton(tr("Select..."));
  dirLayout->addWidget(m_workingDir);
  dirLayout->addWidget(m_selWorkingDir);

  //------------- bottom part --------------
  QWidget *runTab = new QWidget;
  QVBoxLayout *runTabLayout = new QVBoxLayout(runTab);

  // run doxygen
  QHBoxLayout *runLayout = new QHBoxLayout;
  m_run = new QPushButton(tr("Run doxygen"));
  m_run->setEnabled(false);
  m_runStatus = new QLabel(tr("Status: not running"));
  m_saveLog = new QPushButton(tr("Save log..."));
  m_saveLog->setEnabled(false);
  QPushButton *showSettings = new QPushButton(tr("Show configuration"));
  runLayout->addWidget(m_run);
  runLayout->addWidget(m_runStatus);
  runLayout->addStretch(1);
  runLayout->addWidget(showSettings);
  runLayout->addWidget(m_saveLog);

  // output produced by doxygen
  runTabLayout->addLayout(runLayout);
  runTabLayout->addWidget(new QLabel(tr("Output produced by doxygen")));
  QGridLayout *grid = new QGridLayout;
  m_outputLog = new QTextEdit;
  m_outputLog->setReadOnly(true);
  m_outputLog->setFontFamily(QString::fromAscii("courier"));
  m_outputLog->setMinimumWidth(600);
  grid->addWidget(m_outputLog,0,0);
  grid->setColumnStretch(0,1);
  grid->setRowStretch(0,1);
  QHBoxLayout *launchLayout = new QHBoxLayout;
  m_launchHtml = new QPushButton(tr("Show HTML output"));
  launchLayout->addWidget(m_launchHtml);

  launchLayout->addStretch(1);
  grid->addLayout(launchLayout,1,0);
  runTabLayout->addLayout(grid);

  QTabWidget *tabs = new QTabWidget;
  tabs->addTab(m_wizard,tr("Wizard"));
  tabs->addTab(m_expert,tr("Expert"));
  tabs->addTab(runTab,tr("Run"));

  rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run")));
  rowLayout->addLayout(dirLayout);
  rowLayout->addWidget(new QLabel(tr("Step 2: Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation")));
  rowLayout->addWidget(tabs);

  setCentralWidget(topPart);
  statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout);
  loadSettings();

  m_runProcess = new QProcess;
  m_running = false;
  m_timer = new QTimer;
  updateLaunchButtonState();
  m_modified = false;
  updateTitle();

  // connect signals and slots
  connect(tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int)));
  connect(m_selWorkingDir,SIGNAL(clicked()),SLOT(selectWorkingDir()));
  connect(m_recentMenu,SIGNAL(triggered(QAction*)),SLOT(openRecent(QAction*)));
  connect(m_workingDir,SIGNAL(returnPressed()),SLOT(updateWorkingDir()));
  connect(m_runProcess,SIGNAL(readyReadStandardOutput()),SLOT(readStdout()));
  connect(m_runProcess,SIGNAL(finished(int, QProcess::ExitStatus)),SLOT(runComplete()));
  connect(m_timer,SIGNAL(timeout()),SLOT(readStdout()));
  connect(m_run,SIGNAL(clicked()),SLOT(runDoxygen()));
  connect(m_launchHtml,SIGNAL(clicked()),SLOT(showHtmlOutput()));
  connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog()));
  connect(showSettings,SIGNAL(clicked()),SLOT(showSettings()));
  connect(m_expert,SIGNAL(changed()),SLOT(configChanged()));
}
Example #12
0
void TextEdit::setupTextActions()
{
    formattingToolBar = new QToolBar(this);
    formattingToolBar->setWindowTitle(tr("Format Actions"));
    addToolBar(formattingToolBar);

    QMenu *menu = new QMenu(tr("F&ormat"), this);
    menuBar()->addMenu(menu);

    actionTextBold = new QAction(QIcon(":/res/smalltextbold.png"), tr("&Bold"), this);
    actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
    actionTextBold->setPriority(QAction::LowPriority);
    QFont bold;
    bold.setBold(true);
    actionTextBold->setFont(bold);
    connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
    formattingToolBar->addAction(actionTextBold);
    menu->addAction(actionTextBold);
    actionTextBold->setCheckable(true);

    actionTextItalic = new QAction(QIcon(":/res/smalltextitalic.png"), tr("&Italic"), this);
    actionTextItalic->setPriority(QAction::LowPriority);
    actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
    QFont italic;
    italic.setItalic(true);
    actionTextItalic->setFont(italic);
    connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
    formattingToolBar->addAction(actionTextItalic);
    menu->addAction(actionTextItalic);
    actionTextItalic->setCheckable(true);

    actionTextUnderline = new QAction(QIcon(":/res/smalltextunder.png"), tr("&Underline"), this);
    actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
    actionTextUnderline->setPriority(QAction::LowPriority);
    QFont underline;
    underline.setUnderline(true);
    actionTextUnderline->setFont(underline);
    connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
    formattingToolBar->addAction(actionTextUnderline);
    menu->addAction(actionTextUnderline);
    actionTextUnderline->setCheckable(true);

    menu->addSeparator();

    QActionGroup *grp = new QActionGroup(this);
    connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));

    // Make sure the alignLeft  is always left of the alignRight
    if (QApplication::isLeftToRight()) 
    {
        actionAlignLeft = new QAction(QIcon(":/res/smalltextleft.png"), tr("&Left"), grp);
        actionAlignCenter = new QAction(QIcon(":/res/smalltextcenter.png"), tr("C&enter"), grp);
        actionAlignRight = new QAction(QIcon(":/res/smalltextright.png"), tr("&Right"), grp);
    } 
    else 
    {
        actionAlignRight = new QAction(QIcon(":/res/smalltextright.png"), tr("&Right"), grp);
        actionAlignCenter = new QAction(QIcon(":/res/smalltextcenter.png"), tr("C&enter"), grp);
        actionAlignLeft = new QAction(QIcon(":/res/smalltextleft.png"), tr("&Left"), grp);
    }
    actionAlignJustify = new QAction(QIcon(":/res/smalltextjustify.png"), tr("&Justify"), grp);

    actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
    actionAlignLeft->setCheckable(true);
    actionAlignLeft->setPriority(QAction::LowPriority);
    actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
    actionAlignCenter->setCheckable(true);
    actionAlignCenter->setPriority(QAction::LowPriority);
    actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
    actionAlignRight->setCheckable(true);
    actionAlignRight->setPriority(QAction::LowPriority);
    actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
    actionAlignJustify->setCheckable(true);
    actionAlignJustify->setPriority(QAction::LowPriority);

    formattingToolBar->addActions(grp->actions());
    menu->addActions(grp->actions());

    menu->addSeparator();

    actionTextColor = new QAction(QIcon(":/res/smallcolor.png"), tr("&Color..."), this);
    colorButton = new Qtitan::PopupColorButton(formattingToolBar);
    colorButton->setDefaultAction(actionTextColor);
    formattingToolBar->addWidget(colorButton);
    menu->addAction(actionTextColor);
    connect(colorButton, SIGNAL(colorChanged(const QColor&)), this, SLOT(textColor(const QColor&)));
    connect(actionTextColor, SIGNAL(triggered()), this, SLOT(setColorText()));

    QToolBar* tb = new QToolBar(this);
    tb->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
    tb->setWindowTitle(tr("Format Actions"));
    addToolBarBreak(Qt::TopToolBarArea);
    addToolBar(tb);

    comboStyle = new QComboBox(tb);
    tb->addWidget(comboStyle);
    comboStyle->addItem("Standard");
    comboStyle->addItem("Bullet List (Disc)");
    comboStyle->addItem("Bullet List (Circle)");
    comboStyle->addItem("Bullet List (Square)");
    comboStyle->addItem("Ordered List (Decimal)");
    comboStyle->addItem("Ordered List (Alpha lower)");
    comboStyle->addItem("Ordered List (Alpha upper)");
    comboStyle->addItem("Ordered List (Roman lower)");
    comboStyle->addItem("Ordered List (Roman upper)");
    connect(comboStyle, SIGNAL(activated(int)), this, SLOT(textStyle(int)));

    comboFont = new QFontComboBox(tb);
    tb->addWidget(comboFont);
    connect(comboFont, SIGNAL(activated(QString)), this, SLOT(textFamily(QString)));

    comboSize = new QComboBox(tb);
    comboSize->setObjectName("comboSize");
    tb->addWidget(comboSize);
    comboSize->setEditable(true);

    QFontDatabase db;
    foreach(int size, db.standardSizes())
        comboSize->addItem(QString::number(size));

    connect(comboSize, SIGNAL(activated(QString)), this, SLOT(textSize(QString)));
    comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font().pointSize())));
}
Example #13
0
void PaintWindow::createMenu() {
    // Adding the drop down menu to the menubar
    m_menu_app = menuBar()->addMenu(tr("&Application"));
    m_menu_tools = menuBar()->addMenu(tr("&Tools"));
    m_menu_colour = menuBar()->addMenu(tr("&Colour"));
    m_menu_help = menuBar()->addMenu(tr("&Help"));

    // Adding the menu items for each drop down menu
    QAction* quitAct = new QAction(tr("&Quit"), this);
    quitAct->setShortcuts(QKeySequence::Quit);
    quitAct->setStatusTip(tr("Exits the program"));
    connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
    m_menu_app->addAction(quitAct);
    
    QAction* clearAct = new QAction(tr("&Clear"), this);
    clearAct->setShortcut(QKeySequence(Qt::Key_C));
    connect(clearAct, SIGNAL(triggered()), m_canvas, SLOT(clearCanvas()));
    m_menu_app->addAction(clearAct);

    QAction* drawLineAct = new QAction(tr("&Line"), this);
    drawLineAct->setStatusTip(tr("Draws a line"));
    drawLineAct->setShortcut(QKeySequence(Qt::Key_L));
    drawLineAct->setCheckable(true);
    connect(drawLineAct, SIGNAL(triggered()), this, SLOT(set_line()));

    QAction* drawOvalAct = new QAction(tr("&Oval"), this);
    drawOvalAct->setStatusTip(tr("Draws an Oval"));
    drawOvalAct->setShortcut(QKeySequence(Qt::Key_O));
    drawOvalAct->setCheckable(true);
    connect(drawOvalAct, SIGNAL(triggered()), this, SLOT(set_oval()));

    QAction* drawRectangleAct = new QAction(tr("&Rectangle"), this);
    drawRectangleAct->setStatusTip(tr("Draws a rectangle"));
    drawRectangleAct->setShortcut(QKeySequence(Qt::Key_R));
    drawRectangleAct->setCheckable(true);
    connect(drawRectangleAct, SIGNAL(triggered()), this, SLOT(set_rect()));
    
	QActionGroup *toolsActionGroup = new QActionGroup(this);
	toolsActionGroup->addAction(drawLineAct);
	toolsActionGroup->addAction(drawOvalAct);
	toolsActionGroup->addAction(drawRectangleAct);
	toolsActionGroup->setExclusive(true);
	drawLineAct->setChecked(true);
	
    m_menu_tools->addAction(drawLineAct);
    m_menu_tools->addAction(drawOvalAct);
    m_menu_tools->addAction(drawRectangleAct);

    QAction* setColourBlackAct = new QAction(tr("&Black"), this);
    connect(setColourBlackAct, SIGNAL(triggered()), this, SLOT(setColourBlack()));
    
    QAction* setColourRedAct = new QAction(tr("&Red"), this);
    connect(setColourRedAct, SIGNAL(triggered()), this, SLOT(setColourRed()));
    
    QAction* setColourGreenAct = new QAction(tr("&Green"), this);
    connect(setColourGreenAct, SIGNAL(triggered()), this, SLOT(setColourGreen()));
    
    QAction* setColourBlueAct = new QAction(tr("&Blue"), this);
    connect(setColourBlueAct, SIGNAL(triggered()), this, SLOT(setColourBlue()));
    
    m_menu_colour->addAction(setColourBlackAct);
    m_menu_colour->addAction(setColourRedAct);
    m_menu_colour->addAction(setColourGreenAct);
    m_menu_colour->addAction(setColourBlueAct);

    QAction* helpLineAct = new QAction(tr("&Line Help"), this);
    helpLineAct->setStatusTip(tr("Help Instructions"));
    connect(helpLineAct, SIGNAL(triggered()), this, SLOT(help_line()));
    m_menu_help->addAction(helpLineAct);
    
    QAction* helpRectangleAct = new QAction(tr("&Rectangle Help"), this);
    helpRectangleAct->setStatusTip(tr("Help Instructions for rectangles"));
    connect(helpRectangleAct, SIGNAL(triggered()), this, SLOT(help_rectangle()));
    m_menu_help->addAction(helpRectangleAct);

    QAction* helpOvalAct = new QAction(tr("&Oval Help"), this);
    helpOvalAct->setStatusTip(tr("Help Instructions for ovals"));
    connect(helpOvalAct, SIGNAL(triggered()), this, SLOT(help_oval()));
    m_menu_help->addAction(helpOvalAct);
}
Example #14
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
jdlvFrame::jdlvFrame (const char *fileToLoad) : nextWorld(NULL),
  isChanged(false),
    eM(elModeView), genNo(0), curColor(0), speed(3), timerID(0)
{
  QFont fixedFont(jdlvFONTFACENAME, jdlvFONTSIZE);
        fixedFont.setStyleHint(QFont::TypeWriter);
  primeWorld = new_elMundoA();
  vista = new elVista (this, primeWorld); setCentralWidget(vista);
  vista->setMinimumSize(720, 480);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QToolBar *bottom = new permanentToolBar("ctrl", this);
  bottom->setFloatable(false);
  bottom->setMovable  (false);
  bottom->setIconSize(QSize(28,25));
  showTimeCB = new QAction(QIcon(":/time.png"), QString("time"), this);
  showInfoPB = new QAction(QIcon(":/info.png"), QString("info"), this);
  connect(showTimeCB, SIGNAL(triggered(bool)), this, SLOT(ToggleTime(bool)));
  connect(showInfoPB, SIGNAL(triggered()),     this, SLOT(ShowInfo()));
  bottom->addAction(showTimeCB);
  bottom->addAction(showInfoPB);         showInfoPB->setEnabled(false); //+
  bottom->addWidget(new QLabel(" "));
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QActionGroup *modeGroup = new QActionGroup(this);
  modeEdit = new QAction(QIcon(":/pen-in-box.png"),QString("Edit (X)"),  this);
  modeView = new QAction(QIcon(":/eye-half.png"),  QString("View (Z)"),  this);
  setColor = new QAction(QIcon(":/empty1.png"),    QString("color"),     this);
  connect(modeView, SIGNAL(triggered()), this, SLOT(SetModeView()));
  connect(modeEdit, SIGNAL(triggered()), this, SLOT(SetModeEdit()));
  connect(setColor, SIGNAL(triggered()), this, SLOT(PopupColorMenu()));
  showTimeCB->setCheckable(true);
  modeEdit  ->setCheckable(true); modeEdit->setShortcut(QKeySequence("X"));
  modeView  ->setCheckable(true); modeView->setShortcut(QKeySequence("Z"));
  modeView  ->setChecked  (true);
  modeGroup->addAction(modeView); bottom->addAction(modeView);
  modeGroup->addAction(modeEdit); bottom->addAction(modeEdit);
                                  bottom->addAction(setColor);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QMenu *file_menu = menuBar()->addMenu("File");
  openFile =  new QAction(QIcon(":/book.png"), QString("Open.."), this);
  reLoad = new QAction(QIcon(":/reload1.png"), QString("reload"), this);
  connect(openFile, SIGNAL(triggered()), this, SLOT(OpenFile()));
  connect(reLoad,   SIGNAL(triggered()), this, SLOT(DoReload()));
  file_menu->addAction(openFile);
  file_menu->addAction(reLoad);        reLoad->setEnabled(false);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QMenu *edit_menu = menuBar()->addMenu("Edit");
  deleteSelected = new QAction(QString("delete"), this);
  deleteSelected->setShortcut(QKeySequence("Del"));
  cropSelected   = new QAction(QString("crop"), this);
  pasteClipboard =
            new QAction(QIcon(":/win-paste.png"),   QString("paste"),    this);
  copyCLR = new QAction(QIcon(":/export-blue.png"), QString("copy"),     this);
  copyBnW = new QAction(QIcon(":/export-mono.png"), QString("copy b/w"), this);
  newWin = new QAction(QIcon(":/windows1.png"),   QString("new window"), this);
  bottom->addAction(pasteClipboard);     pasteClipboard->setEnabled(false); //+
  bottom->addAction(copyCLR); copyCLR->setShortcut(QKeySequence("Ctrl+C"));
  bottom->addAction(copyBnW);
  bottom->addAction(newWin);       newWin->setEnabled(false); //+
  connect(deleteSelected, SIGNAL(triggered()), this, SLOT(DeleteSelected()));
  connect(  cropSelected, SIGNAL(triggered()), this, SLOT(  CropSelected()));
  connect(pasteClipboard, SIGNAL(triggered()), this, SLOT(PasteClipboard()));
  connect(copyCLR, SIGNAL(triggered()), this, SLOT(CopyCLR()));
  connect(copyBnW, SIGNAL(triggered()), this, SLOT(CopyBnW()));
  connect(newWin, SIGNAL(triggered()), this, SLOT(NewWindow()));
  edit_menu->addAction(deleteSelected);
  edit_menu->addAction(  cropSelected); edit_menu->addSeparator();
  edit_menu->addAction(pasteClipboard); edit_menu->addAction(copyCLR);
                                        edit_menu->addAction(copyBnW);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  colorMenu = menuBar()->addMenu("Color");
#define ADD_colorMenu(ico,text,shortcut) \
  colorMenu->addAction(*ico,text)->setShortcut(QKeySequence(shortcut))
  ADD_colorMenu(enBlancoIco,            "blanco",     "B");
  ADD_colorMenu(enRojoIco,              "rojo (red)", "R");
  ADD_colorMenu(enCastanoIco, Utf8("castaño (brown)"),"C");
  ADD_colorMenu(enVerdeIco,          "verde (green)", "V");
  ADD_colorMenu(enAzulIco,             "azul (blue)", "A");
  colorMenu->addSeparator();
  colorMenu->addAction("random Bicolor")->setShortcut(QKeySequence("Ctrl+B"));
  colorMenu->addAction("random Recolor")->setShortcut(QKeySequence("Ctrl+R"));
  colorMenu->addAction("Un-color all")  ->setShortcut(QKeySequence("Ctrl+U"));
  connect(colorMenu, SIGNAL(triggered(QAction*)),
               this, SLOT(SelectColor(QAction*)));
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QLabel *magIcon = new QLabel; magIcon->setPixmap(QPixmap(":/zoom3.png"));
  magText = new QLabel(QString("+1"));
  magText->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  magText->setFont(fixedFont);
  magText->setMinimumSize(QSize(30,25));     bottom->addWidget(magText);
                                             bottom->addWidget(magIcon);
  fitView = new QAction(QIcon(":/full-size.png"), QString("fit"), this);
  connect(fitView, SIGNAL(triggered()), this, SLOT(DoFitView()));
  bottom->addAction(fitView);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  QMenu *play_menu = menuBar()->addMenu("Play");
  playGen = new QLabel(QString("0"));
  playGen->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  playGen->setMinimumSize(QSize(66,25));
  prevGen =  new QAction(QIcon(":/step-back.png"),    QString("back"), this);
  nextGen =  new QAction(QIcon(":/go-forward.png") ,  QString("step"), this);
  playStop = new QAction(QIcon(":/fast-forward.png"), QString("go!"),  this);
  connect(prevGen,  SIGNAL(triggered()), this, SLOT(DoPrevGen()));
  connect(nextGen,  SIGNAL(triggered()), this, SLOT(DoNextGen()));
  connect(playStop, SIGNAL(triggered()), this, SLOT(DoPlayStop()));
  play_menu->addAction(nextGen);
  play_menu->addAction(playStop);
  play_menu->addAction(prevGen); prevGen->setEnabled(false);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  speedSlider = new QSlider(Qt::Horizontal, this);
  speedSlider->setMinimum(1); speedSlider->setValue(speed);
  speedSlider->setMaximum(4); speedSlider->setMaximumSize(50,22);
  speedSlider->setSingleStep(1);
  speedSlider->setTickInterval(1);
  speedSlider->setTickPosition(QSlider::TicksBelow);
  connect(speedSlider, SIGNAL(valueChanged(int)), this, SLOT(ChangeSpeed(int)));
  bottom->addWidget(playGen);
  bottom->addAction(nextGen);
  bottom->addWidget(speedSlider);
  bottom->addAction(playStop);
  addToolBar(Qt::BottomToolBarArea, bottom);
  //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  if (fileToLoad) LoadTheWorld(fileToLoad);
  else                       SetWinTitle();
  show(); raise();
}
Example #15
0
void Ventana::crearMenu() {
    Juego = menuBar()->addMenu(tr("&Juego"));
        nuevoJuego = new QAction(tr("&Empezar partida nueva"), this);
        nuevoJuego->setStatusTip(tr("Empezar partida nueva"));
        connect(nuevoJuego, SIGNAL(triggered()), this, SLOT(empezarPartida()));
        Juego->addAction(nuevoJuego);

        pausar = new QAction(tr("&Pausar partida"), this);
        pausar->setStatusTip(tr("Pausar partida"));
        connect(pausar, SIGNAL(triggered()), this, SLOT(pausarPartida()));
        Juego->addAction(pausar);

        terminar = new QAction(tr("&Finalizar Partida"), this);
        terminar->setStatusTip(tr("Finalizar Partida"));
        connect(terminar, SIGNAL(triggered()), this, SLOT(terminarPartida()));
        Juego->addAction(terminar);

        Juego->addSeparator();

        salir = new QAction(tr("&Salir"), this);
        salir->setStatusTip(tr("Salir"));
        connect(salir, SIGNAL(triggered()), this, SLOT(close()));
        Juego->addAction(salir);

    Opciones = menuBar()->addMenu(tr("&Opciones"));
        NJugadores = new QAction(tr("&Elegir número de jugadores"), this);
        NJugadores->setStatusTip(tr("Elegir número de jugadores"));
        connect(NJugadores, SIGNAL(triggered()), this, SLOT(elegirNJugadores()));
        Opciones->addAction(NJugadores);

        TamTablero = new QAction(tr("&Elegir el tamaño del tablero"), this);
        TamTablero->setStatusTip(tr("Elegir el tamaño del tablero"));
        connect(TamTablero, SIGNAL(triggered()), this, SLOT(elegirTamTablero()));
        Opciones->addAction(TamTablero);

        Velocidad = new QAction(tr("&Elegir velocidad de las motos"), this);
        Velocidad->setStatusTip(tr("Elegir velocidad de las motos"));
        connect(Velocidad, SIGNAL(triggered()), this, SLOT(setVelocidad()));
        Opciones->addAction(Velocidad);

    ModosVisualizacion = menuBar()->addMenu(tr("&Modos de Visualización"));
        Reflejos = new QAction(tr("&Activar/Desactivar reflejos"), this);
        Reflejos->setStatusTip(tr("Activar/Desactivar reflejos"));
        connect(Reflejos, SIGNAL(triggered()), this, SLOT(elegirReflejos()));
        ModosVisualizacion->addAction(Reflejos);

        Ejes = new QAction(tr("&Mostrar/Ocultar ejes"), this);
        Ejes->setStatusTip(tr("Mostrar/Ocultar ejes"));
        connect(Ejes, SIGNAL(triggered()), this, SLOT(elegirEjes()));
        ModosVisualizacion->addAction(Ejes);

        ModosVisualizacion->addSeparator();

        CamaraLibre = new QAction(tr("&Cámara Libre"), this);
        CamaraLibre->setStatusTip(tr("Cámara Libre"));
        connect(CamaraLibre, SIGNAL(triggered()), this, SLOT(setCamaraLibre()));
        ModosVisualizacion->addAction(CamaraLibre);

        ModosVisualizacion->addSeparator();

        Puntos = new QAction(tr("&Puntos"), this);
        Puntos->setStatusTip(tr("Puntos"));
        connect(Puntos, SIGNAL(triggered()), this, SLOT(modoPuntos()));
        ModosVisualizacion->addAction(Puntos);

        Lineas = new QAction(tr("&Lineas"), this);
        Lineas->setStatusTip(tr("Lineas"));
        connect(Lineas, SIGNAL(triggered()), this, SLOT(modoLineas()));
        ModosVisualizacion->addAction(Lineas);

        Solido = new QAction(tr("&Solido"), this);
        Solido->setStatusTip(tr("Solido"));
        connect(Solido, SIGNAL(triggered()), this, SLOT(modoSolido()));
        ModosVisualizacion->addAction(Solido);

        Ajedrez = new QAction(tr("&Ajedrez"), this);
        Ajedrez->setStatusTip(tr("Ajedrez"));
        connect(Ajedrez, SIGNAL(triggered()), this, SLOT(modoAjedrez()));
        ModosVisualizacion->addAction(Ajedrez);

        this->Flat = new QAction(tr("&Suavizado Flat"), this);
        this->Flat->setStatusTip(tr("Suavizado Flat"));
        connect(this->Flat, SIGNAL(triggered()), this, SLOT(modoFlat()));
        ModosVisualizacion->addAction(this->Flat);

        Smooth = new QAction(tr("&Suavizado Smooth"), this);
        Smooth->setStatusTip(tr("Suavizado Smooth"));
        connect(Smooth, SIGNAL(triggered()), this, SLOT(modoSmooth()));
        ModosVisualizacion->addAction(Smooth);

    fullScreen = menuBar()->addMenu(tr("&Pantalla"));
        pantCompleta = new QAction(tr("&Completa"), this);
        pantCompleta->setStatusTip(tr("Completa"));
        connect(pantCompleta, SIGNAL(triggered()), this, SLOT(showFullScreen()));
        fullScreen->addAction(pantCompleta);

        pantNormal = new QAction(tr("&Ventana"), this);
        pantNormal->setStatusTip(tr("Ventana"));
        connect(pantNormal, SIGNAL(triggered()), this, SLOT(showNormal()));
        fullScreen->addAction(pantNormal);

    Extra = menuBar()->addMenu(tr("&Extra"));
        Ayuda = new QAction(tr("&Ayuda"), this);
        Ayuda->setStatusTip(tr("Ayuda"));
        connect(Ayuda, SIGNAL(triggered()), this, SLOT(showAyuda()));
        Extra->addAction(Ayuda);

        Acerca = new QAction(tr("&Acerca"), this);
        Acerca->setStatusTip(tr("Acerca"));
        connect(Acerca, SIGNAL(triggered()), this, SLOT(showAcerca()));
        Extra->addAction(Acerca);

        Extra->addSeparator();

        Demo = new QAction(tr("&Demo"), this);
        Demo->setStatusTip(tr("Demo"));
        connect(Demo, SIGNAL(triggered()), this, SLOT(showDemo()));
        Extra->addAction(Demo);
}
Example #16
0
  foreach (QtGui::ToolPluginFactory *factory, toolPluginFactories) {
    QtGui::ToolPlugin *tool = factory->createInstance();
    if (tool)
      toolPlugins << tool;
  }
  buildTools(toolPlugins);

  QList<QtGui::ScenePluginFactory *> scenePluginFactories =
      plugin->pluginFactories<QtGui::ScenePluginFactory>();
  foreach (QtGui::ScenePluginFactory *factory, scenePluginFactories) {
    QtGui::ScenePlugin *scenePlugin = factory->createInstance();
    if (scenePlugin)
      scenePluginModel.addItem(scenePlugin);
  }

  QMenu *menuTop = menuBar()->addMenu(tr("&Extensions"));
  QAction *showPeriodicTable = new QAction("&Periodic Table", this);
  menuTop->addAction(showPeriodicTable);
  QtGui::PeriodicTableView *periodicTable = new QtGui::PeriodicTableView(this);
  connect(showPeriodicTable, SIGNAL(triggered()), periodicTable, SLOT(show()));

  // Call this a second time, not needed but ensures plugins only load once.
  plugin->load();

  QList<QtGui::ExtensionPluginFactory *> extensions =
      plugin->pluginFactories<QtGui::ExtensionPluginFactory>();
  qDebug() << "Extension plugins dynamically found..." << extensions.size();
  foreach (QtGui::ExtensionPluginFactory *factory, extensions) {
    QtGui::ExtensionPlugin *extension = factory->createInstance();
    if (extension) {
      extension->setParent(this);
Example #17
0
void Graphical_UI::createMenus ()
{
  // Menus are created here
  QMenu *graphMenu;
  QMenu *recognitionMenu;
  QMenu *viewMenu;
  QMenu *helpMenu;

  //############################## Graph Menu ###############################

  graphMenu = menuBar ()->addMenu (tr ("&Graph"));

  QAction *loadAct = new QAction (tr ("&Load Data"), this);
  loadAct->setShortcut (QString ("Ctrl+L"));
  loadAct->setStatusTip (tr ("Load data"));
  loadAct->setIcon (QIcon::fromTheme ("load")); //doesn't work for gnome
  connect (loadAct, SIGNAL (triggered ()), this, SLOT (loadDataCmd ()));
  graphMenu->addAction (loadAct);
  this->addAction (loadAct);

  QAction *resetAct = new QAction (tr ("&Reset"), this);
  resetAct->setShortcut (QString ("Ctrl+R"));
  resetAct->setStatusTip (tr ("Reset the graph, clear all data collected"));
  resetAct->setIcon (QIcon::fromTheme ("edit-delete")); //doesn't work (for gnome
  connect (resetAct, SIGNAL (triggered ()), this, SLOT (reset ()));
  graphMenu->addAction (resetAct);
  this->addAction (resetAct);

  graphMenu->addSeparator ();

  QAction *showBAImageAct = new QAction (tr ("Show &BA Image"), this);
  showBAImageAct->setShortcut (QString ("Ctrl+B"));
  showBAImageAct->setStatusTip (tr ("Show Bearing-Angle image"));
  showBAImageAct->setIcon (QIcon::fromTheme ("BA-show")); //doesn't work for gnome
  connect (showBAImageAct, SIGNAL (triggered ()), this, SLOT (showBAImageCmd ()));
  graphMenu->addAction (showBAImageAct);
  this->addAction (showBAImageAct);

  QAction *showFlowsheetAct = new QAction (tr ("Show &Flowsheet"), this);
  showFlowsheetAct->setShortcut (QString ("Ctrl+F"));
  showFlowsheetAct->setStatusTip (tr ("Show flowsheet"));
  showFlowsheetAct->setIcon (QIcon::fromTheme ("flowsheet-show")); //doesn't work for gnome
  connect (showFlowsheetAct, SIGNAL (triggered ()), this, SLOT (showFlowsheet ()));
  graphMenu->addAction (showFlowsheetAct);
  this->addAction (showFlowsheetAct);

  graphMenu->addSeparator ();

  QAction *exitAct = new QAction (tr ("&Exit"), this);
  exitAct->setShortcuts (QKeySequence::Quit);
  exitAct->setStatusTip (tr ("Exit the application"));
  exitAct->setIcon (QIcon::fromTheme ("application-exit")); //doesn't work for gnome
  connect (exitAct, SIGNAL (triggered ()), this, SLOT (close ()));
  graphMenu->addAction (exitAct);
  this->addAction (exitAct);


  //########################### Recognition Menu ############################

  recognitionMenu = menuBar ()->addMenu (tr ("&Recognition"));

  QAction *extractAct = new QAction (tr ("&Extract Features"), this);
  extractAct->setShortcut (QString ("Ctrl+E"));
  extractAct->setStatusTip (tr ("Extract global spatial and SURF features, then save to file"));
  extractAct->setIcon (QIcon::fromTheme ("extract-save")); //doesn't work (for gnome
  connect (extractAct, SIGNAL (triggered ()), this, SLOT (extractFeaturesCmd ()));
  recognitionMenu->addAction (extractAct);
  this->addAction (extractAct);

  recognitionMenu->addSeparator ();

  QAction *recognitionAct = new QAction (tr ("&Place Recognition"), this);
  recognitionAct->setShortcut (QString ("Ctrl+P"));
  recognitionAct->setStatusTip (tr ("Place recognition"));
  recognitionAct->setIcon (QIcon::fromTheme ("place-recognition")); //doesn't work for gnome
  connect (recognitionAct, SIGNAL (triggered ()), this, SLOT (placeRecognitionCmd ()));
  recognitionMenu->addAction (recognitionAct);
  this->addAction (recognitionAct);


  //############################## View Menu ################################

  viewMenu = menuBar ()->addMenu (tr ("&View"));

  QAction *toggleGLViewerAct = new QAction (tr ("Toggle &3D Display"), this);
  toggleGLViewerAct->setShortcut (QString ("3"));
  toggleGLViewerAct->setCheckable (true);
  toggleGLViewerAct->setChecked (true);
  toggleGLViewerAct->setStatusTip (tr ("Turn on/off the OpenGL Display"));
  connect (toggleGLViewerAct, SIGNAL (toggled (bool)), lib_glviewer, SLOT (setVisible (bool)));
  connect (toggleGLViewerAct, SIGNAL (toggled (bool)), query_glviewer, SLOT (setVisible (bool)));
  viewMenu->addAction (toggleGLViewerAct);
  this->addAction (toggleGLViewerAct);

  viewMenu->addSeparator ();

  QAction *toggleQLabelAct = new QAction (tr ("Toggle &2D Display"), this);
  toggleQLabelAct->setShortcut (QString ("2"));
  toggleQLabelAct->setCheckable (true);
  toggleQLabelAct->setChecked (true);
  toggleQLabelAct->setStatusTip (tr ("Turn on/off the Image Display"));
  connect (toggleQLabelAct, SIGNAL (toggled (bool)), this, SLOT (set2DImage (bool)));
  viewMenu->addAction (toggleQLabelAct);
  this->addAction (toggleQLabelAct);


  //############################### Help Menu ###############################

  helpMenu = menuBar ()->addMenu (tr ("&Help"));

  QAction *helpAct = new QAction (tr ("&Usage Help"), this);
  helpAct->setShortcuts (QKeySequence::HelpContents);
  helpAct->setStatusTip (tr ("Show usage information"));
  helpAct->setIcon (QIcon::fromTheme ("help-contents")); //doesn't work for gnome
  connect (helpAct, SIGNAL (triggered ()), this, SLOT (help ()));
  helpMenu->addAction (helpAct);
  this->addAction (helpAct);

  helpMenu->addSeparator ();

  QAction *aboutAct = new QAction (tr ("&About Place Recognition"), this);
  aboutAct->setShortcut (QString ("Ctrl+A"));
  aboutAct->setStatusTip (tr ("Show information about place recognition"));
  aboutAct->setIcon (QIcon::fromTheme ("help-about")); //doesn't work for gnome
  connect (aboutAct, SIGNAL (triggered ()), this, SLOT (about ()));
  helpMenu->addAction (aboutAct);
  this->addAction (aboutAct);
}
Example #18
0
void MainWindow::on_actionShow_Hide_Menu_triggered()
{
	QMenuBar *menu_bar = menuBar();
	menu_bar->setVisible(! menu_bar->isVisible());
}
Example #19
0
void MainWindow::initial()
{
    my_sync_widget->setWindowModality(Qt::WindowModal);
    my_sync_widget->hide();

    connect(my_sync_widget, SIGNAL(getSaveFile(QString&)), this, SLOT(syncSaveFile(QString&)));
    connect(my_sync_widget, SIGNAL(enableServiceButton(QString&)), this, SLOT(serviceAdded(QString&)));
    connect(this, SIGNAL(syncClickEmit()), my_sync_widget, SLOT(syncFiles()));
    connect(my_sync_widget, SIGNAL(openXml(QString&)), this, SLOT(openXmlRecv(QString&)));

    connect(my_sync_widget, SIGNAL(dboxAuthResult(bool)), this, SLOT(dboxAuthStatus(bool)));
    connect(my_sync_widget, SIGNAL(dboxRecvResult(bool)), this, SLOT(dboxRecvStatus(bool)));
    connect(my_sync_widget, SIGNAL(dboxSendResult(bool)), this, SLOT(dboxSendStatus(bool)));

    connect(my_sync_widget, SIGNAL(googleAuthResult(bool)), this, SLOT(googleAuthStatus(bool)));
    connect(my_sync_widget, SIGNAL(googleRecvResult(bool)), this, SLOT(googleRecvStatus(bool)));
    connect(my_sync_widget, SIGNAL(googleSendResult(bool)), this, SLOT(googleSendStatus(bool)));

    fileMenu = menuBar()->addMenu(tr("&File"));

    newList = new QAction( tr("&New lists..."), this );
    newList->setShortcuts(QKeySequence::New);
    fileMenu->addAction(newList);
    connect(newList, SIGNAL(triggered()),
            this->my_task_list,SLOT(new_list()));

    fileMenu->addSeparator();
    loadAction = new QAction(tr("&Open XML..."), this);
    loadAction->setShortcuts(QKeySequence::Open);
    fileMenu->addAction(loadAction);
    connect(loadAction, SIGNAL(triggered()),
            this, SLOT(loadFile()));

    saveAction = new QAction( tr("&Save..."), this );
    saveAction->setShortcuts(QKeySequence::Save);
    fileMenu->addAction(saveAction);
    connect(saveAction, SIGNAL(triggered()),
            this, SLOT(saveFile()));

    saveAsAction = new QAction( tr("&Save as..."), this );
    //saveAsAction->setShortcuts(QKeySequence::SaveAs);
    fileMenu->addAction(saveAsAction);
    connect(saveAsAction, SIGNAL(triggered()),
            this, SLOT(saveasFile()));

    fileMenu->addSeparator();


    printAction = new QAction(tr("&Print"),this);
    printAction->setShortcuts(QKeySequence::Print);
    fileMenu->addAction(printAction);
    connect(printAction, SIGNAL(triggered()),
            this,SLOT(print()));

    fileMenu->addSeparator();

    exitAction = new QAction(tr("&Exit"), this);
    fileMenu->addAction(exitAction);
    connect(exitAction, SIGNAL(triggered()),
            this, SLOT(close()));

    OptMenu = menuBar()->addMenu(tr("&Options"));

    change_font = new QAction(tr("&Change Font"),this);
    OptMenu->addAction(change_font);

    display_note = new QAction(tr("&Display/Hide Note"), this);
    OptMenu->addAction(display_note);

    search_for= new QAction(tr("&Search"),this);
    search_for->setShortcut(QKeySequence::Find);
    OptMenu->addAction(search_for);
    connect(search_for,SIGNAL(triggered()),this,SLOT(search_start()));

    Template = menuBar()->addMenu(tr("&Template"));

    new_grocery = new QAction(tr("&Groceries"),this);
    Template->addAction(new_grocery);

    new_week_task = new QAction(tr("&Weekly Task"),this);
    Template->addAction(new_week_task);


    Sync = menuBar()->addMenu(tr("&Sync Menu"));

    new_service = new QAction(tr("&Add Service"), this);
    Sync->addAction(new_service);
    sync_service = new QAction(tr("&Sync Services (On)"), this);
    Sync->addAction(sync_service);
    sync_service_off = new QAction(tr("&Sync Services Off"), this);
    Sync->addAction(sync_service_off);
    send_service = new QAction(tr("&Send Current File"), this);
    Sync->addAction(send_service);
    get_service = new QAction(tr("&Get Dropbox Files"), this);
    Sync->addAction(get_service);
    send_service_gtask = new QAction(tr("&Send Current File (GTask)"), this);
    Sync->addAction(send_service_gtask);
    get_service_gtask = new QAction(tr("&Get GTask Files"), this);
    Sync->addAction(get_service_gtask);

    sync_service->setDisabled(true);
    send_service->setDisabled(true);
    sync_service_off->setDisabled(true);
    get_service->setDisabled(true);
    send_service_gtask->setDisabled(true);
    get_service_gtask->setDisabled(true);

    addTask = new QPushButton( tr("Add Task") );
    delTask = new QPushButton( tr("Delete") );
    editTask = new QPushButton( tr("Edit Task") );
    pop_up = new QPushButton(tr("Pop Task Up"));
    move_down = new QPushButton(tr("Move Task Down"));
    search_button = new QPushButton(tr("Search"));

    QWidget *main_widget = new QWidget;

    QVBoxLayout *main_layout = new QVBoxLayout;
    QHBoxLayout *button_layout1 = new QHBoxLayout;
    QHBoxLayout *button_layout2 = new QHBoxLayout;

    //here is the list name area
    //main_layout->addWidget( new QLabel(tr("Lists name")),0,Qt::AlignCenter );
    //main_layout->addWidget(my_task_list->lists_name);


    this->my_task_list->setColumnCount(5);
    QStringList tmp_l;
    tmp_l << "Name" << "Note" << "Tag" << "Due Date" << "Status";
    this->my_task_list->setHeaderLabels(tmp_l );

    this->my_task_list->setEditTriggers(QAbstractItemView::DoubleClicked);
    this->my_task_list->setSelectionMode(QAbstractItemView::SingleSelection);
    this->my_task_list->setSelectionBehavior(QAbstractItemView::SelectRows);
    //here is the table content
    /*QStandardItemModel *tmp_mod = my_task_list->mod;
    tmp_mod->setColumnCount(4);
    tmp_mod->setHeaderData(0, Qt::Horizontal, tr("Name"));
    tmp_mod->setHeaderData(1,Qt::Horizontal, tr("Note"));
    tmp_mod->setHeaderData(2,Qt::Horizontal, tr("Due date"));
    tmp_mod->setHeaderData(3,Qt::Horizontal, tr("Status"));
    my_task_list->table->setModel(tmp_mod);
    my_task_list->table->setEditTriggers(QAbstractItemView::DoubleClicked);
    my_task_list->table->setSelectionMode(QAbstractItemView::SingleSelection);
    my_task_list->table->setSelectionBehavior(QAbstractItemView::SelectRows);*/

    /*QTreeWidgetItem* task_child = new QTreeWidgetItem(this->my_task_list,0);
    task_child->setText(0,"a");
    this->my_task_list->addTopLevelItem(task_child);
    QTreeWidgetItem* task_child1 = new QTreeWidgetItem(task_child,1);
    task_child1->setText(0,"1");
    QTreeWidgetItem* task_child2 = new QTreeWidgetItem(task_child,1);
    task_child2->setText(0,"2");
    QTreeWidgetItem* task_child3 = new QTreeWidgetItem(task_child,1);
    task_child3->setText(0,"3");
    task_child->addChild(task_child1);
        task_child->addChild(task_child2);
            task_child->addChild(task_child3);
            QTreeWidgetItem* task_child4 = new QTreeWidgetItem(task_child,1);
            task_child4->setText(0,"0");
            task_child->insertChild(-2,task_child4);
    */


    main_layout->addWidget( new QLabel(tr("Current Lists")),0,Qt::AlignCenter );
    main_layout->addWidget(this->my_task_list);

    button_layout1->addWidget(addTask);
    button_layout1->addWidget(delTask);
    button_layout1->addWidget(editTask);

    button_layout2->addWidget(pop_up);
    button_layout2->addWidget(move_down);
    button_layout2->addWidget(search_button);

    main_layout->addLayout(button_layout1);
    main_layout->addLayout(button_layout2);
    main_widget->setLayout(main_layout);
    main_widget->setMinimumSize(520,500);
    this->setCentralWidget(main_widget);

    //connection
    connect(addTask, SIGNAL(clicked()),
            this->my_task_list,SLOT(addTask()));

    connect(delTask, SIGNAL(clicked()),
            this->my_task_list,SLOT(delTask()));

    connect(editTask, SIGNAL(clicked()),
            this->my_task_list, SLOT(editTask()));

    connect(display_note, SIGNAL(triggered()),
            this->my_task_list, SLOT(show_hide_Note()));//the action one in the menu

    connect(change_font, SIGNAL(triggered()),
            this->my_task_list, SLOT(changeFont()));

    connect(pop_up, SIGNAL(clicked()),
            this->my_task_list, SLOT(pop_up()));

    connect(move_down, SIGNAL(clicked()),
            this->my_task_list, SLOT(move_down()));

    connect(new_grocery, SIGNAL(triggered()),
            this->my_task_list, SLOT(grocery()));

    connect(new_week_task, SIGNAL(triggered()),
            this->my_task_list, SLOT(week_task()));

    connect(new_service, SIGNAL(triggered()),
            this, SLOT(newServiceClick()));

    connect(sync_service, SIGNAL(triggered()),
            this, SLOT(syncClick()));
    connect(sync_service_off, SIGNAL(triggered()),
            this, SLOT(syncClickOff()));
    connect(send_service, SIGNAL(triggered()),
            this->my_sync_widget, SLOT(sendFiles()));
    connect(get_service, SIGNAL(triggered()),
            this->my_sync_widget, SLOT(getFiles()));
    connect(send_service_gtask, SIGNAL(triggered()),
            this->my_sync_widget, SLOT(sendFilesGTask()));
    connect(get_service_gtask, SIGNAL(triggered()),
            this->my_sync_widget, SLOT(getFilesGTask()));

    connect(search_button, SIGNAL(clicked()), this, SLOT(search_start()));

}
Example #20
0
Gitarre::Gitarre(QWidget *parent, Qt::WindowFlags flags)
	: QMainWindow (parent, flags)
{
	Repos = vector <Repository *> (0);

	setWindowTitle ("gitarre");
	setMinimumSize (QSize (800, 600));
	setFocusPolicy (Qt::StrongFocus);

	// Create menu
	NewMenu = new QMenu ("New");
	QAction *initAction = new QAction ("Init", NewMenu);
	QAction *cloneAction = new QAction ("Clone", NewMenu);
	QObject::connect (initAction, &QAction::triggered, this, &Gitarre::onInitAction);
	connect (cloneAction, &QAction::triggered, this, &Gitarre::onCloneAction);
	NewMenu->addAction(initAction);
	NewMenu->addAction(cloneAction);

	QAction *openAction = new QAction ("Open", this);
	connect (openAction, &QAction::triggered, this, &Gitarre::onOpenAction);

	SaveMenu = new QMenu ("Save");
	QAction *saveGitignoreAction = new QAction (".gitignore", SaveMenu);
	connect (saveGitignoreAction, &QAction::triggered, this, &Gitarre::onSaveGitignoreAction);
	SaveMenu->addAction (saveGitignoreAction);

	QMenu *fileMenu = menuBar()->addMenu("File");
	fileMenu->addMenu (NewMenu);
	fileMenu->addAction(openAction);
	fileMenu->addMenu (SaveMenu);

	QMenu *repositoryMenu = menuBar()->addMenu ("Repository");
	CommitAction = new QAction ("Commit", repositoryMenu);
	PushAction = new QAction ("Push", repositoryMenu);
	QAction *separator = new QAction (repositoryMenu);
	separator->setSeparator(true);
	connect (CommitAction, &QAction::triggered, this, &Gitarre::onCommitAction);
	connect (PushAction, &QAction::triggered, this, &Gitarre::onPushAction);
	repositoryMenu->addAction (CommitAction);
	repositoryMenu->addAction (PushAction);
	repositoryMenu->addAction (separator);

	RemotesMenu = new QMenu ("Remotes");
	repositoryMenu->addMenu (RemotesMenu);

	// Create status bar
	StatusBar = new QStatusBar ();
	StatusLabel = new QLabel ("");
	StatusProgress = new QProgressBar ();
	StatusBar->addWidget(StatusLabel);
	StatusBar->addWidget(StatusProgress);
	StatusLabel->hide();
	StatusProgress->hide();
	setStatusBar (StatusBar);

	// Create overall layout
	QSplitter *splitter = new QSplitter (Qt::Horizontal);

	// Create repository browser
	RepoView = new QTreeWidget ();
	RepoView->header()->close();
	RepoView->setContextMenuPolicy(Qt::ActionsContextMenu);
	connect (RepoView, &QTreeWidget::currentItemChanged, this, &Gitarre::onRepoViewItemChanged);

	QGroupBox *repoBox = new QGroupBox ("Repositories");
	repoBox->setContentsMargins(6, 12, 0, 0);
	QVBoxLayout *repoBoxLayout = new QVBoxLayout ();
	repoBoxLayout->setContentsMargins(0, 12, 0, 0);
	repoBoxLayout->addWidget (RepoView);
	repoBox->setLayout (repoBoxLayout);
	splitter->addWidget (repoBox);

	this->setCentralWidget(splitter);

	// Create actions for RepoView
	FindRepoAction = new QAction ("Find", RepoView);
	CommitRepoAction = new QAction ("Commit", RepoView);
	PushRepoAction = new QAction ("Push", RepoView);
	RemoveSeparator = new QAction (RepoView);
	RemoveSeparator->setSeparator (true);
	RemoveRepoAction = new QAction ("Remove", RepoView);

	connect (FindRepoAction, &QAction::triggered, this, &Gitarre::onFindRepoAction);
	connect (CommitRepoAction, &QAction::triggered, this, &Gitarre::onCommitAction);
	connect (PushRepoAction, &QAction::triggered, this, &Gitarre::onPushAction);
	connect (RemoveRepoAction, &QAction::triggered, this, &Gitarre::onRemoveRepoAction);

	// Create main tab widget
	MainTabWidget = new QTabWidget ();
	splitter->addWidget (MainTabWidget);

	// Create .gitignore editor
	IgnoreEditor = new QTextEdit ();
	IgnoreEditor->installEventFilter (this);
	MainTabWidget->addTab(IgnoreEditor, ".gitignore");

	// Check whether application folder in /home/user exists and creating if necessary
	QString userDataPath = QDir::homePath() + "/.gitarre/";
	UserDataDir = QDir (userDataPath);
	if (!UserDataDir.exists())
		UserDataDir.mkpath (userDataPath);

	// Read and load saved repositories
	ReadSavedRepos ();

	if (!Repos.empty())
		RepoView->setCurrentItem(RepoView->topLevelItem (0));
}
Example #21
0
void TextEdit::setupFileActions()
{
    standardToolBar = new QToolBar(this);
    standardToolBar->setWindowTitle(tr("File Actions"));
    addToolBar(standardToolBar);

    QMenu *menu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(menu);

    QAction *a;

    a = new QAction( QIcon(":/res/smallNew.png"), tr("&New"), this);
    a->setPriority(QAction::LowPriority);
    a->setShortcut(QKeySequence::New);
    connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
    standardToolBar->addAction(a);
    menu->addAction(a);

    a = new QAction(QIcon(":/res/smallOpen.png"), tr("&Open..."), this);
    a->setShortcut(QKeySequence::Open);
    connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
    standardToolBar->addAction(a);
    menu->addAction(a);

    menu->addSeparator();

    actionSave = a = new QAction(QIcon(":/res/smallSave.png"),tr("&Save"), this);
    a->setShortcut(QKeySequence::Save);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
    a->setEnabled(false);
    standardToolBar->addAction(a);
    menu->addAction(a);

    a = new QAction(tr("Save &As..."), this);
    a->setPriority(QAction::LowPriority);
    connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
    menu->addAction(a);
    menu->addSeparator();

#ifndef QT_NO_PRINTER
    a = new QAction(QIcon(":/res/smallPrint.png"),tr("&Print..."), this);
    a->setPriority(QAction::LowPriority);    
    a->setShortcut(QKeySequence::Print);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
    standardToolBar->addAction(a);
    menu->addAction(a);

    a = new QAction(QIcon(":/res/smallPrintPreview.png"),tr("Print Preview..."), this);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPreview()));
    menu->addAction(a);

    a = new QAction(QIcon(":/res/smallSavePDF.png"),tr("&Export PDF..."), this);
    a->setPriority(QAction::LowPriority);
    a->setShortcut(Qt::CTRL + Qt::Key_D);
    connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
    standardToolBar->addAction(a);
    menu->addAction(a);

    menu->addSeparator();
#endif

    a = new QAction(tr("&Quit"), this);
    a->setShortcut(Qt::CTRL + Qt::Key_Q);
    connect(a, SIGNAL(triggered()), this, SLOT(close()));
    menu->addAction(a);
}
Example #22
0
WaveEdit::WaveEdit(MusECore::PartList* pl, QWidget* parent, const char* name)
   : MidiEditor(TopWin::WAVE, 1, pl, parent, name)
      {
      setFocusPolicy(Qt::NoFocus);
      colorMode      = colorModeInit;

      QSignalMapper* mapper = new QSignalMapper(this);
      QSignalMapper* colorMapper = new QSignalMapper(this);
      QAction* act;
      
      //---------Pulldown Menu----------------------------
      // We probably don't need an empty menu - Orcan
      //QMenu* menuFile = menuBar()->addMenu(tr("&File"));
      QMenu* menuEdit = menuBar()->addMenu(tr("&Edit"));
      
      menuFunctions = menuBar()->addMenu(tr("Func&tions"));

      menuGain = menuFunctions->addMenu(tr("&Gain"));
      
      act = menuGain->addAction("200%");
      mapper->setMapping(act, WaveCanvas::CMD_GAIN_200);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuGain->addAction("150%");
      mapper->setMapping(act, WaveCanvas::CMD_GAIN_150);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuGain->addAction("75%");
      mapper->setMapping(act, WaveCanvas::CMD_GAIN_75);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuGain->addAction("50%");
      mapper->setMapping(act, WaveCanvas::CMD_GAIN_50);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuGain->addAction("25%");
      mapper->setMapping(act, WaveCanvas::CMD_GAIN_25);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuGain->addAction(tr("Other"));
      mapper->setMapping(act, WaveCanvas::CMD_GAIN_FREE);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      connect(mapper, SIGNAL(mapped(int)), this, SLOT(cmd(int)));
      
      menuFunctions->addSeparator();

      copyAction = menuEdit->addAction(tr("&Copy"));
      mapper->setMapping(copyAction, WaveCanvas::CMD_EDIT_COPY);
      connect(copyAction, SIGNAL(triggered()), mapper, SLOT(map()));

      copyPartRegionAction = menuEdit->addAction(tr("&Create Part from Region"));
      mapper->setMapping(copyPartRegionAction, WaveCanvas::CMD_CREATE_PART_REGION);
      connect(copyPartRegionAction, SIGNAL(triggered()), mapper, SLOT(map()));

      cutAction = menuEdit->addAction(tr("C&ut"));
      mapper->setMapping(cutAction, WaveCanvas::CMD_EDIT_CUT);
      connect(cutAction, SIGNAL(triggered()), mapper, SLOT(map()));

      pasteAction = menuEdit->addAction(tr("&Paste"));
      mapper->setMapping(pasteAction, WaveCanvas::CMD_EDIT_PASTE);
      connect(pasteAction, SIGNAL(triggered()), mapper, SLOT(map()));


      act = menuEdit->addAction(tr("Edit in E&xternal Editor"));
      mapper->setMapping(act, WaveCanvas::CMD_EDIT_EXTERNAL);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      menuEdit->addSeparator();

// REMOVE Tim. Also remove CMD_ADJUST_WAVE_OFFSET and so on...      
//       adjustWaveOffsetAction = menuEdit->addAction(tr("Adjust wave offset..."));
//       mapper->setMapping(adjustWaveOffsetAction, WaveCanvas::CMD_ADJUST_WAVE_OFFSET);
//       connect(adjustWaveOffsetAction, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuFunctions->addAction(tr("Mute Selection"));
      mapper->setMapping(act, WaveCanvas::CMD_MUTE);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuFunctions->addAction(tr("Normalize Selection"));
      mapper->setMapping(act, WaveCanvas::CMD_NORMALIZE);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuFunctions->addAction(tr("Fade In Selection"));
      mapper->setMapping(act, WaveCanvas::CMD_FADE_IN);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuFunctions->addAction(tr("Fade Out Selection"));
      mapper->setMapping(act, WaveCanvas::CMD_FADE_OUT);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      act = menuFunctions->addAction(tr("Reverse Selection"));
      mapper->setMapping(act, WaveCanvas::CMD_REVERSE);
      connect(act, SIGNAL(triggered()), mapper, SLOT(map()));
      
      select = menuEdit->addMenu(QIcon(*selectIcon), tr("Select"));
      
      selectAllAction = select->addAction(QIcon(*select_allIcon), tr("Select &All"));
      mapper->setMapping(selectAllAction, WaveCanvas::CMD_SELECT_ALL);
      connect(selectAllAction, SIGNAL(triggered()), mapper, SLOT(map()));
      
      selectNoneAction = select->addAction(QIcon(*select_allIcon), tr("&Deselect All"));
      mapper->setMapping(selectNoneAction, WaveCanvas::CMD_SELECT_NONE);
      connect(selectNoneAction, SIGNAL(triggered()), mapper, SLOT(map()));
      
      select->addSeparator();
      
      selectPrevPartAction = select->addAction(QIcon(*select_all_parts_on_trackIcon), tr("&Previous Part"));
      mapper->setMapping(selectPrevPartAction, WaveCanvas::CMD_SELECT_PREV_PART);
      connect(selectPrevPartAction, SIGNAL(triggered()), mapper, SLOT(map()));
      
      selectNextPartAction = select->addAction(QIcon(*select_all_parts_on_trackIcon), tr("&Next Part"));
      mapper->setMapping(selectNextPartAction, WaveCanvas::CMD_SELECT_NEXT_PART);
      connect(selectNextPartAction, SIGNAL(triggered()), mapper, SLOT(map()));

      
      QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config"));

      eventColor = settingsMenu->addMenu(tr("&Event Color"));      
      
      QActionGroup* actgrp = new QActionGroup(this);
      actgrp->setExclusive(true);
      
      evColorNormalAction = actgrp->addAction(tr("&Part colors"));
      evColorNormalAction->setCheckable(true);
      colorMapper->setMapping(evColorNormalAction, 0);
      
      evColorPartsAction = actgrp->addAction(tr("&Gray"));
      evColorPartsAction->setCheckable(true);
      colorMapper->setMapping(evColorPartsAction, 1);
      
      connect(evColorNormalAction, SIGNAL(triggered()), colorMapper, SLOT(map()));
      connect(evColorPartsAction, SIGNAL(triggered()), colorMapper, SLOT(map()));
      
      eventColor->addActions(actgrp->actions());
      
      connect(colorMapper, SIGNAL(mapped(int)), this, SLOT(eventColorModeChanged(int)));
      
      settingsMenu->addSeparator();
      settingsMenu->addAction(subwinAction);
      settingsMenu->addAction(shareAction);
      settingsMenu->addAction(fullscreenAction);

      connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged()));


      //--------------------------------------------------
      //    ToolBar:   Solo  Cursor1 Cursor2

      tools2 = new MusEGui::EditToolBar(this, waveEditTools);
      addToolBar(tools2);
      
      addToolBarBreak();
      tb1 = addToolBar(tr("WaveEdit tools"));
      tb1->setObjectName("WaveEdit tools");

      //tb1->setLabel(tr("weTools"));
      solo = new QToolButton();
      solo->setText(tr("Solo"));
      solo->setCheckable(true);
      solo->setFocusPolicy(Qt::NoFocus);
      tb1->addWidget(solo);
      connect(solo,  SIGNAL(toggled(bool)), SLOT(soloChanged(bool)));
      
      QLabel* label = new QLabel(tr("Cursor"));
      tb1->addWidget(label);
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      pos1 = new PosLabel(0);
      pos1->setFixedHeight(22);
      tb1->addWidget(pos1);
      pos2 = new PosLabel(0);
      pos2->setFixedHeight(22);
      pos2->setSmpte(true);
      tb1->addWidget(pos2);

      //---------------------------------------------------
      //    Rest
      //---------------------------------------------------

      int yscale = 256;
      int xscale;

      if (!parts()->empty()) { // Roughly match total size of part
            MusECore::Part* firstPart = parts()->begin()->second;
            xscale = 0 - firstPart->lenFrame()/_widthInit[_type];
            }
      else {
            xscale = -8000;
            }

      hscroll = new ScrollScale(-32768, 1, xscale, 10000, Qt::Horizontal, mainw, 0, false, 10000.0);
      //view    = new WaveView(this, mainw, xscale, yscale);
      canvas    = new WaveCanvas(this, mainw, xscale, yscale);
      //wview   = canvas;   // HACK!

      QSizeGrip* corner    = new QSizeGrip(mainw);
      ymag                 = new QSlider(Qt::Vertical, mainw);
      ymag->setMinimum(1);
      ymag->setMaximum(256);
      ymag->setPageStep(256);
      ymag->setValue(yscale);
      ymag->setFocusPolicy(Qt::NoFocus);

      time                 = new MTScale(&_raster, mainw, xscale, true);
      ymag->setFixedWidth(16);
      connect(canvas, SIGNAL(mouseWheelMoved(int)), this, SLOT(moveVerticalSlider(int)));
      connect(ymag, SIGNAL(valueChanged(int)), canvas, SLOT(setYScale(int)));
      connect(canvas, SIGNAL(horizontalZoom(bool, const QPoint&)), SLOT(horizontalZoom(bool, const QPoint&)));
      connect(canvas, SIGNAL(horizontalZoom(int, const QPoint&)), SLOT(horizontalZoom(int, const QPoint&)));

      time->setOrigin(0, 0);

      mainGrid->setRowStretch(0, 100);
      mainGrid->setColumnStretch(0, 100);

      mainGrid->addWidget(time,   0, 0, 1, 2);
      mainGrid->addWidget(MusECore::hLine(mainw),    1, 0, 1, 2);
      mainGrid->addWidget(canvas,    2, 0);
      mainGrid->addWidget(ymag,    2, 1);
      mainGrid->addWidget(hscroll, 3, 0);
      mainGrid->addWidget(corner,  3, 1, Qt::AlignBottom | Qt::AlignRight);

      canvas->setFocus();  
      
      connect(canvas, SIGNAL(toolChanged(int)), tools2, SLOT(set(int)));
      connect(tools2, SIGNAL(toolChanged(int)), canvas,   SLOT(setTool(int)));
      
      connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
      connect(hscroll, SIGNAL(scaleChanged(int)),  canvas, SLOT(setXMag(int)));
      setWindowTitle(canvas->getCaption());
      connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));

      connect(hscroll, SIGNAL(scrollChanged(int)), time,  SLOT(setXPos(int)));
      connect(hscroll, SIGNAL(scaleChanged(int)),  time,  SLOT(setXMag(int)));
      connect(time,    SIGNAL(timeChanged(unsigned)),  SLOT(timeChanged(unsigned)));
      connect(canvas,    SIGNAL(timeChanged(unsigned)),  SLOT(setTime(unsigned)));

      connect(canvas,  SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned)));
      connect(canvas,  SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned))); 

      connect(hscroll, SIGNAL(scaleChanged(int)),  SLOT(updateHScrollRange()));
      connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged1(MusECore::SongChangedFlags_t)));

      // For the wave editor, let's start with the operation range selection tool.
      canvas->setTool(MusEGui::RangeTool);
      tools2->set(MusEGui::RangeTool);
      
      setEventColorMode(colorMode);
      
      initShortcuts();
      
      updateHScrollRange();
      configChanged();
      
      if(!parts()->empty())
      {
        MusECore::WavePart* part = (MusECore::WavePart*)(parts()->begin()->second);
        solo->setChecked(part->track()->solo());
      }

      initTopwinState();
      finalizeInit();
      }
Example #23
0
void TimeTrackingWindow::insertEditMenu()
{
    QMenu* editMenu = menuBar()->addMenu( tr( "Edit" ) );
    m_summaryWidget->populateEditMenu( editMenu );
}
Example #24
0
DSPWindow::DSPWindow(QWidget *parent)
  : QMainWindow(parent)
{
  owDate = new QDate;
  *owDate = QDate::currentDate();

  // Меню - Файл ---------------------------------------------------------------
  QToolBar *tb = new QToolBar(this);
  tb->setWindowTitle(tr("File Actions"));
  addToolBar(tb);

  QMenu *menu = new QMenu(tr("&File"), this);
  menuBar()->addMenu(menu);

  QAction *a;
    
  a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_N);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileNew()));
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(QIcon(rsrcPath + "/fileopen.png"), tr("&Open..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_O);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileOpen()));
  tb->addAction(a);
  menu->addAction(a);

  menu->addSeparator();

  actionSave = a = new QAction(QIcon(rsrcPath + "/filesave.png"), tr("&Save"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_S);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileSave()));
  a->setEnabled(false);
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(tr("Save &As..."), this);
  //connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
  menu->addAction(a);
  menu->addSeparator();

  a = new QAction(QIcon(rsrcPath + "/fileprint.png"), tr("&Print..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_P);
  //connect(a, SIGNAL(triggered()), this, SLOT(filePrint()));
  tb->addAction(a);
  menu->addAction(a);

  a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this);
  a->setShortcut(Qt::CTRL + Qt::Key_D);
  //connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf()));
  tb->addAction(a);
  menu->addAction(a);

  menu->addSeparator();

  a = new QAction(tr("&Quit"), this);
  a->setShortcut(Qt::CTRL + Qt::Key_Q);
  connect(a, SIGNAL(triggered()), this, SLOT(close()));
  menu->addAction(a);
  // Меню - Файл ..............................................................


  // Навигатор ----------------------------------------------------------------
  //QPalette palette( Qt::gray );
  //palette.setColor( QPalette::Button , QColor(Qt::white));

  navigator = new QDockWidget(tr("Навигатор"), this);
  navigator->setFeatures( navigator->features() ^ QDockWidget::DockWidgetClosable );
  navigator->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  navigator->setMaximumSize(QSize( NButtonWidth + 40 , 16777215)); // <- Задаем фиксированный размер
  navigator->setMinimumSize(QSize( NButtonWidth + 40 , 0)); // <----------|

  addDockWidget(Qt::LeftDockWidgetArea, navigator );
    
  navigatorBox = new QToolBox( navigator );
  navigatorBox->setFrameShape( QFrame::Panel );
  navigatorBox->setFrameShadow( QFrame::Plain );
  navigatorBox->setLineWidth(1);
  //navigatorBox->setPalette( palette );
  navigator->setWidget( navigatorBox );

  navigatorButtonGroup = new QButtonGroup;
  navigatorButtonGroup->setExclusive ( true );
  connect( navigatorButtonGroup , SIGNAL(buttonClicked ( int )), 
	   this, SLOT(selectPageInMainLayout( int )));

  NavigatorButton *navigatorButton;
  NavigatorLabel *navigatorLabel;

  // Оперативная работа ---
  QWidget *pageOpWork = new QWidget();

  QVBoxLayout *pageOpWorkVboxLayout = new QVBoxLayout( pageOpWork );
  pageOpWorkVboxLayout->setSpacing(6);
  pageOpWorkVboxLayout->setMargin(9);

  navigatorBox->addItem( pageOpWork , tr( "Оперативная работа" ));
  navigatorBox->setItemIcon ( 0 , QIcon( piconPath + "/32/ow.png") );
  // ее кнопки 

  navigatorLabel = new NavigatorLabel( tr( "Производство:"));
  pageOpWorkVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Производство фосфора") , 
				     QIcon( piconPath + "/32/Factor.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 21 );

  navigatorButton = new NavigatorButton( tr( "Выработка") ,
				     QIcon( piconPath + "/32/vyr.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 22 );

  // Разделитель >-------<
  QFrame *line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageOpWorkVboxLayout->addWidget( line );

  navigatorLabel = new NavigatorLabel( tr( "Сырье:"));
  pageOpWorkVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Приход сырья") ,
				     QIcon( piconPath + "/22/add.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 23 );

  navigatorButton = new NavigatorButton( tr( "Остатки сырья") ,
				     QIcon( piconPath + "/32/ost.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 24 );

  // Разделитель >-------<
  line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageOpWorkVboxLayout->addWidget( line );

  navigatorLabel = new NavigatorLabel( tr( "Продукция:"));
  pageOpWorkVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Приход со стороны") ,
				     QIcon( piconPath + "/22/add.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 25 );

  navigatorButton = new NavigatorButton( tr( "Отгрузка продукции") ,
				     QIcon( piconPath + "/22/remove.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 26 );

  navigatorButton = new NavigatorButton( tr( "Остатки продукции") ,
				     QIcon( piconPath + "/32/ost.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 27 );

  // Разделитель >-------<
  line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageOpWorkVboxLayout->addWidget( line );

  navigatorButton = new NavigatorButton( tr( "Простои") ,
				     QIcon( piconPath + "/32/potP4.png") );
  pageOpWorkVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 26 );


  QSpacerItem *spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
					    QSizePolicy::Expanding);

  pageOpWorkVboxLayout->addItem( spacerItem );
  // Оперативная работа ...

  // Отчеты ---
  QWidget *pageRaports = new QWidget();

  QVBoxLayout *pageRaportsVboxLayout = new QVBoxLayout( pageRaports );
  pageRaportsVboxLayout->setSpacing(6);
  pageRaportsVboxLayout->setMargin(9);
   
  navigatorBox->addItem( pageRaports , tr( "Отчеты" ));
  navigatorBox->setItemIcon ( 1 , QIcon( piconPath + "/16/fileopen.png") );
   
   
  navigatorButton = new NavigatorButton( tr( "Информация о работе") ,
 					 QIcon( radiantPath + "/docs_16.png") );
  pageRaportsVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 41 );

  // Разделитель >-------<
  line = new QFrame;	// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageRaportsVboxLayout->addWidget( line );

  navigatorLabel = new NavigatorLabel( tr( "Баланс общий:"));
  pageRaportsVboxLayout->addWidget( navigatorLabel );

  navigatorButton = new NavigatorButton( tr( "Нарастающий") ,
 					 QIcon( radiantPath + "/docs_16.png") );
  pageRaportsVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 42 );

  navigatorButton = new NavigatorButton( tr( "Текущий") ,
 					 QIcon( radiantPath + "/docs_16.png") );
  pageRaportsVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 43 );
   
  spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
 			       QSizePolicy::Expanding);
  
  pageRaportsVboxLayout->addItem( spacerItem );


  spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
 			       QSizePolicy::Expanding);
  pageRaportsVboxLayout->addItem( spacerItem );
  // Отчеты ..


  // Справочники ---
  QWidget *pageHandbooks = new QWidget();

  QVBoxLayout *pageHandbooksVboxLayout = new QVBoxLayout( pageHandbooks );
  pageHandbooksVboxLayout->setSpacing(6);
  pageHandbooksVboxLayout->setMargin(9);

  navigatorBox->addItem( pageHandbooks , tr( "Справочники" ));
  navigatorBox->setItemIcon ( 2 , QIcon( piconPath + "/48/s.png") );

  navigatorButton = new NavigatorButton( tr( "Баланс фосфора") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 51 );

  navigatorButton = new NavigatorButton( tr( "Выработка") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 52 );

  navigatorButton = new NavigatorButton( tr( "Продукция") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 53 );

  navigatorButton = new NavigatorButton( tr( "Сырье") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 54 );

  navigatorButton = new NavigatorButton( tr( "Причины простоев") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 55 );

  navigatorButton = new NavigatorButton( tr( "Оборудование") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 56 );

  navigatorButton = new NavigatorButton( tr( "Поставщики") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 57 );

  navigatorButton = new NavigatorButton( tr( "Потребители") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 58 );

  // Разделитель >-------<
  line = new QFrame;		// --------------------------
  line->setFrameShape(QFrame::HLine);
  pageHandbooksVboxLayout->addWidget( line );
     
  navigatorButton = new NavigatorButton( tr( "Единицы измерения массы") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 59 );

  navigatorButton = new NavigatorButton( tr( "Цеха") ,
				     QIcon( piconPath + "/22/s_s22.png") );
  pageHandbooksVboxLayout->addWidget( navigatorButton );
  navigatorButtonGroup->addButton ( navigatorButton , 60 );

  spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, 
			       QSizePolicy::Expanding);

  pageHandbooksVboxLayout->addItem( spacerItem );

  // Справочники ..
  // Навигатор ................................................................

  // Док календарь - все остальное для работы с датами ----
  
  QDockWidget * dateTimeBrowser = new QDockWidget(tr("Дата"), this);
  dateTimeBrowser->setFeatures( dateTimeBrowser->features() ^ QDockWidget::DockWidgetClosable);
  dateTimeBrowser->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  dateTimeBrowser->setMaximumSize(QSize( NButtonWidth + 42 , 210 )); // <- Задаем фиксированный размер
  dateTimeBrowser->setMinimumSize(QSize( NButtonWidth + 42 , 0)); // <----------|

  addDockWidget(Qt::LeftDockWidgetArea , dateTimeBrowser );
  
  QWidget *pDatePickerWidget = new QWidget;
  QVBoxLayout *pDatePickerWidgetLayout = new QVBoxLayout; 
  pDatePickerWidgetLayout->setMargin(1);
  pDatePickerWidgetLayout->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
  pDatePickerWidget->setLayout( pDatePickerWidgetLayout );

  PDatePicker *pDatePicker = new PDatePicker( 19 , 28 );
  pDatePicker->setFrameStyle( QFrame::Box | QFrame::Plain );
  //pDatePicker->setFocusPolicy( Qt::NoFocus );
  pDatePickerWidgetLayout->addWidget( pDatePicker );

  dateTimeBrowser->setWidget( pDatePickerWidget );

  
  // ..

  // *************************************************************************
  // Рабочая область ---------------------------------------------------------
  mainWidget = new QWidget;
  mainWidget->setMinimumSize(QSize(400, 0)); // >|----------|<
  setCentralWidget ( mainWidget );
  mainLayout = new QStackedLayout( mainWidget );

  // Оперативная работа ........................
  // Производство фосфора    
  ow_prod_phos = new OW_Prod_Phos;
  mainLayout->addWidget( ow_prod_phos );
  // .. 
  // Выработка
  ow_producing = new OW_Producing;
  mainLayout->addWidget( ow_producing );
  // .. 
  // Приход со стороны
  ow_income = new OW_Income;
  mainLayout->addWidget( ow_income );
  // .. 
  // Отгрузка
  ow_outcome = new OW_Outcome;
  mainLayout->addWidget( ow_outcome );
  // .. 
  // Отгрузка
  ow_depot = new OW_Depot;
  mainLayout->addWidget( ow_depot );
  // .. 
  //Отчеты -------------------------------------
  // Общая информация по работе предприятия
  r_infoforday = new R_InfoForDay;
  mainLayout->addWidget( r_infoforday );
  // ..
  // Баланс общий
  r_allproductionbalance = new R_AllProductionBalance;
  mainLayout->addWidget( r_allproductionbalance );
  // ..
  // Справочники -------------------------------
  // Справочник Баланс фосфора --
  s_bal_dbtable = new S_BAL_DBTable;
  mainLayout->addWidget( s_bal_dbtable );
  // ..
  // Выработка --
  s_vyr_dbtable = new S_VYR_DBTable;
  mainLayout->addWidget( s_vyr_dbtable );
  // ..
  // Продукция --
  s_prod_dbtable = new S_PROD_DBTable;
  mainLayout->addWidget( s_prod_dbtable );
  // ..
  // Сырье --
  s_syr_dbtable = new S_SYR_DBTable;
  mainLayout->addWidget( s_syr_dbtable );
  // ..
  // Причины простоев --
  s_pprost_dbtable = new S_PPROST_DBTable;
  mainLayout->addWidget( s_pprost_dbtable );
  // ..
  // Оборудование --
  s_ob_dbtable = new S_OB_DBTable;
  mainLayout->addWidget( s_ob_dbtable );
  // ..
  // Поставщики --
  s_post_dbtable = new S_POST_DBTable;
  mainLayout->addWidget( s_post_dbtable );
  // ..
  // Поставщики --
  s_potr_dbtable = new S_POTR_DBTable;
  mainLayout->addWidget( s_potr_dbtable );
  // ..
  // Цеха --
  s_dep_dbtable = new S_DEP_DBTable;
  mainLayout->addWidget( s_dep_dbtable );
  // ..
  // Справочник единиц измерения --
  s_ed_mass_dbtable = new S_ED_MASS_DBTable;
  mainLayout->addWidget( s_ed_mass_dbtable );
  // ..
  // Справочники ...............................
 
  // Рабочая область .........................................................
  resize( 800, 576);

  // Сигналы и слоты для функций этого класса *--> >>--|
  connect( pDatePicker , SIGNAL( dateChanged( const QDate & )), 
	   this , SLOT( setOWDate( const QDate & )));
}
Example #25
0
/* TextEdit */
TextEdit::TextEdit(QWidget *parent)
    : QMainWindow(parent)
{
    setIconSize(QSize(16, 16));
    setToolButtonStyle(Qt::ToolButtonFollowStyle);
    setupFileActions();
    setupEditActions();
    setupViewActions();
    setupTextActions();

    QStatusBar *pStatusBar = statusBar();
    pStatusBar->showMessage(tr("Ready"));

    {
        QMenu *helpMenu = new QMenu(tr("Help"), this);
        menuBar()->addMenu(helpMenu);
        helpMenu->addAction(tr("About"), this, SLOT(about()));
    }

    textEdit = new QTextEdit(this);
    connect(textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat)));
    connect(textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged()));

    setCentralWidget(textEdit);
    textEdit->setFocus();
    setCurrentFileName(QString());

    fontChanged(textEdit->font());
    colorChanged(textEdit->textColor());
    alignmentChanged(textEdit->alignment());

    connect(textEdit->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool)));
    connect(textEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool)));
    connect(textEdit->document(), SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool)));
    connect(textEdit->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool)));

    setWindowModified(textEdit->document()->isModified());
    actionSave->setEnabled(textEdit->document()->isModified());
    actionUndo->setEnabled(textEdit->document()->isUndoAvailable());
    actionRedo->setEnabled(textEdit->document()->isRedoAvailable());

    connect(actionUndo, SIGNAL(triggered()), textEdit, SLOT(undo()));
    connect(actionRedo, SIGNAL(triggered()), textEdit, SLOT(redo()));

    actionCut->setEnabled(false);
    actionCopy->setEnabled(false);

    connect(actionCut, SIGNAL(triggered()), textEdit, SLOT(cut()));
    connect(actionCopy, SIGNAL(triggered()), textEdit, SLOT(copy()));
    connect(actionPaste, SIGNAL(triggered()), textEdit, SLOT(paste()));

    connect(textEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool)));
    connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool)));

#ifndef QT_NO_CLIPBOARD
    connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
#endif

    QString initialFile = ":/example.html";
    const QStringList args = QCoreApplication::arguments();
    if (args.count() == 2)
        initialFile = args.at(1);

    if (!load(initialFile))
        fileNew();

    QRect geom = QApplication::desktop()->availableGeometry();
    resize( 2 * geom.width() / 3, 2 * geom.height() / 3 );
}
Example #26
0
GUI::GUI()
{
    setWindowTitle("Generate Color Map");
    setWindowIcon(QIcon(":cg-logo.png"));

    _brewerseq_widget = new ColorMapBrewerSequentialWidget;
    _brewerdiv_widget = new ColorMapBrewerDivergingWidget;
    _brewerqual_widget = new ColorMapBrewerQualitativeWidget;
    _plseq_lightness_widget = new ColorMapPLSequentialLightnessWidget;
    _plseq_saturation_widget = new ColorMapPLSequentialSaturationWidget;
    _plseq_rainbow_widget = new ColorMapPLSequentialRainbowWidget;
    _plseq_blackbody_widget = new ColorMapPLSequentialBlackBodyWidget;
    _pldiv_lightness_widget = new ColorMapPLDivergingLightnessWidget;
    _pldiv_saturation_widget = new ColorMapPLDivergingSaturationWidget;
    _plqual_hue_widget = new ColorMapPLQualitativeHueWidget;
    _cubehelix_widget = new ColorMapCubeHelixWidget;
    _moreland_widget = new ColorMapMorelandWidget;
    _mcnames_widget = new ColorMapMcNamesWidget;
    connect(_brewerseq_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_brewerdiv_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_brewerqual_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_plseq_lightness_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_plseq_saturation_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_plseq_rainbow_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_plseq_blackbody_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_pldiv_lightness_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_pldiv_saturation_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_plqual_hue_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_cubehelix_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_moreland_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));
    connect(_mcnames_widget, SIGNAL(colorMapChanged()), this, SLOT(update()));

    QWidget *widget = new QWidget;
    QGridLayout *layout = new QGridLayout;

    _category_widget = new QTabWidget();
    _category_seq_widget = new QTabWidget();
    _category_seq_widget->addTab(_brewerseq_widget, "Brewer-like");
    _category_seq_widget->addTab(_plseq_lightness_widget, "PL Lightness");
    _category_seq_widget->addTab(_plseq_saturation_widget, "PL Saturation");
    _category_seq_widget->addTab(_plseq_rainbow_widget, "PL Rainbow");
    _category_seq_widget->addTab(_plseq_blackbody_widget, "PL Black Body");
    _category_seq_widget->addTab(_cubehelix_widget, "CubeHelix");
    //_category_seq_widget->addTab(_mcnames_widget, "McNames");
    connect(_category_seq_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
    _category_widget->addTab(_category_seq_widget, "Sequential");
    _category_div_widget = new QTabWidget();
    _category_div_widget->addTab(_brewerdiv_widget, "Brewer-like");
    _category_div_widget->addTab(_pldiv_lightness_widget, "PL Lightness");
    _category_div_widget->addTab(_pldiv_saturation_widget, "PL Saturation");
    _category_div_widget->addTab(_moreland_widget, "Moreland");
    connect(_category_div_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
    _category_widget->addTab(_category_div_widget, "Diverging");
    _category_qual_widget = new QTabWidget();
    _category_qual_widget->addTab(_brewerqual_widget, "Brewer-like");
    _category_qual_widget->addTab(_plqual_hue_widget, "PL Hue");
    connect(_category_qual_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
    _category_widget->addTab(_category_qual_widget, "Qualitative");
    connect(_category_widget, SIGNAL(currentChanged(int)), this, SLOT(update()));
    layout->addWidget(_category_widget, 0, 0);
    _reference_label = new QLabel(_brewerseq_widget->reference());
    _reference_label->setWordWrap(true);
    _reference_label->setOpenExternalLinks(true);
    layout->addWidget(_reference_label, 1, 0);
    layout->addItem(new QSpacerItem(0, 0), 2, 0);
    _clipped_label = new QLabel("");
    layout->addWidget(_clipped_label, 3, 0);

    _colormap_label = new QLabel();
    _colormap_label->setScaledContents(true);
    layout->addWidget(_colormap_label, 0, 1, 4, 1);

    QLabel* test_label = new QLabel("Test pattern "
            "<a href=\"http://peterkovesi.com/projects/colourmaps/colourmaptestimage.html\">"
            "designed by P. Kovesi</a>:");
    test_label->setWordWrap(true);
    test_label->setOpenExternalLinks(true);
    layout->addWidget(test_label, 4, 0, 1, 2);
    _test_widget = new ColorMapTestWidget();
    layout->addWidget(_test_widget, 5, 0, 1, 2);

    layout->setColumnStretch(0, 1);
    layout->setRowStretch(2, 1);
    widget->setLayout(layout);
    setCentralWidget(widget);

    QMenu* file_menu = menuBar()->addMenu("&File");
    QAction* file_export_png_act = new QAction("Export as &PNG...", this);
    connect(file_export_png_act, SIGNAL(triggered()), this, SLOT(file_export_png()));
    file_menu->addAction(file_export_png_act);
    QAction* file_export_csv_act = new QAction("Export as &CSV...", this);
    connect(file_export_csv_act, SIGNAL(triggered()), this, SLOT(file_export_csv()));
    file_menu->addAction(file_export_csv_act);
    file_menu->addSeparator();
    QAction* quit_act = new QAction("&Quit...", this);
    quit_act->setShortcut(QKeySequence::Quit);
    connect(quit_act, SIGNAL(triggered()), this, SLOT(close()));
    file_menu->addAction(quit_act);
    QMenu* edit_menu = menuBar()->addMenu("&Edit");
    QAction* edit_reset_act = new QAction("&Reset", this);
    connect(edit_reset_act, SIGNAL(triggered()), this, SLOT(edit_reset()));
    edit_menu->addAction(edit_reset_act);
    QAction* edit_copy_as_img_act = new QAction("Copy as &image", this);
    connect(edit_copy_as_img_act, SIGNAL(triggered()), this, SLOT(edit_copy_as_img()));
    edit_menu->addAction(edit_copy_as_img_act);
    QAction* edit_copy_as_txt_act = new QAction("Copy as &text", this);
    connect(edit_copy_as_txt_act, SIGNAL(triggered()), this, SLOT(edit_copy_as_txt()));
    edit_copy_as_txt_act->setShortcut(QKeySequence::Copy);
    edit_menu->addAction(edit_copy_as_txt_act);
    QMenu* help_menu = menuBar()->addMenu("&Help");
    QAction* help_about_act = new QAction("&About", this);
    connect(help_about_act, SIGNAL(triggered()), this, SLOT(help_about()));
    help_menu->addAction(help_about_act);

    show();
    update();
}
void MainWindow::createMenus()
{
    fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->addAction(newAct);
}
billingreports::billingreports()
    : QMainWindow( 0, "billingreports", WDestructiveClose )
{
    printer = new QPrinter;
    QPixmap openIcon, saveIcon, printIcon;

    QToolBar * fileTools = new QToolBar( this, "file operations" );
    fileTools->setLabel( tr("File Operations") );

    openIcon = QPixmap( fileopen );
    QToolButton * fileOpen
	= new QToolButton( openIcon, tr("Open File"), QString::null,
			   this, SLOT(choose()), fileTools, "open file" );

    saveIcon = QPixmap( filesave );
    QToolButton * fileSave
	= new QToolButton( saveIcon, tr("Save File"), QString::null,
			   this, SLOT(save()), fileTools, "save file" );

    printIcon = QPixmap( fileprint );
    QToolButton * filePrint
	= new QToolButton( printIcon, tr("Print File"), QString::null,
			   this, SLOT(print()), fileTools, "print file" );


    (void)QWhatsThis::whatsThisButton( fileTools );

    QString fileOpenText = tr("<p><img source=\"fileopen\"> "
	         "Click this button to open a <em>new file</em>. <br>"
                 "You can also select the <b>Open</b> command "
                 "from the <b>File</b> menu.</p>");

    QWhatsThis::add( fileOpen, fileOpenText );

    QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );

    QString fileSaveText = tr("<p>Click this button to save the file you "
                 "are editing. You will be prompted for a file name.\n"
                 "You can also select the <b>Save</b> command "
                 "from the <b>File</b> menu.</p>");

    QWhatsThis::add( fileSave, fileSaveText );

    QString filePrintText = tr("Click this button to print the file you "
                 "are editing.\n You can also select the Print "
                 "command from the File menu.");

    QWhatsThis::add( filePrint, filePrintText );


    QPopupMenu * file = new QPopupMenu( this );
    menuBar()->insertItem( tr("&File"), file );


    file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N );

    int id;
    id = file->insertItem( openIcon, tr("&Open..."),
			   this, SLOT(choose()), CTRL+Key_O );
    file->setWhatsThis( id, fileOpenText );

    id = file->insertItem( saveIcon, tr("&Save"),
			   this, SLOT(save()), CTRL+Key_S );
    file->setWhatsThis( id, fileSaveText );

    id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) );
    file->setWhatsThis( id, fileSaveText );

    file->insertSeparator();

    id = file->insertItem( printIcon, tr("&Print..."),
			   this, SLOT(print()), CTRL+Key_P );
    file->setWhatsThis( id, filePrintText );

    file->insertSeparator();

    file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W );

    file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

    menuBar()->insertSeparator();

    QPopupMenu * help = new QPopupMenu( this );
    menuBar()->insertItem( tr("&Help"), help );

    help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 );
    help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) );
    help->insertSeparator();
    help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 );

    e = new QTextEdit( this, "editor" );
    e->setFocus();
    setCentralWidget( e );
    statusBar()->message( tr("Ready"), 2000 );

    resize( 450, 600 );
}
Example #29
0
MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, nullptr)
{
	setWindowTitle("Debug: Memory View");

	if (parent != nullptr)
	{
		QPoint parentPos = parent->pos();
		setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
	}

	//
	// The main frame and its input and log widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The top frame & groupbox that contains the input widgets
	QFrame* topSubFrame = new QFrame(mainWindowFrame);

	// The input edit
	m_inputEdit = new QLineEdit(topSubFrame);
	connect(m_inputEdit, &QLineEdit::returnPressed, this, &MemoryWindow::expressionSubmitted);

	// The memory space combo box
	m_memoryComboBox = new QComboBox(topSubFrame);
	m_memoryComboBox->setObjectName("memoryregion");
	m_memoryComboBox->setMinimumWidth(300);
	connect(m_memoryComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MemoryWindow::memoryRegionChanged);

	// The main memory window
	m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this);

	// Layout
	QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
	subLayout->addWidget(m_inputEdit);
	subLayout->addWidget(m_memoryComboBox);
	subLayout->setSpacing(3);
	subLayout->setContentsMargins(2,2,2,2);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(2,2,2,2);
	vLayout->addWidget(topSubFrame);
	vLayout->addWidget(m_memTable);

	setCentralWidget(mainWindowFrame);

	//
	// Menu bars
	//

	// Create a data format group
	QActionGroup* dataFormat = new QActionGroup(this);
	dataFormat->setObjectName("dataformat");
	QAction* formatActOne  = new QAction("1-byte chunks", this);
	QAction* formatActTwo  = new QAction("2-byte chunks", this);
	QAction* formatActFour = new QAction("4-byte chunks", this);
	QAction* formatActEight = new QAction("8-byte chunks", this);
	QAction* formatAct32bitFloat = new QAction("32 bit floating point", this);
	QAction* formatAct64bitFloat = new QAction("64 bit floating point", this);
	QAction* formatAct80bitFloat = new QAction("80 bit floating point", this);
	formatActOne->setObjectName("formatActOne");
	formatActTwo->setObjectName("formatActTwo");
	formatActFour->setObjectName("formatActFour");
	formatActEight->setObjectName("formatActEight");
	formatAct32bitFloat->setObjectName("formatAct32bitFloat");
	formatAct64bitFloat->setObjectName("formatAct64bitFloat");
	formatAct80bitFloat->setObjectName("formatAct80bitFloat");
	formatActOne->setCheckable(true);
	formatActTwo->setCheckable(true);
	formatActFour->setCheckable(true);
	formatActEight->setCheckable(true);
	formatAct32bitFloat->setCheckable(true);
	formatAct64bitFloat->setCheckable(true);
	formatAct80bitFloat->setCheckable(true);
	formatActOne->setActionGroup(dataFormat);
	formatActTwo->setActionGroup(dataFormat);
	formatActFour->setActionGroup(dataFormat);
	formatActEight->setActionGroup(dataFormat);
	formatAct32bitFloat->setActionGroup(dataFormat);
	formatAct64bitFloat->setActionGroup(dataFormat);
	formatAct80bitFloat->setActionGroup(dataFormat);
	formatActOne->setShortcut(QKeySequence("Ctrl+1"));
	formatActTwo->setShortcut(QKeySequence("Ctrl+2"));
	formatActFour->setShortcut(QKeySequence("Ctrl+4"));
	formatActEight->setShortcut(QKeySequence("Ctrl+8"));
	formatAct32bitFloat->setShortcut(QKeySequence("Ctrl+9"));
	formatActOne->setChecked(true);
	connect(dataFormat, &QActionGroup::triggered, this, &MemoryWindow::formatChanged);
	// Create a address display group
	QActionGroup* addressGroup = new QActionGroup(this);
	addressGroup->setObjectName("addressgroup");
	QAction* addressActLogical = new QAction("Logical Addresses", this);
	QAction* addressActPhysical = new QAction("Physical Addresses", this);
	addressActLogical->setCheckable(true);
	addressActPhysical->setCheckable(true);
	addressActLogical->setActionGroup(addressGroup);
	addressActPhysical->setActionGroup(addressGroup);
	addressActLogical->setShortcut(QKeySequence("Ctrl+G"));
	addressActPhysical->setShortcut(QKeySequence("Ctrl+Y"));
	addressActLogical->setChecked(true);
	connect(addressGroup, &QActionGroup::triggered, this, &MemoryWindow::addressChanged);

	// Create a reverse view radio
	QAction* reverseAct = new QAction("Reverse View", this);
	reverseAct->setObjectName("reverse");
	reverseAct->setCheckable(true);
	reverseAct->setShortcut(QKeySequence("Ctrl+R"));
	connect(reverseAct, &QAction::toggled, this, &MemoryWindow::reverseChanged);

	// Create increase and decrease bytes-per-line actions
	QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this);
	QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this);
	increaseBplAct->setShortcut(QKeySequence("Ctrl+P"));
	decreaseBplAct->setShortcut(QKeySequence("Ctrl+O"));
	connect(increaseBplAct, &QAction::triggered, this, &MemoryWindow::increaseBytesPerLine);
	connect(decreaseBplAct, &QAction::triggered, this, &MemoryWindow::decreaseBytesPerLine);

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addActions(dataFormat->actions());
	optionsMenu->addSeparator();
	optionsMenu->addActions(addressGroup->actions());
	optionsMenu->addSeparator();
	optionsMenu->addAction(reverseAct);
	optionsMenu->addSeparator();
	optionsMenu->addAction(increaseBplAct);
	optionsMenu->addAction(decreaseBplAct);


	//
	// Initialize
	//
	populateComboBox();

	// Set to the current CPU's memory view
	setToCurrentCpu();
}
Example #30
-1
Collection::Collection() :
  _current_library(0),
  _stdout(stdout)
{

  actionGroup = new QActionGroup(this);

  statusBar();

  QWidget::setWindowTitle( "Qt Papers" );

  QMenu* fileMenu = new QMenu("&File", this);    

  libraryOpen = addChoice("libraryOpen", "Open Library");
  libraryOpen->setStatusTip("Open a library");
  libraryOpen->setEnabled(true);
  libraryOpen->setIcon(QIcon(":/images/libopen.png"));
  connect(libraryOpen, SIGNAL(triggered()), this, SLOT(open_library()));
  fileMenu->addAction(libraryOpen);

  libraryNew = addChoice("libraryNew", "New Library");
  libraryNew->setStatusTip("Create a new library");
  libraryNew->setEnabled(true);
  libraryNew->setIcon(QIcon(":/images/document2.png"));
  connect(libraryNew, SIGNAL(triggered()), this, SLOT(new_library()));
  fileMenu->addAction(libraryNew);


  librarySave = addChoice("librarySave", "Save Library");
  librarySave->setStatusTip("Save the library");
  librarySave->setEnabled(true);
  librarySave->setIcon(QIcon(":/images/save.png"));
  connect(librarySave, SIGNAL(triggered()), this, SLOT(save_library()));
  fileMenu->addAction(librarySave);

  libraryDelete = addChoice("libraryDelete", "Delete Library");
  libraryDelete->setStatusTip("Delete library");
  libraryDelete->setEnabled(true);
  libraryDelete->setIcon(QIcon(":/images/libremove.png"));
  connect(libraryDelete, SIGNAL(triggered()), this, SLOT(delete_library()));
  fileMenu->addAction(libraryDelete);

  libraryImport = addChoice("libraryImport", "Import Library");
  libraryImport->setStatusTip("Import library");
  libraryImport->setEnabled(true);
  libraryImport->setIcon(QIcon(":/images/import.png"));
  connect(libraryImport, SIGNAL(triggered()), this, SLOT(scan_directory_and_import_papers()));

  fileMenu->addAction(libraryImport);

  preferences = addChoice("preferences", "Preferences");
  preferences->setStatusTip("Preferences");
  preferences->setEnabled(true);
  preferences->setIcon(QIcon(":/images/pref.png"));
  connect(preferences, SIGNAL(triggered()), this, SLOT(modify_preferences()));
  fileMenu->addAction(preferences);
  
  exit = addChoice("exit", "Exit");
  exit->setStatusTip("Exit");
  exit->setEnabled(true);
  exit->setIcon(QIcon(":/images/exit.png"));
  connect(exit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
  fileMenu->addAction(exit);

  QMenu* paperMenu = new QMenu("&Paper", this);    
  paperImport = addChoice("paperImport", "Import Paper");
  paperImport->setStatusTip("Import a paper");
  paperImport->setEnabled(false);
  paperImport->setIcon(QIcon(":/images/import.png"));

  paperScanDirectory = addChoice("paperScanDirectory", "Paper Scan");
  paperScanDirectory->setIcon(QIcon(":/images/scan.png"));
  paperScanDirectory->setStatusTip("Scan for papers.");
  paperScanDirectory->setEnabled(true);

  talkImport = addChoice("talkImport", "Import Talk");
  talkImport->setStatusTip("Import a talk");
  talkImport->setEnabled(false);

  paperNew = addChoice("paperNew", "New Paper");
  paperNew->setStatusTip("New paper");
  paperNew->setEnabled(true);
  paperNew->setIcon(QIcon(":/images/new.png"));

  paperDelete = addChoice("paperDelete", "Delete Paper");
  paperDelete->setStatusTip("Delete paper");
  paperDelete->setIcon(QIcon(":/images/remove.png"));
  paperDelete->setEnabled(false);

  paperEdit = addChoice("paperEdit", "Edit Paper");
  paperEdit->setStatusTip("Edit paper");
  paperEdit->setEnabled(false);
  paperEdit->setIcon(QIcon(":/images/edit.png"));

  paperOpen = addChoice("paperOpen", "Open Paper");
  paperOpen->setStatusTip("Open paper");
  paperOpen->setEnabled(false);
  paperOpen->setIcon(QIcon(":/images/open.png"));

  talkNew = addChoice("talkNew", "New Talk");
  talkNew->setStatusTip("New talk");
  talkNew->setEnabled(false);

  connect(paperNew, SIGNAL(triggered()), this, SLOT(new_paper()));
  connect(paperEdit, SIGNAL(triggered()), this, SLOT(edit_paper()));
  connect(paperDelete, SIGNAL(triggered()), this, SLOT(delete_paper()));
  connect(paperOpen, SIGNAL(triggered()), this, SLOT(open_paper()));
  connect(paperImport, SIGNAL(triggered()), this, SLOT(import_paper()));
  // need to implement this

  paperMenu->addAction(paperNew);
  paperMenu->addAction(paperImport);
  paperMenu->addAction(paperEdit);
  paperMenu->addAction(paperDelete);
  paperMenu->addAction(paperOpen);
  paperMenu->addAction(paperScanDirectory);
  paperMenu->addAction(talkNew);
  paperMenu->addAction(talkImport);




  QMenu* helpMenu = new QMenu("&Help", this);    
  showAbout = addChoice("showAbout","About");
  showAbout->setStatusTip("About");
  showAbout->setEnabled(true);
  showAbout->setIcon(QIcon(":/images/about.png"));
  connect(showAbout, SIGNAL(triggered()), this, SLOT(about()));
  helpMenu->addAction(showAbout);

  //Add a menu bar
  menuBar()->addMenu(fileMenu);
  menuBar()->addMenu(paperMenu);
  menuBar()->addMenu(helpMenu);

  //button to trigger find box
  paperFind = new QAction("Find Paper",this);
  paperFind->setStatusTip("Find paper");
  paperFind->setEnabled(true);
  paperFind->setIcon(QIcon(":/images/find.png"));
  connect(paperFind, SIGNAL(triggered()), this, SLOT(find_paper()));

  //add a tool bar
  QPushButton * find_clear = new QPushButton();
  find_clear->setStatusTip("Find paper");
  find_clear->setEnabled(true);
  find_clear->setIcon(QIcon(":/images/clear.png"));
  connect(find_clear, SIGNAL(clicked()), this, SLOT(reset_find()));

  QLabel * find = new QLabel();
  find->setText("Find: ");
  find->setLayoutDirection(Qt::LeftToRight);
  QLabel * in = new QLabel();
  in->setText(" in ");
  _find_edit = new QLineEdit;
  _find_edit->setFixedSize(_find_edit->sizeHint());
  _find_edit->setLayoutDirection(Qt::LeftToRight);
  connect(_find_edit, SIGNAL(returnPressed()), this, SLOT(find_paper()));

  _find_type = new QComboBox();
  QStringList find_names;
  find_names << "Author" << "Title" << "Abstract" << "Any";
  _find_type->insertItems(0,find_names);
  _find_type->setLayoutDirection(Qt::LeftToRight);
  find->setBuddy(_find_edit);
  paperToolBar = addToolBar(tr("Paper"));
  paperToolBar->setLayoutDirection(Qt::RightToLeft);
  paperToolBar->addAction(paperFind);
  paperToolBar->addWidget(_find_type);
  paperToolBar->addWidget(in);
  paperToolBar->addWidget(find_clear);
  paperToolBar->addWidget(_find_edit);
  paperToolBar->addWidget(find);
  paperToolBar->addAction(paperDelete);
  paperToolBar->addAction(paperEdit);
  paperToolBar->addAction(paperNew);
  paperToolBar->addAction(paperOpen);
  paperToolBar->addAction(paperImport);
  paperToolBar->addAction(paperScanDirectory);

  _rss_box = new RssWidget;
  connect(_rss_box, SIGNAL(urlChanged(const QUrl& )), 
	  this, SLOT(check_url(const QUrl& )));

  QAction * rssForward  = new QAction("rssForward",this);
  rssForward->setStatusTip("Forward");
  rssForward->setEnabled(true);
  rssForward->setIcon(QIcon(":/images/forward.png"));
  connect(rssForward, SIGNAL(triggered()), _rss_box, SLOT(forward()));
  paperToolBar->addAction(rssForward);

  QAction * rssBack  = new QAction("rssBack",this);
  rssBack->setStatusTip("Back");
  rssBack->setEnabled(true);
  rssBack->setIcon(QIcon(":/images/back.png"));
  connect(rssBack, SIGNAL(triggered()), _rss_box, SLOT(back()));
  paperToolBar->addAction(rssBack);

  //Set up a central widget that will have a layout in it

  _library_list = new LibraryList(this,this);
  QFont font;
  font.setBold(true);
  font.setCapitalization(QFont::SmallCaps);
  _library_list->setFont(font);
  connect(_library_list, SIGNAL(itemClicked( QListWidgetItem *)), this, SLOT(select_library(QListWidgetItem *)));
  
  
  _abstract_box = new QTextBrowser();
  _abstract_box->setAlignment(Qt::AlignJustify);
  _abstract_box->setFontWeight(QFont::DemiBold);
  _abstract_box->setPlainText("No Paper Selected");
  _paper_list = new PaperList(this,this);

  QStringList sl;
  // The following seems like a non-intuitive operator
  // overload but that is how they do it...
  sl << "Author" << "Title" << "Date";
  _paper_list->setColumnCount(3);
  _paper_list->setHorizontalHeaderLabels(sl);
  _paper_list->setAlternatingRowColors(true);
  _paper_list->horizontalHeader()->setStretchLastSection(true);
  _paper_list->verticalHeader()->hide();
  //  _paper_list->setSortingEnabled(true);
  //need to make the paper_list its own class for drag and drop
  //  _paper_list->setAcceptDrops(true);

  connect(_paper_list, SIGNAL(cellClicked(int , int )), 
	  this, SLOT(select_paper(int, int)));
  //  update_paper_list();
  

  _top_layout = new QSplitter();  
  _top_layout->addWidget(_library_list);
  _top_layout->addWidget(_paper_list);
  _top_layout->setStretchFactor(0,1);
  _top_layout->setStretchFactor(1,3);
  _top_layout->setContentsMargins(0,0,5,0);
  _top_layout->setOrientation(Qt::Horizontal);

  _bot_layout = new QSplitter();  
  _bot_layout->addWidget(_abstract_box);
  _bot_layout->addWidget(_rss_box);
  _bot_layout->setContentsMargins(0,0,0,0);
  _bot_layout->setStretchFactor(0,1);
  _bot_layout->setStretchFactor(1,3);
  _bot_layout->setOrientation(Qt::Horizontal);

  _total_layout = new QSplitter();
  _total_layout->addWidget(_top_layout);
  _total_layout->addWidget(_bot_layout);
  _total_layout->setStretchFactor(0,1);
  _total_layout->setStretchFactor(1,3);
  _total_layout->setOrientation(Qt::Vertical);

  //this splitter window is my central widget
  setCentralWidget(_total_layout);


  QPalette  palette;
  palette.setColor(QPalette::Background,Qt::white);
  centralWidget()->setPalette(palette);
  centralWidget()->setAutoFillBackground(true);
  centralWidget()->setWindowOpacity(0.8);
  centralWidget()->setMinimumSize(300, 200);
  setMinimumSize(700, 500);

  readSettings();
}