QKeySequence QButton::accel() const { if ( d && d->a ) return d->a->key( 0 ); return QKeySequence(); }
void MainWin::setupActions() { ActionCollection *coll = QtUi::actionCollection("General"); // File coll->addAction("ConnectCore", new Action(SmallIcon("network-connect"), tr("&Connect to Core..."), coll, this, SLOT(showCoreConnectionDlg()))); coll->addAction("DisconnectCore", new Action(SmallIcon("network-disconnect"), tr("&Disconnect from Core"), coll, Client::instance(), SLOT(disconnectFromCore()))); coll->addAction("CoreInfo", new Action(SmallIcon("help-about"), tr("Core &Info..."), coll, this, SLOT(showCoreInfoDlg()))); coll->addAction("ConfigureNetworks", new Action(SmallIcon("configure"), tr("Configure &Networks..."), coll, this, SLOT(on_actionConfigureNetworks_triggered()))); coll->addAction("Quit", new Action(SmallIcon("application-exit"), tr("&Quit"), coll, this, SLOT(quit()), tr("Ctrl+Q"))); // View coll->addAction("ConfigureBufferViews", new Action(tr("&Configure Chat Lists..."), coll, this, SLOT(on_actionConfigureViews_triggered()))); QAction *lockAct = coll->addAction("LockLayout", new Action(tr("&Lock Layout"), coll)); lockAct->setCheckable(true); connect(lockAct, SIGNAL(toggled(bool)), SLOT(on_actionLockLayout_toggled(bool))); coll->addAction("ToggleSearchBar", new Action(SmallIcon("edit-find"), tr("Show &Search Bar"), coll, 0, 0, QKeySequence::Find))->setCheckable(true); coll->addAction("ShowAwayLog", new Action(tr("Show Away Log"), coll, this, SLOT(showAwayLog()))); coll->addAction("ToggleStatusBar", new Action(tr("Show Status &Bar"), coll, 0, 0))->setCheckable(true); // Settings coll->addAction("ConfigureQuassel", new Action(SmallIcon("configure"), tr("&Configure Quassel..."), coll, this, SLOT(showSettingsDlg()), tr("F7"))); // Help coll->addAction("AboutQuassel", new Action(SmallIcon("quassel"), tr("&About Quassel"), coll, this, SLOT(showAboutDlg()))); coll->addAction("AboutQt", new Action(QIcon(":/pics/qt-logo.png"), tr("About &Qt"), coll, qApp, SLOT(aboutQt()))); coll->addAction("DebugNetworkModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &NetworkModel"), coll, this, SLOT(on_actionDebugNetworkModel_triggered()))); coll->addAction("DebugBufferViewOverlay", new Action(SmallIcon("tools-report-bug"), tr("Debug &BufferViewOverlay"), coll, this, SLOT(on_actionDebugBufferViewOverlay_triggered()))); coll->addAction("DebugMessageModel", new Action(SmallIcon("tools-report-bug"), tr("Debug &MessageModel"), coll, this, SLOT(on_actionDebugMessageModel_triggered()))); coll->addAction("DebugHotList", new Action(SmallIcon("tools-report-bug"), tr("Debug &HotList"), coll, this, SLOT(on_actionDebugHotList_triggered()))); coll->addAction("DebugLog", new Action(SmallIcon("tools-report-bug"), tr("Debug &Log"), coll, this, SLOT(on_actionDebugLog_triggered()))); coll->addAction("ReloadStyle", new Action(SmallIcon("view-refresh"), tr("Reload Stylesheet"), coll, QtUi::style(), SLOT(reload()), QKeySequence::Refresh)); // Navigation coll->addAction("JumpHotBuffer", new Action(tr("Jump to hot chat"), coll, this, SLOT(on_jumpHotBuffer_triggered()), QKeySequence(Qt::META + Qt::Key_A))); }
void ActionManagerImpl::initMainWidget(MainWidget* mainWidget) { if (d->mainWidget) return; d->mainWidget = mainWidget; KActionCollection* coll = actionCollection(); // Feed/Feed Group popup menu KAction* action = coll->addAction("feed_homepage"); action->setText(i18n("&Open Homepage")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenHomepage())); action->setShortcuts(KShortcut( "Ctrl+H" )); action = coll->addAction("reload_all_tabs"); action->setIcon(KIcon("view-refresh")); action->setText(i18n("Reload All Tabs")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotReloadAllTabs())); action->setShortcuts(KShortcut( "Shift+F5" )); action = coll->addAction("feed_add"); action->setIcon(KIcon("feed-subscribe")); action->setText(i18n("&Add Feed...")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAdd())); action->setShortcuts(KShortcut( "Insert" )); action = coll->addAction("feed_add_group"); action->setIcon(KIcon("folder-new")); action->setText(i18n("Ne&w Folder...")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAddGroup())); action->setShortcuts(KShortcut( "Shift+Insert" )); action = coll->addAction("feed_remove"); action->setIcon(KIcon("edit-delete")); action->setText(i18n("&Delete Feed")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedRemove())); action->setShortcuts(KShortcut( "Alt+Delete" )); action = coll->addAction("feed_modify"); action->setIcon(KIcon("document-properties")); action->setText(i18n("&Edit Feed...")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedModify())); action->setShortcuts(KShortcut( "F2" )); // toolbar / View action = coll->addAction("normal_view"); action->setIcon(KIcon("view-split-top-bottom")); action->setText(i18n("&Normal View")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotNormalView())); action->setShortcuts(KShortcut( "Ctrl+Shift+1" )); action = coll->addAction("widescreen_view"); action->setIcon(KIcon("view-split-left-right")); action->setText(i18n("&Widescreen View")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotWidescreenView())); action->setShortcuts(KShortcut( "Ctrl+Shift+2" )); action = coll->addAction("combined_view"); action->setIcon(KIcon("view-list-text")); action->setText(i18n("C&ombined View")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotCombinedView())); action->setShortcuts(KShortcut( "Ctrl+Shift+3" )); // toolbar / feed menu action = coll->addAction("feed_fetch"); action->setIcon(KIcon("go-down")); action->setText(i18n("&Fetch Feed")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchCurrentFeed())); action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Reload)); action = coll->addAction("feed_fetch_all"); action->setIcon(KIcon("go-bottom")); action->setText(i18n("Fe&tch All Feeds")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchAllFeeds())); action->setShortcuts(KShortcut( "Ctrl+L" )); KAction *stopAction = coll->addAction("feed_stop"); stopAction->setIcon(KIcon("process-stop")); stopAction->setText(i18n("C&ancel Feed Fetches")); connect(stopAction, SIGNAL(triggered(bool)), Kernel::self()->fetchQueue(), SLOT(slotAbort())); stopAction->setShortcut(QKeySequence(Qt::Key_Escape)); stopAction->setEnabled(false); action = coll->addAction("feed_mark_all_as_read"); action->setIcon(KIcon("mail-mark-read")); action->setText(i18n("&Mark Feed as Read")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllRead())); action->setShortcuts(KShortcut( "Ctrl+R" )); action = coll->addAction("feed_mark_all_feeds_as_read"); action->setIcon(KIcon("mail-mark-read")); action->setText(i18n("Ma&rk All Feeds as Read")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllFeedsRead())); action->setShortcuts(KShortcut( "Ctrl+Shift+R" )); // Settings menu KToggleAction *sqf = coll->add<KToggleAction>("show_quick_filter"); sqf->setText(i18n("Show Quick Filter")); connect(sqf, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotToggleShowQuickFilter())); sqf->setChecked( Settings::showQuickFilter() ); action = coll->addAction("article_open" ); action->setIcon(KIcon("tab-new")); action->setText(i18n("Open in Tab")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenSelectedArticles())); action->setShortcuts(KShortcut( "Shift+Return" )); action = coll->addAction("article_open_in_background" ); action->setIcon(KIcon("tab-new")); action->setText(i18n("Open in Background Tab")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenSelectedArticlesInBackground())); action->setShortcuts(KShortcut( "Return" )); action = coll->addAction("article_open_external" ); action->setIcon(KIcon("window-new")); action->setText(i18n("Open in External Browser")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenSelectedArticlesInBrowser())); action->setShortcuts(KShortcut( "Ctrl+Shift+Return" )); action = coll->addAction("article_copy_link_address" ); action->setText(i18n("Copy Link Address")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotCopyLinkAddress())); action = coll->addAction("go_prev_unread_article"); action->setIcon(KIcon("go-previous")); action->setText(i18n("Pre&vious Unread Article")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotPrevUnreadArticle())); action->setShortcut(QKeySequence(Qt::Key_Minus)); action = coll->addAction("go_next_unread_article"); action->setIcon(KIcon("go-next")); action->setText(i18n("Ne&xt Unread Article")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotNextUnreadArticle())); action->setShortcuts(KShortcut(Qt::Key_Plus, Qt::Key_Equal)); action = coll->addAction("article_delete"); action->setIcon(KIcon("edit-delete")); action->setText(i18n("&Delete")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotArticleDelete())); action->setShortcuts(KShortcut( "Delete" )); KActionMenu* statusMenu = coll->add<KActionMenu>("article_set_status"); statusMenu->setText(i18n("&Mark As")); statusMenu->setEnabled( false ); d->speakSelectedArticlesAction = coll->addAction("akr_texttospeech"); d->speakSelectedArticlesAction->setIcon(KIcon("media-playback-start")); d->speakSelectedArticlesAction->setText(i18n("&Speak Selected Articles")); connect(d->speakSelectedArticlesAction, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotTextToSpeechRequest())); action = coll->addAction("akr_aborttexttospeech"); action->setText(i18n( "&Stop Speaking" )); action->setIcon(KIcon("media-playback-stop")); connect(action, SIGNAL(triggered(bool)),SpeechClient::self(), SLOT(slotAbortJobs())); //action->setShortcuts(Qt::Key_Escape); action->setEnabled(false); connect(SpeechClient::self(), SIGNAL(signalActivated(bool)), action, SLOT(setEnabled(bool))); action = coll->addAction("article_set_status_read"); action->setText(i18nc("as in: mark as read","&Read")); action->setIcon(KIcon("mail-mark-read")); action->setToolTip(i18n("Mark selected article as read")); action->setShortcuts(KShortcut( "Ctrl+E" )); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotSetSelectedArticleRead())); statusMenu->addAction(action); action = coll->addAction("article_set_status_new"); action->setText(i18nc("as in: mark as new", "&New")); action->setIcon(KIcon("mail-mark-unread-new")); action->setShortcuts(KShortcut( "Ctrl+N" )); action->setToolTip(i18n("Mark selected article as new")); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotSetSelectedArticleNew())); statusMenu->addAction(action); action = coll->addAction("article_set_status_unread"); action->setText(i18nc("as in: mark as unread", "&Unread")); action->setIcon(KIcon("mail-mark-unread")); action->setToolTip(i18n("Mark selected article as unread")); action->setShortcuts(KShortcut( "Ctrl+U" )); connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotSetSelectedArticleUnread())); statusMenu->addAction(action); KToggleAction* importantAction = coll->add<KToggleAction>("article_set_status_important"); importantAction->setText(i18n("&Mark as Important")); importantAction->setIcon(KIcon("mail-mark-important")); KShortcut importantSC( "Ctrl+I" ); importantSC.setAlternate( Qt::Key_I ); importantAction->setShortcuts( importantSC ); importantAction->setCheckedState(KGuiItem(i18n("Remove &Important Mark"))); connect(importantAction, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotArticleToggleKeepFlag(bool))); action = coll->addAction("feedstree_move_up"); action->setText(i18n("Move Node Up")); connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeUp())); action->setShortcuts(KShortcut( "Shift+Alt+Up" )); action = coll->addAction("feedstree_move_down"); action->setText(i18n("Move Node Down")); connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeDown())); action->setShortcuts(KShortcut( "Shift+Alt+Down" )); action = coll->addAction(i18n("Move Node Left")); action->setText(i18n("Move Node Left")); connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeLeft())); action->setShortcuts(KShortcut( "Shift+Alt+Left" )); action = coll->addAction("feedstree_move_right"); action->setText(i18n("Move Node Right")); connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotMoveCurrentNodeRight())); action->setShortcuts(KShortcut( "Shift+Alt+Right" )); action = coll->addAction("file_sendlink"); action->setIcon(KIcon("mail-message-new")); action->setText(i18n("Send &Link Address...")); connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotSendLink())); action = coll->addAction("file_sendfile"); action->setIcon(KIcon("mail-message-new")); action->setText(i18n("Send &File...")); connect(action, SIGNAL(triggered(bool)), mainWidget, SLOT(slotSendFile())); setArticleActionsEnabled( false ); }
void BitcoinGUI::createActions() { 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 dkcoin 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 dkcoin: 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 Bitcoin Core"), this); aboutAction->setStatusTip(tr("Show information about dkcoin Core")); 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); */ //by zy optionsAction = new QAction(TextColorIcon(":/icons/options"), tr("&Options..."), this); optionsAction->setStatusTip(tr("Modify configuration options for dkcoin Core")); 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 dkcoin 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 dkcoin 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->setMenuRole(QAction::NoRole); showHelpMessageAction->setStatusTip(tr("Show the dkcoin Core help message to get a list with possible dkcoin 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 }
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 pleasecoin 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 pleasecoin"), this); aboutAction->setToolTip(tr("Show information about pleasecoin")); 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 pleasecoin")); optionsAction->setMenuRole(QAction::PreferencesRole); toggleHideAction = new QAction(QIcon(":/icons/bitcoin"), tr("Show/Hide &pleasecoin"), this); toggleHideAction->setToolTip(tr("Show or hide the pleasecoin 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())); }
void DGLMainWindow::createActions() { // create "QActions" - bindings between mainwindow clickable widgets, // and // local slots quitAct = new QAction(tr("&Quit"), this); quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit the application")); CONNASSERT(quitAct, SIGNAL(triggered()), this, SLOT(close())); quitAct->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4)); aboutAct = new QAction(tr("&About"), this); aboutAct->setStatusTip(tr("Show the application's About box")); CONNASSERT(aboutAct, SIGNAL(triggered()), this, SLOT(about())); aboutAct->setShortcut(QKeySequence(Qt::Key_F1)); newProjectAct = new QAction(tr("&New Project..."), this); newProjectAct->setStatusTip(tr("Created new debugging project")); CONNASSERT(newProjectAct, SIGNAL(triggered()), this, SLOT(newProject())); newProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N)); openProjectAct = new QAction(tr("&Open Project..."), this); openProjectAct->setStatusTip(tr("Opens a debugging project")); CONNASSERT(openProjectAct, SIGNAL(triggered()), this, SLOT(openProject())); //TODO: implement openProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O)); saveProjectAct = new QAction(tr("&Save Project"), this); saveProjectAct->setStatusTip(tr("Save a debugging project")); CONNASSERT(saveProjectAct, SIGNAL(triggered()), this, SLOT(saveProject())); //TODO: implement saveProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); saveAsProjectAct = new QAction(tr("&Save Project As ..."), this); saveAsProjectAct->setStatusTip(tr("Save a debugging project as as a file ...")); CONNASSERT(saveAsProjectAct, SIGNAL(triggered()), this, SLOT(saveProjectAs())); //TODO: implement saveAsProjectAct->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S)); projectProperiesAct = new QAction(tr("&Project properties..."), this); projectProperiesAct->setStatusTip(tr("Change properties of current project")); CONNASSERT(projectProperiesAct, SIGNAL(triggered()), this, SLOT(projectProperties())); closeProjectAct = new QAction(tr("&Close project"), this); closeProjectAct->setStatusTip(tr("Created new debugging project")); CONNASSERT(closeProjectAct, SIGNAL(triggered()), this, SLOT(closeProject())); debugStartAct = new QAction(tr("&Start debugging"), this); debugStartAct->setStatusTip(tr("Stop debugging.")); CONNASSERT(debugStartAct, SIGNAL(triggered()), this, SLOT(debugStart())); CONNASSERT(&m_controller, SIGNAL(setDisconnected(bool)), debugStartAct, SLOT(setVisible(bool))); debugStartAct->setShortcut(QKeySequence(Qt::Key_F5)); debugStopAct = new QAction(tr("Sto&p debugging"), this); debugStopAct->setStatusTip(tr("Stop debugging.")); CONNASSERT(debugStopAct, SIGNAL(triggered()), this, SLOT(debugStop())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStopAct, SLOT(setEnabled(bool))); debugStopAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F5)); debugStopAct->setEnabled(false); debugTerminateAct = new QAction(tr("Terminate"), this); debugTerminateAct->setStatusTip(tr("Terminate debugged process.")); CONNASSERT(debugTerminateAct, SIGNAL(triggered()), this, SLOT(debugTerminate())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugTerminateAct, SLOT(setEnabled(bool))); debugTerminateAct->setEnabled(false); debugContinueAct = new QAction(tr("&Continue"), this); debugContinueAct->setStatusTip(tr("Continue program execution")); CONNASSERT(debugContinueAct, SIGNAL(triggered()), &m_controller, SLOT(debugContinue())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugContinueAct, SLOT(setVisible(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugContinueAct, SLOT(setEnabled(bool))); debugContinueAct->setShortcut(QKeySequence(Qt::Key_F5)); debugContinueAct->setVisible(false); debugInterruptAct = new QAction(tr("&Break on next call"), this); debugInterruptAct->setStatusTip( tr("Break program execution on GL call")); CONNASSERT(debugInterruptAct, SIGNAL(triggered()), &m_controller, SLOT(debugInterrupt())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugInterruptAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setRunning(bool)), debugInterruptAct, SLOT(setEnabled(bool))); debugInterruptAct->setShortcut(QKeySequence(Qt::Key_F6)); debugInterruptAct->setEnabled(false); debugStepAct = new QAction(tr("&Step"), this); debugStepAct->setStatusTip(tr("Step one GL call")); CONNASSERT(debugStepAct, SIGNAL(triggered()), &m_controller, SLOT(debugStep())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepAct, SLOT(setEnabled(bool))); debugStepAct->setShortcut(QKeySequence(Qt::Key_F11)); debugStepAct->setEnabled(false); debugStepDrawCallAct = new QAction(tr("&Draw step"), this); debugStepDrawCallAct->setStatusTip(tr("Step one GL drawing call")); CONNASSERT(debugStepDrawCallAct, SIGNAL(triggered()), &m_controller, SLOT(debugStepDrawCall())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepDrawCallAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepDrawCallAct, SLOT(setEnabled(bool))); debugStepDrawCallAct->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F11)); debugStepDrawCallAct->setEnabled(false); debugStepFrameAct = new QAction(tr("&Frame step"), this); debugStepFrameAct->setStatusTip(tr("Step one GL frame")); CONNASSERT(debugStepFrameAct, SIGNAL(triggered()), &m_controller, SLOT(debugStepFrame())); CONNASSERT(&m_controller, SIGNAL(setConnected(bool)), debugStepFrameAct, SLOT(setEnabled(bool))); CONNASSERT(&m_controller, SIGNAL(setBreaked(bool)), debugStepFrameAct, SLOT(setEnabled(bool))); debugStepFrameAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F11)); debugStepFrameAct->setEnabled(false); addDeleteBreakPointsAct = new QAction(tr("&Breakpoints..."), this); addDeleteBreakPointsAct->setStatusTip(tr("Add or remove breakpoints")); CONNASSERT(addDeleteBreakPointsAct, SIGNAL(triggered()), this, SLOT(addDeleteBreakPoints())); addDeleteBreakPointsAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); setBreakOnGLErrorAct = new QAction(tr("Break on GL error"), this); setBreakOnGLErrorAct->setStatusTip( tr("Break execution on GL error (glGetError() != GL_NO_ERROR)")); // this action has a state - it is checbox-like checkable DGLConfiguration& currentConfig = m_controller.getConfig(); setBreakOnGLErrorAct->setCheckable(true); setBreakOnGLErrorAct->setChecked(currentConfig.m_BreakOnGLError); CONNASSERT(setBreakOnGLErrorAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); setBreakOnDebugOutputAct = new QAction(tr("Break on debug output"), this); setBreakOnDebugOutputAct->setStatusTip( tr("Break execution on debug output message")); // this action has a state - it is checbox-like checkable setBreakOnDebugOutputAct->setCheckable(true); setBreakOnDebugOutputAct->setChecked( currentConfig.m_BreakOnGLError); CONNASSERT(setBreakOnDebugOutputAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); setBreakOnCompilerErrAct = new QAction(tr("Break on compiler/linker error"), this); setBreakOnCompilerErrAct->setStatusTip( tr("Break execution on debug GLSL compiler or linker error")); // this action has a state - it is checbox-like checkable setBreakOnCompilerErrAct->setCheckable(true); setBreakOnCompilerErrAct->setChecked( currentConfig.m_BreakOnCompilerError); CONNASSERT(setBreakOnCompilerErrAct, SIGNAL(toggled(bool)), this, SLOT(setBreakOnWhatever(bool))); // Only one color scheme can be choosed - put all related actions to // action // group setColorSchemeActGroup = new QActionGroup(this); // iterate through all color schemes. for each one create one action for (uint i = 0; i < DGLNUM_COLOR_SCHEMES; i++) { setColorSchemeActs[i] = new QAction(tr(dglColorSchemes[i].name), this); setColorSchemeActs[i]->setCheckable(true); setColorSchemeActs[i]->setActionGroup(setColorSchemeActGroup); setColorSchemeActs[i]->setStatusTip(tr("Set this color scheme")); // connect all color scheme actions to one mapper, so we can connect // it // later to only one signal m_SetColorSchemeSignalMapper.setMapping(setColorSchemeActs[i], i); CONNASSERT(setColorSchemeActs[i], SIGNAL(triggered()), &m_SetColorSchemeSignalMapper, SLOT(map())); } // mapper maps connected actions to one emitted signal by int parameter. // Connect this signal to "this" CONNASSERT(&m_SetColorSchemeSignalMapper, SIGNAL(mapped(int)), this, SLOT(setColorScheme(int))); configurationAct = new QAction(tr("Configuration..."), this); configurationAct->setStatusTip(tr("Configuration options")); CONNASSERT(configurationAct, SIGNAL(triggered()), this, SLOT(configure())); prepareAndroidAct = new QAction(tr("Prepare Android device..."), this); prepareAndroidAct->setStatusTip(tr("Installs " DGL_PRODUCT " on Android device")); CONNASSERT(prepareAndroidAct, SIGNAL(triggered()), this, SLOT(androidPrepare())); }
Window::Window() { glWidgets[0][0] = new GLWidget(this, 0, 0); glWidgets[0][1] = new GLWidget(this, 1, 0); glWidgets[0][2] = new GLWidget(this, 2, 0); glWidgets[0][3] = new GLWidget(this, 3, 0); glWidgets[1][0] = new GLWidget(this, 4, 0); glWidgets[1][1] = new GLWidget(this, 5, 0); glWidgets[1][2] = new GLWidget(this, 6, 0); glWidgets[1][3] = new GLWidget(this, 7, 0); glWidgets[2][0] = new GLWidget(this, 8, 0); glWidgets[2][1] = new GLWidget(this, 9, 0); glWidgets[2][2] = new GLWidget(this, 10, 0); glWidgets[2][3] = new GLWidget(this, 11, 0); glWidgets[3][0] = new GLWidget(this, 12, 0); glWidgets[3][1] = new GLWidget(this, 13, 0); glWidgets[3][2] = new GLWidget(this, 14, 0); glWidgets[3][3] = new GLWidget(this, 15, 0); mainLayout = new QGridLayout; mouseOn = mouse[0] = mouse[1] = false; for (int i = 0; i < NumRows; ++i) { for (int j = 0; j < NumColumns; ++j) { mainLayout->addWidget(glWidgets[i][j], i, j); connect(glWidgets[i][j], SIGNAL(clicked()), this, SLOT(setCurrentGlWidget())); } } setLayout(mainLayout); currentGlWidget = glWidgets[0][0]; QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(rotateOneStep())); timer->start(20); setWindowTitle(tr("Sleep Dream Games")); shortcut(QKeySequence(Qt::Key_Escape), SLOT(keyHandleWM())); shortcut(QKeySequence(Qt::Key_Tab), SLOT(keyHandleWP())); shortcut(QKeySequence(Qt::Key_Space), SLOT(keyHandleXM())); shortcut(QKeySequence(Qt::Key_Enter), SLOT(keyHandleXP())); shortcut(QKeySequence(Qt::Key_Up), SLOT(keyHandleYM())); shortcut(QKeySequence(Qt::Key_Down), SLOT(keyHandleYP())); shortcut(QKeySequence(Qt::Key_Left), SLOT(keyHandleZM())); shortcut(QKeySequence(Qt::Key_Right), SLOT(keyHandleZP())); shortcut(QKeySequence(Qt::Key_Delete), SLOT(mouseFlip())); j = new Joystick(); connect(j,SIGNAL(keyHandleWM()), this , SLOT(keyHandleWM())); connect(j,SIGNAL(keyHandleWP()), this , SLOT(keyHandleWP())); connect(j,SIGNAL(keyHandleXM()), this , SLOT(keyHandleXM())); connect(j,SIGNAL(keyHandleXP()), this , SLOT(keyHandleXP())); connect(j,SIGNAL(keyHandleYM()), this , SLOT(keyHandleYM())); connect(j,SIGNAL(keyHandleYP()), this , SLOT(keyHandleYP())); connect(j,SIGNAL(keyHandleZM()), this , SLOT(keyHandleZM())); connect(j,SIGNAL(keyHandleZP()), this , SLOT(keyHandleZP())); QTimer *hot = new QTimer(this); connect(hot, SIGNAL(timeout()), this, SLOT(hotPlug())); hot->start(1000); }
KWebPage::KWebPage(QObject *parent, Integration flags) :QWebPage(parent), d(new KWebPagePrivate) { // KDE KParts integration for <embed> tag... if (!flags || (flags & KPartsIntegration)) setPluginFactory(new KWebPluginFactory(this)); QWidget *parentWidget = qobject_cast<QWidget*>(parent); QWidget *window = parentWidget ? parentWidget->window() : 0; // KDE IO (KIO) integration... if (!flags || (flags & KIOIntegration)) { KIO::Integration::AccessManager *manager = new KIO::Integration::AccessManager(this); // Disable QtWebKit's internal cache to avoid duplication with the one in KIO... manager->setCache(0); manager->setWindow(window); manager->setEmitReadyReadOnMetaDataChange(true); setNetworkAccessManager(manager); } // KWallet integration... if (!flags || (flags & KWalletIntegration)) { setWallet(new KWebWallet(0, (window ? window->winId() : 0) )); } setActionIcon(action(Back), KIcon("go-previous")); setActionIcon(action(Forward), KIcon("go-next")); setActionIcon(action(Reload), KIcon("view-refresh")); setActionIcon(action(Stop), KIcon("process-stop")); setActionIcon(action(Cut), KIcon("edit-cut")); setActionIcon(action(Copy), KIcon("edit-copy")); setActionIcon(action(Paste), KIcon("edit-paste")); setActionIcon(action(Undo), KIcon("edit-undo")); setActionIcon(action(Redo), KIcon("edit-redo")); setActionIcon(action(InspectElement), KIcon("view-process-all")); setActionIcon(action(OpenLinkInNewWindow), KIcon("window-new")); setActionIcon(action(OpenFrameInNewWindow), KIcon("window-new")); setActionIcon(action(OpenImageInNewWindow), KIcon("window-new")); setActionIcon(action(CopyLinkToClipboard), KIcon("edit-copy")); setActionIcon(action(CopyImageToClipboard), KIcon("edit-copy")); setActionIcon(action(ToggleBold), KIcon("format-text-bold")); setActionIcon(action(ToggleItalic), KIcon("format-text-italic")); setActionIcon(action(ToggleUnderline), KIcon("format-text-underline")); setActionIcon(action(DownloadLinkToDisk), KIcon("document-save")); setActionIcon(action(DownloadImageToDisk), KIcon("document-save")); settings()->setWebGraphic(QWebSettings::MissingPluginGraphic, KIcon("preferences-plugin").pixmap(32, 32)); settings()->setWebGraphic(QWebSettings::MissingImageGraphic, KIcon("image-missing").pixmap(32, 32)); settings()->setWebGraphic(QWebSettings::DefaultFrameIconGraphic, KIcon("applications-internet").pixmap(32, 32)); setActionShortcut(action(Back), KStandardShortcut::back()); setActionShortcut(action(Forward), KStandardShortcut::forward()); setActionShortcut(action(Reload), KStandardShortcut::reload()); setActionShortcut(action(Stop), KShortcut(QKeySequence(Qt::Key_Escape))); setActionShortcut(action(Cut), KStandardShortcut::cut()); setActionShortcut(action(Copy), KStandardShortcut::copy()); setActionShortcut(action(Paste), KStandardShortcut::paste()); setActionShortcut(action(Undo), KStandardShortcut::undo()); setActionShortcut(action(Redo), KStandardShortcut::redo()); setActionShortcut(action(SelectAll), KStandardShortcut::selectAll()); }
void LorrisProgrammer::initMenus() { // top menu bar QMenu *chipBar = new QMenu(tr("Chip"), this); addTopMenu(chipBar); m_start_act = chipBar->addAction(QIcon(":/actions/start"), tr("Start chip")); m_stop_act = chipBar->addAction(QIcon(":/actions/stop"), tr("Stop chip")); m_restart_act = chipBar->addAction(QIcon(":/actions/refresh"), tr("Restart chip")); m_start_act->setEnabled(false); m_stop_act->setEnabled(false); m_restart_act->setShortcut(QKeySequence("R")); m_restart_act->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_restart_act->setEnabled(false); connect(m_start_act, SIGNAL(triggered()), SLOT(startChip())); connect(m_stop_act, SIGNAL(triggered()), SLOT(stopChip())); connect(m_restart_act, SIGNAL(triggered()), SLOT(restartChip())); m_modeBar = new QMenu(tr("Mode"), this); addTopMenu(m_modeBar); QMenu *verifyMenu = m_modeBar->addMenu(tr("Verify write")); QSignalMapper *verifyMap = new QSignalMapper(this); for(quint8 i = 0; i < VERIFY_MAX; ++i) { static const QString verifyText[] = { tr("None"), tr("Verify only non-empty pages"), tr("Verify all") }; m_verify[i] = verifyMenu->addAction(verifyText[i]); m_verify[i]->setCheckable(true); verifyMap->setMapping(m_verify[i], i); connect(m_verify[i], SIGNAL(triggered()), verifyMap, SLOT(map())); } connect(verifyMap, SIGNAL(mapped(int)), SLOT(verifyChanged(int))); verifyChanged(sConfig.get(CFG_QUINT32_SHUPITO_VERIFY)); m_set_tunnel_name_act = m_modeBar->addAction(tr("Set RS232 tunnel name...")); m_set_tunnel_name_act->setVisible(false); connect(m_set_tunnel_name_act, SIGNAL(triggered()), SLOT(setTunnelName())); m_enableHardwareButton = m_modeBar->addAction(tr("Enable hardware button")); m_enableHardwareButton->setCheckable(true); m_enableHardwareButton->setChecked(sConfig.get(CFG_BOOL_SHUPITO_ENABLE_HW_BUTTON)); connect(m_enableHardwareButton, SIGNAL(toggled(bool)), this, SLOT(enableHardwareButtonToggled(bool))); m_load_flash = new QAction(QIcon(":/actions/open"), tr("Load..."), this); m_load_flash->setShortcut(QKeySequence("Ctrl+O")); m_load_flash->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(m_load_flash, SIGNAL(triggered()), this, SLOT(loadFromFile())); addTopAction(m_load_flash); m_save_flash = new QAction(QIcon(":/actions/save"), tr("Save..."), this); m_save_flash->setShortcut(QKeySequence("Ctrl+S")); m_save_flash->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(m_save_flash, SIGNAL(triggered()), this, SLOT(saveToFile())); addTopAction(m_save_flash); m_blink_led = new QAction(tr("Blink LED"), this); m_blink_led->setEnabled(false); connect(m_blink_led, SIGNAL(triggered()), this, SLOT(blinkLed())); addTopAction(m_blink_led); m_miniUi = new QAction(tr("Minimal UI"), this); m_miniUi->setCheckable(true); addTopAction(m_miniUi); connect(m_miniUi, SIGNAL(triggered(bool)), SLOT(setMiniUi(bool))); }
void ShortcutEdit::clear() { m_shortcut = QKeySequence(); setText(); emit changed(); }
bool ShortcutEdit::eventFilter(QObject* watched, QEvent* event) { if ((watched == m_edit) && (event->type() == QEvent::KeyPress)) { QKeyEvent* key_event = static_cast<QKeyEvent*>(event); Qt::KeyboardModifiers modifiers = key_event->modifiers() & (Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier); int key = key_event->key(); switch (key) { // Don't do anything if they only press a modifier case Qt::Key_Shift: case Qt::Key_Control: case Qt::Key_Meta: case Qt::Key_Alt: return true; // Clear on backspace unless modifier is used case Qt::Key_Backspace: case Qt::Key_Delete: if (modifiers == Qt::NoModifier) { clear(); return true; } break; // Allow tab to change focus case Qt::Key_Tab: case Qt::Key_Backtab: return false; default: break; } // Add modifiers; only allow shift if it is not required for key of shortcut if (modifiers & Qt::ShiftModifier) { QChar c = !key_event->text().isEmpty() ? key_event->text().at(0) : QChar(); if (!c.isPrint() || c.isLetterOrNumber() || c.isSpace()) { key |= Qt::SHIFT; } } if (modifiers & Qt::ControlModifier) { key |= Qt::CTRL; } if (modifiers & Qt::MetaModifier) { key |= Qt::META; } if (modifiers & Qt::AltModifier) { key |= Qt::ALT; } // Change shortcut m_shortcut = QKeySequence(key); setText(); emit changed(); return true; } else { return QWidget::eventFilter(watched, event); } }
void ShortcutEdit::setShortcut(const QKeySequence& shortcut) { setShortcut(shortcut, QKeySequence()); m_reset_button->setHidden(true); }
void KonqOperations::doDropFileCopy() { assert(m_info); // setDropInfo - and asyncDrop - should have been called before asyncDrop const KUrl::List lst = m_info->urls; Qt::DropAction action = m_info->action; bool allItemsAreFromTrash = true; KUrl::List mlst; // list of items that can be moved for (KUrl::List::ConstIterator it = lst.begin(); it != lst.end(); ++it) { bool local = (*it).isLocalFile(); if ( KProtocolManager::supportsDeleting( *it ) ) { if (!local) { mlst.append(*it); } else { QFileInfo itemInfo((*it).toLocalFile()); QFileInfo dirInfo(itemInfo.absolutePath()); // Posix does not permit the movement of a read-only folder, regardless of the permissions of its parent if (dirInfo.isWritable() && (!itemInfo.isDir() || itemInfo.isWritable())) { mlst.append(*it); } } } if ( local || (*it).protocol() != "trash" ) allItemsAreFromTrash = false; } bool linkOnly = false; // if true, we'll show a popup menu, but with only "link" in it (for confirmation) if ( allItemsAreFromTrash && lst.first().path() == "/" ) { // Dropping a link to the trash: don't move the full contents, just make a link (#319660) linkOnly = true; } if ( !mlst.isEmpty() && m_destUrl.protocol() == "trash" ) { m_method = TRASH; if ( askDeleteConfirmation( mlst, TRASH, DEFAULT_CONFIRMATION, parentWidget() ) ) action = Qt::MoveAction; else { deleteLater(); return; } } else if (!linkOnly && (allItemsAreFromTrash || m_destUrl.protocol() == "trash")) { // No point in asking copy/move/link when using dnd from or to the trash. action = Qt::MoveAction; } else if ( ( ((m_info->keyboardModifiers & Qt::ControlModifier) == 0) && ((m_info->keyboardModifiers & Qt::ShiftModifier) == 0) && ((m_info->keyboardModifiers & Qt::AltModifier) == 0) ) || linkOnly ) { // Neither control, shift or alt are pressed => show popup menu // TODO move this code out somehow. Allow user of KonqOperations to add his own actions... #if 0 KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent()); bool bSetWallpaper = false; if ( iconView && iconView->maySetWallpaper() && lst.count() == 1 ) { KUrl url = lst.first(); KMimeType::Ptr mime = KMimeType::findByUrl( url ); if ( mime && ( ( KImageIO::isSupported(mime->name(), KImageIO::Reading) ) || mime->is( "image/svg+xml" ) ) ) { bSetWallpaper = true; } } #endif // Check what the source can do // we'll assume it's the same for all URLs (hack) // TODO: if we had a KFileItemList instead of a KUrl::List, // we could use KFileItemsCapabilities const KUrl url = lst.first(); bool sReading = KProtocolManager::supportsReading( url ); bool sDeleting = KProtocolManager::supportsDeleting( url ); bool sMoving = KProtocolManager::supportsMoving( url ); // Check what the destination can do bool dWriting = KProtocolManager::supportsWriting( m_destUrl ); if ( !dWriting ) { deleteLater(); return; } bool enableLinking = true; // for now, but see below // We don't want to offer "move" for temp files. They might come from // kmail using a tempfile for attachments, or ark using a tempdir for // extracting an archive -- in all cases, we can't implement a real move, // it's just a copy of the tempfile [and the source app will delete it later]. // https://www.intevation.de/roundup/kolab/issue2026 // // Similarly, linking to a temp file is pointless. if (url.isLocalFile() && url.toLocalFile().startsWith(KStandardDirs::locateLocal("tmp", QString()))) { sMoving = false; sDeleting = false; enableLinking = false; } QMenu popup; QString seq = QKeySequence( Qt::ShiftModifier ).toString(); seq.chop(1); // chop superfluous '+' QAction* popupMoveAction = new QAction(i18n( "&Move Here" ) + '\t' + seq, this); popupMoveAction->setIcon(KIcon("go-jump")); seq = QKeySequence( Qt::ControlModifier ).toString(); seq.chop(1); QAction* popupCopyAction = new QAction(i18n( "&Copy Here" ) + '\t' + seq, this); popupCopyAction->setIcon(KIcon("edit-copy")); seq = QKeySequence( Qt::ControlModifier + Qt::ShiftModifier ).toString(); seq.chop(1); QAction* popupLinkAction = new QAction(i18n( "&Link Here" ) + '\t' + seq, this); popupLinkAction->setIcon(KIcon("edit-link")); QAction* popupWallAction = new QAction( i18n( "Set as &Wallpaper" ), this ); popupWallAction->setIcon(KIcon("preferences-desktop-wallpaper")); QAction* popupCancelAction = new QAction(i18n( "C&ancel" ) + '\t' + QKeySequence( Qt::Key_Escape ).toString(), this); popupCancelAction->setIcon(KIcon("process-stop")); if (!mlst.isEmpty() && (sMoving || (sReading && sDeleting)) && !linkOnly ) { bool equalDestination = true; foreach ( const KUrl & src, lst ) { const bool equalProtocol = ( m_destUrl.protocol() == src.protocol() ); if ( !equalProtocol || m_destUrl.path(KUrl::RemoveTrailingSlash) != src.directory() ) { equalDestination = false; break; } } if ( !equalDestination ) popup.addAction(popupMoveAction); }
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 RazorShortcutButton::setKeySequence(const QString &sequence) { setKeySequence(QKeySequence(sequence)); }
void MainWindow::createMenu() { // menu file actOpen = new QAction(this); actOpen->setShortcut(QKeySequence("Ctrl+O")); actSave = new QAction(this); actSave->setShortcut(QKeySequence("Ctrl+S")); actClose = new QAction(this); actClose->setShortcut(QKeySequence("Ctrl+W")); actExit = new QAction(this); actExit->setShortcut(QKeySequence("Ctrl+X")); menuFile = menuBar()->addMenu(""); menuFile->addAction(actOpen); menuFile->addAction(actSave); menuFile->addAction(actClose); menuFile->addSeparator(); menuFile->addAction(actExit); // menu interface actEn = new QAction(this); actZht = new QAction(this); actZhs = new QAction(this); actEn->setCheckable(true); actZht->setCheckable(true); actZhs->setCheckable(true); updateLangCheckbox(); menuInterface = menuBar()->addMenu(""); menuInterface->addAction(actEn); menuInterface->addAction(actZht); menuInterface->addAction(actZhs); // menu chinese convert actZhsToZht = new QAction(this); actZhtToZhs = new QAction(this); menuChiConv = menuBar()->addMenu(""); menuChiConv->addAction(actZhsToZht); menuChiConv->addAction(actZhtToZhs); // menu help // actHelp = new QAction(this); // actHelp->setShortcut(QKeySequence("F1")); actAbout = new QAction(this); menuHelp = menuBar()->addMenu(""); // menuHelp->addAction(actHelp); menuHelp->addAction(actAbout); // signal and slot QObject::connect(actOpen, SIGNAL(triggered()), this, SLOT(openFile())); QObject::connect(actClose, SIGNAL(triggered()), this, SLOT(closeFile())); QObject::connect(actExit, SIGNAL(triggered()), this, SLOT(close())); // QObject::connect(actHelp, SIGNAL(triggered()), this, SLOT(help())); QObject::connect(actAbout, SIGNAL(triggered()), this, SLOT(about())); QObject::connect(actEn, SIGNAL(triggered()), this, SLOT(changeLangEn())); QObject::connect(actZht, SIGNAL(triggered()), this, SLOT(changeLangZht())); QObject::connect(actZhs, SIGNAL(triggered()), this, SLOT(changeLangZhs())); QObject::connect(actZhsToZht, SIGNAL(triggered()), this, SLOT(convertToZht())); QObject::connect(actZhtToZhs, SIGNAL(triggered()), this, SLOT(convertToZhs())); }
ScriptEdit::ScriptEdit(ScriptingEnv *env, QWidget *parent, const char *name) : QTextEdit(parent, name), scripted(env), d_error(false), d_completer(0), d_highlighter(0), d_file_name(QString::null), d_search_string(QString::null), d_output_widget(NULL) { myScript = scriptEnv->newScript("", this, name); connect(myScript, SIGNAL(error(const QString&, const QString&, int)), this, SLOT(insertErrorMsg(const QString&))); connect(myScript, SIGNAL(print(const QString&)), this, SLOT(scriptPrint(const QString&))); connect(myScript, SIGNAL(error(const QString&, const QString&, int)), this, SIGNAL(error(const QString&, const QString&, int))); setLineWrapMode(NoWrap); setUndoRedoEnabled(true); setTextFormat(Qt::PlainText); setAcceptRichText (false); setFocusPolicy(Qt::StrongFocus); rehighlight(); d_fmt_default.setBackground(palette().brush(QPalette::Base)); //Init completer based on parser built-in functions QStringList functions = MyParser::functionNamesList(); functions.sort(); QCompleter *completer = new QCompleter(this); completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setModel(new QStringListModel(functions, completer)); setCompleter(completer); printCursor = textCursor(); scriptsDirPath = qApp->applicationDirPath(); actionExecute = new QAction(tr("E&xecute"), this); actionExecute->setShortcut( tr("Ctrl+J") ); connect(actionExecute, SIGNAL(activated()), this, SLOT(execute())); actionExecuteAll = new QAction(QIcon(":/play.png"), tr("Execute &All"), this); actionExecuteAll->setShortcut( tr("Ctrl+Shift+J") ); connect(actionExecuteAll, SIGNAL(activated()), this, SLOT(executeAll())); actionEval = new QAction(tr("&Evaluate Expression"), this); actionEval->setShortcut( tr("Ctrl+Return") ); connect(actionEval, SIGNAL(activated()), this, SLOT(evaluate())); actionPrint = new QAction(QIcon(":/fileprint.png"), tr("&Print"), this); connect(actionPrint, SIGNAL(activated()), this, SLOT(print())); actionImport = new QAction(QIcon(":/fileopen.png"), tr("&Import..."), this); actionImport->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_O)); connect(actionImport, SIGNAL(activated()), this, SLOT(importASCII())); actionSave = new QAction(QIcon(":/filesave.png"), tr("&Save"), this); actionSave->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_S)); connect(actionSave, SIGNAL(activated()), this, SLOT(save())); actionExport = new QAction(QIcon(":/filesaveas.png"), tr("Sa&ve as..."), this); connect(actionExport, SIGNAL(activated()), this, SLOT(exportASCII())); actionFind = new QAction(QIcon(":/find.png"), tr("&Find..."), this); actionFind->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_F)); connect(actionFind, SIGNAL(activated()), this, SLOT(showFindDialog())); actionReplace = new QAction(QIcon(":/replace.png"), tr("&Replace..."), this); actionReplace->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_R)); connect(actionReplace, SIGNAL(activated()), this, SLOT(replace())); actionFindNext = new QAction(QIcon(":/find_next.png"), tr("&Find next"), this); actionFindNext->setShortcut(QKeySequence(Qt::Key_F3)); connect(actionFindNext, SIGNAL(activated()), this, SLOT(findNext())); actionFindPrevious = new QAction(QIcon(":/find_previous.png"), tr("&Find previous"), this); actionFindPrevious->setShortcut(QKeySequence(Qt::Key_F4)); connect(actionFindPrevious, SIGNAL(activated()), this, SLOT(findPrevious())); functionsMenu = new QMenu(this); Q_CHECK_PTR(functionsMenu); connect(functionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(insertFunction(QAction *))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(matchParentheses())); }
QKeySequence defaultShortcut(UIActionPoolType) const { return QKeySequence("D"); }
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("Send coins to a Litecoin 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("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 Litecoin"), this); aboutAction->setStatusTip(tr("Show information about Litecoin")); 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 Litecoin")); 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 Litecoin 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 Litecoin 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())); }
ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : QFrame(parent), m_itemIconSize(24, 24), m_resIconSize(24, 24), m_iconProvider(m_resIconSize), m_itemViewQuickWidget(new QQuickWidget), m_resourcesView(new ItemLibraryTreeView(this)), m_filterFlag(QtBasic) { ItemLibraryModel::registerQmlTypes(); setWindowTitle(tr("Library", "Title of library view")); /* create Items view and its model */ m_itemViewQuickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); m_itemLibraryModel = new ItemLibraryModel(this); QQmlContext *rootContext = m_itemViewQuickWidget->rootContext(); rootContext->setContextProperty(QStringLiteral("itemLibraryModel"), m_itemLibraryModel.data()); rootContext->setContextProperty(QStringLiteral("itemLibraryIconWidth"), m_itemIconSize.width()); rootContext->setContextProperty(QStringLiteral("itemLibraryIconHeight"), m_itemIconSize.height()); rootContext->setContextProperty(QStringLiteral("rootView"), this); m_itemViewQuickWidget->rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor()); /* create Resources view and its model */ m_resourcesFileSystemModel = new QFileSystemModel(this); m_resourcesFileSystemModel->setIconProvider(&m_iconProvider); m_resourcesView->setModel(m_resourcesFileSystemModel.data()); m_resourcesView->setIconSize(m_resIconSize); /* create image provider for loading item icons */ m_itemViewQuickWidget->engine()->addImageProvider(QStringLiteral("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider); /* other widgets */ QTabBar *tabBar = new QTabBar(this); tabBar->addTab(tr("QML Types", "Title of library QML types view")); tabBar->addTab(tr("Resources", "Title of library resources view")); tabBar->addTab(tr("Imports", "Title of library imports view")); tabBar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(setCurrentIndexOfStackedWidget(int))); connect(tabBar, SIGNAL(currentChanged(int)), this, SLOT(updateSearch())); m_filterLineEdit = new Utils::FancyLineEdit(this); m_filterLineEdit->setObjectName(QStringLiteral("itemLibrarySearchInput")); m_filterLineEdit->setPlaceholderText(tr("<Filter>", "Library search input hint text")); m_filterLineEdit->setDragEnabled(false); m_filterLineEdit->setMinimumWidth(75); m_filterLineEdit->setTextMargins(0, 0, 20, 0); m_filterLineEdit->setFiltering(true); QWidget *lineEditFrame = new QWidget(this); lineEditFrame->setObjectName(QStringLiteral("itemLibrarySearchInputFrame")); QGridLayout *lineEditLayout = new QGridLayout(lineEditFrame); lineEditLayout->setMargin(2); lineEditLayout->setSpacing(0); lineEditLayout->addItem(new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 0, 1, 3); lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 0); lineEditLayout->addWidget(m_filterLineEdit.data(), 1, 1, 1, 1); lineEditLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed), 1, 2); connect(m_filterLineEdit.data(), SIGNAL(filterChanged(QString)), this, SLOT(setSearchFilter(QString))); m_stackedWidget = new QStackedWidget(this); m_stackedWidget->addWidget(m_itemViewQuickWidget.data()); m_stackedWidget->addWidget(m_resourcesView.data()); QWidget *spacer = new QWidget(this); spacer->setObjectName(QStringLiteral("itemLibrarySearchInputSpacer")); spacer->setFixedHeight(4); QGridLayout *layout = new QGridLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->addWidget(tabBar, 0, 0, 1, 1); layout->addWidget(spacer, 1, 0); layout->addWidget(lineEditFrame, 2, 0, 1, 1); layout->addWidget(m_stackedWidget.data(), 3, 0, 1, 1); setResourcePath(QDir::currentPath()); setSearchFilter(QString()); /* style sheets */ setStyleSheet(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css")))); m_resourcesView->setStyleSheet(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))); m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F5), this); connect(m_qmlSourceUpdateShortcut, SIGNAL(activated()), this, SLOT(reloadQmlSource())); // init the first load of the QML UI elements reloadQmlSource(); }
void pdp::Toolbar::AddToolbar() { //std::cout << "hi from " << __FUNCSIG__ << std::endl; m_Toolbar = m_ThreeDEditing->GetMainWindow()->addToolBar("tools"); QToolButton* btn_OpenFile = new QToolButton(m_Toolbar); QIcon icn_OpenFile; icn_OpenFile.addFile(":/threeDEditing/res/threeDEditing/Open-32.png"); btn_OpenFile->setIcon(icn_OpenFile); btn_OpenFile->setToolTip("Open new file."); btn_OpenFile->setShortcut(QKeySequence("CTRL+O")); m_Toolbar->addWidget(btn_OpenFile); QObject::connect(btn_OpenFile, SIGNAL(clicked()), this, SLOT(OpenFile())); QToolButton* btn_SaveSelectedNode = new QToolButton(m_Toolbar); QIcon icn_SaveSelectedNode; icn_SaveSelectedNode.addFile(":/threeDEditing/res/threeDEditing/Save-32.png"); btn_SaveSelectedNode->setIcon(icn_SaveSelectedNode); btn_SaveSelectedNode->setToolTip("Save selected file."); btn_SaveSelectedNode->setShortcut(QKeySequence("CTRL+S")); m_Toolbar->addWidget(btn_SaveSelectedNode); QObject::connect(btn_SaveSelectedNode, SIGNAL(clicked()), this, SLOT(SaveSelectedNode())); QToolButton* btn_GetCurrentDataStorage = new QToolButton(m_Toolbar); QIcon icn_GetCurrentDataStorage; icn_GetCurrentDataStorage.addFile(":/threeDEditing/res/threeDEditing/Refresh-32.png"); btn_GetCurrentDataStorage->setIcon(icn_GetCurrentDataStorage); btn_GetCurrentDataStorage->setToolTip("Load thickenings created by Pleuradat Plus."); m_Toolbar->addWidget(btn_GetCurrentDataStorage); QObject::connect(btn_GetCurrentDataStorage, SIGNAL(clicked()), this, SLOT(GetCurrentDataStorage())); QToolButton* btn_RemoveSelectedNode = new QToolButton(m_Toolbar); QIcon icn_RemoveSelectedNode; icn_RemoveSelectedNode.addFile(":/threeDEditing/res/threeDEditing/Delete-32.png"); btn_RemoveSelectedNode->setIcon(icn_RemoveSelectedNode); btn_RemoveSelectedNode->setToolTip("Remove selected data node."); btn_RemoveSelectedNode->setShortcut(QKeySequence("Del")); m_Toolbar->addWidget(btn_RemoveSelectedNode); QObject::connect(btn_RemoveSelectedNode, SIGNAL(clicked()), this, SLOT(RemoveSelectedNode())); m_Toolbar->addSeparator(); QToolButton* btn_Undo = new QToolButton(m_Toolbar); QIcon icn_Undo; icn_Undo.addFile(":/threeDEditing/res/threeDEditing/Undo_48.png"); btn_Undo->setIcon(icn_Undo); btn_Undo->setToolTip("Undo the last action (not supported by all modules)."); btn_Undo->setShortcut(QKeySequence("CTRL+Z")); m_Toolbar->addWidget(btn_Undo); QObject::connect(btn_Undo, SIGNAL(clicked()), this, SLOT(Undo())); QToolButton* btn_Redo = new QToolButton(m_Toolbar); QIcon icn_Redo; icn_Redo.addFile(":/threeDEditing/res/threeDEditing/Redo_48.png"); btn_Redo->setIcon(icn_Redo); btn_Redo->setToolTip("Execute the last action that was undone again (not supported by all modules)."); btn_Redo->setShortcut(QKeySequence("CTRL+Y")); m_Toolbar->addWidget(btn_Redo); QObject::connect(btn_Redo, SIGNAL(clicked()), this, SLOT(Redo())); m_Toolbar->addSeparator(); QToolButton* btn_ToggleDataManager = new QToolButton(m_Toolbar); QIcon icn_ToggleDataManager; icn_ToggleDataManager.addFile(":/threeDEditing/res/threeDEditing/DataManager.png"); btn_ToggleDataManager->setIcon(icn_ToggleDataManager); btn_ToggleDataManager->setToolTip("Toggle data manager."); m_Toolbar->addWidget(btn_ToggleDataManager); m_DataManagerToggled = true; btn_ToggleDataManager->setDown(true); QObject::connect(btn_ToggleDataManager, SIGNAL(clicked()), this, SLOT(ToggleDataManager())); QToolButton* btn_UseMITKSegmentationTools = new QToolButton(m_Toolbar); QIcon icn_UseMITKSegmentationTools; icn_UseMITKSegmentationTools.addFile(":/threeDEditing/res/threeDEditing/Segmentation.png"); btn_UseMITKSegmentationTools->setIcon(icn_UseMITKSegmentationTools); btn_UseMITKSegmentationTools->setToolTip("Toggle tool manager."); m_Toolbar->addWidget(btn_UseMITKSegmentationTools); m_ToolManagerInitialize = true; m_ToolManagerToggled = false; btn_UseMITKSegmentationTools->setDown(false); QObject::connect(btn_UseMITKSegmentationTools, SIGNAL(clicked()), this, SLOT(ToggleToolManager())); m_Toolbar->addSeparator(); // Surface Representation part QToolButton* btn_ToggleView = new QToolButton(m_Toolbar); QIcon icn_ToggleView; icn_ToggleView.addFile(":/threeDEditing/res/threeDEditing/View.png"); btn_ToggleView->setIcon(icn_ToggleView); btn_ToggleView->setToolTip("Toggle surface representation: Points -> Surface -> Wireframe."); m_Toolbar->addWidget(btn_ToggleView); QObject::connect(btn_ToggleView, SIGNAL(clicked()), this, SLOT(ToggleView())); QToolButton* btn_ToggleSurfaceColor = new QToolButton(m_Toolbar); QIcon icn_ToggleSurfaceColor; icn_ToggleSurfaceColor.addFile(":/threeDEditing/res/threeDEditing/Color.png"); btn_ToggleSurfaceColor->setIcon(icn_ToggleSurfaceColor); btn_ToggleSurfaceColor->setToolTip("Toggle color of surfaces. Show one or multiple colors."); m_Toolbar->addWidget(btn_ToggleSurfaceColor); QObject::connect(btn_ToggleSurfaceColor, SIGNAL(clicked()), this, SLOT(ToggleSurfaceColor())); QToolButton* btn_ToggleOrientationWidget = new QToolButton(m_Toolbar); QIcon icn_ToggleOrientationWidget; icn_ToggleOrientationWidget.addFile(":/threeDEditing/res/threeDEditing/Orientation.png"); btn_ToggleOrientationWidget->setIcon(icn_ToggleOrientationWidget); btn_ToggleOrientationWidget->setToolTip("Toggle Orientation Widget."); m_Toolbar->addWidget(btn_ToggleOrientationWidget); QObject::connect(btn_ToggleOrientationWidget, SIGNAL(clicked()), this, SLOT(ToggleOrientationWidget())); QToolButton* btn_ToggleAnnotation = new QToolButton(m_Toolbar); QIcon icn_ToggleAnnotation; icn_ToggleAnnotation.addFile(":/threeDEditing/res/threeDEditing/Annotation.png"); btn_ToggleAnnotation->setIcon(icn_ToggleAnnotation); btn_ToggleAnnotation->setToolTip("Toggle renderer window informations."); m_Toolbar->addWidget(btn_ToggleAnnotation); QObject::connect(btn_ToggleAnnotation, SIGNAL(clicked()), this, SLOT(ToggleAnnotation())); m_Toolbar->addSeparator(); QColor color(214,247,202); QPalette colorPalette(color); m_Toolbar->setAutoFillBackground(true); m_Toolbar->setPalette(colorPalette); //std::cout << "ciao from " << __FUNCSIG__ << std::endl; }
static bool convert(const QVariant::Private *d, QVariant::Type t, void *result, bool *ok) { switch (t) { case QVariant::ByteArray: if (d->type == QVariant::Color) { *static_cast<QByteArray *>(result) = v_cast<QColor>(d)->name().toLatin1(); return true; } break; case QVariant::String: { QString *str = static_cast<QString *>(result); switch (d->type) { #ifndef QT_NO_SHORTCUT case QVariant::KeySequence: *str = QString(*v_cast<QKeySequence>(d)); return true; #endif case QVariant::Font: *str = v_cast<QFont>(d)->toString(); return true; case QVariant::Color: *str = v_cast<QColor>(d)->name(); return true; default: break; } break; } case QVariant::Pixmap: if (d->type == QVariant::Image) { *static_cast<QPixmap *>(result) = QPixmap::fromImage(*v_cast<QImage>(d)); return true; } else if (d->type == QVariant::Bitmap) { *static_cast<QPixmap *>(result) = *v_cast<QBitmap>(d); return true; } else if (d->type == QVariant::Brush) { if (v_cast<QBrush>(d)->style() == Qt::TexturePattern) { *static_cast<QPixmap *>(result) = v_cast<QBrush>(d)->texture(); return true; } } break; case QVariant::Image: if (d->type == QVariant::Pixmap) { *static_cast<QImage *>(result) = v_cast<QPixmap>(d)->toImage(); return true; } else if (d->type == QVariant::Bitmap) { *static_cast<QImage *>(result) = v_cast<QBitmap>(d)->toImage(); return true; } break; case QVariant::Bitmap: if (d->type == QVariant::Pixmap) { *static_cast<QBitmap *>(result) = *v_cast<QPixmap>(d); return true; } else if (d->type == QVariant::Image) { *static_cast<QBitmap *>(result) = QBitmap::fromImage(*v_cast<QImage>(d)); return true; } break; #ifndef QT_NO_SHORTCUT case QVariant::Int: if (d->type == QVariant::KeySequence) { *static_cast<int *>(result) = (int)(*(v_cast<QKeySequence>(d))); return true; } break; #endif case QVariant::Font: if (d->type == QVariant::String) { QFont *f = static_cast<QFont *>(result); f->fromString(*v_cast<QString>(d)); return true; } break; case QVariant::Color: if (d->type == QVariant::String) { static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d)); return static_cast<QColor *>(result)->isValid(); } else if (d->type == QVariant::ByteArray) { static_cast<QColor *>(result)->setNamedColor(QString::fromLatin1( *v_cast<QByteArray>(d))); return true; } else if (d->type == QVariant::Brush) { if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) { *static_cast<QColor *>(result) = v_cast<QBrush>(d)->color(); return true; } } break; case QVariant::Brush: if (d->type == QVariant::Color) { *static_cast<QBrush *>(result) = QBrush(*v_cast<QColor>(d)); return true; } else if (d->type == QVariant::Pixmap) { *static_cast<QBrush *>(result) = QBrush(*v_cast<QPixmap>(d)); return true; } break; #ifndef QT_NO_SHORTCUT case QVariant::KeySequence: { QKeySequence *seq = static_cast<QKeySequence *>(result); switch (d->type) { case QVariant::String: *seq = QKeySequence(*v_cast<QString>(d)); return true; case QVariant::Int: *seq = QKeySequence(d->data.i); return true; default: break; } } #endif default: break; } return qcoreVariantHandler()->convert(d, t, result, ok); }
void PropertySheetKeySequenceValue::setStandardKey(const QKeySequence::StandardKey &standardKey) { m_value = QKeySequence(standardKey); m_standardKey = standardKey; }
MainWindow::MainWindow() { _rrtWidget = new RRTWidget(); setWindowTitle("Interactive RRT"); _iterationCountLabel = new QLabel(this); _iterationCountLabel->setText("Iterations: 0"); statusBar()->addPermanentWidget(_iterationCountLabel); QPushButton *run = new QPushButton(this); run->setText("Run"); run->setStyleSheet("background-color: green;"); QPushButton *stop = new QPushButton(this); stop->setText("Stop"); QPushButton *step = new QPushButton(this); step->setText("Step"); QPushButton *stepBig = new QPushButton(this); stepBig->setText("Step 100"); QPushButton *reset = new QPushButton(this); reset->setText("Reset"); QPushButton *clearObstacles = new QPushButton(this); clearObstacles->setText("Clear Obstacles"); clearObstacles->setStyleSheet("background-color: red;"); QSlider *goalBias = new QSlider(Qt::Horizontal, this); goalBias->setTickPosition(QSlider::TicksBelow); goalBias->setMinimum(0); goalBias->setMaximum(100); goalBias->setTickInterval(10); _goalBiasLabel = new QLabel("Goal Bias: 0", this); QSlider *waypointBias = new QSlider(Qt::Horizontal, this); waypointBias->setTickPosition(QSlider::TicksBelow); waypointBias->setMinimum(0); waypointBias->setMaximum(100); waypointBias->setTickInterval(10); _waypointBiasLabel = new QLabel("Waypoint Bias: 0", this); QDoubleSpinBox *stepSizeBox = new QDoubleSpinBox(this); stepSizeBox->setMinimum(0.1); stepSizeBox->setMaximum(100); stepSizeBox->setValue(10); QLabel *stepSizeLabel = new QLabel("Step Size:"); QGridLayout *layout = new QGridLayout(); layout->addWidget(run, 0, 0); layout->addWidget(stop, 1, 0); layout->addWidget(step, 0, 1); layout->addWidget(stepBig, 1, 1); layout->addWidget(reset, 0, 2); layout->addWidget(clearObstacles, 1, 2); layout->addWidget(goalBias, 1, 3); layout->addWidget(_goalBiasLabel, 0, 3); layout->addWidget(waypointBias, 1, 4); layout->addWidget(_waypointBiasLabel, 0, 4); layout->addWidget(stepSizeBox, 1, 5); layout->addWidget(stepSizeLabel, 0, 5); layout->addWidget(_rrtWidget, 2, 0, 1, 6); QWidget *centralWidget = new QWidget(this); centralWidget->setLayout(layout); this->setCentralWidget(centralWidget); // prevent the window from being resized setFixedSize(sizeHint()); // make the buttons do things connect(run, SIGNAL(clicked()), _rrtWidget, SLOT(slot_run())); connect(stop, SIGNAL(clicked()), _rrtWidget, SLOT(slot_stop())); connect(step, SIGNAL(clicked()), _rrtWidget, SLOT(slot_step())); connect(stepBig, SIGNAL(clicked()), _rrtWidget, SLOT(slot_stepBig())); connect(reset, SIGNAL(clicked()), _rrtWidget, SLOT(slot_reset())); connect(clearObstacles, SIGNAL(clicked()), _rrtWidget, SLOT(slot_clearObstacles())); connect(goalBias, SIGNAL(valueChanged(int)), _rrtWidget, SLOT(slot_setGoalBias(int))); connect(goalBias, SIGNAL(valueChanged(int)), this, SLOT(slot_updateGoalBiasLabel(int))); connect(waypointBias, SIGNAL(valueChanged(int)), _rrtWidget, SLOT(slot_setWaypointBias(int))); connect(waypointBias, SIGNAL(valueChanged(int)), this, SLOT(slot_updateWaypointBiasLabel(int))); connect(stepSizeBox, SIGNAL(valueChanged(double)), _rrtWidget, SLOT(slot_setStepSize(double))); connect(_rrtWidget, SIGNAL(signal_stepped(int)), this, SLOT(slot_updateIterationCount(int))); // keyboard shortcuts new QShortcut(QKeySequence(Qt::Key_R), _rrtWidget, SLOT(slot_run())); new QShortcut(QKeySequence(Qt::Key_S), _rrtWidget, SLOT(slot_stop())); new QShortcut(QKeySequence(Qt::Key_C), _rrtWidget, SLOT(slot_reset())); }
quint32 QxtGlobalShortcutPrivate::nativeKeycode(Qt::Key key) { Display* display = QX11Info::display(); return XKeysymToKeycode(display, XStringToKeysym(QKeySequence(key).toString().toLatin1().data())); }
PeerListWidget::PeerListWidget(PropertiesWidget *parent): QTreeView(parent), m_properties(parent), m_displayFlags(false) { // Load settings loadSettings(); // Visual settings setUniformRowHeights(true); setRootIsDecorated(false); setItemsExpandable(false); setAllColumnsShowFocus(true); setSelectionMode(QAbstractItemView::ExtendedSelection); // List Model m_listModel = new QStandardItemModel(0, PeerListDelegate::COL_COUNT); m_listModel->setHeaderData(PeerListDelegate::COUNTRY, Qt::Horizontal, QVariant()); // Country flag column m_listModel->setHeaderData(PeerListDelegate::IP, Qt::Horizontal, tr("IP")); m_listModel->setHeaderData(PeerListDelegate::PORT, Qt::Horizontal, tr("Port")); m_listModel->setHeaderData(PeerListDelegate::FLAGS, Qt::Horizontal, tr("Flags")); m_listModel->setHeaderData(PeerListDelegate::CONNECTION, Qt::Horizontal, tr("Connection")); m_listModel->setHeaderData(PeerListDelegate::CLIENT, Qt::Horizontal, tr("Client", "i.e.: Client application")); m_listModel->setHeaderData(PeerListDelegate::PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded")); m_listModel->setHeaderData(PeerListDelegate::DOWN_SPEED, Qt::Horizontal, tr("Down Speed", "i.e: Download speed")); m_listModel->setHeaderData(PeerListDelegate::UP_SPEED, Qt::Horizontal, tr("Up Speed", "i.e: Upload speed")); m_listModel->setHeaderData(PeerListDelegate::TOT_DOWN, Qt::Horizontal, tr("Downloaded", "i.e: total data downloaded")); m_listModel->setHeaderData(PeerListDelegate::TOT_UP, Qt::Horizontal, tr("Uploaded", "i.e: total data uploaded")); m_listModel->setHeaderData(PeerListDelegate::RELEVANCE, Qt::Horizontal, tr("Relevance", "i.e: How relevant this peer is to us. How many pieces it has that we don't.")); // Proxy model to support sorting without actually altering the underlying model m_proxyModel = new PeerListSortModel(); m_proxyModel->setDynamicSortFilter(true); m_proxyModel->setSourceModel(m_listModel); m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive); setModel(m_proxyModel); //Explicitly set the column visibility. When columns are added/removed //between versions this prevents some of them being hidden due to //incorrect restoreState() being used. for (unsigned int i=0; i<PeerListDelegate::IP_HIDDEN; i++) showColumn(i); hideColumn(PeerListDelegate::IP_HIDDEN); hideColumn(PeerListDelegate::COL_COUNT); if (!Preferences::instance()->resolvePeerCountries()) hideColumn(PeerListDelegate::COUNTRY); //To also mitigate the above issue, we have to resize each column when //its size is 0, because explicitly 'showing' the column isn't enough //in the above scenario. for (unsigned int i=0; i<PeerListDelegate::IP_HIDDEN; i++) if (!columnWidth(i)) resizeColumnToContents(i); // Context menu setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showPeerListMenu(QPoint))); // List delegate m_listDelegate = new PeerListDelegate(this); setItemDelegate(m_listDelegate); // Enable sorting setSortingEnabled(true); // IP to Hostname resolver updatePeerHostNameResolutionState(); // SIGNAL/SLOT connect(header(), SIGNAL(sectionClicked(int)), SLOT(handleSortColumnChanged(int))); handleSortColumnChanged(header()->sortIndicatorSection()); copyHotkey = new QShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_C), this, SLOT(copySelectedPeers()), 0, Qt::WidgetShortcut); }
const vector<QString> primary_widget::toolbar_icon_file_name_vec = { list_of_tbt_suffixes(single_toolbar_icon_file_name) }; #undef single_toolbar_icon_file_name // This needs to be updated manually if more toolbar buttons are added! const vector<QString> primary_widget::toolbar_action_text_vec = { "Laugh", "Draw", "Erase (Single Layer)", "Sprite Properties", "Rect Selection (Single Layer)" }; // This ALSO needs to be updated manually if more toolbar buttons are // added! const vector<QKeySequence> primary_widget::tool_button_shortcut_vec = { QKeySequence(Qt::Key_Q), QKeySequence(Qt::Key_W), QKeySequence(Qt::Key_E), QKeySequence(Qt::Key_R) }; primary_widget::primary_widget( vector<string>& s_argv_copy, QWidget* parent ) : QMainWindow(parent), argv_copy(s_argv_copy) { bool generate_toolbar_result = generate_toolbar(); cout << "Here's the result of generate_toolbar(): " << generate_toolbar_result << endl; if ( !generate_toolbar_result ) { quit_non_slot(); }
connect(toolMapper, SIGNAL(mapped(const QString &)), this, SLOT(manualProcess(const QString &))); i.toFront(); while (i.hasNext()) { i.next(); // The localized processor name is shown in menu QAction *action = new QAction(QString("%1...").arg(i.value()->name()), this); optionsMenu->addAction(action); connect(action, SIGNAL(triggered()), toolMapper, SLOT(map())); toolMapper->setMapping(action, i.key()); } } QMenu *viewMenu = menuBar()->addMenu(tr("&View")); #ifndef Q_OS_MAC viewMenu->addAction(tr("Toggle Full Screen"), this, SLOT(toggleFullScreen()), QKeySequence("F11")); #endif showhideSidebar = viewMenu->addAction(tr("Show Left Sidebar"), this, SLOT(showSidebar(bool))); showhideSidebar->setCheckable(true); showhideSidebar->setChecked(true); #ifndef Q_OS_MAC // not on a Mac QAction *showhideToolbar = viewMenu->addAction(tr("Show Toolbar"), this, SLOT(showToolbar(bool))); showhideToolbar->setCheckable(true); showhideToolbar->setChecked(true); #endif styleAction = viewMenu->addAction(tr("Tabbed View"), this, SLOT(toggleStyle())); styleAction->setCheckable(true); styleAction->setChecked(true); //connect(showhideSidebar, SIGNAL(triggered(bool)), this, SLOT(showSidebar(bool)));
void ActionManagerImpl::initSubscriptionListView(SubscriptionListView* subscriptionListView) { if (d->subscriptionListView) return; else d->subscriptionListView = subscriptionListView; KActionCollection *coll = actionCollection(); KAction *action = coll->addAction("go_prev_feed"); action->setText(i18n("&Previous Feed")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotPrevFeed())); action->setShortcuts(KShortcut( "P" )); action = coll->addAction("go_next_feed"); action->setText(i18n("&Next Feed")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotNextFeed())); action->setShortcuts(KShortcut( "N" )); action = coll->addAction("go_next_unread_feed"); action->setIcon(KIcon("go-down")); action->setText(i18n("N&ext Unread Feed")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotNextUnreadFeed())); action->setShortcut( QKeySequence(Qt::ALT+Qt::Key_Plus) ); action = coll->addAction("go_prev_unread_feed"); action->setIcon(KIcon("go-up")); action->setText(i18n("Prev&ious Unread Feed")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotPrevUnreadFeed())); action->setShortcut( QKeySequence(Qt::ALT+Qt::Key_Minus) ); action = coll->addAction("feedstree_home"); action->setText(i18n("Go to Top of Tree")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemBegin())); action->setShortcuts(KShortcut( "Ctrl+Home" )); action = coll->addAction("feedstree_end"); action->setText(i18n("Go to Bottom of Tree")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemEnd())); action->setShortcuts(KShortcut( "Ctrl+End" )); action = coll->addAction("feedstree_left"); action->setText(i18n("Go Left in Tree")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemLeft())); action->setShortcuts(KShortcut( "Ctrl+Left" )); action = coll->addAction("feedstree_right"); action->setText(i18n("Go Right in Tree")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemRight())); action->setShortcuts(KShortcut( "Ctrl+Right" )); action = coll->addAction("feedstree_up"); action->setText(i18n("Go Up in Tree")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemUp())); action->setShortcuts(KShortcut( "Ctrl+Up" )); action = coll->addAction("feedstree_down" ); action->setText(i18n("Go Down in Tree")); connect(action, SIGNAL(triggered(bool)), subscriptionListView, SLOT(slotItemDown())); action->setShortcuts(KShortcut( "Ctrl+Down" )); }
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())); }