PTeraStitcher::PTeraStitcher(QWidget *parent) : QMainWindow(parent) { #ifdef TSP_DEBUG printf("TeraStitcher plugin [thread %d] >> PTeraStitcher created\n", this->thread()->currentThreadId()); #endif //initializing members parentWidget = parent; fileMenu = menuBar()->addMenu("File"); closeVolumeAction = new QAction("Close volume", this); closeVolumeAction->setIcon(QIcon(":/icons/close.png")); closeVolumeAction->setShortcut(QKeySequence("Ctrl+C")); connect(closeVolumeAction, SIGNAL(triggered()), this, SLOT(closeVolumeTriggered())); fileMenu->addAction(closeVolumeAction); exitAction = new QAction("Quit", this); exitAction->setShortcut(QKeySequence("Ctrl+Q")); fileMenu->addAction(exitAction); connect(exitAction, SIGNAL(triggered()), this, SLOT(exit())); optionsMenu = menuBar()->addMenu("Options"); modeOptionsMenu = optionsMenu->addMenu("Mode"); QActionGroup* modeSelectionGroup = new QActionGroup(this); modeSelectionGroup->setExclusive(true); modeBasicAction = new QAction("Basic", this); modeAdvancedAction = new QAction("Advanced", this); modeBasicAction->setCheckable(true); modeAdvancedAction->setCheckable(true); modeAdvancedAction->setChecked(true); modeSelectionGroup->addAction(modeBasicAction); modeSelectionGroup->addAction(modeAdvancedAction); modeOptionsMenu->addAction(modeBasicAction); modeOptionsMenu->addAction(modeAdvancedAction); connect(modeBasicAction, SIGNAL(changed()), this, SLOT(modeChanged())); connect(modeAdvancedAction, SIGNAL(changed()), this, SLOT(modeChanged())); helpMenu = menuBar()->addMenu("Help"); aboutAction = new QAction("About", this); aboutAction->setIcon(QIcon(":/icons/about.png")); helpMenu->addAction(aboutAction); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); // connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); //creating widgets tabs = new QMyTabWidget(); tabImport = PTabImport::instance(tabs, 0); tabDisplComp = PTabDisplComp::instance(tabs, 1); tabDisplComp->setEnabled(false); tabDisplProj = PTabDisplProj::instance(tabs, 2); tabDisplProj->setEnabled(false); tabDisplThres = PTabDisplThresh::instance(tabs, 3); tabDisplThres->setEnabled(false); tabPlaceTiles = PTabPlaceTiles::instance(tabs, 4); tabPlaceTiles->setEnabled(false); #ifdef VAA3D_TERASTITCHER tabMergeTiles = PTabMergeTiles::instance(tabs, 5, V3D_env); #else tabMergeTiles = PTabMergeTiles::instance(tabs, 5); #endif tabMergeTiles->setEnabled(false); tabs->addTab(tabImport, tr("Import")); tabs->addTab(tabDisplComp, tr("Align")); tabs->addTab(tabDisplProj, tr("Project")); tabs->addTab(tabDisplThres, tr("Threshold")); tabs->addTab(tabPlaceTiles, tr("Place")); tabs->addTab(tabMergeTiles, tr("Merge")); tabs->setTabIcon(0, QIcon(":/icons/number1.png")); tabs->setTabIcon(1, QIcon(":/icons/number2.png")); tabs->setTabIcon(2, QIcon(":/icons/number3.png")); tabs->setTabIcon(3, QIcon(":/icons/number4.png")); tabs->setTabIcon(4, QIcon(":/icons/number5.png")); tabs->setTabIcon(5, QIcon(":/icons/number6.png")); progressBar = new QProgressBar(this); startButton = new QPushButton(this); startButton->setIcon(QIcon(":/icons/start.png")); startButton->setText("Start"); /*startAllButton = new QPushButton(this); startAllButton->setIcon(QIcon(":/icons/startall.png")); startAllButton->setText("Start all");*/ stopButton = new QPushButton(this); stopButton->setIcon(QIcon(":/icons/stop.png")); stopButton->setText("Stop"); statusBar()->showMessage("Ready."); //statusBar()->setFont(QFont("",8)); //helpBox = new QHelpBox(this); //helpBox->setDefaultMessage("<b>What's this?</b><br><i>Move the mouse over an object and its description will be displayed here.</i>"); //layout QHBoxLayout* bottomBar = new QHBoxLayout(); bottomBar->addWidget(progressBar, 1); bottomBar->addWidget(startButton); bottomBar->addWidget(stopButton); //bottomBar->setContentsMargins(5,0,5,5); QVBoxLayout* layout = new QVBoxLayout(); layout->addWidget(tabs, 1); //helpBox->setFixedHeight(100); //QGridLayout *helpBoxLayout = new QGridLayout(); // helpBoxLayout->addWidget(helpBox, 0, 0); //helpBoxLayout->setContentsMargins(5,5,5,0); //layout->addLayout(helpBoxLayout); layout->addLayout(bottomBar, 0); //layout->setSpacing(0); //layout->setContentsMargins(0,0,0,0); QWidget *centralWidget = new QWidget(this); centralWidget->setLayout(layout); setCentralWidget(centralWidget); // signals and slots connect(startButton, SIGNAL(clicked()), this, SLOT(startButtonClicked())); //connect(startAllButton, SIGNAL(clicked()), this, SLOT(startAllButtonClicked())); connect(stopButton, SIGNAL(clicked()), this, SLOT(stopButtonClicked())); connect(ts::QProgressSender::instance(), SIGNAL(sendProgressBarChanged(int, int, int, std::string)), this, SLOT(progressBarChanged(int, int, int, std::string)), Qt::QueuedConnection); /*tabImport->installEventFilter(this); tabDisplComp->installEventFilter(this); tabDisplProj->installEventFilter(this); tabDisplThres->installEventFilter(this); tabPlaceTiles->installEventFilter(this); tabMergeTiles->installEventFilter(this); tabImport->slice_spinbox->installEventFilter(this); tabImport->preview_button->installEventFilter(this);*/ //window attributes setWindowTitle(tr("TeraStitcher v") + (terastitcher::version + " (with Qt " + ts::qtversion + ")").c_str()); //setWindowFlags(Qt::WindowStaysOnTopHint); //resize(1024, 768); // setFixedSize(800, 600); // setFixedSize(1024, 768); show(); move(QApplication::desktop()->screen()->rect().center() - rect().center()); reset(); }
void BitcoinGUI::createActions() { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setToolTip(tr("Show general overview of wallet")); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); miningAction = new QAction(QIcon(":/icons/mining"), tr("&Mining"), this); miningAction->setToolTip(tr("Configure mining")); miningAction->setCheckable(true); //tabGroup->addAction(miningAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setToolTip(tr("Browse transaction history")); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this); addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels")); addressBookAction->setCheckable(true); addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); tabGroup->addAction(addressBookAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this); receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments")); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this); sendCoinsAction->setToolTip(tr("Send coins to a Geotoken address")); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setToolTip(tr("Sign a message to prove you own a Bitcoin address")); tabGroup->addAction(signMessageAction); verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); verifyMessageAction->setToolTip(tr("Verify a message to ensure it was signed with a specified Bitcoin address")); tabGroup->addAction(verifyMessageAction); #ifdef FIRST_CLASS_MESSAGING firstClassMessagingAction = new QAction(QIcon(":/icons/edit"), tr("S&ignatures"), this); firstClassMessagingAction->setToolTip(signMessageAction->toolTip() + QString(". / ") + verifyMessageAction->toolTip() + QString(".")); firstClassMessagingAction->setCheckable(true); tabGroup->addAction(firstClassMessagingAction); #endif connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(miningAction, SIGNAL(triggered()), this, SLOT(gotoMiningPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); #ifdef FIRST_CLASS_MESSAGING connect(firstClassMessagingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); // Always start with the sign message tab for FIRST_CLASS_MESSAGING connect(firstClassMessagingAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); #endif quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setToolTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Geotoken"), this); aboutAction->setToolTip(tr("Show information about Geotoken")); aboutAction->setMenuRole(QAction::AboutRole); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setToolTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setToolTip(tr("Modify configuration options for Geotoken")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("Show/Hide &Geotoken"), this); toggleHideAction->setToolTip(tr("Show or hide the Geotoken window")); exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this); exportAction->setToolTip(tr("Export the data in the current tab to a file")); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet")); encryptWalletAction->setCheckable(true); backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setToolTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption")); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool))); connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); }
MainWindow::MainWindow() : DemosMainWindow() { setupUi(this); this->graphicsView->setAcceptDrops(false); // Add a GraphicItem for the Periodic triangulation pt_gi = new CGAL::Qt::PeriodicTriangulationGraphicsItem<Periodic_DT>(&triang); QObject::connect(this, SIGNAL(changed()), pt_gi, SLOT(modelChanged())); pt_gi->setVerticesPen(QPen(Qt::red, 5, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); scene.addItem(pt_gi); // Add a GraphicItem for the Voronoi diagram vgi = new CGAL::Qt::PeriodicTriangulationVoronoiGraphicsItem<Periodic_DT>(&triang); QObject::connect(this, SIGNAL(changed()), vgi, SLOT(modelChanged())); vgi->setEdgesPen(QPen(Qt::blue, 0, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); scene.addItem(vgi); vgi->hide(); // Setup input handlers. They get events before the scene gets them // and the input they generate is passed to the triangulation with // the signal/slot mechanism pt_pi = new CGAL::Qt::TriangulationPointInputAndConflictZone<Periodic_DT>(&scene, &triang, this ); QObject::connect(pt_pi, SIGNAL(generate(CGAL::Object)), this, SLOT(processInput(CGAL::Object))); pt_mp = new CGAL::Qt::TriangulationMovingPoint<Periodic_DT>(&triang, this); // TriangulationMovingPoint<Periodic_DT> emits a modelChanged() signal each // time the moving point moves. // The following connection is for the purpose of emitting changed(). QObject::connect(pt_mp, SIGNAL(modelChanged()), this, SIGNAL(changed())); pt_cz = new CGAL::Qt::TriangulationConflictZone<Periodic_DT>(&scene, &triang, this); QObject::connect(pt_cz, SIGNAL(modelChanged()), this, SIGNAL(changed())); pt_rv = new CGAL::Qt::TriangulationRemoveVertex<Periodic_DT>(&triang, this); QObject::connect(pt_rv, SIGNAL(modelChanged()), this, SIGNAL(changed())); pt_cc = new CGAL::Qt::TriangulationCircumcircle<Periodic_DT>(&scene, &triang, this); pt_cc ->setPen(QPen(::Qt::black, .01)); QObject::connect(pt_cc, SIGNAL(modelChanged()), this, SIGNAL(changed())); // // Manual handling of actions // QObject::connect(this->actionQuit, SIGNAL(triggered()), this, SLOT(close())); // We put mutually exclusive actions in an QActionGroup QActionGroup* ag = new QActionGroup(this); ag->addAction(this->actionInsertPoint); ag->addAction(this->actionMovingPoint); ag->addAction(this->actionCircumcenter); ag->addAction(this->actionShowConflictZone); // Check two actions this->actionInsertPoint->setChecked(true); this->actionShowDelaunay->setChecked(true); // // Setup the scene and the view // scene.setItemIndexMethod(QGraphicsScene::NoIndex); scene.setSceneRect(0, 0, 1, 1); this->graphicsView->setScene(&scene); this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down this->graphicsView->matrix().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView this->addNavigation(this->graphicsView); this->setupStatusBar(); this->setupOptionsMenu(); this->addAboutDemo(":/cgal/help/about_Periodic_2_triangulation_2.html"); this->addAboutCGAL(); this->addRecentFiles(this->menuFile, this->actionQuit); connect(this, SIGNAL(openRecentFile(QString)), this, SLOT(open(QString))); on_actionRecenter_triggered(); }
void BitcoinGUI::createActions() { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setToolTip(tr("Show general overview of wallet")); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this); sendCoinsAction->setToolTip(tr("Send coins to a FlavorCoin address")); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this); receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments")); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setToolTip(tr("Browse transaction history")); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this); addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels")); addressBookAction->setCheckable(true); addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); tabGroup->addAction(addressBookAction); connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setToolTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About FlavorCoin"), this); aboutAction->setToolTip(tr("Show information about FlavorCoin")); aboutAction->setMenuRole(QAction::AboutRole); aboutQtAction = new QAction(QIcon(":/icons/qtlogo-64"), tr("About &Qt"), this); aboutQtAction->setToolTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setToolTip(tr("Modify configuration options for FlavorCoin")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet")); encryptWalletAction->setCheckable(true); backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setToolTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption")); unlockWalletAction = new QAction(QIcon(":/icons/lock_open"), tr("&Unlock Wallet..."), this); unlockWalletAction->setToolTip(tr("Unlock wallet")); lockWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Lock Wallet"), this); lockWalletAction->setToolTip(tr("Lock wallet")); signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this); exportAction->setToolTip(tr("Export the data in the current tab to a file")); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool))); connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); connect(unlockWalletAction, SIGNAL(triggered()), this, SLOT(unlockWallet())); connect(lockWalletAction, SIGNAL(triggered()), this, SLOT(lockWallet())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); }
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)) ); }
void BitcoinGUI::createActions(const NetworkStyle *networkStyle) { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(SingleColorIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); sendCoinsAction = new QAction(SingleColorIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Send coins to a Chikun address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); sendCoinsMenuAction = new QAction(TextColorIcon(":/icons/send"), sendCoinsAction->text(), this); sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip()); sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip()); receiveCoinsAction = new QAction(SingleColorIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and chikun: URIs)")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); receiveCoinsMenuAction = new QAction(TextColorIcon(":/icons/receiving_addresses"), receiveCoinsAction->text(), this); receiveCoinsMenuAction->setStatusTip(receiveCoinsAction->statusTip()); receiveCoinsMenuAction->setToolTip(receiveCoinsMenuAction->statusTip()); historyAction = new QAction(SingleColorIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); #ifdef ENABLE_WALLET // These showNormalIfMinimized are needed because Send Coins and Receive Coins // can be triggered from the tray menu, and need to show the GUI to be useful. connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsMenuAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); #endif // ENABLE_WALLET quitAction = new QAction(TextColorIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(TextColorIcon(":/icons/about"), tr("&About KUN KORE"), this); aboutAction->setStatusTip(tr("Show information about KUN KORE")); aboutAction->setMenuRole(QAction::AboutRole); aboutQtAction = new QAction(TextColorIcon(":/icons/about_qt"), tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(TextColorIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for KUN KORE")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(TextColorIcon(":/icons/about"), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); encryptWalletAction = new QAction(TextColorIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); backupWalletAction = new QAction(TextColorIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(TextColorIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); signMessageAction = new QAction(TextColorIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your Chikun addresses to prove you own them")); verifyMessageAction = new QAction(TextColorIcon(":/icons/verify"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Chikun addresses")); openRPCConsoleAction = new QAction(TextColorIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); usedSendingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); usedReceivingAddressesAction = new QAction(TextColorIcon(":/icons/address-book"), tr("&Receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); openAction = new QAction(TextColorIcon(":/icons/open"), tr("Open &URI..."), this); openAction->setStatusTip(tr("Open a bitcoin: URI or payment request")); showHelpMessageAction = new QAction(TextColorIcon(":/icons/info"), tr("&Command-line options"), this); showHelpMessageAction->setStatusTip(tr("Show the KUN KORE help message to get a list with possible Chikun command-line options")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked())); #ifdef ENABLE_WALLET if(walletFrame) { connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool))); connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses())); connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses())); connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked())); } #endif // ENABLE_WALLET }
ViewerWindow::ViewerWindow(): fileLoaded_(false){ setupUi( this ); #ifdef WIN32 //Reposition console window QRect myRegion=frameGeometry(); QPoint putAt=myRegion.topRight(); SetWindowPos(GetConsoleWindow(),winId(),putAt.x()+1,putAt.y(),0,0,SWP_NOSIZE); #endif mProdconn.ConnectConsumer( mViewer->InputPort()[0] ); mViewer->SetColorTransformType( M4D::GUI::ctTransferFunction1D ); action2D->setChecked(true); //---TF Editor--- std::vector<M4D::GUI::TF::Size> dataCT1D(1, 4096); //default CT editingSystem_ = M4D::GUI::TFPalette::Ptr(new M4D::GUI::TFPalette(this, dataCT1D)); editingSystem_->setupDefault(); bool previewUpdateConnected = QObject::connect(&(*editingSystem_), SIGNAL(UpdatePreview(M4D::GUI::TF::Size)), this, SLOT(updatePreview(M4D::GUI::TF::Size))); tfAssert(previewUpdateConnected); QDockWidget* dockWidget = new QDockWidget("Transfer Function Palette", this); dockWidget->setWidget( &(*editingSystem_) ); dockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures); dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas); addDockWidget(Qt::LeftDockWidgetArea, dockWidget); dockWidget->setFloating(true); //---Timer--- changeChecker_.setInterval( 500 ); QObject::connect( &changeChecker_, SIGNAL( timeout() ), this, SLOT( updateTransferFunction() ) ); //---Viewer Switch--- QActionGroup *viewerTypeSwitch = new QActionGroup( this ); QSignalMapper *viewerTypeSwitchSignalMapper = new QSignalMapper( this ); viewerTypeSwitch->setExclusive( true ); viewerTypeSwitch->addAction( action2D ); viewerTypeSwitch->addAction( action3D ); viewerTypeSwitchSignalMapper->setMapping( action2D, M4D::GUI::rt2DAlignedSlices ); viewerTypeSwitchSignalMapper->setMapping( action3D, M4D::GUI::rt3D ); QObject::connect( action2D, SIGNAL( triggered() ), viewerTypeSwitchSignalMapper, SLOT( map() ) ); QObject::connect( action3D, SIGNAL( triggered() ), viewerTypeSwitchSignalMapper, SLOT( map() ) ); QObject::connect( viewerTypeSwitchSignalMapper, SIGNAL( mapped ( int ) ), this, SLOT( changeViewerType( int ) ) ); //---Mouse info--- QLabel *infoLabel = new QLabel(); statusbar->addWidget( infoLabel ); mViewer->setMouseTracking ( true ); QObject::connect( mViewer, SIGNAL( MouseInfoUpdate( const QString & ) ), infoLabel, SLOT( setText( const QString & ) ) ); //---Default buffer--- buffer_ = Buffer1D::Ptr(new Buffer1D(4096, Interval(0.0f, 4095.0f))); #ifdef TF_NDEBUG showMaximized(); #endif #ifndef TF_NDEBUG show(); #endif //show must be called before setting transfer function buffer mViewer->SetTransferFunctionBuffer(buffer_); }
void ProgramWindow::setup(const QList<LinkedFile *> & linkedFiles, const QString & alternativePath) { resize(500,700); setAttribute(Qt::WA_DeleteOnClose, true); QFrame * mainFrame = new QFrame(this); QFrame * headerFrame = createHeader(); QFrame * centerFrame = createCenter(); layout()->setMargin(0); layout()->setSpacing(0); QGridLayout *layout = new QGridLayout(mainFrame); layout->setMargin(0); layout->setSpacing(0); layout->addWidget(headerFrame,0,0); layout->addWidget(centerFrame,1,0); setCentralWidget(mainFrame); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); QSettings settings; if (!settings.value("programwindow/state").isNull()) { restoreState(settings.value("programwindow/state").toByteArray()); } if (!settings.value("programwindow/geometry").isNull()) { restoreGeometry(settings.value("programwindow/geometry").toByteArray()); } installEventFilter(this); // Setup new menu bar for the programming window QMenuBar *menubar = menuBar(); QMenu *currentMenu = menubar->addMenu(tr("&File")); QAction *currentAction = new QAction(tr("New"), this); currentAction->setShortcut(tr("Ctrl+N")); currentAction->setStatusTip(tr("Create a new program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(addTab())); currentMenu->addAction(currentAction); currentAction = new QAction(tr("&Open..."), this); currentAction->setShortcut(tr("Ctrl+O")); currentAction->setStatusTip(tr("Open a program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(loadProgramFile())); currentMenu->addAction(currentAction); currentMenu->addSeparator(); m_saveAction = new QAction(tr("&Save"), this); m_saveAction->setShortcut(tr("Ctrl+S")); m_saveAction->setStatusTip(tr("Save the current program")); connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save())); currentMenu->addAction(m_saveAction); currentAction = new QAction(tr("Rename"), this); currentAction->setStatusTip(tr("Rename the current program")); connect(currentAction, SIGNAL(triggered()), this, SLOT(rename())); currentMenu->addAction(currentAction); currentAction = new QAction(tr("Duplicate tab"), this); currentAction->setStatusTip(tr("Copies the current program into a new tab")); connect(currentAction, SIGNAL(triggered()), this, SLOT(duplicateTab())); currentMenu->addAction(currentAction); currentMenu->addSeparator(); currentAction = new QAction(tr("Remove tab"), this); currentAction->setShortcut(tr("Ctrl+W")); currentAction->setStatusTip(tr("Remove the current program from the sketch")); connect(currentAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab())); currentMenu->addAction(currentAction); currentMenu->addSeparator(); m_printAction = new QAction(tr("&Print..."), this); m_printAction->setShortcut(tr("Ctrl+P")); m_printAction->setStatusTip(tr("Print the current program")); connect(m_printAction, SIGNAL(triggered()), this, SLOT(print())); currentMenu->addAction(m_printAction); currentMenu->addSeparator(); currentAction = new QAction(tr("&Quit"), this); currentAction->setShortcut(tr("Ctrl+Q")); currentAction->setStatusTip(tr("Quit the application")); currentAction->setMenuRole(QAction::QuitRole); connect(currentAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows2())); currentMenu->addAction(currentAction); currentMenu = menubar->addMenu(tr("&Edit")); m_undoAction = new QAction(tr("Undo"), this); m_undoAction->setShortcuts(QKeySequence::Undo); m_undoAction->setEnabled(false); connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo())); currentMenu->addAction(m_undoAction); m_redoAction = new QAction(tr("Redo"), this); m_redoAction->setShortcuts(QKeySequence::Redo); m_redoAction->setEnabled(false); connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo())); currentMenu->addAction(m_redoAction); currentMenu->addSeparator(); m_cutAction = new QAction(tr("&Cut"), this); m_cutAction->setShortcut(tr("Ctrl+X")); m_cutAction->setStatusTip(tr("Cut selection")); m_cutAction->setEnabled(false); connect(m_cutAction, SIGNAL(triggered()), this, SLOT(cut())); currentMenu->addAction(m_cutAction); m_copyAction = new QAction(tr("&Copy"), this); m_copyAction->setShortcut(tr("Ctrl+C")); m_copyAction->setStatusTip(tr("Copy selection")); m_copyAction->setEnabled(false); connect(m_copyAction, SIGNAL(triggered()), this, SLOT(copy())); currentMenu->addAction(m_copyAction); currentAction = new QAction(tr("&Paste"), this); currentAction->setShortcut(tr("Ctrl+V")); currentAction->setStatusTip(tr("Paste clipboard contents")); // TODO: Check clipboard status and disable appropriately here connect(currentAction, SIGNAL(triggered()), this, SLOT(paste())); currentMenu->addAction(currentAction); currentMenu->addSeparator(); currentAction = new QAction(tr("&Select All"), this); currentAction->setShortcut(tr("Ctrl+A")); currentAction->setStatusTip(tr("Select all text")); connect(currentAction, SIGNAL(triggered()), this, SLOT(selectAll())); currentMenu->addAction(currentAction); currentMenu = menuBar()->addMenu(tr("&Program")); QMenu *languageMenu = new QMenu(tr("Select language"), this); currentMenu->addMenu(languageMenu); QString currentLanguage = settings.value("programwindow/language", "").toString(); QStringList languages = getAvailableLanguages(); QActionGroup *languageActionGroup = new QActionGroup(this); foreach (QString language, languages) { currentAction = new QAction(language, this); currentAction->setCheckable(true); m_languageActions.insert(language, currentAction); languageActionGroup->addAction(currentAction); languageMenu->addAction(currentAction); if (!currentLanguage.isEmpty()) { if (language.compare(currentLanguage) == 0) { currentAction->setChecked(true); } } }
void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints) { mapper = new QSignalMapper(this); connect(mapper, SIGNAL(mapped(int)), this, SLOT(setCorner(int))); QMenu *corner_menu = dockWidgetMenu->addMenu(tr("Top left corner")); QActionGroup *group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Top dock area"), group, mapper, 0); ::addAction(corner_menu, tr("Left dock area"), group, mapper, 1); corner_menu = dockWidgetMenu->addMenu(tr("Top right corner")); group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Top dock area"), group, mapper, 2); ::addAction(corner_menu, tr("Right dock area"), group, mapper, 3); corner_menu = dockWidgetMenu->addMenu(tr("Bottom left corner")); group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 4); ::addAction(corner_menu, tr("Left dock area"), group, mapper, 5); corner_menu = dockWidgetMenu->addMenu(tr("Bottom right corner")); group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 6); ::addAction(corner_menu, tr("Right dock area"), group, mapper, 7); dockWidgetMenu->addSeparator(); static const struct Set { const char * name; uint flags; Qt::DockWidgetArea area; } sets [] = { #ifndef Q_WS_MAC { "Black", 0, Qt::LeftDockWidgetArea }, #else { "Black", Qt::Drawer, Qt::LeftDockWidgetArea }, #endif { "White", 0, Qt::RightDockWidgetArea }, { "Red", 0, Qt::TopDockWidgetArea }, { "Green", 0, Qt::TopDockWidgetArea }, { "Blue", 0, Qt::BottomDockWidgetArea }, { "Yellow", 0, Qt::BottomDockWidgetArea } }; const int setCount = sizeof(sets) / sizeof(Set); for (int i = 0; i < setCount; ++i) { ColorSwatch *swatch = new ColorSwatch(tr(sets[i].name), this, Qt::WindowFlags(sets[i].flags)); if (i%2) swatch->setWindowIcon(QIcon(QPixmap(":/res/qt.png"))); if (qstrcmp(sets[i].name, "Blue") == 0) { BlueTitleBar *titlebar = new BlueTitleBar(swatch); swatch->setTitleBarWidget(titlebar); connect(swatch, SIGNAL(topLevelChanged(bool)), titlebar, SLOT(updateMask())); connect(swatch, SIGNAL(featuresChanged(QDockWidget::DockWidgetFeatures)), titlebar, SLOT(updateMask())); #ifdef Q_WS_QWS QPalette pal = palette(); pal.setBrush(backgroundRole(), QColor(0,0,0,0)); swatch->setPalette(pal); #endif } QString name = QString::fromLatin1(sets[i].name); if (customSizeHints.contains(name)) swatch->setCustomSizeHint(customSizeHints.value(name)); addDockWidget(sets[i].area, swatch); dockWidgetMenu->addMenu(swatch->menu); } createDockWidgetAction = new QAction(tr("Add dock widget..."), this); connect(createDockWidgetAction, SIGNAL(triggered()), this, SLOT(createDockWidget())); destroyDockWidgetMenu = new QMenu(tr("Destroy dock widget"), this); destroyDockWidgetMenu->setEnabled(false); connect(destroyDockWidgetMenu, SIGNAL(triggered(QAction*)), this, SLOT(destroyDockWidget(QAction*))); dockWidgetMenu->addSeparator(); dockWidgetMenu->addAction(createDockWidgetAction); dockWidgetMenu->addMenu(destroyDockWidgetMenu); }
void PMeshViewer::createActions() { newProjectAction = new QAction(tr("&New Project"), this); newProjectAction->setIcon(QIcon(":/images/new.png")); newProjectAction->setShortcut(tr("Ctrl+N")); newProjectAction->setStatusTip(tr("Create a new project")); //connect(newProjectAction, SIGNAL(triggered()), //this, SLOT(newProject())); openProjectAction = new QAction(tr("&Open Project"), this); openProjectAction->setIcon(QIcon(":/images/open.png")); openProjectAction->setShortcut(tr("Ctrl+O")); openProjectAction->setStatusTip(tr("Open a project file")); connect(openProjectAction, SIGNAL(triggered()), this, SLOT(openProject())); saveProjectAction = new QAction(tr("&Save Project"), this); saveProjectAction->setIcon(QIcon(":/images/save.png")); saveProjectAction->setShortcut(tr("Ctrl+S")); saveProjectAction->setStatusTip(tr("Save project to file")); connect(saveProjectAction, SIGNAL(triggered()), this, SLOT(saveProject())); saveProjectAsAction = new QAction(tr("Save Project &As"), this); saveProjectAsAction->setIcon(QIcon(":/images/saveas.png")); saveProjectAsAction->setShortcut(tr("Ctrl+A")); saveProjectAsAction->setStatusTip(tr("Save project to another file")); connect(saveProjectAsAction, SIGNAL(triggered()), this, SLOT(saveProjectAs())); loadDirAction = new QAction(tr("Load Mesh by &Directory"), this); loadDirAction->setIcon(QIcon(":/images/loaddir.png")); loadDirAction->setShortcut(tr("Ctrl+D")); loadDirAction->setStatusTip(tr("Load mesh files in a directory")); connect(loadDirAction, SIGNAL(triggered()), this, SLOT(loadDir())); loadMeshAction = new QAction(tr("Load Mesh by &File"), this); loadMeshAction->setIcon(QIcon(":/images/loadmesh.png")); loadMeshAction->setShortcut(tr("Ctrl+F")); loadMeshAction->setStatusTip(tr("Load meshes by file names")); connect(loadMeshAction, SIGNAL(triggered()), this, SLOT(loadMesh())); addMeshAction = new QAction(tr("Add Mesh by File"), this); addMeshAction->setIcon(QIcon(":/images/addmesh.png")); addMeshAction->setStatusTip(tr("Add meshes by file names")); connect(addMeshAction, SIGNAL(triggered()), this, SLOT(addMesh())); deleteMeshAction = new QAction(tr("Delete Mesh"), this); deleteMeshAction->setIcon(QIcon(":/images/deletemesh.png")); deleteMeshAction->setStatusTip(tr("Delete loaded meshes")); connect(deleteMeshAction, SIGNAL(triggered()), this, SLOT(deleteMesh())); saveDirPlyAction = new QAction(tr("in PLY format"), this); connect(saveDirPlyAction, SIGNAL(triggered()), this, SLOT(saveDirPly())); saveDirStlAction = new QAction(tr("in STL format"), this); connect(saveDirStlAction, SIGNAL(triggered()), this, SLOT(saveDirStl())); exitAction = new QAction(tr("E&xit"), this); exitAction->setShortcut(tr("Ctrl+Q")); exitAction->setStatusTip(tr("Exit Mesh Viewer")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); saveViewAction = new QAction(tr("Save &View"), this); saveViewAction->setIcon(QIcon(":/images/saveview.png")); saveViewAction->setShortcut(tr("Shift+V")); saveViewAction->setStatusTip(tr("Save current view to a file")); connect(saveViewAction, SIGNAL(triggered()), this, SLOT(saveView())); frontFaceAction = new QAction(tr("&Hide Front Faces"), this); frontFaceAction->setIcon(QIcon(":/images/hide.png")); frontFaceAction->setShortcut(tr("Shift+H")); frontFaceAction->setStatusTip(tr("Hide/show front faces")); frontFaceAction->setCheckable(true); connect(frontFaceAction, SIGNAL(triggered()), this, SLOT(toggleFrontFace())); smoothSurfaceAction = new QAction(tr("&Smooth Surface"), this); smoothSurfaceAction->setShortcut(tr("Shift+S")); smoothSurfaceAction->setStatusTip(tr("Smooth surface")); smoothSurfaceAction->setCheckable(true); connect(smoothSurfaceAction, SIGNAL(triggered()), this, SLOT(setSmoothSurface())); flatSurfaceAction = new QAction(tr("&Flat Surface"), this); flatSurfaceAction->setShortcut(tr("Shift+F")); flatSurfaceAction->setStatusTip(tr("Flat surface")); flatSurfaceAction->setCheckable(true); connect(flatSurfaceAction, SIGNAL(triggered()), this, SLOT(setFlatSurface())); flatLinesAction = new QAction(tr("Flat &Lines"), this); flatLinesAction->setShortcut(tr("Shift+L")); flatLinesAction->setStatusTip(tr("Flat surface & lines")); flatLinesAction->setCheckable(true); connect(flatLinesAction, SIGNAL(triggered()), this, SLOT(setFlatLines())); wireFrameAction = new QAction(tr("&Wire Frame"), this); wireFrameAction->setShortcut(tr("Shift+W")); wireFrameAction->setStatusTip(tr("Wire frame")); wireFrameAction->setCheckable(true); connect(wireFrameAction, SIGNAL(triggered()), this, SLOT(setWireFrame())); QActionGroup *meshModeGroup = new QActionGroup(this); meshModeGroup->addAction(smoothSurfaceAction); meshModeGroup->addAction(flatSurfaceAction); meshModeGroup->addAction(flatLinesAction); meshModeGroup->addAction(wireFrameAction); smoothSurfaceAction->setChecked(true); toggleRightDockWidgetAction = rightDockWidget->toggleViewAction(); toggleRightDockWidgetAction->setIcon(QIcon(":/images/list.png")); infoAction = new QAction(tr("&Info"), this); infoAction->setIcon(QIcon(":/images/info.png")); infoAction->setShortcut(tr("Ctrl+I")); infoAction->setStatusTip(tr("Data information")); connect(infoAction, SIGNAL(triggered()), this, SLOT(info())); helpAction = new QAction(tr("&Help"), this); helpAction->setIcon(QIcon(":/images/help.png")); helpAction->setShortcut(tr("Ctrl+H")); helpAction->setStatusTip(tr("Help information")); connect(helpAction, SIGNAL(triggered()), this, SLOT(help())); aboutAction = new QAction(tr("About"), this); aboutAction->setStatusTip(tr("About this software")); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); }
PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags) : QDesignerPropertyEditor(parent, flags), m_core(core), m_propertySheet(0), m_currentBrowser(0), m_treeBrowser(0), m_propertyManager(new DesignerPropertyManager(m_core, this)), m_dynamicGroup(0), m_updatingBrowser(false), m_stackedWidget(new QStackedWidget), m_filterWidget(new FilterWidget(0, FilterWidget::LayoutAlignNone)), m_buttonIndex(-1), m_treeIndex(-1), m_addDynamicAction(new QAction(createIconSet(QLatin1String("plus.png")), tr("Add Dynamic Property..."), this)), m_removeDynamicAction(new QAction(createIconSet(QLatin1String("minus.png")), tr("Remove Dynamic Property"), this)), m_sortingAction(new QAction(createIconSet(QLatin1String("sort.png")), tr("Sorting"), this)), m_coloringAction(new QAction(createIconSet(QLatin1String("color.png")), tr("Color Groups"), this)), m_treeAction(new QAction(tr("Tree View"), this)), m_buttonAction(new QAction(tr("Drop Down Button View"), this)), m_classLabel(new ElidingLabel), m_sorting(false), m_coloring(false), m_brightness(false) { QVector<QColor> colors; colors.reserve(6); colors.push_back(QColor(255, 230, 191)); colors.push_back(QColor(255, 255, 191)); colors.push_back(QColor(191, 255, 191)); colors.push_back(QColor(199, 255, 255)); colors.push_back(QColor(234, 191, 255)); colors.push_back(QColor(255, 191, 239)); m_colors.reserve(colors.count()); const int darknessFactor = 250; for (int i = 0; i < colors.count(); i++) { QColor c = colors.at(i); m_colors.push_back(qMakePair(c, c.darker(darknessFactor))); } QColor dynamicColor(191, 207, 255); QColor layoutColor(255, 191, 191); m_dynamicColor = qMakePair(dynamicColor, dynamicColor.darker(darknessFactor)); m_layoutColor = qMakePair(layoutColor, layoutColor.darker(darknessFactor)); updateForegroundBrightness(); QActionGroup *actionGroup = new QActionGroup(this); m_treeAction->setCheckable(true); m_treeAction->setIcon(createIconSet(QLatin1String("widgets/listview.png"))); m_buttonAction->setCheckable(true); m_buttonAction->setIcon(createIconSet(QLatin1String("dropdownbutton.png"))); actionGroup->addAction(m_treeAction); actionGroup->addAction(m_buttonAction); connect(actionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotViewTriggered(QAction*))); // Add actions QActionGroup *addDynamicActionGroup = new QActionGroup(this); connect(addDynamicActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(slotAddDynamicProperty(QAction*))); QMenu *addDynamicActionMenu = new QMenu(this); m_addDynamicAction->setMenu(addDynamicActionMenu); m_addDynamicAction->setEnabled(false); QAction *addDynamicAction = addDynamicActionGroup->addAction(tr("String...")); addDynamicAction->setData(static_cast<int>(QVariant::String)); addDynamicActionMenu->addAction(addDynamicAction); addDynamicAction = addDynamicActionGroup->addAction(tr("Bool...")); addDynamicAction->setData(static_cast<int>(QVariant::Bool)); addDynamicActionMenu->addAction(addDynamicAction); addDynamicActionMenu->addSeparator(); addDynamicAction = addDynamicActionGroup->addAction(tr("Other...")); addDynamicAction->setData(static_cast<int>(QVariant::Invalid)); addDynamicActionMenu->addAction(addDynamicAction); // remove m_removeDynamicAction->setEnabled(false); connect(m_removeDynamicAction, SIGNAL(triggered()), this, SLOT(slotRemoveDynamicProperty())); // Configure QAction *configureAction = new QAction(tr("Configure Property Editor"), this); configureAction->setIcon(createIconSet(QLatin1String("configure.png"))); QMenu *configureMenu = new QMenu(this); configureAction->setMenu(configureMenu); m_sortingAction->setCheckable(true); connect(m_sortingAction, SIGNAL(toggled(bool)), this, SLOT(slotSorting(bool))); m_coloringAction->setCheckable(true); connect(m_coloringAction, SIGNAL(toggled(bool)), this, SLOT(slotColoring(bool))); configureMenu->addAction(m_sortingAction); configureMenu->addAction(m_coloringAction); #if QT_VERSION >= 0x04FF00 configureMenu->addSeparator(); configureMenu->addAction(m_treeAction); configureMenu->addAction(m_buttonAction); #endif // Assemble toolbar QToolBar *toolBar = new QToolBar; toolBar->addWidget(m_filterWidget); toolBar->addWidget(createDropDownButton(m_addDynamicAction)); toolBar->addAction(m_removeDynamicAction); toolBar->addWidget(createDropDownButton(configureAction)); // Views QScrollArea *buttonScroll = new QScrollArea(m_stackedWidget); m_buttonBrowser = new QtButtonPropertyBrowser(buttonScroll); buttonScroll->setWidgetResizable(true); buttonScroll->setWidget(m_buttonBrowser); m_buttonIndex = m_stackedWidget->addWidget(buttonScroll); connect(m_buttonBrowser, SIGNAL(currentItemChanged(QtBrowserItem*)), this, SLOT(slotCurrentItemChanged(QtBrowserItem*))); m_treeBrowser = new QtTreePropertyBrowser(m_stackedWidget); m_treeBrowser->setRootIsDecorated(false); m_treeBrowser->setPropertiesWithoutValueMarked(true); m_treeBrowser->setResizeMode(QtTreePropertyBrowser::Interactive); m_treeIndex = m_stackedWidget->addWidget(m_treeBrowser); connect(m_treeBrowser, SIGNAL(currentItemChanged(QtBrowserItem*)), this, SLOT(slotCurrentItemChanged(QtBrowserItem*))); connect(m_filterWidget, SIGNAL(filterChanged(QString)), this, SLOT(setFilter(QString))); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(toolBar); layout->addWidget(m_classLabel); layout->addSpacerItem(new QSpacerItem(0,1)); layout->addWidget(m_stackedWidget); layout->setMargin(0); layout->setSpacing(0); m_treeFactory = new DesignerEditorFactory(m_core, this); m_treeFactory->setSpacing(0); m_groupFactory = new DesignerEditorFactory(m_core, this); QtVariantPropertyManager *variantManager = m_propertyManager; m_buttonBrowser->setFactoryForManager(variantManager, m_groupFactory); m_treeBrowser->setFactoryForManager(variantManager, m_treeFactory); m_stackedWidget->setCurrentIndex(m_treeIndex); m_currentBrowser = m_treeBrowser; m_treeAction->setChecked(true); connect(m_groupFactory, SIGNAL(resetProperty(QtProperty*)), this, SLOT(slotResetProperty(QtProperty*))); connect(m_treeFactory, SIGNAL(resetProperty(QtProperty*)), this, SLOT(slotResetProperty(QtProperty*))); connect(variantManager, SIGNAL(valueChanged(QtProperty*,QVariant,bool)), this, SLOT(slotValueChanged(QtProperty*,QVariant,bool))); // retrieve initial settings QDesignerSettingsInterface *settings = m_core->settingsManager(); settings->beginGroup(QLatin1String(SettingsGroupC)); #if QT_VERSION >= 0x040500 const SettingsView view = settings->value(QLatin1String(ViewKeyC), TreeView).toInt() == TreeView ? TreeView : ButtonView; #endif // Coloring not available unless treeview and not sorted m_sorting = settings->value(QLatin1String(SortedKeyC), false).toBool(); m_coloring = settings->value(QLatin1String(ColorKeyC), true).toBool(); const QVariantMap expansionState = settings->value(QLatin1String(ExpansionKeyC), QVariantMap()).toMap(); settings->endGroup(); // Apply settings m_sortingAction->setChecked(m_sorting); m_coloringAction->setChecked(m_coloring); #if QT_VERSION >= 0x040500 switch (view) { case TreeView: m_currentBrowser = m_treeBrowser; m_stackedWidget->setCurrentIndex(m_treeIndex); m_treeAction->setChecked(true); break; case ButtonView: m_currentBrowser = m_buttonBrowser; m_stackedWidget->setCurrentIndex(m_buttonIndex); m_buttonAction->setChecked(true); break; } #endif // Restore expansionState from QVariant map if (!expansionState.empty()) { const QVariantMap::const_iterator cend = expansionState.constEnd(); for (QVariantMap::const_iterator it = expansionState.constBegin(); it != cend; ++it) m_expansionState.insert(it.key(), it.value().toBool()); } updateActionsState(); }
void KPrView::initActions() { setComponentData(KPrFactory::componentData()); if (!koDocument()->isReadWrite() ) setXMLFile( "stage_readonly.rc" ); else setXMLFile( "stage.rc" ); // do special stage stuff here m_actionExportHtml = new KAction(i18n("Export as HTML..."), this); actionCollection()->addAction("file_export_html", m_actionExportHtml); connect(m_actionExportHtml, SIGNAL(triggered()), this, SLOT(exportToHtml())); m_actionViewModeNormal = new KAction(m_normalMode->name(), this); m_actionViewModeNormal->setCheckable(true); m_actionViewModeNormal->setChecked(true); m_actionViewModeNormal->setShortcut(QKeySequence("CTRL+F5")); actionCollection()->addAction("view_normal", m_actionViewModeNormal); connect(m_actionViewModeNormal, SIGNAL(triggered()), this, SLOT(showNormal())); m_actionViewModeNotes = new KAction(m_notesMode->name(), this); m_actionViewModeNotes->setCheckable(true); m_actionViewModeNotes->setShortcut(QKeySequence("CTRL+F6")); actionCollection()->addAction("view_notes", m_actionViewModeNotes); connect(m_actionViewModeNotes, SIGNAL(triggered()), this, SLOT(showNotes())); m_actionViewModeSlidesSorter = new KAction(m_slidesSorterMode->name(), this); m_actionViewModeSlidesSorter->setCheckable(true); m_actionViewModeSlidesSorter->setShortcut(QKeySequence("CTRL+F7")); actionCollection()->addAction("view_slides_sorter", m_actionViewModeSlidesSorter); connect(m_actionViewModeSlidesSorter, SIGNAL(triggered()), this, SLOT(showSlidesSorter())); if ( QAction *action = actionCollection()->action("view_masterpages") ) action->setShortcut(QKeySequence("CTRL+F8")); m_actionInsertPictures = new KAction(i18n("Insert Pictures as Slides..."), this); actionCollection()->addAction("insert_pictures", m_actionInsertPictures); connect(m_actionInsertPictures, SIGNAL(activated()), this, SLOT(insertPictures())); QActionGroup *viewModesGroup = new QActionGroup(this); viewModesGroup->addAction(m_actionViewModeNormal); viewModesGroup->addAction(m_actionViewModeNotes); viewModesGroup->addAction(m_actionViewModeSlidesSorter); m_actionCreateAnimation = new KAction( i18n( "Create Appear Animation" ), this ); actionCollection()->addAction( "edit_createanimation", m_actionCreateAnimation ); connect( m_actionCreateAnimation, SIGNAL(activated()), this, SLOT(createAnimation()) ); m_actionEditCustomSlideShows = new KAction( i18n( "Edit Custom Slide Shows..." ), this ); actionCollection()->addAction( "edit_customslideshows", m_actionEditCustomSlideShows ); connect( m_actionEditCustomSlideShows, SIGNAL(activated()), this, SLOT(editCustomSlideShows()) ); m_actionStartPresentation = new KActionMenu(koIcon("view-presentation"), i18n("Start Presentation"), this); actionCollection()->addAction( "slideshow_start", m_actionStartPresentation ); connect( m_actionStartPresentation, SIGNAL(activated()), this, SLOT(startPresentation()) ); KAction* action = new KAction( i18n( "From Current Slide" ), this ); action->setShortcut(QKeySequence("Shift+F5")); m_actionStartPresentation->addAction( action ); connect( action, SIGNAL(activated()), this, SLOT(startPresentation()) ); action = new KAction( i18n( "From First Slide" ), this ); action->setShortcut(QKeySequence("F5")); m_actionStartPresentation->addAction( action ); connect( action, SIGNAL(activated()), this, SLOT(startPresentationFromBeginning()) ); KToggleAction *showStatusbarAction = new KToggleAction(i18n("Show Status Bar"), this); showStatusbarAction->setCheckedState(KGuiItem(i18n("Hide Status Bar"))); showStatusbarAction->setToolTip(i18n("Shows or hides the status bar")); actionCollection()->addAction("showStatusBar", showStatusbarAction); connect(showStatusbarAction, SIGNAL(toggled(bool)), this, SLOT(showStatusBar(bool))); //Update state of status bar action if (showStatusbarAction && statusBar()){ showStatusbarAction->setChecked(! statusBar()->isHidden()); } action = new KAction( i18n( "Configure Slide Show..." ), this ); actionCollection()->addAction( "slideshow_configure", action ); connect( action, SIGNAL(activated()), this, SLOT(configureSlideShow()) ); action = new KAction( i18n( "Configure Presenter View..." ), this ); actionCollection()->addAction( "slideshow_presenterview", action ); connect( action, SIGNAL(activated()), this, SLOT(configurePresenterView()) ); m_actionDrawOnPresentation = new KAction( i18n( "Draw on the presentation..." ), this ); m_actionDrawOnPresentation->setShortcut(Qt::Key_P); m_actionDrawOnPresentation->setShortcutContext(Qt::ApplicationShortcut); actionCollection()->addAction( "draw_on_presentation", m_actionDrawOnPresentation ); connect( m_actionDrawOnPresentation, SIGNAL(activated()), this, SLOT(drawOnPresentation()) ); m_actionDrawOnPresentation->setEnabled(false); m_actionHighlightPresentation = new KAction( i18n( "Highlight the presentation..." ), this ); m_actionHighlightPresentation->setShortcut(Qt::Key_H); m_actionHighlightPresentation->setShortcutContext(Qt::ApplicationShortcut); actionCollection()->addAction( "highlight_presentation", m_actionHighlightPresentation ); connect( m_actionHighlightPresentation, SIGNAL(activated()), this, SLOT(highlightPresentation()) ); m_actionHighlightPresentation->setEnabled(false); m_actionBlackPresentation = new KAction( i18n( "Blackscreen on the presentation..." ), this ); m_actionBlackPresentation->setShortcut(Qt::Key_B); m_actionBlackPresentation->setShortcutContext(Qt::ApplicationShortcut); actionCollection()->addAction( "black_presentation", m_actionBlackPresentation ); connect( m_actionBlackPresentation, SIGNAL(activated()), this, SLOT(blackPresentation()) ); m_actionBlackPresentation->setEnabled(false); connect(tabBar(), SIGNAL(currentChanged(int)), this, SLOT(changeViewByIndex(int))); }
void BitcoinGUI::createActions(bool fIsTestnet) { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Send coins to an IPCoin address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and ipcoin: URIs)")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); // These showNormalIfMinimized are needed because Send Coins and Receive Coins // can be triggered from the tray menu, and need to show the GUI to be useful. connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); if (!fIsTestnet) aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About IPCoin"), this); else aboutAction = new QAction(QIcon(":/icons/bitcoin_testnet"), tr("&About IPCoin"), this); aboutAction->setStatusTip(tr("Show information about IPCoin")); aboutAction->setMenuRole(QAction::AboutRole); #if QT_VERSION < 0x050000 aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this); #else aboutQtAction = new QAction(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this); #endif aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for IPCoin")); optionsAction->setMenuRole(QAction::PreferencesRole); if (!fIsTestnet) toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this); else toggleHideAction = new QAction(QIcon(":/icons/bitcoin_testnet"), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your IPCoin addresses to prove you own them")); verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified IPCoin addresses")); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Used sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("Used &receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); openAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_FileIcon), tr("Open URI..."), this); openAction->setStatusTip(tr("Open a ipcoin: URI or payment request")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool))); connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses())); connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses())); connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked())); }
void BitcoinGUI::createActions() { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setToolTip(tr("Show general overview of wallet")); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setToolTip(tr("Browse transaction history")); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this); addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels")); addressBookAction->setCheckable(true); addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); tabGroup->addAction(addressBookAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this); receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments")); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this); sendCoinsAction->setToolTip(tr("Send coins to a bitcoin address")); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); messageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message"), this); messageAction->setToolTip(tr("Prove you control an address")); #ifdef FIRST_CLASS_MESSAGING messageAction->setCheckable(true); #endif tabGroup->addAction(messageAction); connect(overviewAction, SIGNAL(triggered()), this, SLOT(show())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(show())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(show())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(show())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(show())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(messageAction, SIGNAL(triggered()), this, SLOT(show())); connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage())); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setToolTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About %1").arg(qApp->applicationName()), this); aboutAction->setToolTip(tr("Show information about Bitcoin")); aboutAction->setMenuRole(QAction::AboutRole); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setToolTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setToolTip(tr("Modify configuration options for bitcoin")); optionsAction->setMenuRole(QAction::PreferencesRole); openBitcoinAction = new QAction(QIcon(":/icons/bitcoin"), tr("Open &Bitcoin"), this); openBitcoinAction->setToolTip(tr("Show the Bitcoin window")); exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this); exportAction->setToolTip(tr("Export the current view to a file")); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this); encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet")); encryptWalletAction->setCheckable(true); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase"), this); changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(showNormal())); connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool))); connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); }
void BitcoinGUI::createActions() { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setToolTip(tr("Show general overview of wallet")); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setToolTip(tr("Browse transaction history")); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); mintingAction = new QAction(QIcon(":/icons/history"), tr("&Minting"), this); mintingAction->setToolTip(tr("Show your minting capacity")); mintingAction->setCheckable(true); mintingAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); tabGroup->addAction(mintingAction); addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this); addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels")); addressBookAction->setCheckable(true); addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_6)); tabGroup->addAction(addressBookAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this); receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments")); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this); sendCoinsAction->setToolTip(tr("Send coins to a Paycoin address")); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); messageAction = new QAction(QIcon(":/icons/edit"), tr("Sign/Verify &message"), this); messageAction->setToolTip(tr("Prove you control an address")); #ifdef FIRST_CLASS_MESSAGING messageAction->setCheckable(true); #endif tabGroup->addAction(messageAction); multisigAction = new QAction(QIcon(":/icons/send"), tr("Multisig"), this); tabGroup->addAction(multisigAction); connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(mintingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(mintingAction, SIGNAL(triggered()), this, SLOT(gotoMintingPage())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(messageAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(messageAction, SIGNAL(triggered()), this, SLOT(gotoMessagePage())); connect(multisigAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(multisigAction, SIGNAL(triggered()), this, SLOT(gotoMultisigPage())); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setToolTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(QIcon(":/icons/paycoin_tooltip"), tr("&About Paycoin"), this); aboutAction->setToolTip(tr("Show information about Paycoin")); aboutAction->setMenuRole(QAction::AboutRole); aboutQtAction = new QAction(tr("About &Qt"), this); aboutQtAction->setToolTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setToolTip(tr("Modify configuration options for Paycoin")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(QIcon(":/icons/paycoin_tooltip"), tr("Show/Hide &Paycoin"), this); toggleHideAction->setToolTip(tr("Show or hide the Paycoin window")); exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this); exportAction->setToolTip(tr("Export the data in the current tab to a file")); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet"), this); encryptWalletAction->setToolTip(tr("Encrypt or decrypt wallet")); encryptWalletAction->setCheckable(true); unlockForMintingAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Unlock Wallet for Minting Only"), this); unlockForMintingAction->setToolTip(tr("Unlock wallet only for minting. Sending coins will still require the passphrase.")); unlockForMintingAction->setCheckable(true); backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet"), this); backupWalletAction->setToolTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase"), this); changePassphraseAction->setToolTip(tr("Change the passphrase used for wallet encryption")); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setToolTip(tr("Open debugging and diagnostic console")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(encryptWalletAction, SIGNAL(triggered(bool)), this, SLOT(encryptWallet(bool))); connect(unlockForMintingAction, SIGNAL(triggered(bool)), this, SLOT(unlockForMinting(bool))); connect(backupWalletAction, SIGNAL(triggered()), this, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), this, SLOT(changePassphrase())); }
MainWindow::MainWindow() : QMainWindow() , m_view(new SvgView) { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcuts(QKeySequence::Quit); menuBar()->addMenu(fileMenu); QMenu *viewMenu = new QMenu(tr("&View"), this); m_backgroundAction = viewMenu->addAction(tr("&Background")); m_backgroundAction->setEnabled(false); m_backgroundAction->setCheckable(true); m_backgroundAction->setChecked(false); connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool))); m_outlineAction = viewMenu->addAction(tr("&Outline")); m_outlineAction->setEnabled(false); m_outlineAction->setCheckable(true); m_outlineAction->setChecked(true); connect(m_outlineAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewOutline(bool))); menuBar()->addMenu(viewMenu); QMenu *rendererMenu = new QMenu(tr("&Renderer"), this); m_nativeAction = rendererMenu->addAction(tr("&Native")); m_nativeAction->setCheckable(true); m_nativeAction->setChecked(true); #ifndef QT_NO_OPENGL m_glAction = rendererMenu->addAction(tr("&OpenGL")); m_glAction->setCheckable(true); #endif m_imageAction = rendererMenu->addAction(tr("&Image")); m_imageAction->setCheckable(true); #ifndef QT_NO_OPENGL rendererMenu->addSeparator(); m_highQualityAntialiasingAction = rendererMenu->addAction(tr("&High Quality Antialiasing")); m_highQualityAntialiasingAction->setEnabled(false); m_highQualityAntialiasingAction->setCheckable(true); m_highQualityAntialiasingAction->setChecked(false); connect(m_highQualityAntialiasingAction, SIGNAL(toggled(bool)), m_view, SLOT(setHighQualityAntialiasing(bool))); #endif QActionGroup *rendererGroup = new QActionGroup(this); rendererGroup->addAction(m_nativeAction); #ifndef QT_NO_OPENGL rendererGroup->addAction(m_glAction); #endif rendererGroup->addAction(m_imageAction); menuBar()->addMenu(rendererMenu); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(rendererGroup, SIGNAL(triggered(QAction*)), this, SLOT(setRenderer(QAction*))); setCentralWidget(m_view); setWindowTitle(tr("SVG Viewer")); }
HgCommitDialog::HgCommitDialog(QWidget *parent): KDialog(parent, Qt::Dialog) { // dialog properties this->setCaption(i18nc("@title:window", "<application>Hg</application> Commit")); this->setButtons(KDialog::Ok | KDialog::Cancel); this->setDefaultButton(KDialog::Ok); this->setButtonText(KDialog::Ok, i18nc("@action:button", "Commit")); this->enableButtonOk(false); // since commit message is empty when loaded // To show diff between commit KTextEditor::Editor *editor = KTextEditor::EditorChooser::editor(); if (!editor) { KMessageBox::error(this, i18n("A KDE text-editor component could not be found;" "\nplease check your KDE installation.")); return; } m_fileDiffDoc = editor->createDocument(0); m_fileDiffView = qobject_cast<KTextEditor::View*>(m_fileDiffDoc->createView(this)); m_fileDiffDoc->setReadWrite(false); // Setup actions m_useCurrentBranch= new KAction(this); m_useCurrentBranch->setCheckable(true); m_useCurrentBranch->setText(i18nc("@action:inmenu", "Commit to current branch")); m_newBranch = new KAction(this); m_newBranch->setCheckable(true); m_newBranch->setText(i18nc("@action:inmenu", "Create new branch")); m_closeBranch = new KAction(this); m_closeBranch->setCheckable(true); m_closeBranch->setText(i18nc("@action:inmenu", "Close current branch")); m_branchMenu = new KMenu(this); m_branchMenu->addAction(m_useCurrentBranch); m_branchMenu->addAction(m_newBranch); m_branchMenu->addAction(m_closeBranch); QActionGroup *branchActionGroup = new QActionGroup(this); branchActionGroup->addAction(m_useCurrentBranch); branchActionGroup->addAction(m_newBranch); branchActionGroup->addAction(m_closeBranch); m_useCurrentBranch->setChecked(true); connect(branchActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotBranchActions(QAction *))); ////////////// // Setup UI // ////////////// // Top bar of buttons QHBoxLayout *topBarLayout = new QHBoxLayout; m_copyMessageButton = new KPushButton(i18n("Copy Message")); m_branchButton = new KPushButton(i18n("Branch")); m_copyMessageMenu = new KMenu(this); createCopyMessageMenu(); topBarLayout->addWidget(new QLabel(getParentForLabel())); topBarLayout->addStretch(); topBarLayout->addWidget(m_branchButton); topBarLayout->addWidget(m_copyMessageButton); m_branchButton->setMenu(m_branchMenu); m_copyMessageButton->setMenu(m_copyMessageMenu); // the commit box itself QGroupBox *messageGroupBox = new QGroupBox; QVBoxLayout *commitLayout = new QVBoxLayout; m_commitMessage = new QPlainTextEdit; commitLayout->addWidget(m_commitMessage); messageGroupBox->setTitle(i18nc("@title:group", "Commit Message")); messageGroupBox->setLayout(commitLayout); // Show diff here QGroupBox *diffGroupBox = new QGroupBox; QVBoxLayout *diffLayout = new QVBoxLayout(diffGroupBox); diffLayout->addWidget(m_fileDiffView); diffGroupBox->setTitle(i18nc("@title:group", "Diff/Content")); diffGroupBox->setLayout(diffLayout); // Set up layout for Status, Commit and Diff boxes QGridLayout *bodyLayout = new QGridLayout; m_statusList = new HgStatusList; bodyLayout->addWidget(m_statusList, 0, 0, 0, 1); bodyLayout->addWidget(messageGroupBox, 0, 1); bodyLayout->addWidget(diffGroupBox, 1, 1); bodyLayout->setColumnStretch(0, 1); bodyLayout->setColumnStretch(1, 2); bodyLayout->setRowStretch(0, 1); bodyLayout->setRowStretch(1, 1); // Set up layout and container for main dialog QFrame *frame = new QFrame; QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topBarLayout); mainLayout->addLayout(bodyLayout); frame->setLayout(mainLayout); setMainWidget(frame); slotBranchActions(m_useCurrentBranch); slotInitDiffOutput(); // initialise with whole repo diff // Load saved settings FileViewHgPluginSettings *settings = FileViewHgPluginSettings::self(); this->setInitialSize(QSize(settings->commitDialogWidth(), settings->commitDialogHeight())); // connect(m_statusList, SIGNAL(itemSelectionChanged(const char, const QString &)), this, SLOT(slotItemSelectionChanged(const char, const QString &))); connect(m_commitMessage, SIGNAL(textChanged()), this, SLOT(slotMessageChanged())); connect(this, SIGNAL(finished()), this, SLOT(saveGeometry())); }
void CreateBlogMsg::setupTextActions() { QMenu *menu = new QMenu(tr("F&ormat"), this); menuBar()->addMenu(menu); actionTextBold = new QAction(QIcon(":/images/textedit/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())); ui.toolBar_2->addAction(actionTextBold); menu->addAction(actionTextBold); actionTextBold->setCheckable(true); actionTextItalic = new QAction(QIcon(":/images/textedit/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())); ui.toolBar_2->addAction(actionTextItalic); menu->addAction(actionTextItalic); actionTextItalic->setCheckable(true); actionTextUnderline = new QAction(QIcon(":/images/textedit/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())); ui.toolBar_2->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(":/images/textedit/textleft.png"),tr("&Left"), grp); actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp); actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp); } else { actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp); actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp); actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"), tr("&Left"), grp); } actionAlignJustify = new QAction(QIcon(":/images/textedit/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); ui.toolBar_2->addActions(grp->actions()); menu->addActions(grp->actions()); menu->addSeparator(); QPixmap pix(16, 16); pix.fill(Qt::black); actionTextColor = new QAction(pix, tr("&Text Color..."), this); connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor())); ui.toolBar_2->addAction(actionTextColor); menu->addAction(actionTextColor); menu->addAction(ui.actionOrderedlist); menu->addAction(ui.actionUnorderedlist); menu->addAction(ui.actionBlockquoute); /*comboStyle = new QComboBox(ui.toolBar_2); ui.toolBar_2->addWidget(comboStyle); comboStyle->addItem("Paragraph"); comboStyle->addItem("Heading 1"); comboStyle->addItem("Heading 2"); comboStyle->addItem("Heading 3"); comboStyle->addItem("Heading 4"); comboStyle->addItem("Heading 5"); comboStyle->addItem("Heading 6"); connect(comboStyle, SIGNAL(activated(int)), this, SLOT(changeFormatType(int)));*/ comboFont = new QFontComboBox(ui.toolBar_2); ui.toolBar_2->addWidget(comboFont); connect(comboFont, SIGNAL(activated(QString)), this, SLOT(textFamily(QString))); comboSize = new QComboBox(ui.toolBar_2); comboSize->setObjectName("comboSize"); ui.toolBar_2->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()))); }
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) : WindowQt(machine, NULL) { setWindowTitle("Debug: Disassembly 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, &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+C")); 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()); }
Menu::Menu() { MenuWrapper * fileMenu = addMenu("File"); #ifdef Q_OS_MAC addActionToQMenuAndActionHash(fileMenu, MenuOption::AboutApp, 0, qApp, SLOT(aboutApp()), QAction::AboutRole); #endif auto dialogsManager = DependencyManager::get<DialogsManager>(); AccountManager& accountManager = AccountManager::getInstance(); { addActionToQMenuAndActionHash(fileMenu, MenuOption::Login); // connect to the appropriate signal of the AccountManager so that we can change the Login/Logout menu item connect(&accountManager, &AccountManager::profileChanged, dialogsManager.data(), &DialogsManager::toggleLoginDialog); connect(&accountManager, &AccountManager::logoutComplete, dialogsManager.data(), &DialogsManager::toggleLoginDialog); } addDisabledActionAndSeparator(fileMenu, "Scripts"); addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScript, Qt::CTRL | Qt::Key_O, qApp, SLOT(loadDialog())); addActionToQMenuAndActionHash(fileMenu, MenuOption::LoadScriptURL, Qt::CTRL | Qt::SHIFT | Qt::Key_O, qApp, SLOT(loadScriptURLDialog())); addActionToQMenuAndActionHash(fileMenu, MenuOption::StopAllScripts, 0, qApp, SLOT(stopAllScripts())); addActionToQMenuAndActionHash(fileMenu, MenuOption::ReloadAllScripts, Qt::CTRL | Qt::Key_R, qApp, SLOT(reloadAllScripts())); addActionToQMenuAndActionHash(fileMenu, MenuOption::RunningScripts, Qt::CTRL | Qt::Key_J, qApp, SLOT(toggleRunningScriptsWidget())); addDisabledActionAndSeparator(fileMenu, "Location"); qApp->getBookmarks()->setupMenus(this, fileMenu); addActionToQMenuAndActionHash(fileMenu, MenuOption::AddressBar, Qt::CTRL | Qt::Key_L, dialogsManager.data(), SLOT(toggleAddressBar())); auto addressManager = DependencyManager::get<AddressManager>(); addActionToQMenuAndActionHash(fileMenu, MenuOption::CopyAddress, 0, addressManager.data(), SLOT(copyAddress())); addActionToQMenuAndActionHash(fileMenu, MenuOption::CopyPath, 0, addressManager.data(), SLOT(copyPath())); addActionToQMenuAndActionHash(fileMenu, MenuOption::Quit, Qt::CTRL | Qt::Key_Q, qApp, SLOT(quit()), QAction::QuitRole); MenuWrapper* editMenu = addMenu("Edit"); QUndoStack* undoStack = qApp->getUndoStack(); QAction* undoAction = undoStack->createUndoAction(editMenu); undoAction->setShortcut(Qt::CTRL | Qt::Key_Z); addActionToQMenuAndActionHash(editMenu, undoAction); QAction* redoAction = undoStack->createRedoAction(editMenu); redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z); addActionToQMenuAndActionHash(editMenu, redoAction); addActionToQMenuAndActionHash(editMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_Comma, dialogsManager.data(), SLOT(editPreferences()), QAction::PreferencesRole); addActionToQMenuAndActionHash(editMenu, MenuOption::Attachments, 0, dialogsManager.data(), SLOT(editAttachments())); addActionToQMenuAndActionHash(editMenu, MenuOption::Animations, 0, dialogsManager.data(), SLOT(editAnimations())); MenuWrapper* toolsMenu = addMenu("Tools"); addActionToQMenuAndActionHash(toolsMenu, MenuOption::ScriptEditor, Qt::ALT | Qt::Key_S, dialogsManager.data(), SLOT(showScriptEditor())); #if defined(Q_OS_MAC) || defined(Q_OS_WIN) auto speechRecognizer = DependencyManager::get<SpeechRecognizer>(); QAction* speechRecognizerAction = addCheckableActionToQMenuAndActionHash(toolsMenu, MenuOption::ControlWithSpeech, Qt::CTRL | Qt::SHIFT | Qt::Key_C, speechRecognizer->getEnabled(), speechRecognizer.data(), SLOT(setEnabled(bool))); connect(speechRecognizer.data(), SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool))); #endif addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat, 0, // QML Qt::Key_Backslash, dialogsManager.data(), SLOT(showIRCLink())); addActionToQMenuAndActionHash(toolsMenu, MenuOption::AddRemoveFriends, 0, qApp, SLOT(showFriendsWindow())); MenuWrapper* visibilityMenu = toolsMenu->addMenu("I Am Visible To"); { QActionGroup* visibilityGroup = new QActionGroup(toolsMenu); auto discoverabilityManager = DependencyManager::get<DiscoverabilityManager>(); QAction* visibleToEveryone = addCheckableActionToQMenuAndActionHash(visibilityMenu, MenuOption::VisibleToEveryone, 0, discoverabilityManager->getDiscoverabilityMode() == Discoverability::All, discoverabilityManager.data(), SLOT(setVisibility())); visibilityGroup->addAction(visibleToEveryone); QAction* visibleToFriends = addCheckableActionToQMenuAndActionHash(visibilityMenu, MenuOption::VisibleToFriends, 0, discoverabilityManager->getDiscoverabilityMode() == Discoverability::Friends, discoverabilityManager.data(), SLOT(setVisibility())); visibilityGroup->addAction(visibleToFriends); QAction* visibleToNoOne = addCheckableActionToQMenuAndActionHash(visibilityMenu, MenuOption::VisibleToNoOne, 0, discoverabilityManager->getDiscoverabilityMode() == Discoverability::None, discoverabilityManager.data(), SLOT(setVisibility())); visibilityGroup->addAction(visibleToNoOne); connect(discoverabilityManager.data(), &DiscoverabilityManager::discoverabilityModeChanged, discoverabilityManager.data(), &DiscoverabilityManager::visibilityChanged); } addActionToQMenuAndActionHash(toolsMenu, MenuOption::ToolWindow, Qt::CTRL | Qt::ALT | Qt::Key_T, dialogsManager.data(), SLOT(toggleToolWindow())); addActionToQMenuAndActionHash(toolsMenu, MenuOption::Console, Qt::CTRL | Qt::ALT | Qt::Key_J, DependencyManager::get<StandAloneJSConsole>().data(), SLOT(toggleConsole())); addActionToQMenuAndActionHash(toolsMenu, MenuOption::ResetSensors, 0, // QML Qt::Key_Apostrophe, qApp, SLOT(resetSensors())); addActionToQMenuAndActionHash(toolsMenu, MenuOption::PackageModel, 0, qApp, SLOT(packageModel())); MenuWrapper* avatarMenu = addMenu("Avatar"); QObject* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); MenuWrapper* avatarSizeMenu = avatarMenu->addMenu("Size"); addActionToQMenuAndActionHash(avatarSizeMenu, MenuOption::IncreaseAvatarSize, 0, // QML Qt::Key_Plus, avatar, SLOT(increaseSize())); addActionToQMenuAndActionHash(avatarSizeMenu, MenuOption::DecreaseAvatarSize, 0, // QML Qt::Key_Minus, avatar, SLOT(decreaseSize())); addActionToQMenuAndActionHash(avatarSizeMenu, MenuOption::ResetAvatarSize, 0, // QML Qt::Key_Equal, avatar, SLOT(resetSize())); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::KeyboardMotorControl, Qt::CTRL | Qt::SHIFT | Qt::Key_K, true, avatar, SLOT(updateMotionBehavior())); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ScriptedMotorControl, 0, true, avatar, SLOT(updateMotionBehavior())); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::NamesAboveHeads, 0, true); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::GlowWhenSpeaking, 0, true); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::BlueSpeechSphere, 0, true); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::EnableCharacterController, 0, true, avatar, SLOT(updateMotionBehavior())); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ShiftHipsForIdleAnimations, 0, false, avatar, SLOT(updateMotionBehavior())); MenuWrapper* viewMenu = addMenu("View"); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Fullscreen, #ifdef Q_OS_MAC Qt::CTRL | Qt::META | Qt::Key_F, #else Qt::CTRL | Qt::Key_F, #endif false, qApp, SLOT(setFullscreen(bool))); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FirstPerson, 0, // QML Qt::Key_P, true, qApp, SLOT(cameraMenuChanged())); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Mirror, 0, //QML Qt::SHIFT | Qt::Key_H, true); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FullscreenMirror, 0, // QML Qt::Key_H, false, qApp, SLOT(cameraMenuChanged())); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::HMDTools, #ifdef Q_OS_MAC Qt::META | Qt::Key_H, #else Qt::CTRL | Qt::Key_H, #endif false, dialogsManager.data(), SLOT(hmdTools(bool))); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::EnableVRMode, 0, false, qApp, SLOT(setEnableVRMode(bool))); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Enable3DTVMode, 0, false, qApp, SLOT(setEnable3DTVMode(bool))); MenuWrapper* nodeBordersMenu = viewMenu->addMenu("Server Borders"); NodeBounds& nodeBounds = qApp->getNodeBoundsDisplay(); addCheckableActionToQMenuAndActionHash(nodeBordersMenu, MenuOption::ShowBordersEntityNodes, Qt::CTRL | Qt::SHIFT | Qt::Key_1, false, &nodeBounds, SLOT(setShowEntityNodes(bool))); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats); addActionToQMenuAndActionHash(viewMenu, MenuOption::Log, Qt::CTRL | Qt::SHIFT | Qt::Key_L, qApp, SLOT(toggleLogDialog())); addActionToQMenuAndActionHash(viewMenu, MenuOption::BandwidthDetails, 0, dialogsManager.data(), SLOT(bandwidthDetails())); addActionToQMenuAndActionHash(viewMenu, MenuOption::OctreeStats, 0, dialogsManager.data(), SLOT(octreeStatsDetails())); MenuWrapper* developerMenu = addMenu("Developer"); MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Atmosphere, 0, // QML Qt::SHIFT | Qt::Key_A, true); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AmbientOcclusion); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DontFadeOnOctreeServerChanges); MenuWrapper* ambientLightMenu = renderOptionsMenu->addMenu(MenuOption::RenderAmbientLight); QActionGroup* ambientLightGroup = new QActionGroup(ambientLightMenu); ambientLightGroup->setExclusive(true); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLightGlobal, 0, true)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight0, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight1, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight2, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight3, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight4, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight5, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight6, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight7, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight8, 0, false)); ambientLightGroup->addAction(addCheckableActionToQMenuAndActionHash(ambientLightMenu, MenuOption::RenderAmbientLight9, 0, false)); MenuWrapper* shadowMenu = renderOptionsMenu->addMenu("Shadows"); QActionGroup* shadowGroup = new QActionGroup(shadowMenu); shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, "None", 0, true)); shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::SimpleShadows, 0, false)); shadowGroup->addAction(addCheckableActionToQMenuAndActionHash(shadowMenu, MenuOption::CascadedShadows, 0, false)); { MenuWrapper* framerateMenu = renderOptionsMenu->addMenu(MenuOption::RenderTargetFramerate); QActionGroup* framerateGroup = new QActionGroup(framerateMenu); framerateGroup->setExclusive(true); framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerateUnlimited, 0, true)); framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate60, 0, false)); framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate50, 0, false)); framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate40, 0, false)); framerateGroup->addAction(addCheckableActionToQMenuAndActionHash(framerateMenu, MenuOption::RenderTargetFramerate30, 0, false)); #if defined(Q_OS_MAC) #else addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::RenderTargetFramerateVSyncOn, 0, true, qApp, SLOT(setVSyncEnabled())); #endif } MenuWrapper* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution); QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu); resolutionGroup->setExclusive(true); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionOne, 0, true)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionTwoThird, 0, false)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionHalf, 0, false)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionThird, 0, false)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionQuarter, 0, false)); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Stars, 0, // QML Qt::Key_Asterisk, true); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true, DependencyManager::get<GlowEffect>().data(), SLOT(toggleGlowEffect(bool))); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Wireframe, Qt::ALT | Qt::Key_W, false); addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, 0, // QML Qt::SHIFT | Qt::Key_L, dialogsManager.data(), SLOT(lodTools())); MenuWrapper* avatarDebugMenu = developerMenu->addMenu("Avatar"); MenuWrapper* faceTrackingMenu = avatarDebugMenu->addMenu("Face Tracking"); { QActionGroup* faceTrackerGroup = new QActionGroup(avatarDebugMenu); QAction* noFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::NoFaceTracking, 0, true, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(noFaceTracker); #ifdef HAVE_FACESHIFT QAction* faceshiftFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::Faceshift, 0, false, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(faceshiftFaceTracker); #endif #ifdef HAVE_DDE QAction* ddeFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::UseCamera, 0, false, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(ddeFaceTracker); #endif } #ifdef HAVE_DDE faceTrackingMenu->addSeparator(); QAction* binaryEyelidControl = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::BinaryEyelidControl, 0, true); binaryEyelidControl->setVisible(false); QAction* useAudioForMouth = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::UseAudioForMouth, 0, true); useAudioForMouth->setVisible(false); QAction* ddeFiltering = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::VelocityFilter, 0, true); ddeFiltering->setVisible(false); QAction* ddeCalibrate = addActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::CalibrateCamera, 0, DependencyManager::get<DdeFaceTracker>().data(), SLOT(calibrate())); ddeCalibrate->setVisible(false); #endif #if defined(HAVE_FACESHIFT) || defined(HAVE_DDE) faceTrackingMenu->addSeparator(); addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::MuteFaceTracking, Qt::CTRL | Qt::SHIFT | Qt::Key_F, false, qApp, SLOT(toggleFaceTrackerMute())); #endif auto avatarManager = DependencyManager::get<AvatarManager>(); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AvatarReceiveStats, 0, false, avatarManager.data(), SLOT(setShouldShowReceiveStats(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSkeletonCollisionShapes); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderHeadCollisionShapes); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderBoundingCollisionShapes); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderLookAtVectors, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderFocusIndicator, 0, false); MenuWrapper* handOptionsMenu = developerMenu->addMenu("Hands"); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlignForearmsWithWrists, 0, false); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::AlternateIK, 0, false); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHands, 0, true); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHandTargets, 0, false); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::ShowIKConstraints, 0, false); MenuWrapper* sixenseOptionsMenu = handOptionsMenu->addMenu("Sixense"); #ifdef __APPLE__ addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseEnabled, 0, false, &SixenseManager::getInstance(), SLOT(toggleSixense(bool))); #endif addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::FilterSixense, 0, true, &SixenseManager::getInstance(), SLOT(setFilter(bool))); addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::LowVelocityFilter, 0, true, qApp, SLOT(setLowVelocityFilter(bool))); addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseMouseInput, 0, true); addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseLasers, 0, false); MenuWrapper* leapOptionsMenu = handOptionsMenu->addMenu("Leap Motion"); addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false); #ifdef HAVE_RSSDK MenuWrapper* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense"); addActionToQMenuAndActionHash(realSenseOptionsMenu, MenuOption::LoadRSSDKFile, 0, RealSense::getInstance(), SLOT(loadRSSDKFile())); #endif MenuWrapper* networkMenu = developerMenu->addMenu("Network"); addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::DisableNackPackets, 0, false); addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::DisableActivityLogger, 0, false, &UserActivityLogger::getInstance(), SLOT(disable(bool))); addActionToQMenuAndActionHash(networkMenu, MenuOption::CachesSize, 0, dialogsManager.data(), SLOT(cachesSizeDialog())); addActionToQMenuAndActionHash(networkMenu, MenuOption::DiskCacheEditor, 0, dialogsManager.data(), SLOT(toggleDiskCacheEditor())); MenuWrapper* timingMenu = developerMenu->addMenu("Timing and Stats"); MenuWrapper* perfTimerMenu = timingMenu->addMenu("Performance Timer"); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::DisplayDebugTimingDetails, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::OnlyDisplayTopTen, 0, true); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandUpdateTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarSimulateTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandOtherAvatarTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandPaintGLTiming, 0, false); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::TestPing, 0, true); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::FrameTimer); addActionToQMenuAndActionHash(timingMenu, MenuOption::RunTimingTests, 0, qApp, SLOT(runTests())); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::PipelineWarnings); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::SuppressShortTimings); auto audioIO = DependencyManager::get<AudioClient>(); MenuWrapper* audioDebugMenu = developerMenu->addMenu("Audio"); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioNoiseReduction, 0, true, audioIO.data(), SLOT(toggleAudioNoiseReduction())); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::EchoServerAudio, 0, false, audioIO.data(), SLOT(toggleServerEcho())); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::EchoLocalAudio, 0, false, audioIO.data(), SLOT(toggleLocalEcho())); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::MuteAudio, Qt::CTRL | Qt::Key_M, false, audioIO.data(), SLOT(toggleMute())); addActionToQMenuAndActionHash(audioDebugMenu, MenuOption::MuteEnvironment, 0, audioIO.data(), SLOT(sendMuteEnvironmentPacket())); auto scope = DependencyManager::get<AudioScope>(); MenuWrapper* audioScopeMenu = audioDebugMenu->addMenu("Audio Scope"); addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScope, Qt::CTRL | Qt::Key_P, false, scope.data(), SLOT(toggle())); addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopePause, Qt::CTRL | Qt::SHIFT | Qt::Key_P , false, scope.data(), SLOT(togglePause())); addDisabledActionAndSeparator(audioScopeMenu, "Display Frames"); { QAction *fiveFrames = addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopeFiveFrames, 0, true, scope.data(), SLOT(selectAudioScopeFiveFrames())); QAction *twentyFrames = addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopeTwentyFrames, 0, false, scope.data(), SLOT(selectAudioScopeTwentyFrames())); QAction *fiftyFrames = addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopeFiftyFrames, 0, false, scope.data(), SLOT(selectAudioScopeFiftyFrames())); QActionGroup* audioScopeFramesGroup = new QActionGroup(audioScopeMenu); audioScopeFramesGroup->addAction(fiveFrames); audioScopeFramesGroup->addAction(twentyFrames); audioScopeFramesGroup->addAction(fiftyFrames); } auto statsRenderer = DependencyManager::get<AudioIOStatsRenderer>(); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioStats, Qt::CTRL | Qt::SHIFT | Qt::Key_A, false, statsRenderer.data(), SLOT(toggle())); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioStatsShowInjectedStreams, 0, false, statsRenderer.data(), SLOT(toggleShowInjectedStreams())); MenuWrapper* physicsOptionsMenu = developerMenu->addMenu("Physics"); addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowOwned); addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowHulls); MenuWrapper* helpMenu = addMenu("Help"); addActionToQMenuAndActionHash(helpMenu, MenuOption::EditEntitiesHelp, 0, qApp, SLOT(showEditEntitiesHelp())); #ifndef Q_OS_MAC QAction* aboutAction = helpMenu->addAction(MenuOption::AboutApp); connect(aboutAction, SIGNAL(triggered()), qApp, SLOT(aboutApp())); #endif }
/** 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); }
/** 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); }
void BitcoinGUI::createActions(const NetworkStyle *networkStyle) { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); #ifdef Q_OS_MAC overviewAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_1)); #else overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); #endif tabGroup->addAction(overviewAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Send coins to a DarkNet address")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); #ifdef Q_OS_MAC sendCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_2)); #else sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); #endif tabGroup->addAction(sendCoinsAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Request payments (generates QR codes and katana: URIs)")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); #ifdef Q_OS_MAC receiveCoinsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_3)); #else receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); #endif tabGroup->addAction(receiveCoinsAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); #ifdef Q_OS_MAC historyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_4)); #else historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); #endif tabGroup->addAction(historyAction); #ifdef ENABLE_WALLET // These showNormalIfMinimized are needed because Send Coins and Receive Coins // can be triggered from the tray menu, and need to show the GUI to be useful. connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); #endif // ENABLE_WALLET quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(networkStyle->getAppIcon(), tr("&About DarkNet Core"), this); aboutAction->setStatusTip(tr("Show information about DarkNet Core")); aboutAction->setMenuRole(QAction::AboutRole); #if QT_VERSION < 0x050000 aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this); #else aboutQtAction = new QAction(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this); #endif aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for DarkNet")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(networkStyle->getAppIcon(), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); unlockWalletAction = new QAction(tr("&Unlock Wallet..."), this); unlockWalletAction->setToolTip(tr("Unlock wallet")); lockWalletAction = new QAction(tr("&Lock Wallet"), this); signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your DarkNet addresses to prove you own them")); verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified DarkNet addresses")); openInfoAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Information"), this); openInfoAction->setStatusTip(tr("Show diagnostic information")); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug console"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging console")); openNetworkAction = new QAction(QIcon(":/icons/connect_4"), tr("&Network Monitor"), this); openNetworkAction->setStatusTip(tr("Show network monitor")); openPeersAction = new QAction(QIcon(":/icons/connect_4"), tr("&Peers list"), this); openPeersAction->setStatusTip(tr("Show peers info")); openRepairAction = new QAction(QIcon(":/icons/options"), tr("Wallet &Repair"), this); openRepairAction->setStatusTip(tr("Show wallet repair options")); openConfEditorAction = new QAction(QIcon(":/icons/edit"), tr("Open &Configuration File"), this); openConfEditorAction->setStatusTip(tr("Open configuration file")); showBackupsAction = new QAction(QIcon(":/icons/browse"), tr("Show Automatic &Backups"), this); showBackupsAction->setStatusTip(tr("Show automatically created wallet backups")); usedSendingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Sending addresses..."), this); usedSendingAddressesAction->setStatusTip(tr("Show the list of used sending addresses and labels")); usedReceivingAddressesAction = new QAction(QIcon(":/icons/address-book"), tr("&Receiving addresses..."), this); usedReceivingAddressesAction->setStatusTip(tr("Show the list of used receiving addresses and labels")); openAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_FileIcon), tr("Open &URI..."), this); openAction->setStatusTip(tr("Open a DarkNet: URI or payment request")); showHelpMessageAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Command-line options"), this); showHelpMessageAction->setMenuRole(QAction::NoRole); showHelpMessageAction->setStatusTip(tr("Show the DarkNet Core help message to get a list with possible DarkNet command-line options")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked())); #ifdef ENABLE_WALLET if(walletFrame) { connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool))); connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase())); connect(unlockWalletAction, SIGNAL(triggered()), walletFrame, SLOT(unlockWallet())); connect(lockWalletAction, SIGNAL(triggered()), walletFrame, SLOT(lockWallet())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses())); connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses())); connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked())); } #endif // ENABLE_WALLET }
void KviToolBar::mousePressEvent(QMouseEvent * e) { if(!(e->button() & Qt::RightButton)) { QToolBar::mousePressEvent(e); return; } if(!g_pToolBarContextPopup) { g_pToolBarContextPopup = new QMenu(); g_pToolBarIconSizesPopup = new QMenu(); g_pToolBarWindowsPopup = new QMenu(); g_pToolBarButtonStylePopup = new QMenu(); QAction * pAction = g_pToolBarContextPopup->addAction(__tr2qs("Toolbars")); pAction->setMenu(g_pToolBarWindowsPopup); pAction = g_pToolBarContextPopup->addAction(__tr2qs("Icon Size")); pAction->setMenu(g_pToolBarIconSizesPopup); pAction = g_pToolBarContextPopup->addAction(__tr2qs("Button Style")); pAction->setMenu(g_pToolBarButtonStylePopup); // fill toolbars menu g_pMainWindow->fillToolBarsPopup(g_pToolBarWindowsPopup); // fill icon size menu QActionGroup * pIconSizeGroup = new QActionGroup(g_pToolBarIconSizesPopup); QAction * pTmp = nullptr; IconSizes iconSize; for(auto & valid_iconsize : valid_iconsizes) { iconSize = valid_iconsize; pTmp = pIconSizeGroup->addAction(g_pToolBarIconSizesPopup->addAction(__tr2qs(iconSize.pcName))); pTmp->setData((uint)iconSize.uSize); pTmp->setCheckable(true); if(iconSize.uSize == KVI_OPTION_UINT(KviOption_uintToolBarIconSize)) pTmp->setChecked(true); } connect(pIconSizeGroup, SIGNAL(triggered(QAction *)), g_pMainWindow, SLOT(iconSizePopupSelected(QAction *))); // fill button style menu QActionGroup * pButtonStyleGroup = new QActionGroup(g_pToolBarButtonStylePopup); pTmp = nullptr; ButtonStyles buttonStyle; for(auto & valid_buttonstyle : valid_buttonstyles) { buttonStyle = valid_buttonstyle; pTmp = pButtonStyleGroup->addAction(g_pToolBarButtonStylePopup->addAction(__tr2qs(buttonStyle.pcName))); pTmp->setData((uint)buttonStyle.uStyle); pTmp->setCheckable(true); if(buttonStyle.uStyle == KVI_OPTION_UINT(KviOption_uintToolBarButtonStyle)) pTmp->setChecked(true); } connect(pButtonStyleGroup, SIGNAL(triggered(QAction *)), g_pMainWindow, SLOT(buttonStylePopupSelected(QAction *))); } g_pToolBarContextPopup->popup(QCursor::pos()); }
void CantorWorksheetView::initActions() { QActionGroup* cantorActionGroup = new QActionGroup(this); cantorActionGroup->setExclusive(false); m_restartBackendAction = new QAction(QIcon::fromTheme("system-reboot"), i18n("Restart Backend"), cantorActionGroup); m_restartBackendAction->setData("restart_backend"); m_evaluateWorsheetAction = new QAction(QIcon::fromTheme("system-run"), i18n("Evaluate Worksheet"), cantorActionGroup); m_evaluateWorsheetAction->setData("evaluate_worksheet"); m_evaluateEntryAction = new QAction(i18n("Evaluate Entry"), cantorActionGroup); m_evaluateEntryAction->setShortcut(Qt::SHIFT + Qt::Key_Return); m_evaluateEntryAction->setData("evaluate_current"); m_insertCommandEntryAction = new QAction(i18n("Insert Command Entry"), cantorActionGroup); m_insertCommandEntryAction->setData("insert_command_entry"); m_insertCommandEntryAction->setShortcut(Qt::CTRL + Qt::Key_Return); m_insertTextEntryAction = new QAction(i18n("Insert Text Entry"), cantorActionGroup); m_insertTextEntryAction->setData("insert_text_entry"); m_insertLatexEntryAction = new QAction(i18n("Insert Latex Entry"), cantorActionGroup); m_insertLatexEntryAction->setData("insert_latex_entry"); m_insertPageBreakAction = new QAction(i18n("Insert Page Break"), cantorActionGroup); m_insertPageBreakAction->setData("insert_page_break_entry"); m_removeCurrentEntryAction = new QAction(i18n("Remove Current Entry"), cantorActionGroup); m_removeCurrentEntryAction->setData("remove_current"); m_computeEigenvectorsAction = new QAction(i18n("Compute Eigenvectors"), cantorActionGroup); m_computeEigenvectorsAction->setData("eigenvectors_assistant"); m_createMattrixAction = new QAction(i18n("Create Matrix"), cantorActionGroup); m_createMattrixAction->setData("creatematrix_assistant"); m_computeEigenvaluesAction = new QAction(i18n("Compute Eigenvalues"), cantorActionGroup); m_computeEigenvaluesAction->setData("eigenvalues_assistant"); m_invertMattrixAction = new QAction(i18n("Invert Matrix"), cantorActionGroup); m_invertMattrixAction->setData("invertmatrix_assistant"); m_differentiationAction = new QAction(i18n("Differentiation"), cantorActionGroup); m_differentiationAction->setData("differentiate_assistant"); m_integrationAction = new QAction(i18n("Integration"), cantorActionGroup); m_integrationAction->setData("integrate_assistant"); m_solveEquationsAction = new QAction(i18n("Solve Equations"), cantorActionGroup); m_solveEquationsAction->setData("solve_assistant"); m_zoomIn = new QAction(QIcon::fromTheme("zoom-in"), i18n("Zoom in"), cantorActionGroup); m_zoomIn->setData("view_zoom_in"); m_zoomIn->setShortcut(Qt::CTRL+Qt::Key_Plus); m_zoomOut = new QAction(QIcon::fromTheme("zoom-out"), i18n("Zoom out"), cantorActionGroup); m_zoomOut->setData("view_zoom_out"); m_zoomOut->setShortcut(Qt::CTRL+Qt::Key_Minus); m_find = new QAction(QIcon::fromTheme("edit-find"), i18n("Find"), cantorActionGroup); m_find->setData("edit_find"); m_find->setShortcut(Qt::CTRL+Qt::Key_F); m_replace = new QAction(QIcon::fromTheme("edit-replace"), i18n("Replace"), cantorActionGroup); m_replace->setData("edit_replace"); m_replace->setShortcut(Qt::CTRL+Qt::Key_R); m_lineNumbers = new KToggleAction(i18n("Line Numbers"), cantorActionGroup); m_lineNumbers->setChecked(false); m_lineNumbers->setData("enable_expression_numbers"); m_animateWorksheet = new KToggleAction(i18n("Animate Worksheet"), cantorActionGroup); m_animateWorksheet->setChecked(true); m_animateWorksheet->setData("enable_animations"); m_latexTypesetting = new KToggleAction(i18n("Latex Typesetting"), cantorActionGroup); m_latexTypesetting->setChecked(true); m_latexTypesetting->setData("enable_typesetting"); m_showCompletion = new QAction(i18n("Syntax Completion"), cantorActionGroup); m_showCompletion->setShortcut(Qt::CTRL + Qt::Key_Space); m_showCompletion->setData("show_completion"); connect(cantorActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(triggerCantorAction(QAction*))); }
void QCSXCAD::BuildToolBar() { QToolBar *mainTB = addToolBar(tr("General")); mainTB->setObjectName("General_ToolBar"); QSize TBIconSize(16,16); mainTB->setIconSize(TBIconSize); if (QCSX_Settings.GetEdit()) mainTB->addAction(QIcon(":/images/filenew.png"),tr("New"),this,SLOT(New())); if (QCSX_Settings.GetEdit()) mainTB->addAction(QIcon(":/images/down.png"),tr("Import"),this,SLOT(ImportGeometry())); mainTB->addAction(QIcon(":/images/up.png"),tr("Export"),this,SLOT(ExportGeometry())); QToolBar *ItemTB = addToolBar(tr("Item View")); ItemTB->setIconSize(TBIconSize); ItemTB->setObjectName("Item_View_ToolBar"); ItemTB->addAction(tr("CollapseAll"),CSTree,SLOT(collapseAll())); ItemTB->addAction(tr("ExpandAll"),CSTree,SLOT(expandAll())); ItemTB->addAction(QIcon(":/images/bulb.png"),tr("ShowAll"),this,SLOT(ShowAll())); ItemTB->addAction(QIcon(":/images/bulb_off.png"),tr("HideAll"),this,SLOT(HideAll())); QToolBar *newObjct = NULL; QAction* newAct = NULL; if (QCSX_Settings.GetEdit()) { newObjct = addToolBar(tr("add new Primitive")); newObjct->setObjectName("New_Primitive_ToolBar"); newAct = newObjct->addAction(tr("Box"),this,SLOT(NewBox())); newAct->setToolTip(tr("add new Box")); newAct = newObjct->addAction(tr("MultiBox"),this,SLOT(NewMultiBox())); newAct->setToolTip(tr("add new Multi-Box")); newAct = newObjct->addAction(tr("Sphere"),this,SLOT(NewSphere())); newAct->setToolTip(tr("add new Sphere")); newAct = newObjct->addAction(tr("Cylinder"),this,SLOT(NewCylinder())); newAct->setToolTip(tr("add new Cylinder")); newAct = newObjct->addAction(tr("Polygon"),this,SLOT(NewPolygon())); newAct->setToolTip(tr("add new Polygon")); newAct = newObjct->addAction(tr("User Defined"),this,SLOT(NewUserDefined())); newAct->setToolTip(tr("add new User Definied Primitive")); newObjct = addToolBar(tr("add new Property")); newObjct->setObjectName("New_Property_ToolBar"); newAct = newObjct->addAction(tr("Material"),this,SLOT(NewMaterial())); newAct->setToolTip(tr("add new Material-Property")); newAct = newObjct->addAction(tr("Metal"),this,SLOT(NewMetal())); newAct->setToolTip(tr("add new Metal-Property")); newAct = newObjct->addAction(tr("Excitation"),this,SLOT(NewExcitation())); newAct->setToolTip(tr("add new Excitation-Property")); newAct = newObjct->addAction(tr("ProbeBox"),this,SLOT(NewChargeBox())); newAct->setToolTip(tr("add new Probe-Box-Property")); newAct = newObjct->addAction(tr("ResBox"),this,SLOT(NewResBox())); newAct->setToolTip(tr("add new Res-Box-Property")); newAct = newObjct->addAction(tr("DumpBox"),this,SLOT(NewDumpBox())); newAct->setToolTip(tr("add new Dump-Box-Property")); } newObjct = addToolBar(tr("Zoom")); newObjct->setIconSize(TBIconSize); newObjct->setObjectName("Zoom_ToolBar"); newAct = newObjct->addAction(QIcon(":/images/viewmagfit.png"),tr("Zoom fit"),this,SLOT(BestView())); newAct->setToolTip("Zoom to best fit all objects"); viewPlane[0] = newObjct->addAction(GridEditor->GetNormName(0),this,SLOT(setYZ())); viewPlane[0]->setToolTip(tr("Switch to y-z-plane view (x-normal)")); viewPlane[1] = newObjct->addAction(GridEditor->GetNormName(1),this,SLOT(setZX())); viewPlane[1]->setToolTip(tr("Switch to z-x-plane view (y-normal)")); viewPlane[2] = newObjct->addAction(GridEditor->GetNormName(2),this,SLOT(setXY())); viewPlane[2]->setToolTip(tr("Switch to x-y-plane view (z-normal)")); addToolBarBreak(); QActionGroup* ActViewGrp = new QActionGroup(this); newAct = newObjct->addAction(tr("2D"),this,SLOT(View2D())); newAct->setToolTip(tr("Switch to 2D view mode")); ActViewGrp->addAction(newAct); newAct->setCheckable(true); newAct = newObjct->addAction(tr("3D"),this,SLOT(View3D())); newAct->setToolTip(tr("Switch to 3D view mode")); ActViewGrp->addAction(newAct); newAct->setCheckable(true); m_PPview = newObjct->addAction(tr("PP")); m_PPview->setToolTip(tr("Toggle parallel projection view mode")); QObject::connect(m_PPview,SIGNAL(toggled(bool)),this,SLOT(SetParallelProjection(bool))); m_PPview->setCheckable(true); if (QCSX_Settings.GetEdit()) addToolBar(GridEditor->BuildToolbar()); }
MainWindow::MainWindow(FmPath* path): QMainWindow(), fileLauncher_(this) { Settings& settings = static_cast<Application*>(qApp)->settings(); setAttribute(Qt::WA_DeleteOnClose); // setup user interface ui.setupUi(this); // FIXME: why popup menus over back/forward buttons don't work when they're disabled? QToolButton* forwardButton = static_cast<QToolButton*>(ui.toolBar->widgetForAction(ui.actionGoForward)); forwardButton->setContextMenuPolicy(Qt::CustomContextMenu); connect(forwardButton, SIGNAL(customContextMenuRequested(QPoint)), SLOT(onBackForwardContextMenu(QPoint))); QToolButton* backButton = static_cast<QToolButton*>(ui.toolBar->widgetForAction(ui.actionGoBack)); backButton->setContextMenuPolicy(Qt::CustomContextMenu); connect(backButton, SIGNAL(customContextMenuRequested(QPoint)), SLOT(onBackForwardContextMenu(QPoint))); /* QToolButton* btn = new QToolButton(); btn->setArrowType(Qt::DownArrow); btn->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); ui.toolBar->insertWidget(ui.actionGoUp, btn); */ // tabbed browsing interface ui.tabBar->setDocumentMode(true); ui.tabBar->setTabsClosable(true); ui.tabBar->setElideMode(Qt::ElideRight); ui.tabBar->setExpanding(false); connect(ui.tabBar, SIGNAL(currentChanged(int)), SLOT(onTabBarCurrentChanged(int))); connect(ui.tabBar, SIGNAL(tabCloseRequested(int)), SLOT(onTabBarCloseRequested(int))); connect(ui.stackedWidget, SIGNAL(widgetRemoved(int)), SLOT(onStackedWidgetWidgetRemoved(int))); // side pane ui.sidePane->setIconSize(QSize(settings.sidePaneIconSize(), settings.sidePaneIconSize())); ui.sidePane->setMode(Fm::SidePane::ModePlaces); connect(ui.sidePane, SIGNAL(chdirRequested(int, FmPath*)), SLOT(onSidePaneChdirRequested(int, FmPath*))); // path bar pathEntry = new Fm::PathEdit(this); connect(pathEntry, SIGNAL(returnPressed()), SLOT(onPathEntryReturnPressed())); ui.toolBar->insertWidget(ui.actionGo, pathEntry); // add filesystem info to status bar fsInfoLabel = new QLabel(ui.statusbar); ui.statusbar->addPermanentWidget(fsInfoLabel); // setup the splitter ui.splitter->setStretchFactor(1, 1); // only the right pane can be stretched QList<int> sizes; sizes.append(150); sizes.append(300); ui.splitter->setSizes(sizes); // load bookmark menu bookmarks = fm_bookmarks_dup(); g_signal_connect(bookmarks, "changed", G_CALLBACK(onBookmarksChanged), this); loadBookmarksMenu(); // Fix the menu groups which is not done by Qt designer // To my suprise, this was supported in Qt designer 3 :-( QActionGroup* group = new QActionGroup(ui.menu_View); group->setExclusive(true); group->addAction(ui.actionIconView); group->addAction(ui.actionCompactView); group->addAction(ui.actionThumbnailView); group->addAction(ui.actionDetailedList); group = new QActionGroup(ui.menuSorting); group->setExclusive(true); group->addAction(ui.actionByFileName); group->addAction(ui.actionByMTime); group->addAction(ui.actionByFileSize); group->addAction(ui.actionByFileType); group->addAction(ui.actionByOwner); group = new QActionGroup(ui.menuSorting); group->setExclusive(true); group->addAction(ui.actionAscending); group->addAction(ui.actionDescending); // create shortcuts QShortcut* shortcut = new QShortcut(Qt::CTRL + Qt::Key_L, this); connect(shortcut, SIGNAL(activated()), pathEntry, SLOT(setFocus())); shortcut = new QShortcut(Qt::ALT + Qt::Key_D, this); connect(shortcut, SIGNAL(activated()), pathEntry, SLOT(setFocus())); shortcut = new QShortcut(Qt::CTRL + Qt::Key_Tab, this); connect(shortcut, SIGNAL(activated()), SLOT(onShortcutNextTab())); shortcut = new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this); connect(shortcut, SIGNAL(activated()), SLOT(onShortcutPrevTab())); int i; for(i = 0; i < 10; ++i) { shortcut = new QShortcut(QKeySequence(Qt::ALT + Qt::Key_0 + i), this); connect(shortcut, SIGNAL(activated()), SLOT(onShortcutJumpToTab())); shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_0 + i), this); connect(shortcut, SIGNAL(activated()), SLOT(onShortcutJumpToTab())); } if(path) addTab(path); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), m_preferencesWindow(nullptr) { ui->setupUi(this); // Init actions for sidebar and menu ui->buttonDownloads->setDefaultAction(ui->actionDownloads); ui->buttonSeries->setDefaultAction(ui->actionTV_Shows); QActionGroup *viewActionGroup = new QActionGroup(this); viewActionGroup->addAction(ui->actionDownloads); viewActionGroup->addAction(ui->actionTV_Shows); // Init downloads page m_downloadsModel = new DownloadsItemModel(this); ui->treeViewDownloads->setAttribute(Qt::WA_MacShowFocusRect, false); ui->treeViewDownloads->setModel(m_downloadsModel); ui->treeViewDownloads->setItemDelegate(new DownloadsItemDelegate(this)); ui->treeViewDownloads->setContextMenuPolicy(Qt::ActionsContextMenu); ui->treeViewDownloads->addAction(ui->actionDeleteDownload); ui->treeViewDownloads->addAction(ui->actionResetDownload); ui->treeViewDownloads->addAction(ui->actionExtract); ui->treeViewDownloads->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(ui->treeViewDownloads->selectionModel(), &QItemSelectionModel::selectionChanged, this, &MainWindow::enableActionsAccordingToDownloadSelection); // Init series page m_seriesModel = new SeriesListModel(this); ui->treeViewSeries->setAttribute(Qt::WA_MacShowFocusRect, false); ui->treeViewSeries->setModel(m_seriesModel); ui->treeViewSeries->setItemDelegate(new SeriesListItemDelegate(this)); m_seasonsModel = new SeasonsListModel(this); ui->treeViewSeasons->setAttribute(Qt::WA_MacShowFocusRect, false); ui->treeViewSeasons->setModel(m_seasonsModel); m_episodesModel = new EpisodesListModel(this); ui->treeViewEpisodes->setAttribute(Qt::WA_MacShowFocusRect, false); ui->treeViewEpisodes->setModel(m_episodesModel); connect(ui->treeViewSeries->selectionModel(), &QItemSelectionModel::selectionChanged, this, &MainWindow::showSeasonsForSelectedSeries); connect(ui->treeViewSeasons->selectionModel(), &QItemSelectionModel::selectionChanged, this, &MainWindow::showEpisodesForSelectedSeason); // Restore settings QSettings settings; restoreGeometry(settings.value(WINDOWGEOMETRY, "").toByteArray()); restoreState(settings.value(WINDOWSTATE, "").toByteArray()); ui->treeViewDownloads->header()->restoreState(settings.value(DOWNLOADSHEADERSTATE, "").toByteArray()); // ui->splitter_2->restoreState(settings.value(SERIESPAGESPLITTERSTATE, "").toByteArray()); connect(Controller::downloads(), &DownloadController::statusChanged, this, &MainWindow::enableActionsAccordingToDownloadStatus); enableActionsAccordingToDownloadSelection(); }
void BitcoinGUI::createActions() { QActionGroup *tabGroup = new QActionGroup(this); overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this); overviewAction->setStatusTip(tr("Show general overview of wallet")); overviewAction->setToolTip(overviewAction->statusTip()); overviewAction->setCheckable(true); overviewAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_1)); tabGroup->addAction(overviewAction); sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send"), this); sendCoinsAction->setStatusTip(tr("Shut up and take my money")); sendCoinsAction->setToolTip(sendCoinsAction->statusTip()); sendCoinsAction->setCheckable(true); sendCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_2)); tabGroup->addAction(sendCoinsAction); receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive"), this); receiveCoinsAction->setStatusTip(tr("Show the list of addresses for receiving payments")); receiveCoinsAction->setToolTip(receiveCoinsAction->statusTip()); receiveCoinsAction->setCheckable(true); receiveCoinsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_3)); tabGroup->addAction(receiveCoinsAction); historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this); historyAction->setStatusTip(tr("Browse transaction history")); historyAction->setToolTip(historyAction->statusTip()); historyAction->setCheckable(true); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Addresses"), this); addressBookAction->setStatusTip(tr("Edit the list of stored addresses and labels")); addressBookAction->setToolTip(addressBookAction->statusTip()); addressBookAction->setCheckable(true); addressBookAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_5)); tabGroup->addAction(addressBookAction); connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage())); connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage())); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setStatusTip(tr("Quit application")); quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q)); quitAction->setMenuRole(QAction::QuitRole); aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About Hfrcoin"), this); aboutAction->setStatusTip(tr("Show information about Hfrcoin")); aboutAction->setMenuRole(QAction::AboutRole); aboutQtAction = new QAction(QIcon(":/trolltech/qmessagebox/images/qtlogo-64.png"), tr("About &Qt"), this); aboutQtAction->setStatusTip(tr("Show information about Qt")); aboutQtAction->setMenuRole(QAction::AboutQtRole); optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for Hfrcoin")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("&Show / Hide"), this); toggleHideAction->setStatusTip(tr("Show or hide the main Window")); encryptWalletAction = new QAction(QIcon(":/icons/lock_closed"), tr("&Encrypt Wallet..."), this); encryptWalletAction->setStatusTip(tr("Encrypt the private keys that belong to your wallet")); encryptWalletAction->setCheckable(true); backupWalletAction = new QAction(QIcon(":/icons/filesave"), tr("&Backup Wallet..."), this); backupWalletAction->setStatusTip(tr("Backup wallet to another location")); changePassphraseAction = new QAction(QIcon(":/icons/key"), tr("&Change Passphrase..."), this); changePassphraseAction->setStatusTip(tr("Change the passphrase used for wallet encryption")); signMessageAction = new QAction(QIcon(":/icons/edit"), tr("Sign &message..."), this); signMessageAction->setStatusTip(tr("Sign messages with your Hfrcoin addresses to prove you own them")); verifyMessageAction = new QAction(QIcon(":/icons/transaction_0"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified Hfrcoin addresses")); openRPCConsoleAction = new QAction(QIcon(":/icons/debugwindow"), tr("&Debug window"), this); openRPCConsoleAction->setStatusTip(tr("Open debugging and diagnostic console")); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked())); connect(toggleHideAction, SIGNAL(triggered()), this, SLOT(toggleHidden())); connect(encryptWalletAction, SIGNAL(triggered(bool)), walletFrame, SLOT(encryptWallet(bool))); connect(backupWalletAction, SIGNAL(triggered()), walletFrame, SLOT(backupWallet())); connect(changePassphraseAction, SIGNAL(triggered()), walletFrame, SLOT(changePassphrase())); connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); }
void Monitor::initToolBar() { QActionGroup* group; QAction* action; QToolBar* toolBar = new QToolBar(this); /* Menu bar */ Q_ASSERT(layout() != NULL); layout()->setMenuBar(toolBar); /* Font */ toolBar->addAction(QIcon(":/fonts.png"), tr("Font"), this, SLOT(slotChooseFont())); toolBar->addSeparator(); /* Channel style */ group = new QActionGroup(this); group->setExclusive(true); action = toolBar->addAction(tr("DMX Channels")); action->setToolTip(tr("Show absolute DMX channel numbers")); action->setCheckable(true); action->setData(DMXChannels); connect(action, SIGNAL(triggered(bool)), this, SLOT(slotChannelStyleTriggered())); toolBar->addAction(action); group->addAction(action); if (channelStyle() == DMXChannels) action->setChecked(true); action = toolBar->addAction(tr("Relative Channels")); action->setToolTip(tr("Show channel numbers relative to fixture")); action->setCheckable(true); action->setData(RelativeChannels); connect(action, SIGNAL(triggered(bool)), this, SLOT(slotChannelStyleTriggered())); toolBar->addAction(action); group->addAction(action); if (channelStyle() == RelativeChannels) action->setChecked(true); toolBar->addSeparator(); /* Value display style */ group = new QActionGroup(this); group->setExclusive(true); action = toolBar->addAction(tr("DMX Values")); action->setToolTip(tr("Show DMX values 0-255")); action->setCheckable(true); action->setData(DMXValues); connect(action, SIGNAL(triggered(bool)), this, SLOT(slotValueStyleTriggered())); toolBar->addAction(action); group->addAction(action); action->setChecked(true); if (valueStyle() == DMXValues) action->setChecked(true); action = toolBar->addAction(tr("Percent Values")); action->setToolTip(tr("Show percentage values 0-100%")); action->setCheckable(true); action->setData(PercentageValues); connect(action, SIGNAL(triggered(bool)), this, SLOT(slotValueStyleTriggered())); toolBar->addAction(action); group->addAction(action); if (valueStyle() == PercentageValues) action->setChecked(true); }