/** Constructor */ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) : RWindow("MainWindow", parent, flags), ui(new Ui::MainWindow) { /* Invoke the Qt Designer generated QObject setup routine */ ui->setupUi(this); _instance = this; m_bStatusLoadDone = false; isIdle = false; onlineCount = 0; notifyMenu = NULL; /* Calculate only once */ RsPeerDetails pd; if (rsPeers->getPeerDetails(rsPeers->getOwnId(), pd)) { nameAndLocation = QString("%1 (%2)").arg(QString::fromUtf8(pd.name.c_str())).arg(QString::fromUtf8(pd.location.c_str())); } setWindowTitle(tr("RetroShare %1 a secure decentralized communication platform").arg(retroshareVersion()) + " - " + nameAndLocation); /* WORK OUT IF WE"RE IN ADVANCED MODE OR NOT */ bool advancedMode = false; std::string advsetting; if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES")) { advancedMode = true; } /* add url handler for RetroShare links */ QDesktopServices::setUrlHandler(RSLINK_SCHEME, this, "retroshareLinkActivated"); QDesktopServices::setUrlHandler("http", this, "externalLinkActivated"); QDesktopServices::setUrlHandler("https", this, "externalLinkActivated"); // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); /* Create all the dialogs of which we only want one instance */ _bandwidthGraph = new BandwidthGraph(); #ifdef UNFINISHED applicationWindow = new ApplicationWindow(); applicationWindow->hide(); #endif /** Left Side ToolBar**/ connect(ui->actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) ); connect(ui->actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) ); connect(ui->actionOptions, SIGNAL(triggered()), this, SLOT( showSettings()) ); connect(ui->actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) ); ui->actionMessenger->setVisible(true); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) ); //connect(ui->actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) ); /** adjusted quit behaviour: trigger a warning that can be switched off in the saved config file RetroShare.conf */ connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(doQuit())); QList<QPair<MainPage*, QAction*> > notify; /* Create the Main pages and actions */ QActionGroup *grp = new QActionGroup(this); QAction *action; ui->stackPages->add(newsFeed = new NewsFeed(ui->stackPages), createPageAction(QIcon(IMAGE_NEWSFEED), tr("News feed"), grp)); // ui->stackPages->add(networkDialog = new NetworkDialog(ui->stackPages), // createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp)); ui->stackPages->add(friendsDialog = new FriendsDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_PEERS), tr("Friends"), grp)); notify.push_back(QPair<MainPage*, QAction*>(friendsDialog, action)); // ui->stackPages->add(searchDialog = new SearchDialog(ui->stackPages), // createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp)); ui->stackPages->add(transfersDialog = new TransfersDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_TRANSFERS), tr("File sharing"), grp)); notify.push_back(QPair<MainPage*, QAction*>(transfersDialog, action)); ui->stackPages->add(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages), action = createPageAction(QIcon(IMAGE_CHATLOBBY), tr("Chat Lobbies"), grp)); notify.push_back(QPair<MainPage*, QAction*>(chatLobbyDialog, action)); ui->stackPages->add(messagesDialog = new MessagesDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); notify.push_back(QPair<MainPage*, QAction*>(messagesDialog, action)); ui->stackPages->add(channelFeed = new ChannelFeed(ui->stackPages), action = createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp)); notify.push_back(QPair<MainPage*, QAction*>(channelFeed, action)); #ifdef BLOGS ui->stackPages->add(blogsFeed = new BlogsDialog(ui->stackPages), createPageAction(QIcon(IMAGE_BLOGS), tr("Blogs"), grp)); #endif ui->stackPages->add(forumsDialog = new ForumsDialog(ui->stackPages), action = createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); notify.push_back(QPair<MainPage*, QAction*>(forumsDialog, action)); std::cerr << "Looking for interfaces in existing plugins:" << std::endl; for(int i = 0;i<rsPlugins->nbPlugins();++i) { QIcon icon ; if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_page() != NULL) { if(rsPlugins->plugin(i)->qt_icon() != NULL) icon = *rsPlugins->plugin(i)->qt_icon() ; else icon = QIcon(":images/extension_48.png") ; std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl; MainPage *pluginPage = rsPlugins->plugin(i)->qt_page(); QAction *pluginAction = createPageAction(icon, QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()), grp); ui->stackPages->add(pluginPage, pluginAction); notify.push_back(QPair<MainPage*, QAction*>(pluginPage, pluginAction)); } else if(rsPlugins->plugin(i) == NULL) std::cerr << " No plugin object !" << std::endl; else std::cerr << " No plugin page !" << std::endl; } #ifndef RS_RELEASE_VERSION #ifdef PLUGINMGR ui->stackPages->add(pluginsPage = new PluginsPage(ui->stackPages), createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp)); #endif #endif #ifdef GETSTARTED_GUI MainPage *getStartedPage = NULL; if (!advancedMode) { ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages), createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp)); } #endif /* Create the toolbar */ ui->toolBar->addActions(grp->actions()); connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *))); #ifdef UNFINISHED ui->toolBar->addSeparator(); addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), SLOT(showApplWindow())); #endif ui->stackPages->setCurrentIndex(Settings->getLastPageInMainWindow()); /** StatusBar section ********/ /* initialize combobox in status bar */ statusComboBox = new QComboBox(statusBar()); statusComboBox->setFocusPolicy(Qt::ClickFocus); initializeStatusObject(statusComboBox, true); QWidget *widget = new QWidget(); QHBoxLayout *hbox = new QHBoxLayout(); hbox->setMargin(0); hbox->setSpacing(6); hbox->addWidget(statusComboBox); widget->setLayout(hbox); statusBar()->addWidget(widget); peerstatus = new PeerStatus(); statusBar()->addWidget(peerstatus); natstatus = new NATStatus(); statusBar()->addWidget(natstatus); dhtstatus = new DHTStatus(); statusBar()->addWidget(dhtstatus); hashingstatus = new HashingStatus(); statusBar()->addPermanentWidget(hashingstatus); discstatus = new DiscStatus(); statusBar()->addPermanentWidget(discstatus); ratesstatus = new RatesStatus(); statusBar()->addPermanentWidget(ratesstatus); statusBar()->addPermanentWidget(new OpModeStatus()); statusBar()->addPermanentWidget(new SoundStatus()); /** Status Bar end ******/ /* Creates a tray icon with a context menu and adds it to the system's * notification area. */ createTrayIcon(); QList<QPair<MainPage*, QAction*> >::iterator notifyIt; for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) { UserNotify *userNotify = notifyIt->first->getUserNotify(this); if (userNotify) { userNotify->initialize(ui->toolBar, notifyIt->second); connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine())); userNotifyList.push_back(userNotify); } } createNotifyIcons(); /* caclulate friend count */ updateFriends(); connect(NotifyQt::getInstance(), SIGNAL(peerStatusChanged(QString,int)), this, SLOT(updateFriends())); connect(NotifyQt::getInstance(), SIGNAL(friendsChanged()), this, SLOT(updateFriends())); loadOwnStatus(); /* Set focus to the current page */ ui->stackPages->currentWidget()->setFocus(); idle = new Idle(); idle->start(); connect(idle, SIGNAL(secondsIdle(int)), this, SLOT(checkAndSetIdle(int))); QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); timer->start(1000); }
FormEditorWidget::FormEditorWidget(FormEditorView *view) : QWidget(), m_formEditorView(view) { setStyleSheet(QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/formeditorstylesheet.css"))); QVBoxLayout *fillLayout = new QVBoxLayout(this); fillLayout->setMargin(0); fillLayout->setSpacing(0); setLayout(fillLayout); QList<QAction*> upperActions; m_toolActionGroup = new QActionGroup(this); m_transformToolAction = m_toolActionGroup->addAction("Transform Tool (Press Key Q)"); m_transformToolAction->setShortcut(Qt::Key_Q); m_transformToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_transformToolAction->setCheckable(true); m_transformToolAction->setChecked(true); m_transformToolAction->setIcon(QPixmap(":/icon/tool/transform.png")); connect(m_transformToolAction.data(), SIGNAL(triggered(bool)), SLOT(changeTransformTool(bool))); m_anchorToolAction = m_toolActionGroup->addAction("Anchor Tool (Press Key W)"); m_anchorToolAction->setShortcut(Qt::Key_W); m_anchorToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_anchorToolAction->setCheckable(true); m_anchorToolAction->setIcon(QPixmap(":/icon/tool/anchor.png")); connect(m_anchorToolAction.data(), SIGNAL(triggered(bool)), SLOT(changeAnchorTool(bool))); // addActions(m_toolActionGroup->actions()); // upperActions.append(m_toolActionGroup->actions()); QActionGroup *layoutActionGroup = new QActionGroup(this); layoutActionGroup->setExclusive(false); m_snappingAction = layoutActionGroup->addAction(tr("Snap to guides (E)")); m_snappingAction->setShortcut(Qt::Key_E); m_snappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_snappingAction->setCheckable(true); m_snappingAction->setChecked(true); m_snappingAction->setIcon(QPixmap(":/icon/layout/snapping.png")); m_snappingAndAnchoringAction = layoutActionGroup->addAction("Toogle Snapping And Anchoring (Press Key R)"); m_snappingAndAnchoringAction->setShortcut(Qt::Key_R); m_snappingAndAnchoringAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_snappingAndAnchoringAction->setCheckable(true); m_snappingAndAnchoringAction->setChecked(false); m_snappingAndAnchoringAction->setEnabled(false); m_snappingAndAnchoringAction->setVisible(false); m_snappingAndAnchoringAction->setIcon(QPixmap(":/icon/layout/snapping_and_anchoring.png")); addActions(layoutActionGroup->actions()); upperActions.append(layoutActionGroup->actions()); QAction *separatorAction = new QAction(this); separatorAction->setSeparator(true); addAction(separatorAction); upperActions.append(separatorAction); m_showBoundingRectAction = new QAction(tr("Show bounding rectangles and stripes for empty items (Press Key A)"), this); m_showBoundingRectAction->setShortcut(Qt::Key_A); m_showBoundingRectAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_showBoundingRectAction->setCheckable(true); m_showBoundingRectAction->setChecked(true); m_showBoundingRectAction->setIcon(QPixmap(":/icon/layout/boundingrect.png")); addAction(m_showBoundingRectAction.data()); upperActions.append(m_showBoundingRectAction.data()); m_selectOnlyContentItemsAction = new QAction(tr("Only select items with content (S)"), this); m_selectOnlyContentItemsAction->setShortcut(Qt::Key_S); m_selectOnlyContentItemsAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_selectOnlyContentItemsAction->setCheckable(true); m_selectOnlyContentItemsAction->setChecked(false); m_selectOnlyContentItemsAction->setIcon(QPixmap(":/icon/selection/selectonlycontentitems.png")); addAction(m_selectOnlyContentItemsAction.data()); upperActions.append(m_selectOnlyContentItemsAction.data()); m_rootWidthAction = new LineEditAction("width", this); connect(m_rootWidthAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemWidth(QString))); addAction(m_rootWidthAction.data()); upperActions.append(m_rootWidthAction.data()); m_rootHeightAction = new LineEditAction("height", this); connect(m_rootHeightAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemHeight(QString))); addAction(m_rootHeightAction.data()); upperActions.append(m_rootHeightAction.data()); m_snappingAndAnchoringAction = layoutActionGroup->addAction("Toogle Snapping And Anchoring (Press Key R)"); m_toolBox = new ToolBox(this); fillLayout->addWidget(m_toolBox.data()); m_toolBox->setLeftSideActions(upperActions); m_graphicsView = new FormEditorGraphicsView(this); fillLayout->addWidget(m_graphicsView.data()); m_graphicsView.data()->setStyleSheet( QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css"))); QList<QAction*> lowerActions; m_zoomAction = new ZoomAction(m_toolActionGroup.data()); connect(m_zoomAction.data(), SIGNAL(zoomLevelChanged(double)), SLOT(setZoomLevel(double))); addAction(m_zoomAction.data()); upperActions.append(m_zoomAction.data()); m_toolBox->addRightSideAction(m_zoomAction.data()); m_resetAction = new QAction(tr("Reset view (R)"), this); m_resetAction->setShortcut(Qt::Key_R); m_resetAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_resetAction->setIcon(QPixmap(":/icon/reset.png")); connect(m_resetAction.data(), SIGNAL(triggered(bool)), this, SLOT(resetNodeInstanceView())); addAction(m_resetAction.data()); upperActions.append(m_resetAction.data()); m_toolBox->addRightSideAction(m_resetAction.data()); }
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : WindowQt(machine, nullptr) { setWindowTitle("Debug: Disassembly 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, &DasmWindow::expressionSubmitted); // The cpu combo box m_cpuComboBox = new QComboBox(topSubFrame); m_cpuComboBox->setObjectName("cpu"); m_cpuComboBox->setMinimumWidth(300); connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged); // The main disasm window m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this); connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated); // Force a recompute of the disassembly region downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc"); // Populate the combo box & set the proper cpu populateComboBox(); //const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu); //gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source)); //mem->views[0]->view->set_source(*source); // Layout QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame); subLayout->addWidget(m_inputEdit); subLayout->addWidget(m_cpuComboBox); 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_dasmView); setCentralWidget(mainWindowFrame); // // Menu bars // // Create three commands m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this); m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this); m_runToCursorAct = new QAction("Run to Cursor", this); m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); connect(m_breakpointToggleAct, &QAction::triggered, this, &DasmWindow::toggleBreakpointAtCursor); connect(m_breakpointEnableAct, &QAction::triggered, this, &DasmWindow::enableBreakpointAtCursor); connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::runToCursor); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); rightBarGroup->setObjectName("rightbargroup"); QAction* rightActRaw = new QAction("Raw Opcodes", this); QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this); QAction* rightActComments = new QAction("Comments", this); rightActRaw->setCheckable(true); rightActEncrypted->setCheckable(true); rightActComments->setCheckable(true); rightActRaw->setActionGroup(rightBarGroup); rightActEncrypted->setActionGroup(rightBarGroup); rightActComments->setActionGroup(rightBarGroup); rightActRaw->setShortcut(QKeySequence("Ctrl+R")); rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+N")); rightActRaw->setChecked(true); connect(rightBarGroup, &QActionGroup::triggered, this, &DasmWindow::rightBarChanged); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); optionsMenu->addAction(m_breakpointToggleAct); optionsMenu->addAction(m_breakpointEnableAct); optionsMenu->addAction(m_runToCursorAct); optionsMenu->addSeparator(); optionsMenu->addActions(rightBarGroup->actions()); }
TextTools::TextTools(QWidget* parent) : QDockWidget(parent) { _textElement = 0; setObjectName("text-tools"); setWindowTitle(tr("Text Tools")); setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea)); QToolBar* tb = new QToolBar(tr("Text Edit")); tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight)); textStyles = new QComboBox; tb->addWidget(textStyles); showKeyboard = getAction("show-keys"); showKeyboard->setCheckable(true); tb->addAction(showKeyboard); typefaceBold = tb->addAction(*icons[textBold_ICON], ""); typefaceBold->setToolTip(tr("bold")); typefaceBold->setCheckable(true); typefaceItalic = tb->addAction(*icons[textItalic_ICON], ""); typefaceItalic->setToolTip(tr("italic")); typefaceItalic->setCheckable(true); typefaceUnderline = tb->addAction(*icons[textUnderline_ICON], ""); typefaceUnderline->setToolTip(tr("underline")); typefaceUnderline->setCheckable(true); tb->addSeparator(); QActionGroup* ha = new QActionGroup(tb); leftAlign = new QAction(*icons[textLeft_ICON], "", ha); leftAlign->setToolTip(tr("align left")); leftAlign->setCheckable(true); leftAlign->setData(ALIGN_LEFT); hcenterAlign = new QAction(*icons[textCenter_ICON], "", ha); hcenterAlign->setToolTip(tr("align horizontal center")); hcenterAlign->setCheckable(true); hcenterAlign->setData(ALIGN_HCENTER); rightAlign = new QAction(*icons[textRight_ICON], "", ha); rightAlign->setToolTip(tr("align right")); rightAlign->setCheckable(true); rightAlign->setData(ALIGN_RIGHT); tb->addActions(ha->actions()); QActionGroup* va = new QActionGroup(tb); topAlign = new QAction(*icons[textTop_ICON], "", va); topAlign->setToolTip(tr("align top")); topAlign->setCheckable(true); topAlign->setData(ALIGN_TOP); bottomAlign = new QAction(*icons[textBottom_ICON], "", va); bottomAlign->setToolTip(tr("align bottom")); bottomAlign->setCheckable(true); bottomAlign->setData(ALIGN_BOTTOM); baselineAlign = new QAction(*icons[textBaseline_ICON], "", va); baselineAlign->setToolTip(tr("align vertical baseline")); baselineAlign->setCheckable(true); baselineAlign->setData(ALIGN_BASELINE); vcenterAlign = new QAction(*icons[textVCenter_ICON], "", va); vcenterAlign->setToolTip(tr("align vertical center")); vcenterAlign->setCheckable(true); vcenterAlign->setData(ALIGN_VCENTER); tb->addActions(va->actions()); typefaceSubscript = tb->addAction(*icons[textSub_ICON], ""); typefaceSubscript->setToolTip(tr("subscript")); typefaceSubscript->setCheckable(true); typefaceSuperscript = tb->addAction(*icons[textSuper_ICON], ""); typefaceSuperscript->setToolTip(tr("superscript")); typefaceSuperscript->setCheckable(true); // unorderedList = tb->addAction(*icons[formatListUnordered_ICON], ""); // unorderedList->setToolTip(tr("unordered list")); // orderedList = tb->addAction(*icons[formatListOrdered_ICON], ""); // orderedList->setToolTip(tr("ordered list")); // indentMore = tb->addAction(*icons[formatIndentMore_ICON], ""); // indentMore->setToolTip(tr("indent more")); // indentLess = tb->addAction(*icons[formatIndentLess_ICON], ""); // indentLess->setToolTip(tr("indent less")); tb->addSeparator(); typefaceFamily = new QFontComboBox(this); tb->addWidget(typefaceFamily); typefaceSize = new QDoubleSpinBox(this); typefaceSize->setFocusPolicy(Qt::ClickFocus); tb->addWidget(typefaceSize); setWidget(tb); QWidget* w = new QWidget(this); setTitleBarWidget(w); titleBarWidget()->hide(); connect(typefaceSize, SIGNAL(valueChanged(double)), SLOT(sizeChanged(double))); connect(typefaceFamily, SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&))); connect(typefaceBold, SIGNAL(triggered(bool)), SLOT(boldClicked(bool))); connect(typefaceItalic, SIGNAL(triggered(bool)), SLOT(italicClicked(bool))); connect(typefaceUnderline, SIGNAL(triggered(bool)), SLOT(underlineClicked(bool))); connect(typefaceSubscript, SIGNAL(triggered(bool)), SLOT(subscriptClicked(bool))); connect(typefaceSuperscript, SIGNAL(triggered(bool)), SLOT(superscriptClicked(bool))); connect(typefaceFamily, SIGNAL(currentFontChanged(const QFont&)), SLOT(fontChanged(const QFont&))); connect(ha, SIGNAL(triggered(QAction*)), SLOT(setHalign(QAction*))); connect(va, SIGNAL(triggered(QAction*)), SLOT(setValign(QAction*))); connect(showKeyboard, SIGNAL(triggered(bool)), SLOT(showKeyboardClicked(bool))); connect(textStyles, SIGNAL(currentIndexChanged(int)), SLOT(styleChanged(int))); // connect(unorderedList, SIGNAL(triggered()), SLOT(unorderedListClicked())); // connect(orderedList, SIGNAL(triggered()), SLOT(orderedListClicked())); // connect(indentLess, SIGNAL(triggered()), SLOT(indentLessClicked())); // connect(indentMore, SIGNAL(triggered()), SLOT(indentMoreClicked())); }
MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) : WindowQt(machine, NULL) { setWindowTitle("Debug: Memory View"); if (parent != NULL) { 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, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted())); // The memory space combo box m_memoryComboBox = new QComboBox(topSubFrame); m_memoryComboBox->setObjectName("memoryregion"); m_memoryComboBox->setMinimumWidth(300); connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int))); // 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 byte-chunk group QActionGroup* chunkGroup = new QActionGroup(this); chunkGroup->setObjectName("chunkgroup"); QAction* chunkActOne = new QAction("1-byte chunks", this); chunkActOne->setObjectName("chunkActOne"); QAction* chunkActTwo = new QAction("2-byte chunks", this); chunkActTwo->setObjectName("chunkActTwo"); QAction* chunkActFour = new QAction("4-byte chunks", this); chunkActFour->setObjectName("chunkActFour"); chunkActOne->setCheckable(true); chunkActTwo->setCheckable(true); chunkActFour->setCheckable(true); chunkActOne->setActionGroup(chunkGroup); chunkActTwo->setActionGroup(chunkGroup); chunkActFour->setActionGroup(chunkGroup); chunkActOne->setShortcut(QKeySequence("Ctrl+1")); chunkActTwo->setShortcut(QKeySequence("Ctrl+2")); chunkActFour->setShortcut(QKeySequence("Ctrl+4")); chunkActOne->setChecked(true); connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*))); // 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, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*))); // 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, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool))); // 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, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool))); connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool))); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); optionsMenu->addActions(chunkGroup->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(); }
MainWindow::MainWindow(running_machine* machine, QWidget* parent) : WindowQt(machine, NULL), m_historyIndex(0), m_inputHistory() { setGeometry(300, 300, 1000, 600); // // The main frame and its input and log widgets // QFrame* mainWindowFrame = new QFrame(this); // The input line m_inputEdit = new QLineEdit(mainWindowFrame); connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(executeCommand())); m_inputEdit->installEventFilter(this); // The log view m_consoleView = new DebuggerView(DVT_CONSOLE, m_machine, mainWindowFrame); m_consoleView->setFocusPolicy(Qt::NoFocus); m_consoleView->setPreferBottom(true); QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame); vLayout->addWidget(m_consoleView); vLayout->addWidget(m_inputEdit); vLayout->setSpacing(3); vLayout->setContentsMargins(4,0,4,2); setCentralWidget(mainWindowFrame); // // Options Menu // // Create three commands m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this); m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this); m_runToCursorAct = new QAction("Run to Cursor", this); m_breakpointToggleAct->setShortcut(Qt::Key_F9); m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9); m_runToCursorAct->setShortcut(Qt::Key_F4); connect(m_breakpointToggleAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool))); connect(m_breakpointEnableAct, SIGNAL(triggered(bool)), this, SLOT(enableBreakpointAtCursor(bool))); connect(m_runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool))); // Right bar options QActionGroup* rightBarGroup = new QActionGroup(this); rightBarGroup->setObjectName("rightbargroup"); QAction* rightActRaw = new QAction("Raw Opcodes", this); QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this); QAction* rightActComments = new QAction("Comments", this); rightActRaw->setCheckable(true); rightActEncrypted->setCheckable(true); rightActComments->setCheckable(true); rightActRaw->setActionGroup(rightBarGroup); rightActEncrypted->setActionGroup(rightBarGroup); rightActComments->setActionGroup(rightBarGroup); rightActRaw->setShortcut(QKeySequence("Ctrl+R")); rightActEncrypted->setShortcut(QKeySequence("Ctrl+E")); rightActComments->setShortcut(QKeySequence("Ctrl+C")); rightActRaw->setChecked(true); connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*))); // Assemble the options menu QMenu* optionsMenu = menuBar()->addMenu("&Options"); optionsMenu->addAction(m_breakpointToggleAct); optionsMenu->addAction(m_breakpointEnableAct); optionsMenu->addAction(m_runToCursorAct); optionsMenu->addSeparator(); optionsMenu->addActions(rightBarGroup->actions()); // // Images menu // image_interface_iterator imageIterTest(m_machine->root_device()); if (imageIterTest.first() != NULL) { createImagesMenu(); } // // Dock window menu // QMenu* dockMenu = menuBar()->addMenu("Doc&ks"); setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea); setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); // The processor dock QDockWidget* cpuDock = new QDockWidget("processor", this); cpuDock->setObjectName("cpudock"); cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea); m_procFrame = new ProcessorDockWidget(m_machine, cpuDock); cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame)); addDockWidget(Qt::LeftDockWidgetArea, cpuDock); dockMenu->addAction(cpuDock->toggleViewAction()); // The disassembly dock QDockWidget* dasmDock = new QDockWidget("dasm", this); dasmDock->setObjectName("dasmdock"); dasmDock->setAllowedAreas(Qt::TopDockWidgetArea); m_dasmFrame = new DasmDockWidget(m_machine, dasmDock); dasmDock->setWidget(m_dasmFrame); connect(m_dasmFrame->view(), SIGNAL(updated()), this, SLOT(dasmViewUpdated())); addDockWidget(Qt::TopDockWidgetArea, dasmDock); dockMenu->addAction(dasmDock->toggleViewAction()); }
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate() { // very bad hack... berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow(); QMainWindow* mainWindow = static_cast<QMainWindow*> (window->GetShell()->GetControl()); if (!windowIcon.empty()) { mainWindow->setWindowIcon(QIcon(QString::fromStdString(windowIcon))); } mainWindow->setContextMenuPolicy(Qt::PreventContextMenu); /*mainWindow->setStyleSheet("color: white;" "background-color: #808080;" "selection-color: #659EC7;" "selection-background-color: #808080;" " QMenuBar {" "background-color: #808080; }");*/ // ==== Application menu ============================ QMenuBar* menuBar = mainWindow->menuBar(); menuBar->setContextMenuPolicy(Qt::PreventContextMenu); QMenu* fileMenu = menuBar->addMenu("&File"); fileMenu->setObjectName("FileMenu"); QAction* fileOpenAction = new QmitkFileOpenAction(QIcon(":/org.mitk.gui.qt.ext/Load_48.png"), window); fileMenu->addAction(fileOpenAction); fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window); fileSaveProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Save_48.png")); fileMenu->addAction(fileSaveProjectAction); closeProjectAction = new QmitkCloseProjectAction(window); closeProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Remove_48.png")); fileMenu->addAction(closeProjectAction); fileMenu->addSeparator(); QAction* fileExitAction = new QmitkFileExitAction(window); fileExitAction->setObjectName("QmitkFileExitAction"); fileMenu->addAction(fileExitAction); if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor")) { openDicomEditorAction = new QmitkOpenDicomEditorAction(QIcon(":/org.mitk.gui.qt.ext/dcm-icon.png"),window); } berry::IViewRegistry* viewRegistry = berry::PlatformUI::GetWorkbench()->GetViewRegistry(); const std::vector<berry::IViewDescriptor::Pointer>& viewDescriptors = viewRegistry->GetViews(); // another bad hack to get an edit/undo menu... QMenu* editMenu = menuBar->addMenu("&Edit"); undoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Undo_48.png"), "&Undo", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()), QKeySequence("CTRL+Z")); undoAction->setToolTip("Undo the last action (not supported by all modules)"); redoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Redo_48.png") , "&Redo", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()), QKeySequence("CTRL+Y")); redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)"); imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", NULL); bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator"); if (imageNavigatorViewFound) { QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator())); imageNavigatorAction->setCheckable(true); // add part listener for image navigator imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction); window->GetPartService()->AddPartListener(imageNavigatorPartListener); berry::IViewPart::Pointer imageNavigatorView = window->GetActivePage()->FindView("org.mitk.views.imagenavigator"); imageNavigatorAction->setChecked(false); if (imageNavigatorView) { bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView); if (isImageNavigatorVisible) imageNavigatorAction->setChecked(true); } imageNavigatorAction->setToolTip("Open image navigator for navigating through image"); } // toolbar for showing file open, undo, redo and other main actions QToolBar* mainActionsToolBar = new QToolBar; mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu); #ifdef __APPLE__ mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon ); #else mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon ); #endif mainActionsToolBar->addAction(fileOpenAction); mainActionsToolBar->addAction(fileSaveProjectAction); mainActionsToolBar->addAction(closeProjectAction); mainActionsToolBar->addAction(undoAction); mainActionsToolBar->addAction(redoAction); if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor")) { mainActionsToolBar->addAction(openDicomEditorAction); } if (imageNavigatorViewFound) { mainActionsToolBar->addAction(imageNavigatorAction); } mainWindow->addToolBar(mainActionsToolBar); #ifdef __APPLE__ mainWindow->setUnifiedTitleAndToolBarOnMac(true); #endif // ==== Window Menu ========================== QMenu* windowMenu = menuBar->addMenu("Window"); if (showNewWindowMenuItem) { windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow())); windowMenu->addSeparator(); } QMenu* perspMenu = windowMenu->addMenu("&Open Perspective"); QMenu* viewMenu; if (showViewMenuItem) { viewMenu = windowMenu->addMenu("Show &View"); viewMenu->setObjectName("Show View"); } windowMenu->addSeparator(); resetPerspAction = windowMenu->addAction("&Reset Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective())); if(showClosePerspectiveMenuItem) closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective())); windowMenu->addSeparator(); windowMenu->addAction("&Preferences...", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()), QKeySequence("CTRL+P")); // fill perspective menu berry::IPerspectiveRegistry* perspRegistry = window->GetWorkbench()->GetPerspectiveRegistry(); QActionGroup* perspGroup = new QActionGroup(menuBar); std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives( perspRegistry->GetPerspectives()); bool skip = false; for (std::vector<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt = perspectives.begin(); perspIt != perspectives.end(); ++perspIt) { // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which // should not appear as an menu-entry in the perspective menu if (perspectiveExcludeList.size() > 0) { for (unsigned int i=0; i<perspectiveExcludeList.size(); i++) { if (perspectiveExcludeList.at(i) == (*perspIt)->GetId()) { skip = true; break; } } if (skip) { skip = false; continue; } } QAction* perspAction = new berry::QtOpenPerspectiveAction(window, *perspIt, perspGroup); mapPerspIdToAction.insert(std::make_pair((*perspIt)->GetId(), perspAction)); } perspMenu->addActions(perspGroup->actions()); // sort elements (converting vector to map...) std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter; std::map<std::string, berry::IViewDescriptor::Pointer> VDMap; skip = false; for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter) { // if viewExcludeList is set, it contains the id-strings of view, which // should not appear as an menu-entry in the menu if (viewExcludeList.size() > 0) { for (unsigned int i=0; i<viewExcludeList.size(); i++) { if (viewExcludeList.at(i) == (*iter)->GetId()) { skip = true; break; } } if (skip) { skip = false; continue; } } if ((*iter)->GetId() == "org.blueberry.ui.internal.introview") continue; if ((*iter)->GetId() == "org.mitk.views.imagenavigator") continue; std::pair<std::string, berry::IViewDescriptor::Pointer> p( (*iter)->GetLabel(), (*iter)); VDMap.insert(p); } // ================================================== // ==== Perspective Toolbar ================================== QToolBar* qPerspectiveToolbar = new QToolBar; if (showPerspectiveToolbar) { qPerspectiveToolbar->addActions(perspGroup->actions()); mainWindow->addToolBar(qPerspectiveToolbar); } else delete qPerspectiveToolbar; // ==== View Toolbar ================================== QToolBar* qToolbar = new QToolBar; std::map<std::string, berry::IViewDescriptor::Pointer>::const_iterator MapIter; for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter) { berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window, (*MapIter).second); viewActions.push_back(viewAction); if(showViewMenuItem) viewMenu->addAction(viewAction); if (showViewToolbar) { qToolbar->addAction(viewAction); } } if (showViewToolbar) { mainWindow->addToolBar(qToolbar); } else delete qToolbar; QSettings settings(GetQSettingsFile(), QSettings::IniFormat); mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray()); // ==================================================== // ===== Help menu ==================================== QMenu* helpMenu = menuBar->addMenu("&Help"); helpMenu->addAction("&Welcome",this, SLOT(onIntro())); helpMenu->addAction("&Open Help Perspective", this, SLOT(onHelpOpenHelpPerspective())); helpMenu->addAction("&Context Help",this, SLOT(onHelp()), QKeySequence("F1")); helpMenu->addAction("&About",this, SLOT(onAbout())); // ===================================================== QStatusBar* qStatusBar = new QStatusBar(); //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar); //disabling the SizeGrip in the lower right corner statusBar->SetSizeGripEnabled(false); QmitkProgressBar *progBar = new QmitkProgressBar(); qStatusBar->addPermanentWidget(progBar, 0); progBar->hide(); // progBar->AddStepsToDo(2); // progBar->Progress(1); mainWindow->setStatusBar(qStatusBar); QmitkMemoryUsageIndicatorView* memoryIndicator = new QmitkMemoryUsageIndicatorView(); qStatusBar->addPermanentWidget(memoryIndicator, 0); }
CoverFoundDialog::CoverFoundDialog( const CoverFetchUnit::Ptr unit, const CoverFetch::Metadata &data, QWidget *parent ) : KDialog( parent ) , m_album( unit->album() ) , m_isSorted( false ) , m_sortEnabled( false ) , m_unit( unit ) , m_queryPage( 0 ) { DEBUG_BLOCK setButtons( KDialog::Ok | KDialog::Cancel | KDialog::User1 ); // User1: clear icon view setButtonGuiItem( KDialog::User1, KStandardGuiItem::clear() ); connect( button( KDialog::User1 ), SIGNAL(clicked()), SLOT(clearView()) ); m_save = button( KDialog::Ok ); QSplitter *splitter = new QSplitter( this ); m_sideBar = new CoverFoundSideBar( m_album, splitter ); KVBox *vbox = new KVBox( splitter ); vbox->setSpacing( 4 ); KHBox *breadcrumbBox = new KHBox( vbox ); QLabel *breadcrumbLabel = new QLabel( i18n( "Finding cover for" ), breadcrumbBox ); AlbumBreadcrumbWidget *breadcrumb = new AlbumBreadcrumbWidget( m_album, breadcrumbBox ); QFont breadcrumbLabelFont; breadcrumbLabelFont.setBold( true ); breadcrumbLabel->setFont( breadcrumbLabelFont ); breadcrumbLabel->setIndent( 4 ); connect( breadcrumb, SIGNAL(artistClicked(const QString&)), SLOT(addToCustomSearch(const QString&)) ); connect( breadcrumb, SIGNAL(albumClicked(const QString&)), SLOT(addToCustomSearch(const QString&)) ); KHBox *searchBox = new KHBox( vbox ); vbox->setSpacing( 4 ); QStringList completionNames; QString firstRunQuery( m_album->name() ); completionNames << firstRunQuery; if( m_album->hasAlbumArtist() ) { const QString &name = m_album->albumArtist()->name(); completionNames << name; firstRunQuery += ' ' + name; } m_query = firstRunQuery; m_album->setSuppressImageAutoFetch( true ); m_search = new KComboBox( searchBox ); m_search->setEditable( true ); // creates a KLineEdit for the combobox m_search->setTrapReturnKey( true ); m_search->setInsertPolicy( QComboBox::NoInsert ); // insertion is handled by us m_search->setCompletionMode( KGlobalSettings::CompletionPopup ); m_search->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); qobject_cast<KLineEdit*>( m_search->lineEdit() )->setClickMessage( i18n( "Enter Custom Search" ) ); m_search->completionObject()->setOrder( KCompletion::Insertion ); m_search->completionObject()->setIgnoreCase( true ); m_search->completionObject()->setItems( completionNames ); m_search->insertItem( 0, KStandardGuiItem::find().icon(), QString() ); m_search->insertSeparator( 1 ); m_search->insertItem( 2, KIcon("filename-album-amarok"), m_album->name() ); if( m_album->hasAlbumArtist() ) m_search->insertItem( 3, KIcon("filename-artist-amarok"), m_album->albumArtist()->name() ); m_searchButton = new KPushButton( KStandardGuiItem::find(), searchBox ); KPushButton *sourceButton = new KPushButton( KStandardGuiItem::configure(), searchBox ); updateSearchButton( firstRunQuery ); QMenu *sourceMenu = new QMenu( sourceButton ); QAction *lastFmAct = new QAction( i18n( "Last.fm" ), sourceMenu ); QAction *googleAct = new QAction( i18n( "Google" ), sourceMenu ); QAction *yahooAct = new QAction( i18n( "Yahoo!" ), sourceMenu ); QAction *discogsAct = new QAction( i18n( "Discogs" ), sourceMenu ); lastFmAct->setCheckable( true ); googleAct->setCheckable( true ); yahooAct->setCheckable( true ); discogsAct->setCheckable( true ); connect( lastFmAct, SIGNAL(triggered()), this, SLOT(selectLastFm()) ); connect( googleAct, SIGNAL(triggered()), this, SLOT(selectGoogle()) ); connect( yahooAct, SIGNAL(triggered()), this, SLOT(selectYahoo()) ); connect( discogsAct, SIGNAL(triggered()), this, SLOT(selectDiscogs()) ); m_sortAction = new QAction( i18n( "Sort by size" ), sourceMenu ); m_sortAction->setCheckable( true ); connect( m_sortAction, SIGNAL(triggered(bool)), this, SLOT(sortingTriggered(bool)) ); QActionGroup *ag = new QActionGroup( sourceButton ); ag->addAction( lastFmAct ); ag->addAction( googleAct ); ag->addAction( yahooAct ); ag->addAction( discogsAct ); sourceMenu->addActions( ag->actions() ); sourceMenu->addSeparator(); sourceMenu->addAction( m_sortAction ); sourceButton->setMenu( sourceMenu ); connect( m_search, SIGNAL(returnPressed(const QString&)), SLOT(insertComboText(const QString&)) ); connect( m_search, SIGNAL(returnPressed(const QString&)), SLOT(processQuery(const QString&)) ); connect( m_search, SIGNAL(returnPressed(const QString&)), SLOT(updateSearchButton(const QString&)) ); connect( m_search, SIGNAL(editTextChanged(const QString&)), SLOT(updateSearchButton(const QString&)) ); connect( m_search->lineEdit(), SIGNAL(clearButtonClicked()), SLOT(clearQueryButtonClicked())); connect( m_searchButton, SIGNAL(clicked()), SLOT(processQuery()) ); m_view = new KListWidget( vbox ); m_view->setAcceptDrops( false ); m_view->setContextMenuPolicy( Qt::CustomContextMenu ); m_view->setDragDropMode( QAbstractItemView::NoDragDrop ); m_view->setDragEnabled( false ); m_view->setDropIndicatorShown( false ); m_view->setMovement( QListView::Static ); m_view->setGridSize( QSize( 140, 150 ) ); m_view->setIconSize( QSize( 120, 120 ) ); m_view->setSpacing( 4 ); m_view->setViewMode( QListView::IconMode ); m_view->setResizeMode( QListView::Adjust ); connect( m_view, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(currentItemChanged(QListWidgetItem*, QListWidgetItem*)) ); connect( m_view, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(itemDoubleClicked(QListWidgetItem*)) ); connect( m_view, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(itemMenuRequested(const QPoint&)) ); splitter->addWidget( m_sideBar ); splitter->addWidget( vbox ); setMainWidget( splitter ); const KConfigGroup config = Amarok::config( "Cover Fetcher" ); const QString source = config.readEntry( "Interactive Image Source", "LastFm" ); m_sortEnabled = config.readEntry( "Sort by Size", false ); m_sortAction->setChecked( m_sortEnabled ); m_isSorted = m_sortEnabled; restoreDialogSize( config ); // call this after setMainWidget() if( source == "LastFm" ) lastFmAct->setChecked( true ); else if( source == "Yahoo" ) yahooAct->setChecked( true ); else if( source == "Discogs" ) discogsAct->setChecked( true ); else googleAct->setChecked( true ); typedef CoverFetchArtPayload CFAP; const CFAP *payload = dynamic_cast< const CFAP* >( unit->payload() ); if( !m_album->hasImage() ) m_sideBar->setPixmap( QPixmap::fromImage( m_album->image(190 ) ) ); else if( payload ) add( m_album->image(), data, payload->imageSize() ); else add( m_album->image(), data ); m_view->setCurrentItem( m_view->item( 0 ) ); updateGui(); connect( The::networkAccessManager(), SIGNAL( requestRedirected( QNetworkReply*, QNetworkReply* ) ), this, SLOT( fetchRequestRedirected( QNetworkReply*, QNetworkReply* ) ) ); }
NavigatorConfigAction::NavigatorConfigAction( QWidget * parent ) : KAction( parent ) { KMenu * navigatorMenu = new KMenu( 0 ); setMenu( navigatorMenu ); setText( i18n( "Track Progression" ) ); QActionGroup * navigatorActions = new QActionGroup( navigatorMenu ); navigatorActions->setExclusive( true ); m_standardNavigatorAction = navigatorActions->addAction( i18n( "Standard" ) ); m_standardNavigatorAction->setIcon( KIcon( "media-standard-track-progression-amarok" ) ); m_standardNavigatorAction->setCheckable( true ); //action->setIcon( true ); m_onlyQueueNavigatorAction = navigatorActions->addAction( i18n( "Only Queue" ) ); m_onlyQueueNavigatorAction->setIcon( KIcon( "media-standard-track-progression-amarok" ) ); m_onlyQueueNavigatorAction->setCheckable( true ); QAction * action = new QAction( parent ); action->setSeparator( true ); navigatorActions->addAction( action ); m_repeatTrackNavigatorAction = navigatorActions->addAction( i18n( "Repeat Track" ) ); m_repeatTrackNavigatorAction->setIcon( KIcon( "media-repeat-track-amarok" ) ); m_repeatTrackNavigatorAction->setCheckable( true ); m_repeatAlbumNavigatorAction = navigatorActions->addAction( i18n( "Repeat Album" ) ); m_repeatAlbumNavigatorAction->setIcon( KIcon( "media-repeat-album-amarok" ) ); m_repeatAlbumNavigatorAction->setCheckable( true ); m_repeatPlaylistNavigatorAction = navigatorActions->addAction( i18n( "Repeat Playlist" ) ); m_repeatPlaylistNavigatorAction->setIcon( KIcon( "media-repeat-playlist-amarok" ) ); m_repeatPlaylistNavigatorAction->setCheckable( true ); action = new QAction( parent ); action->setSeparator( true ); navigatorActions->addAction( action ); m_randomTrackNavigatorAction = navigatorActions->addAction( i18n( "Random Tracks" ) ); m_randomTrackNavigatorAction->setIcon( KIcon( "media-random-tracks-amarok" ) ); m_randomTrackNavigatorAction->setCheckable( true ); m_randomAlbumNavigatorAction = navigatorActions->addAction( i18n( "Random Albums" ) ); m_randomAlbumNavigatorAction->setIcon( KIcon( "media-random-albums-amarok" ) ); m_randomAlbumNavigatorAction->setCheckable( true ); navigatorMenu->addActions( navigatorActions->actions() ); QMenu * favorMenu = navigatorMenu->addMenu( i18n( "Favor" ) ); QActionGroup * favorActions = new QActionGroup( favorMenu ); m_favorNoneAction = favorActions->addAction( i18n( "None" ) ); m_favorNoneAction->setCheckable( true ); m_favorScoresAction = favorActions->addAction( i18n( "Higher Scores" ) ); m_favorScoresAction->setCheckable( true ); m_favorRatingsAction = favorActions->addAction( i18n( "Higher Ratings" ) ); m_favorRatingsAction->setCheckable( true ); m_favorLastPlayedAction = favorActions->addAction( i18n( "Not Recently Played" ) ); m_favorLastPlayedAction->setCheckable( true ); favorMenu->addActions( favorActions->actions() ); //make sure the correct entry is selected from start: switch( AmarokConfig::trackProgression() ) { case AmarokConfig::EnumTrackProgression::OnlyQueue: m_onlyQueueNavigatorAction->setChecked( true ); setIcon( m_onlyQueueNavigatorAction->icon() ); break; case AmarokConfig::EnumTrackProgression::RepeatTrack: m_repeatTrackNavigatorAction->setChecked( true ); setIcon( m_repeatTrackNavigatorAction->icon() ); break; case AmarokConfig::EnumTrackProgression::RepeatAlbum: m_repeatAlbumNavigatorAction->setChecked( true ); setIcon( m_repeatAlbumNavigatorAction->icon() ); break; case AmarokConfig::EnumTrackProgression::RepeatPlaylist: m_repeatPlaylistNavigatorAction->setChecked( true ); setIcon( m_repeatPlaylistNavigatorAction->icon() ); break; case AmarokConfig::EnumTrackProgression::RandomTrack: m_randomTrackNavigatorAction->setChecked( true ); setIcon( m_randomTrackNavigatorAction->icon() ); break; case AmarokConfig::EnumTrackProgression::RandomAlbum: m_randomAlbumNavigatorAction->setChecked( true ); setIcon( m_randomAlbumNavigatorAction->icon() ); break; case AmarokConfig::EnumTrackProgression::Normal: default: m_standardNavigatorAction->setChecked( true ); setIcon( m_standardNavigatorAction->icon() ); break; } switch( AmarokConfig::favorTracks() ) { case AmarokConfig::EnumFavorTracks::HigherScores: m_favorScoresAction->setChecked( true ); break; case AmarokConfig::EnumFavorTracks::HigherRatings: m_favorRatingsAction->setChecked( true ); break; case AmarokConfig::EnumFavorTracks::LessRecentlyPlayed: m_favorLastPlayedAction->setChecked( true ); break; case AmarokConfig::EnumFavorTracks::Off: default: m_favorNoneAction->setChecked( true ); break; } connect( navigatorMenu, SIGNAL( triggered( QAction* ) ), this, SLOT( setActiveNavigator( QAction* ) ) ); connect( favorMenu, SIGNAL( triggered( QAction* ) ), this, SLOT( setFavored( QAction* ) ) ); connect( The::playlistActions(), SIGNAL( navigatorChanged() ), this, SLOT( navigatorChanged() ) ); }
void RichTextEdit::setupActions() { EditMenu *menu = Controller::create()->getEditMenu(); toolbar->setWindowTitle(tr("Edit Actions")); actionSave = toolbar->addAction(QIcon("icons/document-save.png"), tr("Save")); actionSave->setShortcut(QKeySequence::Save); toolbar->addSeparator(); actionUndo = toolbar->addAction(QIcon("icons/edit-undo.png"), tr("Undo")); menu->addAction(actionUndo); actionUndo->setShortcut(QKeySequence::Undo); actionRedo = toolbar->addAction(QIcon("icons/edit-redo.png"), tr("Redo")); menu->addAction(actionRedo); actionRedo->setShortcut(QKeySequence::Redo); actionCut = toolbar->addAction(QIcon("icons/edit-cut.png"), tr("Cut")); menu->addAction(actionCut); actionCut->setShortcut(QKeySequence::Cut); actionCopy = toolbar->addAction(QIcon("icons/edit-copy.png"), tr("Copy")); menu->addAction(actionCopy); actionCopy->setShortcut(QKeySequence::Copy); actionPaste = toolbar->addAction(QIcon("icons/edit-paste.png"), tr("Paste")); menu->addAction(actionPaste); actionPaste->setShortcut(QKeySequence::Paste); toolbar->addSeparator(); actionTextBold = toolbar->addAction(QIcon("icons/format-text-bold.png"), tr("Bold")); menu->addAction(actionTextBold); actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); QFont bold; bold.setBold(true); actionTextBold->setFont(bold); connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold())); actionTextBold->setCheckable(true); actionTextItalic = toolbar->addAction(QIcon("icons/format-text-italic.png"), tr("Italic")); menu->addAction(actionTextItalic); actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); QFont italic; italic.setItalic(true); actionTextItalic->setFont(italic); connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic())); actionTextItalic->setCheckable(true); actionTextUnderline = toolbar->addAction(QIcon("icons/format-text-underline.png"), tr("Underline")); menu->addAction(actionTextUnderline); actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); QFont underline; underline.setUnderline(true); actionTextUnderline->setFont(underline); connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline())); actionTextUnderline->setCheckable(true); toolbar->addSeparator(); QActionGroup *grp = new QActionGroup(this); connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *))); actionAlignLeft = new QAction(QIcon("icons/format-justify-left.png"), tr("&Left"), grp); actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); actionAlignLeft->setCheckable(true); actionAlignCenter = new QAction(QIcon("icons/format-justify-center.png"), tr("C&enter"), grp); actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); actionAlignCenter->setCheckable(true); actionAlignRight = new QAction(QIcon("icons/format-justify-right.png"), tr("&Right"), grp); actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); actionAlignRight->setCheckable(true); actionAlignJustify = new QAction(QIcon("icons/format-justify-fill.png"), tr("&Justify"), grp); actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); actionAlignJustify->setCheckable(true); toolbar->addActions(grp->actions()); menu->addActions(grp->actions()); toolbar->addSeparator(); // color QPixmap pix(16, 16); pix.fill(Qt::black); actionTextColor = new QAction(pix, tr("&Color..."), this); connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor())); toolbar->addAction(actionTextColor); menu->addAction(actionTextColor); actionFind = toolbar->addAction(QIcon("icons/edit-find.png"), tr("Find")); actionFind->setShortcut(QKeySequence::Find); menu->addAction(actionFind); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), color_ranges_(), palettes_(), user_color_ranges_(), user_palettes_(), ui(new Ui::MainWindow), img_path_(), img_original_(), img_transview_(), zoom_(1.0), ignore_drops_(false), drag_use_rc_(false), drag_start_(false), drag_start_pos_(), recent_file_acts_(), zoom_factors_({ 0.5, 1.0, 2.0, 4.0, 8.0 }) { ui->setupUi(this); mos_config_load(user_color_ranges_, user_palettes_); const QSize& lastWindowSize = mos_get_main_window_size(); if(lastWindowSize.isValid()) { resize(lastWindowSize); } generateMergedRcDefinitions(); processRcDefinitions(); QAction* const act_whatsthis = QWhatsThis::createAction(this); ui->menu_Help->insertAction(ui->actionAbout_Morning_Star, act_whatsthis); ui->menu_Help->insertSeparator(ui->actionAbout_Morning_Star); QPushButton* const save = ui->buttonBox->button(QDialogButtonBox::Save); QPushButton* const close = ui->buttonBox->button(QDialogButtonBox::Close); save->setWhatsThis(tr("Saves the current recolor job.")); close->setWhatsThis(tr("Abandons the current job and exits.")); ui->action_Open->setIcon(this->style()->standardIcon(QStyle::SP_DialogOpenButton, nullptr, dynamic_cast<QWidget*>(ui->action_Open))); ui->action_Save->setIcon(this->style()->standardIcon(QStyle::SP_DialogSaveButton, nullptr, dynamic_cast<QWidget*>(ui->action_Save))); ui->action_Reload->setIcon(this->style()->standardIcon(QStyle::SP_BrowserReload, nullptr, dynamic_cast<QWidget*>(ui->action_Reload))); ui->action_Quit->setIcon(this->style()->standardIcon(QStyle::SP_DialogCloseButton, nullptr, dynamic_cast<QWidget*>(ui->action_Quit))); // Use theme icons for some buttons on X11. This is not // in the .ui file for Qt 4.6 - 4.7 compatibility. ui->tbZoomIn->setIcon(QIcon::fromTheme("zoom-in", QIcon(":/zoom-in-16.png"))); ui->tbZoomOut->setIcon(QIcon::fromTheme("zoom-out", QIcon(":/zoom-out-16.png"))); for(unsigned k = 0; k < mos_max_recent_files(); ++k) { QAction* act = new QAction(this); act->setVisible(false); connect(act, SIGNAL(triggered()), this, SLOT(handleRecent())); ui->menu_File->insertAction(ui->action_RecentPlaceholder, act); recent_file_acts_.push_back(act); } ui->action_RecentPlaceholder->setVisible(false); update_recent_files_menu(); const QString& bgColorName = mos_get_preview_background_color_name(); QActionGroup* bgColorActs = new QActionGroup(this); // The Custom Color entry goes into the list first so that it is preemptively // selected first on the next loop in case the color saved in preferences isn't // any of the predefined ones. bgColorActs->addAction(ui->actionPreviewBgCustom); ui->actionPreviewBgCustom->setData(bgColorName); do_custom_preview_color_icon(); bgColorActs->addAction(ui->actionPreviewBgBlack); ui->actionPreviewBgBlack->setData(QColor(Qt::black).name()); bgColorActs->addAction(ui->actionPreviewBgDark); ui->actionPreviewBgDark->setData(QColor(Qt::darkGray).name()); bgColorActs->addAction(ui->actionPreviewBgDefault); ui->actionPreviewBgDefault->setData(""); bgColorActs->addAction(ui->actionPreviewBgLight); ui->actionPreviewBgLight->setData(QColor(Qt::lightGray).name()); bgColorActs->addAction(ui->actionPreviewBgWhite); ui->actionPreviewBgWhite->setData(QColor(Qt::white).name()); QList<QAction*> bgColorActList = bgColorActs->actions(); for(auto* act : bgColorActList) { connect(act, SIGNAL(triggered(bool)), this, SLOT(handlePreviewBgOption(bool))); // We must find the menu item for the color we read from the app // config and mark it as checked, and update the preview background // color manually since setChecked() won't raise the triggered() // signal. if(act->data().toString() == bgColorName) { act->setChecked(true); setPreviewBackgroundColor(bgColorName); } } ui->radRc->setChecked(true); ui->staFunctionOpts->setCurrentIndex(0); toggle_page2(false); toggle_page1(true); ui->zoomSlider->setMinimum(0); ui->zoomSlider->setMaximum(zoom_factors_.size() - 1); ui->zoomSlider->setValue(1); ui->previewOriginalContainer->viewport()->setBackgroundRole(QPalette::Dark); ui->previewRcContainer->viewport()->setBackgroundRole(QPalette::Dark); // // FIXME: hack to prevent Oxygen stealing our drag events when dragging // windows from empty areas is enabled. // // http://lists.kde.org/?l=kde-devel&m=130530904703913&w=2 // // We should probably figure out a better way to do this later, as well // as the preview panels themselves; the proper way according to the // Oxygen dev is to prevent (at the widget level) propagation of the event // to the window widget. // ui->previewOriginalContainer->setProperty("_kde_no_window_grab", true); ui->previewRcContainer->setProperty("_kde_no_window_grab", true); connect( ui->previewOriginalContainer->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->previewRcContainer->horizontalScrollBar(), SLOT(setValue(int))); connect( ui->previewRcContainer->horizontalScrollBar(), SIGNAL(valueChanged(int)), ui->previewOriginalContainer->horizontalScrollBar(), SLOT(setValue(int))); connect( ui->previewOriginalContainer->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->previewRcContainer->verticalScrollBar(), SLOT(setValue(int))); connect( ui->previewRcContainer->verticalScrollBar(), SIGNAL(valueChanged(int)), ui->previewOriginalContainer->verticalScrollBar(), SLOT(setValue(int))); }
void QRibbonButtonBar::mouseReleaseEvent(QMouseEvent* evt) { QPoint cursor(evt->pos()); if (m_active_button) { QRibbonButtonBarButtonSizeInfo& size = m_active_button->base->sizes[m_active_button->size]; QRect btn_rect; btn_rect.setTopLeft(m_layout_offset + m_active_button->position); btn_rect.setSize(size.size); if (btn_rect.contains(cursor)) { int id = m_active_button->base->id; cursor -= btn_rect.topLeft(); QAction* pAction = m_active_button->base->m_pAction; if (pAction) { do { if (size.normal_region.contains(cursor)) { int nKind = m_active_button->base->kind; if (nKind == QRIBBON_BUTTON_NORMAL) { pAction->triggered(); } else if (nKind == QRIBBON_BUTTON_TOGGLE) { pAction->triggered(true); } else if (nKind == QRIBBON_BUTTON_HYBRID || nKind == QRIBBON_BUTTON_DROPDOWN) { QActionGroup* pGroup = pAction->actionGroup(); if (pGroup) { QList<QAction*> lsActions = pGroup->actions(); Q_ASSERT(lsActions.size() == 3); QAction* pAction1 = lsActions.at(0); QAction* pAction2 = lsActions.at(1); if (pAction1 && pAction2) { pAction1->triggered(); pAction2->triggered(); } } } } m_lock_active_state = true; m_lock_active_state = false; } while (false); } if (m_active_button) // may have been NULLed by event handler { m_active_button->base->state &= ~QRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK; m_active_button = NULL; } update(); } } }
/** Initialyse Stacked Page*/ void MainWindow::initStackedPage() { /* WORK OUT IF WE"RE IN ADVANCED MODE OR NOT */ bool advancedMode = false; std::string advsetting; if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES")) { advancedMode = true; } QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > > notify; /* Create the Main pages and actions */ QActionGroup *grp = new QActionGroup(this); addPage(newsFeed = new NewsFeed(ui->stackPages), grp, ¬ify); addPage(friendsDialog = new FriendsDialog(ui->stackPages), grp, ¬ify); #ifdef RS_USE_CIRCLES PeopleDialog *peopleDialog = NULL; addPage(peopleDialog = new PeopleDialog(ui->stackPages), grp, ¬ify); #endif IdDialog *idDialog = NULL; addPage(idDialog = new IdDialog(ui->stackPages), grp, ¬ify); #ifdef RS_USE_CIRCLES CirclesDialog *circlesDialog = NULL; addPage(circlesDialog = new CirclesDialog(ui->stackPages), grp, ¬ify); #endif addPage(transfersDialog = new TransfersDialog(ui->stackPages), grp, ¬ify); addPage(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages), grp, ¬ify); addPage(messagesDialog = new MessagesDialog(ui->stackPages), grp, ¬ify); addPage(gxschannelDialog = new GxsChannelDialog(ui->stackPages), grp, ¬ify); addPage(gxsforumDialog = new GxsForumsDialog(ui->stackPages), grp, ¬ify); addPage(postedDialog = new PostedDialog(ui->stackPages), grp, ¬ify); #ifdef RS_USE_WIKI WikiDialog *wikiDialog = NULL; addPage(wikiDialog = new WikiDialog(ui->stackPages), grp, ¬ify); #endif #ifdef BLOGS addPage(blogsFeed = new BlogsDialog(ui->stackPages), grp, NULL); #endif std::cerr << "Looking for interfaces in existing plugins:" << std::endl; for(int i = 0;i<rsPlugins->nbPlugins();++i) { QIcon icon ; if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_page() != NULL) { if(rsPlugins->plugin(i)->qt_icon() != NULL) icon = *rsPlugins->plugin(i)->qt_icon() ; else icon = QIcon(":images/extension_48.png") ; std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl; MainPage *pluginPage = rsPlugins->plugin(i)->qt_page(); pluginPage->setIconPixmap(icon); pluginPage->setPageName(QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str())); addPage(pluginPage, grp, ¬ify); } else if(rsPlugins->plugin(i) == NULL) std::cerr << " No plugin object !" << std::endl; else std::cerr << " No plugin page !" << std::endl; } #ifndef RS_RELEASE_VERSION #ifdef PLUGINMGR addPage(pluginsPage = new PluginsPage(ui->stackPages), grp, NULL); #endif #endif #ifdef GETSTARTED_GUI MainPage *getStartedPage = NULL; if (!advancedMode) { //ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages), // createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp)); addPage(getStartedPage = new GetStartedDialog(ui->stackPages), grp, NULL); } #endif /* Create the toolbar */ ui->toolBarPage->addActions(grp->actions()); connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *))); #ifdef UNFINISHED addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), &MainWindow::showApplWindow, SLOT(showApplWindow())); ui->toolBarAction->addSeparator(); notify += applicationWindow->getNotify(); #endif /** Add icon on Action bar */ addAction(new QAction(QIcon(IMAGE_ADDFRIEND), tr("Add"), ui->toolBarAction), &MainWindow::addFriend, SLOT(addFriend())); //addAction(new QAction(QIcon(IMAGE_NEWRSCOLLECTION), tr("New"), ui->toolBarAction), &MainWindow::newRsCollection, SLOT(newRsCollection())); addAction(new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), ui->toolBarAction), &MainWindow::showSettings, SLOT(showSettings())); addAction(new QAction(QIcon(IMAGE_ABOUT), tr("About"), ui->toolBarAction), &MainWindow::showabout, SLOT(showabout())); addAction(new QAction(QIcon(IMAGE_QUIT), tr("Quit"), ui->toolBarAction), &MainWindow::doQuit, SLOT(doQuit())); QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > >::iterator notifyIt; for (notifyIt = notify.begin(); notifyIt != notify.end(); ++notifyIt) { UserNotify *userNotify = notifyIt->first->getUserNotify(this); if (userNotify) { userNotify->initialize(ui->toolBarPage, notifyIt->second.first, notifyIt->second.second); connect(userNotify, SIGNAL(countChanged()), this, SLOT(updateTrayCombine())); userNotifyList.push_back(userNotify); } } }
MainWindow::MainWindow( QWidget *parent ) : QWidget( parent ) , cardsGroup( new QActionGroup( this ) ) { setAttribute( Qt::WA_DeleteOnClose, true ); setupUi( this ); cards->hide(); cards->hack(); languages->hack(); setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint ); #if QT_VERSION >= 0x040500 setWindowFlags( windowFlags() | Qt::WindowCloseButtonHint ); #else setWindowFlags( windowFlags() | Qt::WindowSystemMenuHint ); #endif // Buttons QButtonGroup *buttonGroup = new QButtonGroup( this ); buttonGroup->addButton( settings, HeadSettings ); buttonGroup->addButton( help, HeadHelp ); buttonGroup->addButton( about, HeadAbout ); buttonGroup->addButton( homeCreate, HomeCreate ); buttonGroup->addButton( homeView, HomeView ); introNext = introButtons->addButton( tr( "Next" ), QDialogButtonBox::ActionRole ); buttonGroup->addButton( introNext, IntroNext ); buttonGroup->addButton( introButtons->button( QDialogButtonBox::Cancel ), IntroBack ); viewCrypt = viewButtons->addButton( tr("Encrypt"), QDialogButtonBox::ActionRole ); buttonGroup->addButton( viewCrypt, ViewCrypt ); buttonGroup->addButton( viewButtons->button( QDialogButtonBox::Close ), ViewClose ); connect( buttonGroup, SIGNAL(buttonClicked(int)), SLOT(buttonClicked(int)) ); connect( cards, SIGNAL(activated(QString)), qApp->poller(), SLOT(selectCard(QString)), Qt::QueuedConnection ); connect( qApp->poller(), SIGNAL(dataChanged()), SLOT(showCardStatus()) ); // Cryptodoc doc = new CryptoDoc( this ); // Translations lang << "et" << "en" << "ru"; retranslate(); QActionGroup *langGroup = new QActionGroup( this ); for( int i = 0; i < lang.size(); ++i ) { QAction *a = langGroup->addAction( new QAction( langGroup ) ); a->setData( lang[i] ); a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_0 + i ); } addActions( langGroup->actions() ); connect( langGroup, SIGNAL(triggered(QAction*)), SLOT(changeLang(QAction*)) ); connect( cardsGroup, SIGNAL(triggered(QAction*)), SLOT(changeCard(QAction*)) ); // Views connect( viewContentView, SIGNAL(remove(int)), SLOT(removeDocument(int)) ); connect( viewContentView, SIGNAL(save(int,QString)), doc, SLOT(saveDocument(int,QString)) ); }
/****************************************************************************** * Initializes the menu. ******************************************************************************/ ViewportMenu::ViewportMenu(Viewport* vp) : QMenu(vp->widget()), _viewport(vp) { QAction* action; // Build menu. action = addAction(tr("Preview Mode"), this, SLOT(onRenderPreviewMode(bool))); action->setCheckable(true); action->setChecked(_viewport->renderPreviewMode()); action = addAction(tr("Show Grid"), this, SLOT(onShowGrid(bool))); action->setCheckable(true); action->setChecked(_viewport->isGridVisible()); #ifdef OVITO_DEBUG action = addAction(tr("Stereoscopic Mode (anaglyphs)"), this, SLOT(onStereoscopicMode(bool))); action->setCheckable(true); action->setChecked(_viewport->stereoscopicMode()); #endif addSeparator(); _viewTypeMenu = addMenu(tr("View Type")); connect(_viewTypeMenu, &QMenu::aboutToShow, this, &ViewportMenu::onShowViewTypeMenu); QActionGroup* viewTypeGroup = new QActionGroup(this); action = viewTypeGroup->addAction(tr("Top")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_TOP); action->setData((int)Viewport::VIEW_TOP); action = viewTypeGroup->addAction(tr("Bottom")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_BOTTOM); action->setData((int)Viewport::VIEW_BOTTOM); action = viewTypeGroup->addAction(tr("Front")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_FRONT); action->setData((int)Viewport::VIEW_FRONT); action = viewTypeGroup->addAction(tr("Back")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_BACK); action->setData((int)Viewport::VIEW_BACK); action = viewTypeGroup->addAction(tr("Left")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_LEFT); action->setData((int)Viewport::VIEW_LEFT); action = viewTypeGroup->addAction(tr("Right")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_RIGHT); action->setData((int)Viewport::VIEW_RIGHT); action = viewTypeGroup->addAction(tr("Ortho")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_ORTHO); action->setData((int)Viewport::VIEW_ORTHO); action = viewTypeGroup->addAction(tr("Perspective")); action->setCheckable(true); action->setChecked(_viewport->viewType() == Viewport::VIEW_PERSPECTIVE); action->setData((int)Viewport::VIEW_PERSPECTIVE); _viewTypeMenu->addActions(viewTypeGroup->actions()); connect(viewTypeGroup, &QActionGroup::triggered, this, &ViewportMenu::onViewType); addSeparator(); addAction(tr("Adjust View..."), this, SLOT(onAdjustView()))->setEnabled(_viewport->viewType() != Viewport::VIEW_SCENENODE); #if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) && defined(Q_OS_MACX) connect(static_cast<QGuiApplication*>(QGuiApplication::instance()), &QGuiApplication::focusWindowChanged, this, &ViewportMenu::onWindowFocusChanged); #endif }
// Constructor MakeRT::MakeRT(QWidget *parent): QWidget(parent), _ui(new Ui::MakeRT), _audioOutput(new Phonon::AudioOutput(Phonon::MusicCategory, this)), _player(new Phonon::MediaObject(this)), _timer(new QTimer(this)), _settings(new QSettings(this)), _textNotificationWidget(new TextNotificationWidget(this)), _soundNotificationWidget(new SoundNotificationWidget(this, _player)), _timerSettingsWidget(new TimerSettingsWidget(this)), _messageBox(new QMessageBox(QMessageBox::Information, tr("Make reality test!"), "", QMessageBox::Ok, this)) #ifndef Q_OS_SYMBIAN , _trayIcon(new QSystemTrayIcon(QIcon(":/icon.png"), this)) #else , _textNotificationAction(new QAction(tr("Text notifications"), this)), _soundNotificationAction(new QAction(tr("Sound notification"), this)), _timerSettingsAction(new QAction(tr("Timer settings"), this)), _vibrationsMenu(new QMenu(tr("Vibrations"), this)), _vibrationsOnAction(new QAction(tr("On"), this)), _vibrationsOffAction(new QAction(tr("Off"), this)), _aboutQtAction(new QAction(tr("About Qt4"), this)), _quitAction(new QAction(tr("Quit"), this)), _menu(new QMenu(this)), _menuAction(new QAction(tr("Menu"), this)), _hideAction(new QAction(tr("Hide"), this)) #endif // Q_OS_SYMBIAN { if (!_instance) _instance = this; else return; _ui->setupUi(this); #ifdef Q_OS_SYMBIAN _vibrator = CHWRMVibra::NewL(); _vibrationsOnAction->setCheckable(true); //_vibrationsOnAction->setChecked(true); _vibrationsOffAction->setCheckable(true); QActionGroup *group = new QActionGroup(this); group->addAction(_vibrationsOnAction); group->addAction(_vibrationsOffAction); _vibrationsMenu->addActions(group->actions()); addAction(_menuAction); addAction(_hideAction); _menu->addAction(_textNotificationAction); _menu->addAction(_soundNotificationAction); _menu->addAction(_timerSettingsAction); _menu->addMenu(_vibrationsMenu); _menu->addAction(_aboutQtAction); _menu->addAction(_quitAction); _menuAction->setMenu(_menu); _menuAction->setSoftKeyRole(QAction::PositiveSoftKey); _hideAction->setSoftKeyRole(QAction::NegativeSoftKey); connect(_textNotificationAction, SIGNAL(triggered()), _textNotificationWidget, SLOT(showMaximized())); connect(_soundNotificationAction, SIGNAL(triggered()), _soundNotificationWidget, SLOT(showMaximized())); connect(_timerSettingsAction, SIGNAL(triggered()), _timerSettingsWidget, SLOT(showMaximized())); connect(_vibrationsOnAction, SIGNAL(triggered()), this, SLOT(VibrationsEnabled())); connect(_vibrationsOffAction, SIGNAL(triggered()), this, SLOT(VibrationsEnabled())); connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(_quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(_hideAction, SIGNAL(triggered()), this, SLOT(lower())); _ui->about->setFocus(); #else _ui->tabWidget->addTab(_textNotificationWidget, tr("Text notifications settings")); _ui->tabWidget->addTab(_soundNotificationWidget, tr("Sound notification settigns")); _ui->tabWidget->addTab(_timerSettingsWidget, tr("Timer settings")); connect(_ui->quit, SIGNAL(clicked()), qApp, SLOT(quit())); connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(TrayIconClicked())); connect(_ui->startup, SIGNAL(toggled(bool)), this, SLOT(RunAtStartupEnabled(bool))); connect(_ui->tray, SIGNAL(toggled(bool)), this, SLOT(RunInTrayEnabled(bool))); _trayIcon->show(); #endif // Q_OS_SYMBIAN connect(_textNotificationWidget, SIGNAL(ActivationChanged(bool)), this, SLOT(TextMessageActivationChanged(bool))); connect(_textNotificationWidget, SIGNAL(TextMessageChanged(QString)), this, SLOT(TextMessageChanged(QString))); connect(_textNotificationWidget, SIGNAL(MessageListChanged(QStringList&)), this, SLOT(MessageListChanged(QStringList&))); connect(_textNotificationWidget, SIGNAL(ModeChanged(TextNotificationWidget::Mode)), this, SLOT(TextMessageModeChanged(TextNotificationWidget::Mode))); connect(_soundNotificationWidget, SIGNAL(ActivationChanged(bool)), this, SLOT(SoundNotificationActivationChanged(bool))); connect(_soundNotificationWidget, SIGNAL(FileNameChanged(QString)), this, SLOT(AudioFileNameChanged(QString))); connect(_timerSettingsWidget, SIGNAL(ModeChanged(TimerSettingsWidget::Mode)), this, SLOT(TimerModeChanged(TimerSettingsWidget::Mode))); connect(_timerSettingsWidget, SIGNAL(FixedIntervalChanged(int)), this, SLOT(FixedIntervalChanged(int))); connect(_timerSettingsWidget, SIGNAL(RandomIntervalChanged(int,int)), this, SLOT(RandomIntervalChanged(int,int))); connect(_timerSettingsWidget, SIGNAL(ModeChanged(TimerSettingsWidget::Mode)), this, SLOT(SetTimer())); connect(_timerSettingsWidget, SIGNAL(FixedIntervalChanged(int)), this, SLOT(SetTimer())); connect(_timerSettingsWidget, SIGNAL(RandomIntervalChanged(int,int)), this, SLOT(SetTimer())); connect(_audioOutput, SIGNAL(volumeChanged(qreal)), this, SLOT(VolumeChanged(qreal))); connect(_timer, SIGNAL(timeout()), this, SLOT(Alarm())); Phonon::createPath(_player, _audioOutput); SetTimer(); _soundNotificationWidget->SetAudioOutput(_audioOutput); #ifndef Q_OS_SYMBIAN _trayIcon->show(); #endif // Q_OS_SYMBIAN LoadSettings(); _ui->about->setHtml(tr("<b>MakeRT</b> is a simple application dedicated to a newbie lucid dreamers (<a href=\"http://en.wikipedia.org/wiki/Lucid_dream\">http://en.wikipedia.org/wiki/Lucid_dream</a>). It helps to reach a lucid dream by forming a habit of making reality checks.<br><br>\n" "<b>Features:</b>\n" "<ul><li>text notifications (single or randomly selected from list)\n" "<li>sound notification (by plaing audio file)\n" "<li>vibrations (only on Symbian)\n" "<li>fixed or random interval between following notifications</ul><br><br>\n" "<a href=\"mailto:[email protected]\">[email protected]</a>")); this->adjustSize(); this->setWindowIcon(QIcon(":/icon.png")); this->setWindowTitle(QString("MakeRT v.") + qApp->applicationVersion()); }
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(); }
void MainWindow::setupActions() { // File menu actions KStandardAction::quit(qApp, SLOT(quit()), actionCollection()); m_recent = KStandardAction::openRecent(this, SLOT(openScript(QUrl)), 0); actionCollection()->addAction("openrecentscript", m_recent); QAction *newQueryTab= new QAction(QIcon::fromTheme("tab-new"), tr("New Query"), this); actionCollection()->addAction("newquerytab", newQueryTab); connect(newQueryTab, &QAction::triggered, this, &MainWindow::newQueryTab); QAction *newScriptTab = new QAction(QIcon::fromTheme("document-new"), tr("New Script"), this); actionCollection()->addAction("newscripttab", newScriptTab); connect(newScriptTab, &QAction::triggered, this, &MainWindow::newBlankScriptTab); QAction *openScript = new QAction(QIcon::fromTheme("document-open"), tr("Open Script..."), this); actionCollection()->addAction("openscript", openScript); connect(openScript, &QAction::triggered, this, &MainWindow::openScriptDialog); QAction *saveScript = new QAction(QIcon::fromTheme("document-save"), tr("Save Script"), this); actionCollection()->addAction("savescript", saveScript); connect(saveScript, &QAction::triggered, this, &MainWindow::saveScript); saveScript->setEnabled(false); QAction *saveScriptAs = new QAction(QIcon::fromTheme("document-save-as"), tr("Save Script As..."), this); actionCollection()->addAction("savescriptas", saveScriptAs); connect(saveScriptAs, &QAction::triggered, this, &MainWindow::saveScriptAs); saveScriptAs->setEnabled(false); // Export submenu KActionMenu *exportmenu = new KActionMenu(QIcon::fromTheme("document-export-table"), tr("Export results"), this); actionCollection()->addAction("resultexportmenu", exportmenu); QActionGroup *exportgroup = Exporters::instance().multiTableActions(this); for(QAction *a : exportgroup->actions()) exportmenu->addAction(a); connect(exportgroup, SIGNAL(triggered(QAction*)), this, SLOT(exportResults(QAction*))); // Edit menu actions KStandardAction::find(this, SLOT(search()), actionCollection()); KStandardAction::findNext(this, SLOT(findNext()), actionCollection()); KStandardAction::findPrev(this, SLOT(findPrev()), actionCollection()); QAction *clearResultView = new QAction(tr("Clear results"), this); actionCollection()->addAction("resultsclear", clearResultView); connect(clearResultView, &QAction::triggered, this, &MainWindow::clearResults); // Settings menu actions QAction *showTableDock = new QAction(tr("Show Tables"), this); showTableDock->setCheckable(true); actionCollection()->addAction("showtables", showTableDock); QAction *showDatabaseDock = new QAction(tr("Show Databases"), this); showDatabaseDock->setCheckable(true); actionCollection()->addAction("showdatabases", showDatabaseDock); // Other actions QAction *newConnection = new QAction(tr("New Connection"), this); actionCollection()->addAction("newconnection", newConnection); connect(newConnection, &QAction::triggered, this, &MainWindow::newConnection); }
void GraphicTextDialog::setupTextActions() { QToolBar *tb = toolBar; QString rsrcPath = Qucs::bitmapDirectory(); actionTextBold = new QAction(QIcon(rsrcPath + "textbold.png"), tr("&Bold"), this); actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); QFont bold; bold.setBold(true); actionTextBold->setFont(bold); connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold())); tb->addAction(actionTextBold); actionTextBold->setCheckable(true); actionTextItalic = new QAction(QIcon(rsrcPath + "textitalic.png"), tr("&Italic"), this); actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); QFont italic; italic.setItalic(true); actionTextItalic->setFont(italic); connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic())); tb->addAction(actionTextItalic); actionTextItalic->setCheckable(true); actionTextUnderline = new QAction(QIcon(rsrcPath + "textunder.png"), tr("&Underline"), this); actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); QFont underline; underline.setUnderline(true); actionTextUnderline->setFont(underline); connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline())); tb->addAction(actionTextUnderline); actionTextUnderline->setCheckable(true); QActionGroup *grp = new QActionGroup(this); connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *))); actionAlignLeft = new QAction(QIcon(rsrcPath + "textleft.png"), tr("&Left"), grp); actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); actionAlignLeft->setCheckable(true); actionAlignCenter = new QAction(QIcon(rsrcPath + "textcenter.png"), tr("C&enter"), grp); actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); actionAlignCenter->setCheckable(true); actionAlignRight = new QAction(QIcon(rsrcPath + "textright.png"), tr("&Right"), grp); actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); actionAlignRight->setCheckable(true); actionAlignJustify = new QAction(QIcon(rsrcPath + "textjustify.png"), tr("&Justify"), grp); actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); actionAlignJustify->setCheckable(true); tb->addActions(grp->actions()); tb->addSeparator(); QPixmap pix(16, 16); pix.fill(Qt::black); actionTextColor = new QAction(pix, tr("&Color..."), this); connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor())); tb->addAction(actionTextColor); tb = new QToolBar(this); tb->setIconSize(QSize(16, 16)); mainLayout->insertWidget(2, 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)"); connect(comboStyle, SIGNAL(activated(int)), this, SLOT(textStyle(int))); comboFont = new QFontComboBox(tb); tb->addWidget(comboFont); connect(comboFont, SIGNAL(activated(const QString &)), this, SLOT(textFamily(const QString &))); comboFont->setCurrentFont(font()); 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(const QString &)), this, SLOT(textSize(const QString &))); comboSize->setCurrentIndex(comboSize->findText(QString::number(QApplication::font() .pointSize()))); tb->addSeparator(); grp = new QActionGroup(this); connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlignSubSuperScript(QAction *))); actionAlignSubscript = new QAction(QIcon(rsrcPath + "sub.png"), tr("Subscript"), grp); actionAlignSubscript->setCheckable(true); actionAlignSupersript = new QAction(QIcon(rsrcPath + "super.png"), tr("Superscript"), grp); actionAlignSupersript->setCheckable(true); actionAlignNormalscript = new QAction(QIcon(rsrcPath + "text.png"), tr("Normal"), grp); actionAlignNormalscript->setCheckable(true); tb->addActions(grp->actions()); }
StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent, intf_thread_t *_p_intf, playlist_t *p_playlist, playlist_item_t *p_root ): QWidget( _parent ), p_intf( _p_intf ) { layout = new QGridLayout( this ); layout->setSpacing( 0 ); layout->setMargin( 0 ); setMinimumWidth( 300 ); iconView = NULL; treeView = NULL; listView = NULL; viewStack = new QStackedLayout(); layout->addLayout( viewStack, 1, 0, 1, -1 ); model = new PLModel( p_playlist, p_intf, p_root, this ); currentRootId = -1; currentRootIndexId = -1; lastActivatedId = -1; locationBar = new LocationBar( model ); locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); layout->addWidget( locationBar, 0, 0 ); layout->setColumnStretch( 0, 5 ); CONNECT( locationBar, invoked( const QModelIndex & ), this, browseInto( const QModelIndex & ) ); searchEdit = new SearchLineEdit( this ); searchEdit->setMaximumWidth( 250 ); searchEdit->setMinimumWidth( 80 ); layout->addWidget( searchEdit, 0, 2 ); CONNECT( searchEdit, textChanged( const QString& ), this, search( const QString& ) ); layout->setColumnStretch( 2, 3 ); /* Button to switch views */ QToolButton *viewButton = new QToolButton( this ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setToolTip( qtr("Change playlistview")); layout->addWidget( viewButton, 0, 1 ); /* View selection menu */ viewSelectionMapper = new QSignalMapper( this ); CONNECT( viewSelectionMapper, mapped( int ), this, showView( int ) ); QActionGroup *actionGroup = new QActionGroup( this ); for( int i = 0; i < VIEW_COUNT; i++ ) { viewActions[i] = actionGroup->addAction( viewNames[i] ); viewActions[i]->setCheckable( true ); viewSelectionMapper->setMapping( viewActions[i], i ); CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() ); } BUTTONACT( viewButton, cycleViews() ); QMenu *viewMenu = new QMenu( this ); viewMenu->addActions( actionGroup->actions() ); viewButton->setMenu( viewMenu ); /* Saved Settings */ getSettings()->beginGroup("Playlist"); int i_viewMode = getSettings()->value( "view-mode", TREE_VIEW ).toInt(); getSettings()->endGroup(); showView( i_viewMode ); DCONNECT( THEMIM, leafBecameParent( input_item_t *), this, browseInto( input_item_t * ) ); CONNECT( model, currentChanged( const QModelIndex& ), this, handleExpansion( const QModelIndex& ) ); CONNECT( model, rootChanged(), this, handleRootChange() ); }
void TextEdit::setupTextActions() { QToolBar *tb = new QToolBar(this); tb->setWindowTitle(tr("Format Actions")); addToolBar(tb); QMenu *menu = new QMenu(tr("F&ormat"), this); menuBar()->addMenu(menu); actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.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())); tb->addAction(actionTextBold); menu->addAction(actionTextBold); actionTextBold->setCheckable(true); actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.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())); tb->addAction(actionTextItalic); menu->addAction(actionTextItalic); actionTextItalic->setCheckable(true); actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.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())); tb->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::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp); actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); } else { actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp); actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp); actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp); } actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.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); tb->addActions(grp->actions()); menu->addActions(grp->actions()); menu->addSeparator(); QPixmap pix(16, 16); pix.fill(Qt::black); actionTextColor = new QAction(pix, tr("&Color..."), this); connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor())); tb->addAction(actionTextColor); menu->addAction(actionTextColor); 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()))); }
void TupMainWindow::setupMenu() { // Setting up the file menu setupFileActions(); // Menu File m_fileMenu = new QMenu(tr("&File"), this); menuBar()->addMenu(m_fileMenu); // Adding Option New /* QMenu *newMenu = new QMenu(tr("&New"), this); newMenu->setIcon(QPixmap(THEME_DIR + "icons/file_new.png")); m_fileMenu->addMenu(newMenu); newMenu->addAction(m_actionManager->find("newproject")); newMenu->addSeparator(); */ m_fileMenu->addAction(m_actionManager->find("newproject")); m_fileMenu->addAction(m_actionManager->find("openproject")); m_fileMenu->addAction(m_actionManager->find("opennetproject")); m_fileMenu->addAction(m_actionManager->find("exportprojectserver")); // Adding Option Open Recent m_recentProjectsMenu = new QMenu(tr("Recents"), this); // m_recentProjectsMenu->setIcon(QPixmap(THEME_DIR + "icons/recent_files.png")); TCONFIG->beginGroup("General"); QStringList recents = TCONFIG->value("Recents").toString().split(';'); updateOpenRecentMenu(m_recentProjectsMenu, recents); m_fileMenu->addMenu(m_recentProjectsMenu); // Adding Options save, save as, close, export, import palettes and exit m_fileMenu->addAction(m_actionManager->find("saveproject")); m_fileMenu->addAction(m_actionManager->find("saveprojectas")); m_fileMenu->addAction(m_actionManager->find("closeproject")); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_actionManager->find("export")); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_actionManager->find("ImportPalettes")); m_fileMenu->addSeparator(); m_fileMenu->addAction(m_actionManager->find("Exit")); m_fileMenu->addSeparator(); // Setting up the Settings menu setupSettingsActions(); m_settingsMenu = new QMenu(tr("&Edit"), this); menuBar()->addMenu(m_settingsMenu); // Adding Options wizard and preferences //m_settingsMenu->addAction(m_actionManager->find("wizard")); m_settingsMenu->addAction(m_actionManager->find("preferences")); // Temporary out while SQA is done m_actionManager->enable("preferences", false); // Temporary out while SQA is done // Setting up the insert menu // setupInsertActions(); // Menu Insert m_insertMenu = new QMenu(tr("&Import"), this); menuBar()->addMenu(m_insertMenu); // Adding Options insert scene, insert layer and insert frame /* m_insertMenu->addAction(m_actionManager->find("InsertScene")); m_insertMenu->addAction(m_actionManager->find("InsertLayer")); m_insertMenu->addAction(m_actionManager->find("InsertFrame")); m_insertMenu->addSeparator(); */ // Adding Options import bitmap and import audio file m_insertMenu->addAction(m_actionManager->find("importbitmap")); m_insertMenu->addAction(m_actionManager->find("importbitmaparray")); m_insertMenu->addAction(m_actionManager->find("importsvg")); m_insertMenu->addAction(m_actionManager->find("importsvgarray")); //m_insertMenu->addAction(m_actionManager->find("importaudiofile")); // Setting up the window menu // setupWindowActions(); m_windowMenu = new QMenu(tr("&Window"),this); menuBar()->addMenu(m_windowMenu); // Adding Options show debug, palette, pen, library, timeline, scenes, exposure, help m_windowMenu->addAction(m_actionManager->find("show palette")); m_windowMenu->addAction(m_actionManager->find("show pen")); m_windowMenu->addAction(m_actionManager->find("show library")); m_windowMenu->addAction(m_actionManager->find("show timeline")); m_actionManager->enable("show timeline", false); m_windowMenu->addAction(m_actionManager->find("show scenes")); m_windowMenu->addAction(m_actionManager->find("show exposure")); m_windowMenu->addAction(m_actionManager->find("show help")); #if defined(QT_GUI_LIB) && defined(K_DEBUG) m_windowMenu->addAction(m_actionManager->find("show debug")); #endif // m_actionManager->enable("show help", false); m_windowMenu->addSeparator(); // Setup perspective menu m_viewMenu = new QMenu(tr("Modules"),this); QActionGroup *group = new QActionGroup(this); group->setExclusive(true); // Adding Option Animation QAction *drawingPerspective = new QAction(tr("Animation"), this); drawingPerspective->setIcon(QPixmap(THEME_DIR + "icons/animation_mode.png")); drawingPerspective->setIconVisibleInMenu(true); drawingPerspective->setShortcut(QKeySequence("Ctrl+1")); drawingPerspective->setData(Animation); group->addAction(drawingPerspective); // Adding Option Player QAction *animationPerspective = new QAction(tr("Player"), this); animationPerspective->setIcon(QPixmap(THEME_DIR + "icons/play_small.png")); animationPerspective->setIconVisibleInMenu(true); animationPerspective->setShortcut(QKeySequence("Ctrl+2")); animationPerspective->setData(Player); group->addAction(animationPerspective); // Adding Option Help QAction *helpPerspective = new QAction(tr("Help"), this); helpPerspective->setIcon(QPixmap(THEME_DIR + "icons/help_mode.png")); helpPerspective->setIconVisibleInMenu(true); helpPerspective->setShortcut(QKeySequence("Ctrl+3")); helpPerspective->setData(Help); group->addAction(helpPerspective); // Adding Option News QAction *newsPerspective = new QAction(tr("News"), this); newsPerspective->setIcon(QPixmap(THEME_DIR + "icons/news_mode.png")); newsPerspective->setIconVisibleInMenu(true); newsPerspective->setShortcut(QKeySequence("Ctrl+4")); newsPerspective->setData(News); group->addAction(newsPerspective); m_viewMenu->addActions(group->actions()); connect(group, SIGNAL(triggered(QAction *)), this, SLOT(changePerspective(QAction *))); menuBar()->addMenu(m_viewMenu); // Setting up the help menu setupHelpActions(); m_helpMenu = new QMenu(tr("&Help"),this); menuBar()->addMenu(m_helpMenu); m_helpMenu->addAction(m_actionManager->find("tipofday")); m_helpMenu->addSeparator(); m_helpMenu->addAction(m_actionManager->find("about tupi")); setMenuItemsContext(false); }
FormEditorWidget::FormEditorWidget(FormEditorView *view) : QWidget(), m_formEditorView(view) { setStyleSheet(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/formeditorstylesheet.css")))); QVBoxLayout *fillLayout = new QVBoxLayout(this); fillLayout->setMargin(0); fillLayout->setSpacing(0); setLayout(fillLayout); QList<QAction*> upperActions; m_toolActionGroup = new QActionGroup(this); QActionGroup *layoutActionGroup = new QActionGroup(this); layoutActionGroup->setExclusive(true); m_noSnappingAction = layoutActionGroup->addAction(tr("No snapping (T).")); m_noSnappingAction->setShortcut(Qt::Key_W); m_noSnappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_noSnappingAction->setCheckable(true); m_noSnappingAction->setChecked(true); m_noSnappingAction->setIcon(QPixmap(QLatin1String(":/icon/layout/no_snapping.png"))); m_snappingAndAnchoringAction = layoutActionGroup->addAction(tr("Snap to parent or sibling items and generate anchors (W).")); m_snappingAndAnchoringAction->setShortcut(Qt::Key_W); m_snappingAndAnchoringAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_snappingAndAnchoringAction->setCheckable(true); m_snappingAndAnchoringAction->setChecked(true); m_snappingAndAnchoringAction->setIcon(QPixmap(QLatin1String(":/icon/layout/snapping_and_anchoring.png"))); m_snappingAction = layoutActionGroup->addAction(tr("Snap to parent or sibling items but do not generate anchors (E).")); m_snappingAction->setShortcut(Qt::Key_E); m_snappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_snappingAction->setCheckable(true); m_snappingAction->setChecked(true); m_snappingAction->setIcon(QPixmap(QLatin1String(":/icon/layout/snapping.png"))); addActions(layoutActionGroup->actions()); upperActions.append(layoutActionGroup->actions()); QAction *separatorAction = new QAction(this); separatorAction->setSeparator(true); addAction(separatorAction); upperActions.append(separatorAction); m_showBoundingRectAction = new QAction(tr("Show bounding rectangles and stripes for empty items (A)."), this); m_showBoundingRectAction->setShortcut(Qt::Key_A); m_showBoundingRectAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_showBoundingRectAction->setCheckable(true); m_showBoundingRectAction->setChecked(true); m_showBoundingRectAction->setIcon(QPixmap(QLatin1String(":/icon/layout/boundingrect.png"))); addAction(m_showBoundingRectAction.data()); upperActions.append(m_showBoundingRectAction.data()); separatorAction = new QAction(this); separatorAction->setSeparator(true); addAction(separatorAction); upperActions.append(separatorAction); m_rootWidthAction = new LineEditAction(tr("Width"), this); connect(m_rootWidthAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemWidth(QString))); addAction(m_rootWidthAction.data()); upperActions.append(m_rootWidthAction.data()); m_rootHeightAction = new LineEditAction(tr("Height"), this); connect(m_rootHeightAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemHeight(QString))); addAction(m_rootHeightAction.data()); upperActions.append(m_rootHeightAction.data()); m_toolBox = new ToolBox(this); fillLayout->addWidget(m_toolBox.data()); m_toolBox->setLeftSideActions(upperActions); m_backgroundAction = new BackgroundAction(m_toolActionGroup.data()); connect(m_backgroundAction.data(), &BackgroundAction::backgroundChanged, this, &FormEditorWidget::changeBackgound); addAction(m_backgroundAction.data()); upperActions.append(m_backgroundAction.data()); m_toolBox->addRightSideAction(m_backgroundAction.data()); m_zoomAction = new ZoomAction(m_toolActionGroup.data()); connect(m_zoomAction.data(), SIGNAL(zoomLevelChanged(double)), SLOT(setZoomLevel(double))); addAction(m_zoomAction.data()); upperActions.append(m_zoomAction.data()); m_toolBox->addRightSideAction(m_zoomAction.data()); m_resetAction = new QAction(tr("Reset view (R)."), this); m_resetAction->setShortcut(Qt::Key_R); m_resetAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_resetAction->setIcon(QPixmap(QLatin1String(":/icon/reset.png"))); connect(m_resetAction.data(), SIGNAL(triggered(bool)), this, SLOT(resetNodeInstanceView())); addAction(m_resetAction.data()); upperActions.append(m_resetAction.data()); m_toolBox->addRightSideAction(m_resetAction.data()); m_graphicsView = new FormEditorGraphicsView(this); fillLayout->addWidget(m_graphicsView.data()); m_graphicsView.data()->setStyleSheet(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))); }
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par ) : QWidget( _par ), p_intf ( _p_i ) { setContentsMargins( 0, 3, 0, 3 ); QGridLayout *layout = new QGridLayout( this ); layout->setMargin( 0 ); layout->setSpacing( 0 ); /******************* * Left * *******************/ /* We use a QSplitter for the left part */ leftSplitter = new QSplitter( Qt::Vertical, this ); /* Source Selector */ selector = new PLSelector( this, p_intf ); leftSplitter->addWidget( selector ); /* Create a Container for the Art Label in order to have a beautiful resizing for the selector above it */ artContainer = new QStackedWidget; artContainer->setMaximumHeight( 128 ); /* Art label */ CoverArtLabel *art = new CoverArtLabel( artContainer, p_intf ); art->setToolTip( qtr( "Double click to get media information" ) ); artContainer->addWidget( art ); CONNECT( THEMIM->getIM(), artChanged( QString ), art, showArtUpdate( const QString& ) ); leftSplitter->addWidget( artContainer ); /******************* * Right * *******************/ /* Initialisation of the playlist */ playlist_t * p_playlist = THEPL; PL_LOCK; playlist_item_t *p_root = p_playlist->p_playing; PL_UNLOCK; setMinimumWidth( 400 ); PLModel *model = PLModel::getPLModel( p_intf ); #ifdef MEDIA_LIBRARY MLModel *mlmodel = new MLModel( p_intf, this ); mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel ); #else mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, NULL ); #endif /* Location Bar */ locationBar = new LocationBar( model ); locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); layout->addWidget( locationBar, 0, 0, 1, 2 ); layout->setColumnStretch( 0, 5 ); CONNECT( locationBar, invoked( const QModelIndex & ), mainView, browseInto( const QModelIndex & ) ); QHBoxLayout *topbarLayout = new QHBoxLayout(); layout->addLayout( topbarLayout, 0, 1 ); topbarLayout->setSpacing( 10 ); /* Button to switch views */ QToolButton *viewButton = new QToolButton( this ); viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) ); viewButton->setToolTip( qtr("Change playlistview") ); topbarLayout->addWidget( viewButton ); /* View selection menu */ QSignalMapper *viewSelectionMapper = new QSignalMapper( this ); CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) ); QActionGroup *actionGroup = new QActionGroup( this ); #ifndef NDEBUG # define MAX_VIEW StandardPLPanel::VIEW_COUNT #else # define MAX_VIEW StandardPLPanel::VIEW_COUNT - 1 #endif for( int i = 0; i < MAX_VIEW; i++ ) { viewActions[i] = actionGroup->addAction( viewNames[i] ); viewActions[i]->setCheckable( true ); viewSelectionMapper->setMapping( viewActions[i], i ); CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() ); } viewActions[0]->setChecked( true ); QMenu *viewMenu = new QMenu( viewButton ); viewMenu->addActions( actionGroup->actions() ); viewButton->setMenu( viewMenu ); CONNECT( viewButton, clicked(), mainView, cycleViews() ); /* Search */ searchEdit = new SearchLineEdit( this ); searchEdit->setMaximumWidth( 250 ); searchEdit->setMinimumWidth( 80 ); searchEdit->setToolTip( qtr("Search the playlist") ); topbarLayout->addWidget( searchEdit ); CONNECT( searchEdit, textChanged( const QString& ), mainView, search( const QString& ) ); CONNECT( searchEdit, searchDelayedChanged( const QString& ), mainView, searchDelayed( const QString & ) ); CONNECT( mainView, viewChanged( const QModelIndex& ), this, changeView( const QModelIndex &) ); /* Connect the activation of the selector to a redefining of the PL */ DCONNECT( selector, categoryActivated( playlist_item_t *, bool ), mainView, setRootItem( playlist_item_t *, bool ) ); mainView->setRootItem( p_root, false ); /* */ split = new PlaylistSplitter( this ); /* Add the two sides of the QSplitter */ split->addWidget( leftSplitter ); split->addWidget( mainView ); QList<int> sizeList; sizeList << 180 << 420 ; split->setSizes( sizeList ); split->setStretchFactor( 0, 0 ); split->setStretchFactor( 1, 3 ); split->setCollapsible( 1, false ); leftSplitter->setMaximumWidth( 250 ); /* In case we want to keep the splitter information */ // components shall never write there setting to a fixed location, may infer // with other uses of the same component... getSettings()->beginGroup("Playlist"); split->restoreState( getSettings()->value("splitterSizes").toByteArray()); leftSplitter->restoreState( getSettings()->value("leftSplitterGeometry").toByteArray() ); getSettings()->endGroup(); layout->addWidget( split, 1, 0, 1, -1 ); setAcceptDrops( true ); setWindowTitle( qtr( "Playlist" ) ); setWindowRole( "vlc-playlist" ); setWindowIcon( QApplication::windowIcon() ); }
EditorWidget::EditorWidget(QString theme, QWidget *parent) : QWidget(parent), editor_rich_text(new EditorRichText(this)), editor_plain_text(new CodeEditor(this, CodeEditor::Html)), pag_stacked(new QStackedWidget(this)), m_state(Clean), m_initialPag(RichTextIndex) { m_theme = theme; m_color = editor_rich_text->textColor(); connect(editor_plain_text, SIGNAL(textChanged()), this, SLOT(plainTextChanged())); connect(editor_rich_text, SIGNAL(textChanged()), this, SLOT(richTextChanged())); connect(editor_rich_text, SIGNAL(simplifyRichTextChanged(bool)), this, SLOT(richTextChanged())); connect(editor_rich_text, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); connect(editor_rich_text, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); list_smile = new QListWidget(this); list_smile->setMaximumSize(QSize(155, 16777215)); list_smile->setMovement(QListView::Static); list_smile->setResizeMode(QListView::Adjust); list_smile->setViewMode(QListView::IconMode); connect(list_smile, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(list_smile_itemDoubleClicked(QListWidgetItem*))); toolbar_find_replace = new QWidget(this); toolbar_find_replace->setMinimumSize(QSize(0, 30)); QVBoxLayout *main_layout = new QVBoxLayout(this); main_layout->setContentsMargins(0, 0, 0, 0); main_layout->setSpacing(4); QHBoxLayout *toolbar_layout = new QHBoxLayout(); toolbar_layout->setContentsMargins(0, 0, 0, 0); toolbar_layout->setSpacing(10); QToolBar *toolbar_edit = new QToolBar(this); toolbar_edit->setMinimumSize(QSize(0, 30)); toolbar_edit->setIconSize(QSize(20, 20)); toolbar_edit->setStyleSheet("QToolBar{border:0px;}"); // Save Pdf /* m_pdf_action = createAction(QIcon(m_theme +"img16/pdf.png"), tr("Exportar a PDF") +"...", false, toolbar_edit); m_pdf_action->setPriority(QAction::LowPriority); m_pdf_action->setShortcut(Qt::CTRL + Qt::Key_D); connect(m_pdf_action, SIGNAL(triggered()), this, SLOT(on_edit_export_pdf())); toolbar_edit->addAction(m_pdf_action); toolbar_edit->addSeparator();*/ // combos font and size QWidget *toolbar_font_input = new QWidget(this); QHBoxLayout *combofont_layout = new QHBoxLayout(toolbar_font_input); combofont_layout->setContentsMargins(0, 0, 2, 0); m_font_input = new QFontComboBox(toolbar_edit); connect(m_font_input, SIGNAL(activated(QString)), this, SLOT(on_edit_font(QString))); combofont_layout->addWidget(m_font_input); m_font_size_input = new QComboBox(toolbar_edit); QFontDatabase font_db; foreach(int size, font_db.standardSizes()) m_font_size_input->addItem(QString::number(size)); connect(m_font_size_input, SIGNAL(activated(QString)), this, SLOT(on_edit_font_size(QString))); combofont_layout->addWidget(m_font_size_input); // combofont_layout->setStretch(0, 1); toolbar_edit->addWidget(toolbar_font_input); toolbar_edit->addSeparator(); // cut, copy, paste m_cut_action = createAction(QIcon(m_theme +"img16/edit_cut.png"), tr("Cortar"), false, toolbar_edit); m_cut_action->setPriority(QAction::LowPriority); m_cut_action->setShortcut(QKeySequence::Cut); connect(m_cut_action, SIGNAL(triggered()), this, SLOT(on_edit_cut())); toolbar_edit->addAction(m_cut_action); m_copy_action = createAction(QIcon(m_theme +"img16/edit_copy.png"), tr("Copiar"), false, toolbar_edit); m_copy_action->setPriority(QAction::LowPriority); m_copy_action->setShortcut(QKeySequence::Copy); connect(m_copy_action, SIGNAL(triggered()), this, SLOT(on_edit_copy())); toolbar_edit->addAction(m_copy_action); m_paste_action = createAction(QIcon(m_theme +"img16/edit_paste.png"), tr("Pegar"), false, toolbar_edit); m_paste_action->setPriority(QAction::LowPriority); m_paste_action->setShortcut(QKeySequence::Paste); connect(m_paste_action, SIGNAL(triggered()), this, SLOT(on_edit_paste())); toolbar_edit->addAction(m_paste_action); toolbar_edit->addSeparator(); // undo, redo m_undo_action = createAction(QIcon(m_theme +"img16/edit_deshacer.png"), tr("Deshacer"), false, toolbar_edit); m_undo_action->setShortcut(QKeySequence::Undo); connect(m_undo_action, SIGNAL(triggered()), this, SLOT(on_edit_undo())); toolbar_edit->addAction(m_undo_action); m_redo_action = createAction(QIcon(m_theme +"img16/edit_rehacer.png"), tr("Rehacer"), false, toolbar_edit); m_redo_action->setPriority(QAction::LowPriority); m_redo_action->setShortcut(QKeySequence::Redo); connect(m_redo_action, SIGNAL(triggered()), this, SLOT(on_edit_redo())); toolbar_edit->addAction(m_redo_action); toolbar_edit->addSeparator(); // bold, italic, underline, , m_bold_action = createAction(QIcon(m_theme +"img16/edit_negrita.png"), tr("Negrita"), true, toolbar_edit); m_bold_action->setPriority(QAction::LowPriority); m_bold_action->setShortcut(Qt::CTRL + Qt::Key_B); connect(m_bold_action, SIGNAL(triggered()), this, SLOT(on_edit_bold())); toolbar_edit->addAction(m_bold_action); m_italic_action = createAction(QIcon(m_theme +"img16/edit_cursiva.png"), tr("Cursiva"), true, toolbar_edit); m_italic_action->setPriority(QAction::LowPriority); m_italic_action->setShortcut(Qt::CTRL + Qt::Key_I); connect(m_italic_action, SIGNAL(triggered()), this, SLOT(on_edit_italic())); toolbar_edit->addAction(m_italic_action); m_underline_action = createAction(QIcon(m_theme +"img16/edit_subrayada.png"), tr("Subrayado"), true, toolbar_edit); m_underline_action->setPriority(QAction::LowPriority); m_underline_action->setShortcut(Qt::CTRL + Qt::Key_U); connect(m_underline_action, SIGNAL(triggered()), this, SLOT(on_edit_underline())); toolbar_edit->addAction(m_underline_action); toolbar_edit->addSeparator(); // align: left, center, right, justify QActionGroup *grp = new QActionGroup(toolbar_edit); connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(on_edit_text_align(QAction*))); if (QApplication::isLeftToRight()) { m_align_left_action = createAction(QIcon(m_theme +"img16/edit_text_left.png"), tr("Izquierdo"), true, grp); m_align_center_action = createAction(QIcon(m_theme +"img16/edit_text_center.png"), tr("Centro"), true, grp); m_align_right_action = createAction(QIcon(m_theme +"img16/edit_text_right.png"), tr("Derecho"), true, grp); } else { m_align_right_action = createAction(QIcon(m_theme +"img16/edit_text_right.png"), tr("Derecho"), true, grp); m_align_center_action = createAction(QIcon(m_theme +"img16/edit_text_center.png"), tr("Centro"), true, grp); m_align_left_action = createAction(QIcon(m_theme +"img16/edit_text_left.png"), tr("Izquierdo"), true, grp); } m_align_justify_action = createAction(QIcon(m_theme +"img16/edit_text_justify.png"), tr("Justificado"), true, grp); m_align_left_action->setPriority(QAction::LowPriority); m_align_left_action->setShortcut(Qt::CTRL + Qt::Key_L); m_align_center_action->setPriority(QAction::LowPriority); m_align_center_action->setShortcut(Qt::CTRL + Qt::Key_E); m_align_right_action->setPriority(QAction::LowPriority); m_align_right_action->setShortcut(Qt::CTRL + Qt::Key_R); m_align_justify_action->setPriority(QAction::LowPriority); m_align_justify_action->setShortcut(Qt::CTRL + Qt::Key_J); toolbar_edit->addActions(grp->actions()); toolbar_edit->addSeparator(); // superscript, subscript m_valign_sup_action = createAction(QIcon(m_theme +"img16/edit_text_super.png"), tr("Superíndice"), true, toolbar_edit); connect(m_valign_sup_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_valign_sup())); toolbar_edit->addAction(m_valign_sup_action); m_valign_sub_action = createAction(QIcon(m_theme +"img16/edit_text_subs.png"), tr("Subíndice"), true, toolbar_edit); connect(m_valign_sub_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_valign_sub())); toolbar_edit->addAction(m_valign_sub_action); toolbar_edit->addSeparator(); // image, link, color, simplify m_image_action = createAction(QIcon(m_theme +"img16/edit_imagen.png"), tr("Imagen"), false, toolbar_edit); connect(m_image_action, SIGNAL(triggered()), this, SLOT(on_edit_image())); toolbar_edit->addAction(m_image_action); m_link_action = createAction(QIcon(m_theme +"img16/edit_enlace.png"), tr("Enlace"), true, toolbar_edit); connect(m_link_action, SIGNAL(triggered(bool)), this, SLOT(on_edit_link(bool))); toolbar_edit->addAction(m_link_action); QPixmap pix(16, 16); pix.fill(Qt::black); m_color_action = createAction(QIcon(pix), tr("Color") +"...", false, toolbar_edit); connect(m_color_action, SIGNAL(triggered()), this, SLOT(on_edit_color())); toolbar_edit->addAction(m_color_action); toolbar_edit->addSeparator(); m_simplify_richtext_action = createAction(QIcon(m_theme +"img16/edit_simplify_richtext.png"), tr("Simplificar") +" Html", true, toolbar_edit); m_simplify_richtext_action->setChecked(editor_rich_text->simplifyRichText()); connect(m_simplify_richtext_action, SIGNAL(triggered(bool)), editor_rich_text, SLOT(setSimplifyRichText(bool))); connect(editor_rich_text, SIGNAL(simplifyRichTextChanged(bool)), m_simplify_richtext_action, SLOT(setChecked(bool))); toolbar_edit->addAction(m_simplify_richtext_action); toolbar_layout->addWidget(toolbar_edit); QToolBar *toolbar_opts = new QToolBar(this); toolbar_opts->setIconSize(QSize(20, 20)); toolbar_opts->setMinimumSize(QSize(30, 30)); toolbar_opts->setStyleSheet("QToolBar{border:0px;}"); m_find_replace_text_action = createAction(QIcon(m_theme +"img16/edit_buscar.png"), tr("Buscar") +"/"+ tr("Reemplazar"), true, toolbar_opts); m_find_replace_text_action->setPriority(QAction::LowPriority); m_find_replace_text_action->setShortcut(QKeySequence::Find); connect(m_find_replace_text_action, SIGNAL(triggered(bool)), this, SLOT(on_show_find_replace(bool))); toolbar_opts->addAction(m_find_replace_text_action); m_rich_plain_action = createAction(QIcon(m_theme +"img16/script.png"), tr("Editor") +"/"+ tr("Código"), true, toolbar_opts); connect(m_rich_plain_action, SIGNAL(triggered(bool)), this, SLOT(on_show_source(bool))); toolbar_opts->addAction(m_rich_plain_action); m_smiles_action = createAction(QIcon(m_theme +"img16/smile.png"), tr("Smiles"), true, toolbar_opts); connect(m_smiles_action, SIGNAL(triggered(bool)), list_smile, SLOT(setVisible(bool))); toolbar_opts->addAction(m_smiles_action); toolbar_layout->addWidget(toolbar_opts); toolbar_layout->setStretch(0, 1); main_layout->addLayout(toolbar_layout); QHBoxLayout *edit_smiles_layout = new QHBoxLayout(); edit_smiles_layout->setContentsMargins(0, 0, 0, 0); edit_smiles_layout->setSpacing(4); QWidget *rich_edit = new QWidget(); QVBoxLayout *rich_edit_layout = new QVBoxLayout(rich_edit); rich_edit_layout->setContentsMargins(0, 0, 0, 0); rich_edit_layout->addWidget(editor_rich_text); pag_stacked->addWidget(rich_edit); QWidget *plain_edit = new QWidget(); QVBoxLayout *plain_edit_layout = new QVBoxLayout(plain_edit); plain_edit_layout->setContentsMargins(0, 0, 0, 0); plain_edit_layout->addWidget(editor_plain_text); pag_stacked->addWidget(plain_edit); connect(pag_stacked, SIGNAL(currentChanged(int)), this, SLOT(pagIndexChanged(int))); edit_smiles_layout->addWidget(pag_stacked); edit_smiles_layout->addWidget(list_smile); main_layout->addLayout(edit_smiles_layout); QGridLayout *gridLayout = new QGridLayout(toolbar_find_replace); gridLayout->setSpacing(4); gridLayout->setContentsMargins(0, 0, 0, 0); QLabel *lb_find = new QLabel(tr("Buscar")+":", toolbar_find_replace); gridLayout->addWidget(lb_find, 0, 0, 1, 1); txt_find = new QLineEdit(toolbar_find_replace); txt_find->setMinimumSize(QSize(0, 24)); connect(txt_find, SIGNAL(textChanged(QString)), this, SLOT(txtFindTextChanged(QString))); gridLayout->addWidget(txt_find, 0, 1, 1, 1); QToolButton *btnFindBack = createToolButton(QIcon(m_theme +"img16/edit_buscar_anterior.png"), tr("Buscar anterior"), toolbar_find_replace); btnFindBack->setShortcut(QKeySequence::FindPrevious); connect(btnFindBack, SIGNAL(clicked()), this, SLOT(btnFindBack_clicked())); gridLayout->addWidget(btnFindBack, 0, 2, 1, 1); QToolButton *btnFindNext = createToolButton(QIcon(m_theme +"img16/edit_buscar_siguiente.png"), tr("Buscar siguiente"), toolbar_find_replace); btnFindBack->setShortcut(QKeySequence::FindNext); connect(btnFindNext, SIGNAL(clicked()), this, SLOT(btnFindNext_clicked())); gridLayout->addWidget(btnFindNext, 0, 3, 1, 1); chkCaseSensitive = new QCheckBox(tr("Coincidir mayúsculas/minúsculas"), toolbar_find_replace); chkCaseSensitive->setChecked(false); connect(chkCaseSensitive, SIGNAL(toggled(bool)), this, SLOT(chkCaseSensitive_toggled(bool))); gridLayout->addWidget(chkCaseSensitive, 0, 5, 1, 1); QCheckBox *chkReplace = new QCheckBox(tr("Reemplazar por") +":", toolbar_find_replace); chkReplace->setChecked(false); connect(chkReplace, SIGNAL(toggled(bool)), this, SLOT(chkReplace_toggled(bool))); gridLayout->addWidget(chkReplace, 1, 0, 1, 1); txt_replace = new QLineEdit(toolbar_find_replace); txt_replace->setEnabled(false); txt_replace->setMinimumSize(QSize(0, 24)); gridLayout->addWidget(txt_replace, 1, 1, 1, 1); btnReplace = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar"), toolbar_find_replace); btnReplace->setEnabled(false); connect(btnReplace, SIGNAL(clicked()), this, SLOT(btnReplace_clicked())); gridLayout->addWidget(btnReplace, 1, 2, 1, 1); btnReplaceAndNext = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar siguiente"), toolbar_find_replace); btnReplaceAndNext->setEnabled(false); connect(btnReplaceAndNext, SIGNAL(clicked()), this, SLOT(btnReplaceAndNext_clicked())); gridLayout->addWidget(btnReplaceAndNext, 1, 3, 1, 1); btnReplaceAll = createToolButton(QIcon(m_theme +"img16/edit_reemplazar.png"), tr("Reemplazar todo"), toolbar_find_replace); btnReplaceAll->setEnabled(false); connect(btnReplaceAll, SIGNAL(clicked()), this, SLOT(btnReplaceAll_clicked())); gridLayout->addWidget(btnReplaceAll, 1, 4, 1, 1); chkWholeWords = new QCheckBox(tr("Solo palabras completas"), toolbar_find_replace); gridLayout->addWidget(chkWholeWords, 1, 5, 1, 1); main_layout->addWidget(toolbar_find_replace); #ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); #endif showSource(m_initialPag == RichTextIndex ? false : true); showFindReplace(false); showSmiles(false); setTabStopWidth(40); fontChanged(editor_rich_text->font()); colorChanged(editor_rich_text->textColor()); alignmentChanged(editor_rich_text->alignment()); }
Escena::Escena(QWidget *parent) : QGLWidget(parent) , m_camara(0) , m_camara2(0) , m_esCamaraLibre(true) , m_manipularMuebles(new QAction("Muebles", this)) , m_manipularLampara(new QAction("Lampara", this)) , m_camaraLibre(new QAction("Libre", this)) , m_camaraEsquina1(new QAction("Esquina", this)) , m_camaraFrontal1(new QAction("Frontal", this)) , m_camaraLateral1(new QAction("Lateral", this)) , m_camaraCenital1(new QAction("Cenital", this)) , m_camaraEsquina2(new QAction("Esquina", this)) , m_camaraFrontal2(new QAction("Frontal", this)) , m_camaraLateral2(new QAction("Lateral", this)) , m_camaraCenital2(new QAction("Cenital", this)) , m_proyeccion(Camara::Perspectiva) { s_self = this; QAction *proyeccionOrtogonal = new QAction("Ortogonal", this); proyeccionOrtogonal->setCheckable(true); QAction *proyeccionPerspectiva = new QAction("Perspectiva", this); proyeccionPerspectiva->setCheckable(true); proyeccionPerspectiva->setChecked(true); QAction *proyeccionOblicua = new QAction("Oblicua", this); proyeccionOblicua->setCheckable(true); QActionGroup *proyeccionGroup = new QActionGroup(this); proyeccionGroup->addAction(proyeccionOrtogonal); proyeccionGroup->addAction(proyeccionPerspectiva); proyeccionGroup->addAction(proyeccionOblicua); connect(proyeccionOrtogonal, SIGNAL(triggered()), this, SLOT(proyeccionOrtogonal())); connect(proyeccionPerspectiva, SIGNAL(triggered()), this, SLOT(proyeccionPerspectiva())); connect(proyeccionOblicua, SIGNAL(triggered()), this, SLOT(proyeccionOblicua())); connect(m_camaraLibre, SIGNAL(triggered()), this, SLOT(camaraLibre())); connect(m_camaraEsquina1, SIGNAL(triggered()), this, SLOT(camaraEsquina1())); connect(m_camaraFrontal1, SIGNAL(triggered()), this, SLOT(camaraFrontal1())); connect(m_camaraLateral1, SIGNAL(triggered()), this, SLOT(camaraLateral1())); connect(m_camaraCenital1, SIGNAL(triggered()), this, SLOT(camaraCenital1())); connect(m_camaraEsquina2, SIGNAL(triggered()), this, SLOT(camaraEsquina2())); connect(m_camaraFrontal2, SIGNAL(triggered()), this, SLOT(camaraFrontal2())); connect(m_camaraLateral2, SIGNAL(triggered()), this, SLOT(camaraLateral2())); connect(m_camaraCenital2, SIGNAL(triggered()), this, SLOT(camaraCenital2())); setFocusPolicy(Qt::StrongFocus); setMouseTracking(true); QMenuBar *menuBar = new QMenuBar(parent); m_manipularMuebles->setCheckable(true); m_manipularMuebles->setChecked(true); m_manipularLampara->setCheckable(true); QActionGroup *actionGroup = new QActionGroup(this); actionGroup->addAction(m_manipularMuebles); actionGroup->addAction(m_manipularLampara); QMenu *controlEscena = new QMenu("Control Escena", this); controlEscena->addActions(actionGroup->actions()); menuBar->addMenu(controlEscena); QMenu *habitacion1 = new QMenu("Habitacion 1", this); habitacion1->addAction(m_camaraEsquina1); habitacion1->addAction(m_camaraFrontal1); habitacion1->addAction(m_camaraLateral1); habitacion1->addAction(m_camaraCenital1); QMenu *habitacion2 = new QMenu("Habitacion 2", this); habitacion2->addAction(m_camaraEsquina2); habitacion2->addAction(m_camaraFrontal2); habitacion2->addAction(m_camaraLateral2); habitacion2->addAction(m_camaraCenital2); QMenu *posicionCamara = new QMenu("Camara", this); posicionCamara->addAction(m_camaraLibre); posicionCamara->addMenu(habitacion1); posicionCamara->addMenu(habitacion2); menuBar->addMenu(posicionCamara); QMenu *proyeccion = new QMenu("Proyeccion", this); proyeccion->addActions(proyeccionGroup->actions()); menuBar->addMenu(proyeccion); static_cast<QMainWindow*>(parent)->setMenuBar(menuBar); }
MainWindow::MainWindow( QWidget * parent ) : QMainWindow( parent ) { setupUi(this); setWindowTitle( QString("%1 %2") .arg(QApplication::applicationName()) .arg(QApplication::applicationVersion()) ); #if QT_VERSION > 0x040600 _tbPlay->setIcon( QIcon::fromTheme("media-playback-start",QIcon(":/images/media-playback-start.png")) ); _tbZoomOriginal->setIcon( QIcon::fromTheme("zoom-original", QIcon(":/images/zoom-original.png") )); _tbZoomFit->setIcon( QIcon::fromTheme("zoom-fit-best", QIcon(":/images/zoom-fit-best.png") )); #else _tbPlay->setIcon( QIcon(":/images/media-playback-start.png") ); _tbZoomOriginal->setIcon( QIcon(":/images/zoom-original.png") ); _tbZoomFit->setIcon( QIcon(":/images/zoom-fit-best.png") ); #endif // Menu and actions QMenu * menu; menu = menuBar()->addMenu( tr("&File") ); QAction * action = new QAction( tr("&Save presets..."), this ); action->setShortcut( QKeySequence::SaveAs ); #if QT_VERSION > 0x040600 action->setIcon( QIcon::fromTheme( "document-save-as" ) ); #endif menu->addAction( action ); connect( action, SIGNAL( triggered() ), this, SLOT( savePresetsFile() ) ); action = new QAction( tr("&Quit"), this ); action->setShortcut( QKeySequence::Quit ); #if QT_VERSION > 0x040600 action->setIcon( QIcon::fromTheme( "application-exit", QIcon(":/images/application-exit.png") ) ); #else action->setIcon( QIcon(":/images/application-exit.png") ); #endif connect( action, SIGNAL( triggered() ), qApp, SLOT( closeAllWindows() ) ); menu->addAction( action ); QMenu * webcamMenu; QStringList args = qApp->arguments(); if ( args.size() == 3 && args[1] == "--cam" ) { int index = args[2].toInt(); _webcam.setCameraIndex( index ); } else { // Find available cameras, and setup the default one QList<int> cameras = WebcamGrabber::getWebcamList(); if ( cameras.size() > 1 ) { webcamMenu = menuBar()->addMenu( tr("&Webcam") ); QActionGroup * actionGroup = new QActionGroup(this); actionGroup->setExclusive(true); QAction * action; QList<int>::iterator it = cameras.begin(); while (it != cameras.end()) { action = new QAction( QString("Webcam %1").arg(*it), this ); action->setData( QVariant( *it ) ); action->setCheckable( true ); webcamMenu->addAction( action ); actionGroup->addAction( action ); ++it; } actionGroup->actions()[0]->setChecked(true); _webcam.setCameraIndex( actionGroup->actions()[0]->data().toInt() ); connect( actionGroup, SIGNAL( triggered( QAction * ) ), this, SLOT( onWebcamSelected( QAction * ) ) ); } else if ( cameras.size() == 1 ) {
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(); }
PianorollEditor::PianorollEditor(QWidget* parent) : QMainWindow(parent) { setWindowTitle(QString("MuseScore")); waveView = 0; _score = 0; staff = 0; QWidget* mainWidget = new QWidget; QToolBar* tb = addToolBar(tr("toolbar1")); tb->addAction(getAction("undo")); tb->addAction(getAction("redo")); tb->addSeparator(); tb->addAction(getAction("sound-on")); #ifdef HAS_MIDI tb->addAction(getAction("midi-on")); #endif QAction* a = getAction("follow"); a->setCheckable(true); a->setChecked(preferences.followSong); tb->addAction(a); tb->addSeparator(); tb->addAction(getAction("rewind")); tb->addAction(getAction("play")); tb->addSeparator(); showWave = new QAction(tr("Wave"), tb); showWave->setToolTip(tr("show wave display")); showWave->setCheckable(true); showWave->setChecked(false); connect(showWave, SIGNAL(toggled(bool)), SLOT(showWaveView(bool))); tb->addAction(showWave); //------------- tb = addToolBar(tr("toolbar2")); VoiceSelector* vs = new VoiceSelector; tb->addWidget(vs); tb->addSeparator(); tb->addWidget(new QLabel(tr("Cursor:"))); pos = new Awl::PosLabel; tb->addWidget(pos); Awl::PitchLabel* pl = new Awl::PitchLabel(); tb->addWidget(pl); tb->addSeparator(); tb->addWidget(new QLabel(tr("Velocity:"))); veloType = new QComboBox; veloType->addItem(tr("offset"), MScore::OFFSET_VAL); veloType->addItem(tr("user"), MScore::USER_VAL); tb->addWidget(veloType); velocity = new QSpinBox; velocity->setRange(-1, 127); velocity->setSpecialValueText("--"); velocity->setReadOnly(true); tb->addWidget(velocity); tb->addWidget(new QLabel(tr("Pitch:"))); pitch = new Awl::PitchEdit; pitch->setReadOnly(true); tb->addWidget(pitch); //------------- qreal xmag = .1; ruler = new Ruler; ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); ruler->setFixedHeight(rulerHeight); ruler->setMag(xmag, 1.0); Piano* piano = new Piano; piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); piano->setFixedWidth(pianoWidth); gv = new PianoView; gv->scale(xmag, 1.0); gv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); hsb = new QScrollBar(Qt::Horizontal); connect(gv->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(rangeChanged(int,int))); // layout QHBoxLayout* hbox = new QHBoxLayout; hbox->setSpacing(0); hbox->addWidget(piano); hbox->addWidget(gv); split = new QSplitter(Qt::Vertical); split->setLineWidth(0); split->setMidLineWidth(0); QWidget* split1 = new QWidget; split1->setLayout(hbox); split->addWidget(split1); QGridLayout* layout = new QGridLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); mainWidget->setLayout(layout); layout->setColumnMinimumWidth(0, pianoWidth + 5); layout->setSpacing(0); layout->addWidget(tb, 0, 1, 1, 1); layout->addWidget(ruler, 1, 1); layout->addWidget(split, 2, 0, 1, 2); layout->addWidget(hsb, 3, 1); setCentralWidget(mainWidget); connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int))); connect(gv, SIGNAL(magChanged(double,double)), ruler, SLOT(setMag(double,double))); connect(gv, SIGNAL(magChanged(double,double)), piano, SLOT(setMag(double,double))); connect(gv, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(pitchChanged(int)), piano, SLOT(setPitch(int))); connect(piano, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(gv, SIGNAL(posChanged(const Pos&)), ruler, SLOT(setPos(const Pos&))); connect(ruler, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(hsb, SIGNAL(valueChanged(int)), SLOT(setXpos(int))); connect(gv, SIGNAL(xposChanged(int)), SLOT(setXPos(int))); connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(setXpos(int))); connect(ruler, SIGNAL(locatorMoved(int)), SLOT(moveLocator(int))); connect(veloType, SIGNAL(activated(int)), SLOT(veloTypeChanged(int))); connect(velocity, SIGNAL(valueChanged(int)), SLOT(velocityChanged(int))); connect(gv->scene(), SIGNAL(selectionChanged()), SLOT(selectionChanged())); connect(piano, SIGNAL(keyPressed(int)), SLOT(keyPressed(int))); connect(piano, SIGNAL(keyReleased(int)), SLOT(keyReleased(int))); resize(800, 400); QActionGroup* ag = new QActionGroup(this); a = new QAction(this); a->setData("delete"); a->setShortcut(Qt::Key_Delete); ag->addAction(a); addActions(ag->actions()); connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*))); setXpos(0); }
/** Constructor */ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) : RWindow("MainWindow", parent, flags) { /* Invoke the Qt Designer generated QObject setup routine */ ui.setupUi(this); /* Create RshareSettings object */ _settings = new RshareSettings(); setWindowTitle(tr("RetroShare %1 a secure decentralised commmunication platform").arg(retroshareVersion())); mSMPlayer = NULL; // Setting icons this->setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); /* Create all the dialogs of which we only want one instance */ _bandwidthGraph = new BandwidthGraph(); messengerWindow = new MessengerWindow(); _preferencesWindow = new PreferencesWindow(); applicationWindow = new ApplicationWindow(); applicationWindow->hide(); /** Left Side ToolBar**/ connect(ui.actionAdd_Friend, SIGNAL(triggered() ), this , SLOT( addFriend() ) ); connect(ui.actionAdd_Share, SIGNAL(triggered() ), this , SLOT( openShareManager() ) ); connect(ui.actionOptions, SIGNAL(triggered()), this, SLOT( showPreferencesWindow()) ); connect(ui.actionMessenger, SIGNAL(triggered()), this, SLOT( showMessengerWindow()) ); connect(ui.actionSMPlayer, SIGNAL(triggered()), this, SLOT( showsmplayer()) ); connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT( showabout()) ); connect(ui.actionColor, SIGNAL(triggered()), this, SLOT( setStyle()) ); //connect(ui.actionSettings, SIGNAL(triggered()), this, SLOT( showSettings()) ); /** adjusted quit behaviour: trigger a warning that can be switched off in the saved config file RetroShare.conf */ connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(doQuit())); /* load the StyleSheet*/ loadStyleSheet(Rshare::stylesheet()); /* Create the Main pages and actions */ QActionGroup *grp = new QActionGroup(this); ui.stackPages->add(networkDialog = new NetworkDialog(ui.stackPages), createPageAction(QIcon(IMAGE_NETWORK2), tr("Network"), grp)); ui.stackPages->add(peersDialog = new PeersDialog(ui.stackPages), createPageAction(QIcon(IMAGE_PEERS), tr("Friends"), grp)); //PeersFeed *peersFeed = NULL; //ui.stackPages->add(peersFeed = new PeersFeed(ui.stackPages), // createPageAction(QIcon(IMAGE_PEERS), tr("Peers"), grp)); #ifdef TURTLE_HOPPING ui.stackPages->add(turtleDialog = new TurtleSearchDialog(ui.stackPages), createPageAction(QIcon(IMAGE_TURTLE), tr("Turtle"), grp)); #endif ui.stackPages->add(searchDialog = new SearchDialog(ui.stackPages), createPageAction(QIcon(IMAGE_SEARCH), tr("Search"), grp)); ui.stackPages->add(transfersDialog = new TransfersDialog(ui.stackPages), createPageAction(QIcon(IMAGE_TRANSFERS), tr("Transfers"), grp)); //TransferFeed *transferFeed = NULL; //ui.stackPages->add(transferFeed = new TransferFeed(ui.stackPages), // createPageAction(QIcon(IMAGE_LINKS), tr("Transfers"), grp)); ui.stackPages->add(sharedfilesDialog = new SharedFilesDialog(ui.stackPages), createPageAction(QIcon(IMAGE_FILES), tr("Files"), grp)); //MsgFeed *msgFeed = NULL; //ui.stackPages->add(msgFeed = new MsgFeed(ui.stackPages), // createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); ui.stackPages->add(messagesDialog = new MessagesDialog(ui.stackPages), createPageAction(QIcon(IMAGE_MESSAGES), tr("Messages"), grp)); LinksDialog *linksDialog = NULL; #ifdef RS_RELEASE_VERSION channelsDialog = NULL; ui.stackPages->add(linksDialog = new LinksDialog(ui.stackPages), createPageAction(QIcon(IMAGE_LINKS), tr("Links Cloud"), grp)); ForumsDialog *forumsDialog = NULL; ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages), createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); #else channelsDialog = NULL; ui.stackPages->add(linksDialog = new LinksDialog(ui.stackPages), createPageAction(QIcon(IMAGE_LINKS), tr("Links Cloud"), grp)); ChannelFeed *channelFeed = NULL; ui.stackPages->add(channelFeed = new ChannelFeed(ui.stackPages), createPageAction(QIcon(IMAGE_CHANNELS), tr("Channels"), grp)); ForumsDialog *forumsDialog = NULL; ui.stackPages->add(forumsDialog = new ForumsDialog(ui.stackPages), createPageAction(QIcon(IMAGE_FORUMS), tr("Forums"), grp)); #endif NewsFeed *newsFeed = NULL; ui.stackPages->add(newsFeed = new NewsFeed(ui.stackPages), createPageAction(QIcon(IMAGE_NEWSFEED), tr("News Feed"), grp)); #ifdef PLUGINMGR ui.stackPages->add(pluginsPage = new PluginsPage(ui.stackPages), createPageAction(QIcon(IMAGE_PLUGINS), tr("Plugins"), grp)); #endif /* Create the toolbar */ ui.toolBar->addActions(grp->actions()); ui.toolBar->addSeparator(); connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *))); #ifdef RS_RELEASE_VERSION #else addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui.toolBar), SLOT(showApplWindow())); #endif /* Select the first action */ grp->actions()[0]->setChecked(true); /* also an empty list of chat windows */ messengerWindow->setChatDialog(peersDialog); // Allow to play files from SharedFilesDialog. connect(sharedfilesDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); connect(transfersDialog, SIGNAL(playFiles( QStringList )), this, SLOT(playFiles( QStringList ))); /** StatusBar section **/ peerstatus = new PeerStatus(); statusBar()->addWidget(peerstatus); dhtstatus = new DHTStatus(); statusBar()->addWidget(dhtstatus); natstatus = new NATStatus(); statusBar()->addWidget(natstatus); QWidget *widget = new QWidget(); QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(widget->sizePolicy().hasHeightForWidth()); widget->setSizePolicy(sizePolicy); QHBoxLayout *horizontalLayout = new QHBoxLayout(widget); horizontalLayout->setContentsMargins(0, 0, 0, 0); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); _hashing_info_label = new QLabel(widget) ; _hashing_info_label->setObjectName(QString::fromUtf8("label")); horizontalLayout->addWidget(_hashing_info_label); QSpacerItem *horizontalSpacer = new QSpacerItem(1000, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer); statusBar()->addPermanentWidget(widget); _hashing_info_label->hide() ; ratesstatus = new RatesStatus(); statusBar()->addPermanentWidget(ratesstatus); /******* Status Bar end ******/ /* Create the actions that will go in the tray menu */ createActions(); /****** * This is an annoying warning I get all the time... * (no help!) * * if (!QSystemTrayIcon::isSystemTrayAvailable()) QMessageBox::warning(0, tr("System tray is unavailable"), tr("System tray unavailable")); ******/ // Tray icon Menu menu = new QMenu(this); QObject::connect(menu, SIGNAL(aboutToShow()), this, SLOT(updateMenu())); toggleVisibilityAction = menu->addAction(QIcon(IMAGE_RETROSHARE), tr("Show/Hide"), this, SLOT(toggleVisibilitycontextmenu())); menu->addSeparator(); menu->addAction(_messengerwindowAct); menu->addAction(_messagesAct); menu->addAction(_bandwidthAct); /* bandwidth only in development version */ #ifdef RS_RELEASE_VERSION #else menu->addAction(_appAct); #endif menu->addAction(_prefsAct); //menu->addAction(_smplayerAct); menu->addAction(_helpAct); menu->addSeparator(); menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized())); menu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized())); menu->addSeparator(); menu->addAction(QIcon(IMAGE_CLOSE), tr("&Quit"), this, SLOT(doQuit())); // End of Icon Menu // Create the tray icon trayIcon = new QSystemTrayIcon(this); trayIcon->setToolTip(tr("RetroShare")); trayIcon->setContextMenu(menu); trayIcon->setIcon(QIcon(IMAGE_RETROSHARE)); connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggleVisibility(QSystemTrayIcon::ActivationReason))); trayIcon->show(); QTimer *timer = new QTimer(this); timer->connect(timer, SIGNAL(timeout()), this, SLOT(updateStatus())); timer->start(1000); }