BitcoinGUI::BitcoinGUI(QWidget *parent): QMainWindow(parent), clientModel(0), walletModel(0), encryptWalletAction(0), changePassphraseAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0) { resize(850, 550); setWindowTitle(tr("slugcoin") + " - " + tr("Wallet")); #ifndef Q_WS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolslgOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolslg, menu slg and tray/dock icon createActions(); // Create application menu slg createMenuslg(); // Create the toolslgs createToolslgs(); // Create the tray icon (or setup the dock icon) createTrayIcon(); // Create tabs overviewPage = new OverviewPage(); miningPage = new MiningPage(this); transactionsPage = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(); transactionView = new TransactionView(this); vbox->addWidget(transactionView); transactionsPage->setLayout(vbox); addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab); receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab); sendCoinsPage = new SendCoinsDialog(this); signVerifyMessageDialog = new SignVerifyMessageDialog(this); centralWidget = new QStackedWidget(this); centralWidget->addWidget(overviewPage); centralWidget->addWidget(miningPage); centralWidget->addWidget(transactionsPage); centralWidget->addWidget(addressBookPage); centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); #ifdef FIRST_CLASS_MESSAGING centralWidget->addWidget(signVerifyMessageDialog); #endif setCentralWidget(centralWidget); // Create status slg statusslg(); // Status slg notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setMinimumWidth(73); frameBlocks->setMaximumWidth(73); QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); labelEncryptionIcon = new QLabel(); labelMiningIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelMiningIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); // Progress slg and label for blocks download progressslgLabel = new QLabel(); progressslgLabel->setVisible(false); progressslg = new QProgressslg(); progressslg->setAlignment(Qt::AlignCenter); progressslg->setVisible(false); statusslg()->addWidget(progressslgLabel); statusslg()->addWidget(progressslg); statusslg()->addPermanentWidget(frameBlocks); syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this); // Clicking on a transaction on the overview page simply sends you to transaction history page connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage())); connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); // Doubleclicking on a transaction on the transaction history page shows details connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // Clicking on "Verify Message" in the address book sends you to the verify message tab connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString))); // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString))); gotoOverviewPage(); }
TransactionView::TransactionView(QWidget *parent) : QWidget(parent), model(0), transactionProxyModel(0), transactionView(0) { // Build filter row setContentsMargins(0,0,0,0); QHBoxLayout *hlayout = new QHBoxLayout(); hlayout->setContentsMargins(0,0,0,0); #ifdef Q_OS_MAC hlayout->setSpacing(5); hlayout->addSpacing(26); #else hlayout->setSpacing(0); hlayout->addSpacing(23); #endif dateWidget = new QComboBox(this); #ifdef Q_OS_MAC dateWidget->setFixedWidth(121); #else dateWidget->setFixedWidth(120); #endif dateWidget->addItem(tr("All"), All); dateWidget->addItem(tr("Today"), Today); dateWidget->addItem(tr("This week"), ThisWeek); dateWidget->addItem(tr("This month"), ThisMonth); dateWidget->addItem(tr("Last month"), LastMonth); dateWidget->addItem(tr("This year"), ThisYear); dateWidget->addItem(tr("Range..."), Range); hlayout->addWidget(dateWidget); typeWidget = new QComboBox(this); #ifdef Q_OS_MAC typeWidget->setFixedWidth(121); #else typeWidget->setFixedWidth(120); #endif typeWidget->addItem(tr("All"), TransactionFilterProxy::ALL_TYPES); typeWidget->addItem(tr("Received with"), TransactionFilterProxy::TYPE(TransactionRecord::RecvWithAddress) | TransactionFilterProxy::TYPE(TransactionRecord::RecvFromOther)); typeWidget->addItem(tr("Sent to"), TransactionFilterProxy::TYPE(TransactionRecord::SendToAddress) | TransactionFilterProxy::TYPE(TransactionRecord::SendToOther)); typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf)); typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated)); typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other)); typeWidget->addItem(tr("New Alias"), TransactionFilterProxy::TYPE(TransactionRecord::AliasNew)); typeWidget->addItem(tr("Alias Activated"), TransactionFilterProxy::TYPE(TransactionRecord::AliasActivate)); typeWidget->addItem(tr("Alias Updated"), TransactionFilterProxy::TYPE(TransactionRecord::AliasUpdate)); typeWidget->addItem(tr("Alias Updated (Transfer)"), TransactionFilterProxy::TYPE(TransactionRecord::AliasTransfer)); typeWidget->addItem(tr("New Data Alias"), TransactionFilterProxy::TYPE(TransactionRecord::DataNew)); typeWidget->addItem(tr("Data Alias Activated"), TransactionFilterProxy::TYPE(TransactionRecord::DataActivate)); typeWidget->addItem(tr("Data Alias Updated"), TransactionFilterProxy::TYPE(TransactionRecord::DataUpdate)); typeWidget->addItem(tr("Data Alias Updated (Transfer)"), TransactionFilterProxy::TYPE(TransactionRecord::DataTransfer)); typeWidget->addItem(tr("New Offer"), TransactionFilterProxy::TYPE(TransactionRecord::OfferNew)); typeWidget->addItem(tr("Offer Activated"), TransactionFilterProxy::TYPE(TransactionRecord::OfferActivate)); typeWidget->addItem(tr("Offer Updated"), TransactionFilterProxy::TYPE(TransactionRecord::OfferUpdate)); typeWidget->addItem(tr("Offer Accepted"), TransactionFilterProxy::TYPE(TransactionRecord::OfferAccept)); typeWidget->addItem(tr("Offer Paid"), TransactionFilterProxy::TYPE(TransactionRecord::OfferPay)); typeWidget->addItem(tr("New Cert. Issuer"), TransactionFilterProxy::TYPE(TransactionRecord::CertIssuerNew)); typeWidget->addItem(tr("Cert. Issuer Activated"), TransactionFilterProxy::TYPE(TransactionRecord::CertIssuerActivate)); typeWidget->addItem(tr("Cert. Issuer updated"), TransactionFilterProxy::TYPE(TransactionRecord::CertIssuerUpdate)); typeWidget->addItem(tr("New Certificate"), TransactionFilterProxy::TYPE(TransactionRecord::CertNew)); typeWidget->addItem(tr("Certificate Transfer"), TransactionFilterProxy::TYPE(TransactionRecord::CertTransfer)); hlayout->addWidget(typeWidget); addressWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ addressWidget->setPlaceholderText(tr("Enter address or label to search")); #endif hlayout->addWidget(addressWidget); amountWidget = new QLineEdit(this); #if QT_VERSION >= 0x040700 /* Do not move this to the XML file, Qt before 4.7 will choke on it */ amountWidget->setPlaceholderText(tr("Min amount")); #endif #ifdef Q_OS_MAC amountWidget->setFixedWidth(97); #else amountWidget->setFixedWidth(100); #endif amountWidget->setValidator(new QDoubleValidator(0, 1e20, 8, this)); hlayout->addWidget(amountWidget); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setContentsMargins(0,0,0,0); vlayout->setSpacing(0); QTableView *view = new QTableView(this); vlayout->addLayout(hlayout); vlayout->addWidget(createDateRangeWidget()); vlayout->addWidget(view); vlayout->setSpacing(0); int width = view->verticalScrollBar()->sizeHint().width(); // Cover scroll bar width with spacing #ifdef Q_OS_MAC hlayout->addSpacing(width+2); #else hlayout->addSpacing(width); #endif // Always show scroll bar view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); view->setTabKeyNavigation(false); view->setContextMenuPolicy(Qt::CustomContextMenu); transactionView = view; // Actions QAction *copyAddressAction = new QAction(tr("Copy address"), this); QAction *copyLabelAction = new QAction(tr("Copy label"), this); QAction *copyAmountAction = new QAction(tr("Copy amount"), this); QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this); QAction *editLabelAction = new QAction(tr("Edit label"), this); QAction *showDetailsAction = new QAction(tr("Show transaction details"), this); contextMenu = new QMenu(); contextMenu->addAction(copyAddressAction); contextMenu->addAction(copyLabelAction); contextMenu->addAction(copyAmountAction); contextMenu->addAction(copyTxIDAction); contextMenu->addAction(editLabelAction); contextMenu->addAction(showDetailsAction); // Connect actions connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int))); connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int))); connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString))); connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString))); connect(view, SIGNAL(doubleClicked(QModelIndex)), this, SIGNAL(doubleClicked(QModelIndex))); connect(view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint))); connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress())); connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel())); connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount())); connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID())); connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel())); connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails())); }
void GameWall::addGame(ChessGame* game) { Q_ASSERT(game != nullptr); QWidget* widget = new QWidget(this); ChessClock* clock[2] = { new ChessClock(), new ChessClock() }; QHBoxLayout* clockLayout = new QHBoxLayout(); for (int i = 0; i < 2; i++) { clock[i] = new ChessClock(); clockLayout->addWidget(clock[i]); Chess::Side side = Chess::Side::Type(i); clock[i]->setPlayerName(side.toString()); } clockLayout->insertSpacing(1, 20); BoardScene* scene = new BoardScene(); BoardView* view = new BoardView(scene); QVBoxLayout* mainLayout = new QVBoxLayout(); mainLayout->addLayout(clockLayout); mainLayout->addWidget(view); mainLayout->setContentsMargins(0, 0, 0, 0); widget->setLayout(mainLayout); layout()->addWidget(widget); game->lockThread(); connect(game, SIGNAL(fenChanged(QString)), scene, SLOT(setFenString(QString))); connect(game, SIGNAL(moveMade(Chess::GenericMove, QString, QString)), scene, SLOT(makeMove(Chess::GenericMove))); connect(game, SIGNAL(humanEnabled(bool)), view, SLOT(setEnabled(bool))); for (int i = 0; i < 2; i++) { ChessPlayer* player(game->player(Chess::Side::Type(i))); if (player->isHuman()) connect(scene, SIGNAL(humanMove(Chess::GenericMove, Chess::Side)), player, SLOT(onHumanMove(Chess::GenericMove, Chess::Side))); clock[i]->setPlayerName(player->name()); connect(player, SIGNAL(nameChanged(QString)), clock[i], SLOT(setPlayerName(QString))); clock[i]->setInfiniteTime(player->timeControl()->isInfinite()); if (player->state() == ChessPlayer::Thinking) clock[i]->start(player->timeControl()->activeTimeLeft()); else clock[i]->setTime(player->timeControl()->timeLeft()); connect(player, SIGNAL(startedThinking(int)), clock[i], SLOT(start(int))); connect(player, SIGNAL(stoppedThinking()), clock[i], SLOT(stop())); } scene->setBoard(game->pgn()->createBoard()); scene->populate(); foreach (const Chess::Move& move, game->moves()) scene->makeMove(move); game->unlockThread(); view->setEnabled(!game->isFinished() && game->playerToMove()->isHuman()); m_games[game] = widget; cleanupWidgets(); }
DirOpener::DirOpener( Config *_config, Mode _mode, QWidget *parent, Qt::WFlags f ) : KDialog( parent, f ), dialogAborted( false ), config( _config ), mode( _mode ) { setCaption( i18n("Add folder") ); setWindowIcon( KIcon("folder") ); if( mode == Convert ) { setButtons( KDialog::User1 | KDialog::Cancel ); } else if( mode == ReplayGain ) { setButtons( KDialog::Ok | KDialog::Cancel ); } setButtonText( KDialog::User1, i18n("Proceed") ); setButtonIcon( KDialog::User1, KIcon("go-next") ); const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); connect( this, SIGNAL(user1Clicked()), this, SLOT(proceedClicked()) ); connect( this, SIGNAL(okClicked()), this, SLOT(addClicked()) ); page = DirOpenPage; QWidget *widget = new QWidget(); QGridLayout *mainGrid = new QGridLayout( widget ); QGridLayout *topGrid = new QGridLayout(); mainGrid->addLayout( topGrid, 0, 0 ); setMainWidget( widget ); lSelector = new QLabel( i18n("1. Select directory"), widget ); QFont font; font.setBold( true ); lSelector->setFont( font ); topGrid->addWidget( lSelector, 0, 0 ); lOptions = new QLabel( i18n("2. Set conversion options"), widget ); topGrid->addWidget( lOptions, 0, 1 ); // draw a horizontal line QFrame *lineFrame = new QFrame( widget ); lineFrame->setFrameShape( QFrame::HLine ); lineFrame->setFrameShadow( QFrame::Sunken ); mainGrid->addWidget( lineFrame, 1, 0 ); if( mode == ReplayGain ) { lSelector->hide(); lOptions->hide(); lineFrame->hide(); } // Dir Opener Widget dirOpenerWidget = new QWidget( widget ); mainGrid->addWidget( dirOpenerWidget, 2, 0 ); QVBoxLayout *box = new QVBoxLayout( dirOpenerWidget ); QHBoxLayout *directoryBox = new QHBoxLayout(); box->addLayout( directoryBox ); QLabel *labelFilter = new QLabel( i18n("Directory:"), dirOpenerWidget ); directoryBox->addWidget( labelFilter ); uDirectory = new KUrlRequester( KUrl("kfiledialog:///soundkonverter-add-media"), dirOpenerWidget ); uDirectory->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); directoryBox->addWidget( uDirectory ); QLabel *labelDirectory = new QLabel( i18n("Only add selected file formats:"), dirOpenerWidget ); box->addWidget( labelDirectory ); QHBoxLayout *fileTypesBox = new QHBoxLayout(); box->addLayout( fileTypesBox ); QStringList codecList; fileTypes = new KListWidget( dirOpenerWidget ); if( mode == Convert ) { codecList = config->pluginLoader()->formatList( PluginLoader::Decode, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); } else if( mode == ReplayGain ) { codecList = config->pluginLoader()->formatList( PluginLoader::ReplayGain, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); } for( int i = 0; i < codecList.size(); i++ ) { if( codecList.at(i) == "audio cd" ) continue; QListWidgetItem *newItem = new QListWidgetItem( codecList.at(i), fileTypes ); newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable ); newItem->setCheckState( Qt::Checked ); } QVBoxLayout *fileTypesFormatsBox = new QVBoxLayout(); fileTypesBox->addLayout( fileTypesFormatsBox ); fileTypesFormatsBox->addWidget( fileTypes ); QLabel *formatHelp = new QLabel( "<a href=\"format-help\">" + i18n("Are you missing some file formats?") + "</a>", this ); connect( formatHelp, SIGNAL(linkActivated(const QString&)), this, SLOT(showHelp()) ); fileTypesFormatsBox->addWidget( formatHelp ); QVBoxLayout *fileTypesButtonsBox = new QVBoxLayout(); fileTypesBox->addLayout( fileTypesButtonsBox ); fileTypesButtonsBox->addStretch(); pSelectAll = new KPushButton( KIcon("edit-select-all"), i18n("Select all"), dirOpenerWidget ); fileTypesButtonsBox->addWidget( pSelectAll ); connect( pSelectAll, SIGNAL(clicked()), this, SLOT(selectAllClicked()) ); pSelectNone = new KPushButton( KIcon("application-x-zerosize"), i18n("Select none"), dirOpenerWidget ); fileTypesButtonsBox->addWidget( pSelectNone ); connect( pSelectNone, SIGNAL(clicked()), this, SLOT(selectNoneClicked()) ); cRecursive = new QCheckBox( i18n("Recursive"), dirOpenerWidget ); cRecursive->setChecked( true ); cRecursive->setToolTip( i18n("If checked, files from subdirectories will be added, too.") ); fileTypesButtonsBox->addWidget( cRecursive ); fileTypesButtonsBox->addStretch(); // Conversion Options Widget options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget ); mainGrid->addWidget( options, 2, 0 ); adjustSize(); options->hide(); const KUrl url = KFileDialog::getExistingDirectoryUrl( uDirectory->url(), this ); if( !url.isEmpty() ) uDirectory->setUrl( url ); else dialogAborted = true; // Prevent the dialog from beeing too wide because of the directory history if( parent && width() > parent->width() ) setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) ); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "DirOpener" ); restoreDialogSize( group ); }
BitcoinGUI::BitcoinGUI(QWidget *parent): QMainWindow(parent), clientModel(0), walletModel(0), encryptWalletAction(0), changePassphraseAction(0), unlockWalletAction(0), lockWalletAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0) { resize(900, 650); setWindowTitle(tr("ANARCHISTS PRIME") + " - " + tr("Wallet")); #ifndef Q_OS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolBarOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create the tray icon (or setup the dock icon) createTrayIcon(); // Create tabs overviewPage = new OverviewPage(); blockBrowser = new BlockBrowser; blockBrowser->setObjectName("BlockBrowser"); transactionsPage = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(); transactionView = new TransactionView(this); vbox->addWidget(transactionView); transactionsPage->setLayout(vbox); addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab); receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab); sendCoinsPage = new SendCoinsDialog(this); signVerifyMessageDialog = new SignVerifyMessageDialog(this); centralWidget = new QStackedWidget(this); centralWidget->addWidget(overviewPage); centralWidget->addWidget(transactionsPage); centralWidget->addWidget(addressBookPage); centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); centralWidget->addWidget(blockBrowser); setCentralWidget(centralWidget); // Create status bar statusBar(); // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks); frameBlocksLayout->setContentsMargins(3,0,3,0); frameBlocksLayout->setSpacing(3); labelEncryptionIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); progressBar = new QProgressBar(); progressBar->setAlignment(Qt::AlignCenter); progressBar->setVisible(false); // Override style sheet for progress bar for styles that have a segmented progress bar, // as they make the text unreadable (workaround for issue #1071) // See https://qt-project.org/doc/qt-4.8/gallery.html QString curStyle = qApp->style()->metaObject()->className(); if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle") { progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }"); } statusBar()->addWidget(progressBarLabel); statusBar()->addWidget(progressBar); statusBar()->addPermanentWidget(frameBlocks); syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this); // Clicking on a transaction on the overview page simply sends you to transaction history page connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage())); connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); // Double-clicking on a transaction on the transaction history page shows details connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails())); rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // Clicking on "Verify Message" in the address book sends you to the verify message tab connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString))); // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString))); gotoOverviewPage(); applyTheme("default"); }
void JabberAddAccountWidget::createGui(bool showButtons) { QVBoxLayout *mainLayout = new QVBoxLayout(this); QWidget *formWidget = new QWidget(this); mainLayout->addWidget(formWidget); QFormLayout *layout = new QFormLayout(formWidget); QWidget *jidWidget = new QWidget(this); QGridLayout *jidLayout = new QGridLayout(jidWidget); jidLayout->setSpacing(0); jidLayout->setMargin(0); jidLayout->setColumnStretch(0, 2); jidLayout->setColumnStretch(2, 2); Username = new QLineEdit(this); connect(Username, SIGNAL(textEdited(QString)), this, SLOT(dataChanged())); jidLayout->addWidget(Username); AtLabel = new QLabel("@", this); jidLayout->addWidget(AtLabel, 0, 1); Domain = new QComboBox(); Domain->setEditable(true); if (!Factory->allowChangeServer()) { Domain->setVisible(false); AtLabel->setVisible(false); QString toolTip = Factory->whatIsMyUsername(); if (!toolTip.isEmpty()) { QLabel *whatIsMyUsernameLabel = new QLabel(tr("<a href='#'>What is my username?</a>"), this); whatIsMyUsernameLabel->setTextInteractionFlags(Qt::LinksAccessibleByMouse); jidLayout->addWidget(whatIsMyUsernameLabel, 0, 2, Qt::AlignRight); connect(whatIsMyUsernameLabel, SIGNAL(linkActivated(QString)), this, SLOT(showWhatIsMyUsername())); } } else { connect(Domain, SIGNAL(currentIndexChanged(QString)), this, SLOT(dataChanged())); connect(Domain, SIGNAL(editTextChanged(QString)), this, SLOT(dataChanged())); } jidLayout->addWidget(Domain, 0, 2); layout->addRow(tr("Username") + ':', jidWidget); AccountPassword = new QLineEdit(this); connect(AccountPassword, SIGNAL(textEdited(QString)), this, SLOT(dataChanged())); AccountPassword->setEchoMode(QLineEdit::Password); layout->addRow(tr("Password") + ':', AccountPassword); RememberPassword = new QCheckBox(tr("Remember Password"), this); layout->addRow(0, RememberPassword); Identity = new IdentitiesComboBox(this); connect(Identity, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged())); layout->addRow(tr("Account Identity") + ':', Identity); QLabel *infoLabel = new QLabel(tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"), this); infoLabel->setWordWrap(true); infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)); layout->addRow(0, infoLabel); mainLayout->addStretch(100); QDialogButtonBox *buttons = new QDialogButtonBox(Qt::Horizontal, this); mainLayout->addWidget(buttons); AddAccountButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add Account"), this); QPushButton *cancelButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this); buttons->addButton(AddAccountButton, QDialogButtonBox::AcceptRole); buttons->addButton(cancelButton, QDialogButtonBox::DestructiveRole); connect(AddAccountButton, SIGNAL(clicked(bool)), this, SLOT(apply())); connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel())); if (!showButtons) buttons->hide(); }
/** * Constructs a newFTPGUI which is a child of 'parent', * with the name 'name' and widget flags set to 'f' */ newFTPGUI::newFTPGUI(QWidget* parent) : QDialog(parent) { setModal(true); setWindowTitle(i18n("New Network Connection")); resize(400, 240); QVBoxLayout *mainLayout = new QVBoxLayout; setLayout(mainLayout); QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred); policy.setHeightForWidth(sizePolicy().hasHeightForWidth()); setSizePolicy(policy); iconLabel = new QLabel(this); iconLabel->setPixmap(krLoader->loadIcon("network-wired", KIconLoader::Desktop, 32)); iconLabel->setSizePolicy(SIZE_MINIMUM); aboutLabel = new QLabel(i18n("About to connect to..."), this); QFont font(aboutLabel->font()); font.setBold(true); aboutLabel->setFont(font); protocolLabel = new QLabel(i18n("Protocol:"), this); hostLabel = new QLabel(i18n("Host:"), this); portLabel = new QLabel(i18n("Port:"), this); prefix = new KComboBox(this); prefix->setObjectName(QString::fromUtf8("protocol")); prefix->setSizePolicy(SIZE_MINIMUM); url = new KHistoryComboBox(this); url->setMaxCount(50); url->setMinimumContentsLength(10); QStringList protocols = KProtocolInfo::protocols(); if (protocols.contains("ftp")) prefix->addItem(i18n("ftp://")); if (protocols.contains("smb")) prefix->addItem(i18n("smb://")); if (protocols.contains("fish")) prefix->addItem(i18n("fish://")); if (protocols.contains("sftp")) prefix->addItem(i18n("sftp://")); // load the history and completion list after creating the history combo KConfigGroup group(krConfig, "Private"); QStringList list = group.readEntry("newFTP Completion list", QStringList()); url->completionObject()->setItems(list); list = group.readEntry("newFTP History list", QStringList()); url->setHistoryItems(list); // Select last used protocol QString lastUsedProtocol = group.readEntry("newFTP Protocol", QString()); if(!lastUsedProtocol.isEmpty()) { prefix->setCurrentItem(lastUsedProtocol); } port = new QSpinBox(this); port->setMaximum(65535); port->setValue(21); port->setSizePolicy(SIZE_MINIMUM); usernameLabel = new QLabel(i18n("Username:"******"Password:"******"&Connect")); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(prefix, SIGNAL(activated(const QString &)), this, SLOT(slotTextChanged(const QString &))); connect(url, SIGNAL(activated(const QString &)), url, SLOT(addToHistory(const QString &))); if(!lastUsedProtocol.isEmpty()) { // update the port field slotTextChanged(lastUsedProtocol); } setTabOrder(url, username); setTabOrder(username, password); setTabOrder(password, prefix); }
GameCFGWidget::GameCFGWidget(QWidget* parent) : QGroupBox(parent) , mainLayout(this) , seedRegexp("\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}") { mainLayout.setMargin(0); setMinimumHeight(310); setMaximumHeight(447); setMinimumWidth(470); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_master = true; // Easy containers for the map/game options in either stacked or tabbed mode mapContainerFree = new QWidget(); mapContainerTabbed = new QWidget(); optionsContainerFree = new QWidget(); optionsContainerTabbed = new QWidget(); tabbed = false; // Container for when in tabbed mode tabs = new QTabWidget(this); tabs->setFixedWidth(470); tabs->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); tabs->addTab(mapContainerTabbed, tr("Map")); tabs->addTab(optionsContainerTabbed, tr("Game options")); tabs->setObjectName("gameCfgWidgetTabs"); mainLayout.addWidget(tabs, 1); tabs->setVisible(false); // Container for when in stacked mode StackContainer = new QWidget(); StackContainer->setObjectName("gameStackContainer"); mainLayout.addWidget(StackContainer, 1); QVBoxLayout * stackLayout = new QVBoxLayout(StackContainer); // Map options pMapContainer = new HWMapContainer(mapContainerFree); stackLayout->addWidget(mapContainerFree, 0, Qt::AlignHCenter); pMapContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); pMapContainer->setFixedSize(width() - 14, 278); mapContainerFree->setFixedSize(pMapContainer->width(), pMapContainer->height()); // Horizontal divider QFrame * divider = new QFrame(); divider->setFrameShape(QFrame::HLine); divider->setFrameShadow(QFrame::Plain); stackLayout->addWidget(divider, 0, Qt::AlignBottom); //stackLayout->setRowMinimumHeight(1, 10); // Game options optionsContainerTabbed->setContentsMargins(0, 0, 0, 0); optionsContainerFree->setFixedSize(width() - 14, 140); stackLayout->addWidget(optionsContainerFree, 0, Qt::AlignHCenter); OptionsInnerContainer = new QWidget(optionsContainerFree); m_childWidgets << OptionsInnerContainer; OptionsInnerContainer->setFixedSize(optionsContainerFree->width(), optionsContainerFree->height()); OptionsInnerContainer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); GBoxOptionsLayout = new QGridLayout(OptionsInnerContainer); GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Style"), this), 1, 0); Scripts = new QComboBox(this); GBoxOptionsLayout->addWidget(Scripts, 1, 1); Scripts->setModel(DataManager::instance().gameStyleModel()); m_curScript = Scripts->currentText(); connect(Scripts, SIGNAL(currentIndexChanged(int)), this, SLOT(scriptChanged(int))); QWidget *SchemeWidget = new QWidget(this); GBoxOptionsLayout->addWidget(SchemeWidget, 2, 0, 1, 2); QGridLayout *SchemeWidgetLayout = new QGridLayout(SchemeWidget); SchemeWidgetLayout->setMargin(0); GameSchemes = new QComboBox(SchemeWidget); SchemeWidgetLayout->addWidget(GameSchemes, 0, 2); connect(GameSchemes, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeChanged(int))); SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Scheme"), SchemeWidget), 0, 0); QPixmap pmEdit(":/res/edit.png"); QPushButton * goToSchemePage = new QPushButton(SchemeWidget); goToSchemePage->setWhatsThis(tr("Edit schemes")); goToSchemePage->setIconSize(pmEdit.size()); goToSchemePage->setIcon(pmEdit); goToSchemePage->setMaximumWidth(pmEdit.width() + 6); SchemeWidgetLayout->addWidget(goToSchemePage, 0, 3); connect(goToSchemePage, SIGNAL(clicked()), this, SLOT(jumpToSchemes())); SchemeWidgetLayout->addWidget(new QLabel(QLabel::tr("Weapons"), SchemeWidget), 1, 0); WeaponsName = new QComboBox(SchemeWidget); SchemeWidgetLayout->addWidget(WeaponsName, 1, 2); connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int))); QPushButton * goToWeaponPage = new QPushButton(SchemeWidget); goToWeaponPage->setWhatsThis(tr("Edit weapons")); goToWeaponPage->setIconSize(pmEdit.size()); goToWeaponPage->setIcon(pmEdit); goToWeaponPage->setMaximumWidth(pmEdit.width() + 6); SchemeWidgetLayout->addWidget(goToWeaponPage, 1, 3); connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons())); bindEntries = new QCheckBox(SchemeWidget); bindEntries->setWhatsThis(tr("Game scheme will auto-select a weapon")); bindEntries->setChecked(true); bindEntries->setMaximumWidth(42); bindEntries->setStyleSheet( "QCheckBox::indicator:checked { image: url(\":/res/lock.png\"); }" "QCheckBox::indicator:unchecked { image: url(\":/res/unlock.png\"); }" ); SchemeWidgetLayout->addWidget(bindEntries, 0, 1, 0, 1, Qt::AlignVCenter); connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &))); connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &))); connect(pMapContainer, SIGNAL(mapgenChanged(MapGenerator)), this, SLOT(mapgenChanged(MapGenerator))); connect(pMapContainer, SIGNAL(mazeSizeChanged(int)), this, SLOT(maze_sizeChanged(int))); connect(pMapContainer, SIGNAL(mapFeatureSizeChanged(int)), this, SLOT(slMapFeatureSizeChanged(int))); connect(pMapContainer, SIGNAL(themeChanged(const QString &)), this, SLOT(themeChanged(const QString &))); connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int))); connect(pMapContainer, SIGNAL(drawMapRequested()), this, SIGNAL(goToDrawMap())); connect(pMapContainer, SIGNAL(drawnMapChanged(const QByteArray &)), this, SLOT(onDrawnMapChanged(const QByteArray &))); connect(&DataManager::instance(), SIGNAL(updated()), this, SLOT(updateModelViews())); }
PreferencesDialog::PreferencesDialog( QWidget * parent ) : QDialog( parent ) { Preferences *preferences = GetPreferences(); m_restoreSearchPaths = preferences->getSearchPaths(); m_restoreEnvironmentEnabled = preferences->getEnvironmentEnabled(); m_restoreEnvironmentTextureName = preferences->getEnvironmentTextureName(); m_restoreMaterialCatalogPath = preferences->getMaterialCatalogPath(); m_environmentMapLabel = new QLabel( m_restoreEnvironmentTextureName ); m_environmentMapLabel->setFrameShadow( QFrame::Sunken ); m_environmentMapLabel->setFrameShape( QFrame::StyledPanel ); QPushButton * environmentMapButton = new QPushButton( "..." ); connect( environmentMapButton, SIGNAL(clicked(bool)), this, SLOT(selectEnvironmentMap(bool)) ); QHBoxLayout * environmentMapLayout = new QHBoxLayout(); environmentMapLayout->addWidget( m_environmentMapLabel ); environmentMapLayout->addWidget( environmentMapButton ); QFormLayout * environmentLayout = new QFormLayout(); environmentLayout->addRow( "Environment Map", environmentMapLayout ); QGroupBox * environmentBox = new QGroupBox( "Environment" ); environmentBox->setCheckable( true ); environmentBox->setChecked( m_restoreEnvironmentEnabled ); environmentBox->setLayout( environmentLayout ); connect( environmentBox, SIGNAL(toggled(bool)), this, SLOT(toggledEnvironmentBox(bool)) ); m_materialCatalogLabel = new QLabel( m_restoreMaterialCatalogPath ); m_materialCatalogLabel->setFrameShadow( QFrame::Sunken ); m_materialCatalogLabel->setFrameShape( QFrame::StyledPanel ); QPushButton * materialCatalogButton = new QPushButton( "..." ); connect( materialCatalogButton, SIGNAL(clicked(bool)), this, SLOT(selectMaterialCatalogPath(bool)) ); QHBoxLayout * materialCatalogLayout = new QHBoxLayout(); materialCatalogLayout->addWidget( m_materialCatalogLabel ); materialCatalogLayout->addWidget( materialCatalogButton ); QFormLayout * materialLayout = new QFormLayout(); materialLayout->addRow( "Material Catalog", materialCatalogLayout ); QGroupBox * materialBox = new QGroupBox( "Material" ); materialBox->setLayout( materialLayout ); m_searchPaths = new QListWidget(); m_searchPaths->addItems( m_restoreSearchPaths ); QPushButton * addPathButton = new QPushButton( "Add ..." ); connect( addPathButton, SIGNAL(clicked(bool)), this, SLOT(addPath(bool)) ); QPushButton * removePathButton = new QPushButton( "Remove" ); connect( removePathButton, SIGNAL(clicked(bool)), this, SLOT(removePath(bool)) ); QPushButton * moveUpPathButton = new QPushButton( "Move Up" ); connect( moveUpPathButton, SIGNAL(clicked(bool)), this, SLOT(moveUpPath(bool)) ); QPushButton * moveDownPathButton = new QPushButton( "Move Down" ); connect( moveDownPathButton, SIGNAL(clicked(bool)), this, SLOT(moveDownPath(bool)) ); QHBoxLayout * searchPathsButtons = new QHBoxLayout(); searchPathsButtons->addWidget( addPathButton ); searchPathsButtons->addWidget( removePathButton ); searchPathsButtons->addWidget( moveUpPathButton ); searchPathsButtons->addWidget( moveDownPathButton ); QVBoxLayout * verticalLayout = new QVBoxLayout(); verticalLayout->addWidget( m_searchPaths ); verticalLayout->addLayout( searchPathsButtons ); QGroupBox * searchPathsBox = new QGroupBox( "Search Paths" ); searchPathsBox->setLayout( verticalLayout ); QDialogButtonBox * buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok ); connect( buttonBox, SIGNAL(accepted()), this, SLOT(accept()) ); connect( buttonBox, SIGNAL(rejected()), this, SLOT(reject()) ); verticalLayout = new QVBoxLayout(); verticalLayout->addWidget( environmentBox ); verticalLayout->addWidget( materialBox ); verticalLayout->addWidget( searchPathsBox ); verticalLayout->addWidget( buttonBox ); setWindowTitle( "Preferences" ); setLayout( verticalLayout ); }
QWidget *ServerDialog::createAdvancedTab() { QVBoxLayout *layout = new QVBoxLayout; contest_mode_checkbox = new QCheckBox(tr("Contest mode")); contest_mode_checkbox->setChecked(Config.ContestMode); contest_mode_checkbox->setToolTip(tr("Requires password to login, hide screen name and disable kicking")); free_choose_checkbox = new QCheckBox(tr("Choose generals and cards freely")); free_choose_checkbox->setChecked(Config.FreeChoose); free_assign_checkbox = new QCheckBox(tr("Assign role and seat freely")); free_assign_checkbox->setChecked(Config.value("FreeAssign").toBool()); maxchoice_spinbox = new QSpinBox; maxchoice_spinbox->setRange(3, 10); maxchoice_spinbox->setValue(Config.value("MaxChoice", 5).toInt()); forbid_same_ip_checkbox = new QCheckBox(tr("Forbid same IP with multiple connection")); forbid_same_ip_checkbox->setChecked(Config.ForbidSIMC); disable_chat_checkbox = new QCheckBox(tr("Disable chat")); disable_chat_checkbox->setChecked(Config.DisableChat); second_general_checkbox = new QCheckBox(tr("Enable second general")); scene_checkbox = new QCheckBox(tr("Enable Scene")); //changjing max_hp_scheme_combobox = new QComboBox; max_hp_scheme_combobox->addItem(tr("Sum - 3")); max_hp_scheme_combobox->addItem(tr("Minimum")); max_hp_scheme_combobox->addItem(tr("Average")); max_hp_scheme_combobox->setCurrentIndex(Config.MaxHpScheme); max_hp_scheme_combobox->setEnabled(Config.Enable2ndGeneral); connect(second_general_checkbox, SIGNAL(toggled(bool)), max_hp_scheme_combobox, SLOT(setEnabled(bool))); second_general_checkbox->setChecked(Config.Enable2ndGeneral); scene_checkbox->setChecked(Config.EnableScene); //changjing QPushButton *banpair_button = new QPushButton(tr("Ban pairs table ...")); BanPairDialog *banpair_dialog = new BanPairDialog(this); connect(banpair_button, SIGNAL(clicked()), banpair_dialog, SLOT(exec())); connect(second_general_checkbox, SIGNAL(toggled(bool)), banpair_button, SLOT(setEnabled(bool))); announce_ip_checkbox = new QCheckBox(tr("Annouce my IP in WAN")); announce_ip_checkbox->setChecked(Config.AnnounceIP); announce_ip_checkbox->setEnabled(false); // not support now address_edit = new QLineEdit; address_edit->setText(Config.Address); #if QT_VERSION >= 0x040700 address_edit->setPlaceholderText(tr("Public IP or domain")); #endif QPushButton *detect_button = new QPushButton(tr("Detect my WAN IP")); connect(detect_button, SIGNAL(clicked()), this, SLOT(onDetectButtonClicked())); //address_edit->setEnabled(announce_ip_checkbox->isChecked()); // connect(announce_ip_checkbox, SIGNAL(toggled(bool)), address_edit, SLOT(setEnabled(bool))); port_edit = new QLineEdit; port_edit->setText(QString::number(Config.ServerPort)); port_edit->setValidator(new QIntValidator(1, 9999, port_edit)); layout->addWidget(contest_mode_checkbox); layout->addWidget(forbid_same_ip_checkbox); layout->addWidget(disable_chat_checkbox); layout->addWidget(free_choose_checkbox); layout->addWidget(free_assign_checkbox); layout->addLayout(HLay(new QLabel(tr("Upperlimit for general")), maxchoice_spinbox)); layout->addLayout(HLay(second_general_checkbox, banpair_button)); layout->addLayout(HLay(new QLabel(tr("Max HP scheme")), max_hp_scheme_combobox)); layout->addWidget(scene_checkbox); //changjing layout->addWidget(announce_ip_checkbox); layout->addLayout(HLay(new QLabel(tr("Address")), address_edit)); layout->addWidget(detect_button); layout->addLayout(HLay(new QLabel(tr("Port")), port_edit)); layout->addStretch(); QWidget *widget = new QWidget; widget->setLayout(layout); return widget; }
AccountsToolButton::AccountsToolButton( QWidget* parent ) : QToolButton( parent ) { m_popup = new AccountsPopupWidget( this ); m_popup->hide(); QToolBar* toolbar = qobject_cast< QToolBar* >( parent ); if ( toolbar ) setIconSize( toolbar->iconSize() ); else setIconSize( QSize( 22, 22 ) ); //Set up popup... QWidget *w = new QWidget( this ); w->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum ); QVBoxLayout *wMainLayout = new QVBoxLayout( w ); w->setLayout( wMainLayout ); TomahawkUtils::unmarginLayout( w->layout() ); w->setContentsMargins( 6, 6, 6, 6 ); #ifdef Q_OS_MAC w->setContentsMargins( 6, 6, 6, 0 ); wMainLayout->setMargin( 12 ); #endif m_popup->setWidget( w ); connect( m_popup, SIGNAL( hidden() ), SLOT( popupHidden() ) ); m_model = new Tomahawk::Accounts::AccountModel( this ); m_proxy = new AccountModelFactoryProxy( m_model ); m_proxy->setSourceModel( m_model ); m_proxy->setFilterRowType( Tomahawk::Accounts::AccountModel::TopLevelFactory ); m_proxy->setFilterEnabled( true ); AccountListWidget *view = new AccountListWidget( m_proxy, m_popup ); wMainLayout->addWidget( view ); view->setAutoFillBackground( false ); view->setAttribute( Qt::WA_TranslucentBackground, true ); connect( m_proxy, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( repaint() ) ); QWidget *separatorLine = new QWidget( w ); separatorLine->setFixedHeight( 1 ); separatorLine->setContentsMargins( 0, 0, 0, 0 ); separatorLine->setStyleSheet( "QWidget { border-top: 1px solid " + TomahawkUtils::Colors::BORDER_LINE.name() + "; }" ); //from ProxyStyle wMainLayout->addWidget( separatorLine ); wMainLayout->addSpacing( 6 ); QPushButton *settingsButton = new QPushButton( w ); settingsButton->setIcon( TomahawkUtils::defaultPixmap( TomahawkUtils::AccountSettings ) ); settingsButton->setText( tr( "Configure Accounts" ) ); connect( settingsButton, SIGNAL( clicked() ), window(), SLOT( showSettingsDialog() ) ); QHBoxLayout *bottomLayout = new QHBoxLayout( w ); TomahawkUtils::unmarginLayout( bottomLayout ); bottomLayout->addStretch(); bottomLayout->addWidget( settingsButton ); wMainLayout->addLayout( bottomLayout ); connect( m_proxy, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SLOT( updateIcons() ) ); connect( m_proxy, SIGNAL( rowsInserted ( QModelIndex, int, int ) ), this, SLOT( updateIcons() ) ); connect( m_proxy, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( updateIcons() ) ); connect( m_proxy, SIGNAL( modelReset() ), this, SLOT( updateIcons() ) ); }
MeterDialog::MeterDialog( QWidget * _parent, bool _simple ) : QWidget( _parent ), ModelView( NULL, this ) { QVBoxLayout * vlayout = new QVBoxLayout( this ); vlayout->setSpacing( 0 ); vlayout->setMargin( 0 ); QWidget * num = new QWidget( this ); QHBoxLayout * num_layout = new QHBoxLayout( num ); num_layout->setSpacing( 0 ); num_layout->setMargin( 0 ); m_numerator = new LcdSpinBox( 2, num, tr( "Meter Numerator" ) ); ToolTip::add( m_numerator, tr( "Meter numerator" ) ); num_layout->addWidget( m_numerator ); if( !_simple ) { QLabel * num_label = new QLabel( tr( "Meter Numerator" ), num ); QFont f = num_label->font(); num_label->setFont( pointSize<7>( f ) ); num_layout->addSpacing( 5 ); num_layout->addWidget( num_label ); } num_layout->addStretch(); QWidget * den = new QWidget( this ); QHBoxLayout * den_layout = new QHBoxLayout( den ); den_layout->setSpacing( 0 ); den_layout->setMargin( 0 ); m_denominator = new LcdSpinBox( 2, den, tr( "Meter Denominator" ) ); ToolTip::add( m_denominator, tr( "Meter denominator" ) ); if( _simple ) { m_denominator->setLabel( tr( "TIME SIG" ) ); } den_layout->addWidget( m_denominator ); if( !_simple ) { QLabel * den_label = new QLabel( tr( "Meter Denominator" ), den ); QFont f = den_label->font(); den_label->setFont( pointSize<7>( f ) ); den_layout->addSpacing( 5 ); den_layout->addWidget( den_label ); } den_layout->addStretch(); vlayout->addSpacing( _simple ? 1 : 3 ); vlayout->addWidget( num ); vlayout->addSpacing( 2 ); vlayout->addWidget( den ); vlayout->addStretch(); }
void QFontDialogPrivate::init() { Q_Q(QFontDialog); q->setSizeGripEnabled(true); q->setWindowTitle(QFontDialog::tr("Select Font")); // grid familyEdit = new QLineEdit(q); familyEdit->setReadOnly(true); familyList = new QFontListView(q); familyEdit->setFocusProxy(familyList); familyAccel = new QLabel(q); #ifndef QT_NO_SHORTCUT familyAccel->setBuddy(familyList); #endif familyAccel->setIndent(2); styleEdit = new QLineEdit(q); styleEdit->setReadOnly(true); styleList = new QFontListView(q); styleEdit->setFocusProxy(styleList); styleAccel = new QLabel(q); #ifndef QT_NO_SHORTCUT styleAccel->setBuddy(styleList); #endif styleAccel->setIndent(2); sizeEdit = new QLineEdit(q); sizeEdit->setFocusPolicy(Qt::ClickFocus); QIntValidator *validator = new QIntValidator(1, 512, q); sizeEdit->setValidator(validator); sizeList = new QFontListView(q); sizeAccel = new QLabel(q); #ifndef QT_NO_SHORTCUT sizeAccel->setBuddy(sizeEdit); #endif sizeAccel->setIndent(2); // effects box effects = new QGroupBox(q); QVBoxLayout *vbox = new QVBoxLayout(effects); strikeout = new QCheckBox(effects); vbox->addWidget(strikeout); underline = new QCheckBox(effects); vbox->addWidget(underline); sample = new QGroupBox(q); QHBoxLayout *hbox = new QHBoxLayout(sample); sampleEdit = new QLineEdit(sample); sampleEdit->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)); sampleEdit->setAlignment(Qt::AlignCenter); // Note that the sample text is *not* translated with tr(), as the // characters used depend on the charset encoding. sampleEdit->setText(QLatin1String("AaBbYyZz")); hbox->addWidget(sampleEdit); writingSystemCombo = new QComboBox(q); writingSystemAccel = new QLabel(q); #ifndef QT_NO_SHORTCUT writingSystemAccel->setBuddy(writingSystemCombo); #endif writingSystemAccel->setIndent(2); size = 0; smoothScalable = false; QObject::connect(writingSystemCombo, SIGNAL(activated(int)), q, SLOT(_q_writingSystemHighlighted(int))); QObject::connect(familyList, SIGNAL(highlighted(int)), q, SLOT(_q_familyHighlighted(int))); QObject::connect(styleList, SIGNAL(highlighted(int)), q, SLOT(_q_styleHighlighted(int))); QObject::connect(sizeList, SIGNAL(highlighted(int)), q, SLOT(_q_sizeHighlighted(int))); QObject::connect(sizeEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_sizeChanged(QString))); QObject::connect(strikeout, SIGNAL(clicked()), q, SLOT(_q_updateSample())); QObject::connect(underline, SIGNAL(clicked()), q, SLOT(_q_updateSample())); for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) { QFontDatabase::WritingSystem ws = QFontDatabase::WritingSystem(i); QString writingSystemName = QFontDatabase::writingSystemName(ws); if (writingSystemName.isEmpty()) break; writingSystemCombo->addItem(writingSystemName); } updateFamilies(); if (familyList->count() != 0) { familyList->setCurrentItem(0); sizeList->setCurrentItem(0); } // grid layout QGridLayout *mainGrid = new QGridLayout(q); int spacing = mainGrid->spacing(); if (spacing >= 0) { // uniform spacing mainGrid->setSpacing(0); mainGrid->setColumnMinimumWidth(1, spacing); mainGrid->setColumnMinimumWidth(3, spacing); int margin = 0; mainGrid->getContentsMargins(0, 0, 0, &margin); mainGrid->setRowMinimumHeight(3, margin); mainGrid->setRowMinimumHeight(6, 2); mainGrid->setRowMinimumHeight(8, margin); } mainGrid->addWidget(familyAccel, 0, 0); mainGrid->addWidget(familyEdit, 1, 0); mainGrid->addWidget(familyList, 2, 0); mainGrid->addWidget(styleAccel, 0, 2); mainGrid->addWidget(styleEdit, 1, 2); mainGrid->addWidget(styleList, 2, 2); mainGrid->addWidget(sizeAccel, 0, 4); mainGrid->addWidget(sizeEdit, 1, 4); mainGrid->addWidget(sizeList, 2, 4); mainGrid->setColumnStretch(0, 38); mainGrid->setColumnStretch(2, 24); mainGrid->setColumnStretch(4, 10); mainGrid->addWidget(effects, 4, 0); mainGrid->addWidget(sample, 4, 2, 4, 3); mainGrid->addWidget(writingSystemAccel, 5, 0); mainGrid->addWidget(writingSystemCombo, 7, 0); buttonBox = new QDialogButtonBox(q); mainGrid->addWidget(buttonBox, 9, 0, 1, 5); QPushButton *button = static_cast<QPushButton *>(buttonBox->addButton(QDialogButtonBox::Ok)); QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept())); button->setDefault(true); buttonBox->addButton(QDialogButtonBox::Cancel); QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject())); #if defined(Q_OS_WINCE) q->resize(180, 120); #else q->resize(500, 360); #endif // Q_OS_WINCE sizeEdit->installEventFilter(q); familyList->installEventFilter(q); styleList->installEventFilter(q); sizeList->installEventFilter(q); familyList->setFocus(); retranslateStrings(); sampleEdit->setObjectName(QLatin1String("qt_fontDialog_sampleEdit")); }
CommServDialog::CommServDialog(QWidget *parent) :QDialog(parent) { m_mouse_down = false; //setFrameShape(Panel); // Make this a borderless window which can't // be resized or moved via the window system setMouseTracking(true); this->setAttribute(Qt::WA_QuitOnClose,true); m_titleBar = new TitleBar(this); QRegExp regx("[0-9]+$"); label=new QLabel("输入:"); labelOutput=new QLabel("输出:"); lineEdit = new QLineEdit; lineEdit->setValidator(new QRegExpValidator(regx,this)); lineOutput = new QLineEdit; lineOutput->setValidator(new QRegExpValidator(regx,this)); lineOutput->setEnabled(false); readButton = new QPushButton(tr("读")); //say_helloButton->setFocus(); writeButton = new QPushButton(tr("写")); writeButton->setEnabled(false); read_writeButton = new QPushButton(tr("读/写")); read_writeButton->setEnabled(false); QObject::connect(lineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(enableWriteButton(const QString &))); QObject::connect(lineEdit,SIGNAL(textChanged(const QString &)),this,SLOT(enableRead_writeButton(const QString &))); QObject::connect(readButton,SIGNAL(clicked()),this,SLOT(readClicked())); QObject::connect(writeButton,SIGNAL(clicked()),this,SLOT(writeClicked())); QObject::connect(read_writeButton,SIGNAL(clicked()),this,SLOT(read_writeClicked())); QHBoxLayout *topLayoutUp = new QHBoxLayout; topLayoutUp->addWidget(label); topLayoutUp->addWidget(lineEdit); topLayoutUp->setMargin(5); topLayoutUp->setSpacing(3); QHBoxLayout *topLayoutMiddle = new QHBoxLayout; topLayoutMiddle->addWidget(labelOutput); topLayoutMiddle->addWidget(lineOutput); topLayoutMiddle->setMargin(5); topLayoutMiddle->setSpacing(3); QHBoxLayout *topLayoutDown = new QHBoxLayout; topLayoutDown->addWidget(readButton); topLayoutDown->addWidget(writeButton); topLayoutDown->addWidget(read_writeButton); topLayoutDown->setMargin(5); topLayoutDown->setSpacing(3); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(m_titleBar); mainLayout->addLayout(topLayoutUp); mainLayout->addLayout(topLayoutMiddle); mainLayout->addLayout(topLayoutDown); mainLayout->setMargin(1); mainLayout->setSpacing(0); setLayout(mainLayout); setWindowTitle(tr("高密级应用")); setFixedSize(300,125); }
/** * Sets up the page. */ void ActivityPage::setupPage() { int margin = fontMetrics().height(); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(10); m_pActivityGB = new QGroupBox(i18n("Activities"), this); // vertical box layout for the activity lists, arrow buttons and the button box QVBoxLayout* listVBoxLayout = new QVBoxLayout(m_pActivityGB); listVBoxLayout->setMargin(margin); listVBoxLayout->setSpacing(10); //horizontal box contains the list box and the move up/down buttons QHBoxLayout* listHBoxLayout = new QHBoxLayout(); listHBoxLayout->setSpacing(10); listVBoxLayout->addItem(listHBoxLayout); m_pActivityLW = new QListWidget(m_pActivityGB); m_pActivityLW->setContextMenuPolicy(Qt::CustomContextMenu); listHBoxLayout->addWidget(m_pActivityLW); QVBoxLayout * buttonLayout = new QVBoxLayout(); listHBoxLayout->addItem(buttonLayout); m_pTopArrowB = new QToolButton(m_pActivityGB); m_pTopArrowB->setArrowType(Qt::UpArrow); m_pTopArrowB->setEnabled(false); m_pTopArrowB->setToolTip(i18n("Move selected item to the top")); buttonLayout->addWidget(m_pTopArrowB); m_pUpArrowB = new QToolButton(m_pActivityGB); m_pUpArrowB->setArrowType(Qt::UpArrow); m_pUpArrowB->setEnabled(false); m_pUpArrowB->setToolTip(i18n("Move selected item up")); buttonLayout->addWidget(m_pUpArrowB); m_pDownArrowB = new QToolButton(m_pActivityGB); m_pDownArrowB->setArrowType(Qt::DownArrow); m_pDownArrowB->setEnabled(false); m_pDownArrowB->setToolTip(i18n("Move selected item down")); buttonLayout->addWidget(m_pDownArrowB); m_pBottomArrowB = new QToolButton(m_pActivityGB); m_pBottomArrowB->setArrowType(Qt::DownArrow); m_pBottomArrowB->setEnabled(false); m_pBottomArrowB->setToolTip(i18n("Move selected item to the bottom")); buttonLayout->addWidget(m_pBottomArrowB); #if QT_VERSION >= 0x050000 QDialogButtonBox* buttonBox = new QDialogButtonBox(m_pActivityGB); QPushButton* newActivity = buttonBox->addButton(i18n("New Activity..."), QDialogButtonBox::ActionRole); connect(newActivity, SIGNAL(clicked()), this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), QDialogButtonBox::ActionRole); connect(m_pDeleteActivityButton, SIGNAL(clicked()), this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), QDialogButtonBox::ActionRole); connect(m_pRenameButton, SIGNAL(clicked()), this, SLOT(slotRename())); #else KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pActivityGB); buttonBox->addButton(i18n("New Activity..."), KDialogButtonBox::ActionRole, this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), KDialogButtonBox::ActionRole, this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), KDialogButtonBox::ActionRole, this, SLOT(slotRename())); #endif listVBoxLayout->addWidget(buttonBox); mainLayout->addWidget(m_pActivityGB); //now fill activity list box QStringList list = m_pStateWidget->activities(); QStringList::ConstIterator end(list.end()); for(QStringList::ConstIterator it(list.begin()); it != end; ++it) { m_pActivityLW->addItem(*it); } //now setup the signals connect(m_pActivityLW, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotClicked(QListWidgetItem*))); connect(m_pActivityLW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotRightButtonPressed(QPoint))); connect(m_pTopArrowB, SIGNAL(clicked()), this, SLOT(slotTopClicked())); connect(m_pUpArrowB, SIGNAL(clicked()), this, SLOT(slotUpClicked())); connect(m_pDownArrowB, SIGNAL(clicked()), this, SLOT(slotDownClicked())); connect(m_pBottomArrowB, SIGNAL(clicked()), this, SLOT(slotBottomClicked())); connect(m_pActivityLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotDoubleClicked(QListWidgetItem*))); enableWidgets(false); }
SXRMBEXAFSScanConfigurationView::SXRMBEXAFSScanConfigurationView(SXRMBEXAFSScanConfiguration *configuration, QWidget *parent) : SXRMBScanConfigurationView(parent) { SXRMBBeamline *sxrmbBL = SXRMBBeamline::sxrmb(); configuration_ = configuration; regionsView_ = new AMEXAFSScanAxisView("SXRMB Region Configuration", configuration_); autoRegionButton_ = new QPushButton("Auto Set XANES Regions"); connect(autoRegionButton_, SIGNAL(clicked()), this, SLOT(setupDefaultXANESScanRegions())); pseudoXAFSButton_ = new QPushButton("Auto Set EXAFS Regions"); connect(pseudoXAFSButton_, SIGNAL(clicked()), this, SLOT(setupDefaultEXAFSScanRegions())); // Energy (Eo) selection energy_ = new QDoubleSpinBox; energy_->setSuffix(" eV"); energy_->setMinimum(0); energy_->setMaximum(10000); connect(energy_, SIGNAL(editingFinished()), this, SLOT(setEnergy())); elementChoice_ = new QToolButton; connect(elementChoice_, SIGNAL(clicked()), this, SLOT(onElementChoiceClicked())); lineChoice_ = new QComboBox; connect(lineChoice_, SIGNAL(currentIndexChanged(int)), this, SLOT(onLinesComboBoxIndexChanged(int))); if (configuration_->edge().isEmpty()){ elementChoice_->setText("Cl"); fillLinesComboBox(AMPeriodicTable::table()->elementBySymbol("Cl")); lineChoice_->setCurrentIndex(0); } // Resets the view for the view to what it should be. Using the saved for the energy in case it is different from the original line energy. else { elementChoice_->setText(configuration_->edge().split(" ").first()); lineChoice_->blockSignals(true); fillLinesComboBox(AMPeriodicTable::table()->elementBySymbol(elementChoice_->text())); lineChoice_->setCurrentIndex(lineChoice_->findText(configuration_->edge(), Qt::MatchStartsWith | Qt::MatchCaseSensitive)); lineChoice_->blockSignals(false); energy_->setValue(configuration_->energy()); } connect(configuration_, SIGNAL(edgeChanged(QString)), this, SLOT(onEdgeChanged())); QFormLayout *energySetpointLayout = new QFormLayout; energySetpointLayout->addRow("Energy:", energy_); QHBoxLayout *energyLayout = new QHBoxLayout; energyLayout->addLayout(energySetpointLayout); energyLayout->addWidget(elementChoice_); energyLayout->addWidget(lineChoice_); QHBoxLayout *regionsHL = new QHBoxLayout(); regionsHL->addStretch(); regionsHL->addWidget(autoRegionButton_); regionsHL->addWidget(pseudoXAFSButton_); QVBoxLayout *scanRegionConfigurationBoxLayout = new QVBoxLayout; scanRegionConfigurationBoxLayout->addLayout(energyLayout); scanRegionConfigurationBoxLayout->addWidget(regionsView_); scanRegionConfigurationBoxLayout->addLayout(regionsHL); QGroupBox *scanRegionConfigurationGroupBox = new QGroupBox("Scan Region Configuration"); scanRegionConfigurationGroupBox->setLayout(scanRegionConfigurationBoxLayout); // Scan information: scan name selection scanName_ = new QLineEdit(configuration_->userScanName()); scanName_->setAlignment(Qt::AlignCenter); connect(scanName_, SIGNAL(editingFinished()), this, SLOT(onScanNameEdited())); connect(configuration_, SIGNAL(nameChanged(QString)), scanName_, SLOT(setText(QString))); onScanNameEdited(); QFormLayout *scanNameLayout = new QFormLayout; scanNameLayout->addRow("Scan Name:", scanName_); // Scan information: the estimated scan time. estimatedTime_ = new QLabel; connect(configuration_, SIGNAL(totalTimeChanged(double)), this, SLOT(onEstimatedTimeChanged())); onEstimatedTimeChanged(); QVBoxLayout *scanInfoBoxLayout = new QVBoxLayout; scanInfoBoxLayout->addLayout(scanNameLayout); scanInfoBoxLayout->addWidget(estimatedTime_); QGroupBox *scanInfoGroupBox = new QGroupBox("Scan Information"); scanInfoGroupBox->setLayout(scanInfoBoxLayout); // Beamline setting layout QGroupBox *beamlineSettingsGroupBox = createAndLayoutBeamlineSettings(); // Bruker detector setting QGroupBox *detectorSettingGroupBox = createAndLayoutDetectorSettings(configuration_); // layout the contents QGridLayout *contentLayout = new QGridLayout(); contentLayout->addWidget(scanRegionConfigurationGroupBox, 0, 0, 1, 1); contentLayout->addWidget(scanInfoGroupBox, 1, 0, 1, 1); contentLayout->addWidget(beamlineSettingsGroupBox, 0, 4, 1, 1); contentLayout->addWidget(detectorSettingGroupBox, 1, 4, 1, 1); contentLayout->setContentsMargins(20,0,0,20); contentLayout->setSpacing(1); setLayout(contentLayout); connect(configuration_->dbObject(), SIGNAL(xChanged(double)), this, SLOT(onScanConfigurationSampleStageXChanged(double))); connect(configuration_->dbObject(), SIGNAL(zChanged(double)), this, SLOT(onScanConfigurationSampleStageZChanged(double))); connect(configuration_->dbObject(), SIGNAL(yChanged(double)), this, SLOT(onScanConfigurationNormalChanged(double))); connect(configuration_->dbObject(), SIGNAL(rotationChanged(double)), this, SLOT(onScanConfigurationRotationChanged(double))); connect(sxrmbBL, SIGNAL(endstationChanged(SXRMB::Endstation, SXRMB::Endstation)), this, SLOT(onBeamlineEndstationChanged(SXRMB::Endstation, SXRMB::Endstation))); if(sxrmbBL->isConnected()) onEndstationSampleStagePositionChanged(-1); }
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); this->setWindowTitle("Flow Free Game"); this->setFixedHeight(560); this->setFixedWidth(500); m_gen = NULL; m_solver = new Solver(); m_size = m_sizePrev = 0; m_pairNum = 0; m_num = 0; m_move = 0; m_connectedNum = 0; m_x = m_y = NULL; m_arr = NULL; m_path = NULL; isMousePress = false; isGameBegin = false; isDrawing = -1; prev = new QPushButton("上一关", this); next = new QPushButton("下一关", this); reStart = new QPushButton("重新开始", this); choose = new QPushButton("选关", this); solution = new QPushButton("显示解答", this); flowLabel = new QLabel("flows:"); moveLabel = new QLabel("moves:"); pipeLabel = new QLabel("pipe:"); flowEdit = new QLineEdit(); moveEdit = new QLineEdit(); pipeEdit = new QLineEdit(); flowEdit->setReadOnly(true); moveEdit->setReadOnly(true); pipeEdit->setReadOnly(true); QVBoxLayout *vt = new QVBoxLayout(this); QHBoxLayout *ht1 = new QHBoxLayout(); vt->addLayout(ht1); QPalette pe; pe.setColor(QPalette::WindowText, Qt::white); flowLabel->setPalette(pe); moveLabel->setPalette(pe); pipeLabel->setPalette(pe); ht1->addWidget(flowLabel); ht1->addWidget(flowEdit); ht1->addSpacing(50); ht1->addWidget(moveLabel); ht1->addWidget(moveEdit); ht1->addSpacing(50); ht1->addWidget(pipeLabel); ht1->addWidget(pipeEdit); vt->addStretch(); QHBoxLayout *ht2 = new QHBoxLayout(); vt->addLayout(ht2); ht2->addWidget(prev); ht2->addWidget(choose); ht2->addWidget(reStart); ht2->addWidget(solution); ht2->addWidget(next); chooseDialog = new QDialog(); chooseDialog->setWindowTitle("Choose Level"); chooseDialog->setFixedHeight(190); chooseDialog->setFixedWidth(320); for (int i = 0; i < 3; ++i) { level5[i] = new QPushButton(QString::number(i + 1), chooseDialog); level6[i] = new QPushButton(QString::number(i + 1), chooseDialog); level7[i] = new QPushButton(QString::number(i + 1), chooseDialog); randomButton[i] = new QPushButton("Random", chooseDialog); } label5 = new QLabel("5×5:"); label6 = new QLabel("6×6:"); label7 = new QLabel("7×7:"); tipLabel = new QLabel("Tip: Random生成的是随机有解的关卡"); QVBoxLayout *vt2 = new QVBoxLayout(chooseDialog); QGridLayout *gt = new QGridLayout(); vt2->addLayout(gt); vt2->addWidget(tipLabel); gt->addWidget(label5, 0, 0); gt->addWidget(label6, 1, 0); gt->addWidget(label7, 2, 0); for (int i = 0; i < 3; ++i) { gt->addWidget(level5[i], 0, i + 1); gt->addWidget(level6[i], 1, i + 1); gt->addWidget(level7[i], 2, i + 1); gt->addWidget(randomButton[i], i, 4); } //chooseLevel->show(); conDialog = new QDialog(); conLabel = new QLabel("Congratulations!", conDialog); conButton = new QPushButton("OK", conDialog); QVBoxLayout *cvt = new QVBoxLayout(conDialog); cvt->addWidget(conLabel); cvt->addWidget(conButton); //conDialog->show(); //dingSound = new QMediaPlayer(); //waterSound = new QMediaPlayer(); /*dingSound->setMedia(QUrl::fromLocalFile("/Users/Roger/Qt/Projects/FlowFreeGame/ding.mov")); dingSound->setVolume(30); waterSound->setMedia(QUrl::fromLocalFile("/Users/Roger/Qt/Projects/FlowFreeGame/water.mov")); waterSound->setVolume(60);*/ connect(choose, SIGNAL(clicked(bool)), chooseDialog, SLOT(show())); connect(solution, SIGNAL(clicked(bool)), this, SLOT(solve())); connect(reStart, SIGNAL(clicked(bool)), this, SLOT(reGame())); connect(prev, SIGNAL(clicked(bool)), this, SLOT(prevGame())); connect(next, SIGNAL(clicked(bool)), this, SLOT(nextGame())); connect(conButton, SIGNAL(clicked(bool)), conDialog, SLOT(hide())); connect(this, SIGNAL(win()), conDialog, SLOT(show())); QSignalMapper *m = new QSignalMapper(); for (int i = 0; i < 3; ++i) { connect(level5[i], SIGNAL(clicked(bool)), chooseDialog, SLOT(hide())); connect(level6[i], SIGNAL(clicked(bool)), chooseDialog, SLOT(hide())); connect(level7[i], SIGNAL(clicked(bool)), chooseDialog, SLOT(hide())); connect(randomButton[i], SIGNAL(clicked(bool)), chooseDialog, SLOT(hide())); connect(level5[i], SIGNAL(clicked(bool)), m, SLOT(map())); connect(level6[i], SIGNAL(clicked(bool)), m, SLOT(map())); connect(level7[i], SIGNAL(clicked(bool)), m, SLOT(map())); connect(randomButton[i], SIGNAL(clicked(bool)), m, SLOT(map())); m->setMapping(level5[i], "5_" + QString::number(i)); m->setMapping(level6[i], "6_" + QString::number(i)); m->setMapping(level7[i], "7_" + QString::number(i)); m->setMapping(randomButton[i], QString::number(i + 5) + "_r"); } connect(m, SIGNAL(mapped(QString)), this, SLOT(chooseLevel(QString))); }
KBannerSetup::KBannerSetup( QWidget *parent ) : KDialog( parent) , saver( 0 ), ed(0), speed( 50 ) { setButtons(Ok|Cancel|Help); setDefaultButton(Ok); setCaption(i18n( "Setup Banner Screen Saver" )); setModal(true); setButtonText( Help, i18n( "A&bout" ) ); readSettings(); QWidget *main = new QWidget(this); setMainWidget(main); QLabel *label; QVBoxLayout *tl = new QVBoxLayout( main ); QHBoxLayout *tl1 = new QHBoxLayout(); tl->addLayout(tl1); QVBoxLayout *tl11 = new QVBoxLayout(); tl1->addLayout(tl11); QGroupBox *group = new QGroupBox( i18n("Font"), main ); QVBoxLayout *vbox = new QVBoxLayout; group->setLayout(vbox); QGridLayout *gl = new QGridLayout(); vbox->addLayout(gl); gl->setSpacing(spacingHint()); label = new QLabel( i18n("Family:"), group ); gl->addWidget(label, 1, 0); KFontComboBox* comboFonts = new KFontComboBox( group ); comboFonts->setCurrentFont( fontFamily ); gl->addWidget(comboFonts, 1, 1); connect( comboFonts, SIGNAL(currentFontChanged(QFont)), SLOT(slotFamily(QFont)) ); label = new QLabel( i18n("Size:"), group ); gl->addWidget(label, 2, 0); comboSizes = new QComboBox( group ); comboSizes->setEditable( true ); fillFontSizes(); gl->addWidget(comboSizes, 2, 1); connect( comboSizes, SIGNAL(activated(int)), SLOT(slotSize(int)) ); connect( comboSizes, SIGNAL(editTextChanged(QString)), SLOT(slotSizeEdit(QString)) ); QCheckBox *cb = new QCheckBox( i18n("Bold"), group ); cb->setChecked( bold ); connect( cb, SIGNAL(toggled(bool)), SLOT(slotBold(bool)) ); gl->addWidget(cb, 3, 0); cb = new QCheckBox( i18n("Italic"), group ); cb->setChecked( italic ); gl->addWidget(cb, 3, 1); connect( cb, SIGNAL(toggled(bool)), SLOT(slotItalic(bool)) ); label = new QLabel( i18n("Color:"), group ); gl->addWidget(label, 4, 0); colorPush = new KColorButton( fontColor, group ); gl->addWidget(colorPush, 4, 1); connect( colorPush, SIGNAL(changed(QColor)), SLOT(slotColor(QColor)) ); QCheckBox *cyclingColorCb=new QCheckBox(i18n("Cycling color"),group); cyclingColorCb->setMinimumSize(cyclingColorCb->sizeHint()); gl->addWidget(cyclingColorCb, 5, 0,5,1); connect(cyclingColorCb,SIGNAL(toggled(bool)),this,SLOT(slotCyclingColor(bool))); cyclingColorCb->setChecked(cyclingColor); preview = new QWidget( main ); preview->setFixedSize( 220, 170 ); { QPalette palette; palette.setColor( preview->backgroundRole(), Qt::black ); preview->setPalette( palette ); preview->setAutoFillBackground(true); } preview->show(); // otherwise saver does not get correct size saver = new KBannerSaver( preview->winId() ); tl1->addWidget(preview); tl11->addWidget(group); label = new QLabel( i18n("Speed:"), main ); tl11->addStretch(1); tl11->addWidget(label); QSlider *sb = new QSlider( Qt::Horizontal, main ); sb->setMinimum(0); sb->setMaximum(100); sb->setPageStep(10); sb->setValue(speed); sb->setMinimumWidth( 180); sb->setFixedHeight(20); sb->setTickPosition(QSlider::TicksBelow); sb->setTickInterval(10); tl11->addWidget(sb); connect( sb, SIGNAL(valueChanged(int)), SLOT(slotSpeed(int)) ); QHBoxLayout *tl2 = new QHBoxLayout; tl->addLayout(tl2); label = new QLabel( i18n("Message:"), main ); tl2->addWidget(label); ed = new QLineEdit( main ); tl2->addWidget(ed); ed->setText( message ); connect( ed, SIGNAL(textChanged(QString)), SLOT(slotMessage(QString)) ); QCheckBox *timeCb=new QCheckBox( i18n("Show current time"), main); timeCb->setFixedSize(timeCb->sizeHint()); tl->addWidget(timeCb,0,Qt::AlignLeft); connect(timeCb,SIGNAL(toggled(bool)),this,SLOT(slotTimeToggled(bool))); timeCb->setChecked(showTime); connect(this,SIGNAL(okClicked()),this,SLOT(slotOk())); connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp())); tl->addStretch(); }
Dialog_Mail::Dialog_Mail(QWidget *parent, QString iTitle, int *iIdx, DialogMailType iMode) : QDialog(parent) { Mode = iMode; Idx = iIdx; setWindowTitle(iTitle); QAction *ActSend = new QAction(tr("Отправить"),this); ActSend->setIcon(QPixmap(":img/SendMail.png")); ActSend->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); ActSend->setText(tr("&Отправить Сообщения")); ActSend->setToolTip(tr("Отправить Сообщения")); ActSend->setStatusTip(tr("Отправить Сообщения")); connect(ActSend, SIGNAL(triggered()), this, SLOT(SlotSend())); QAction *ActSave = new QAction(tr("Сохранить"),this); ActSave->setIcon(QPixmap(":img/Save.png")); ActSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R)); ActSave->setText(tr("&Сохранить Сообщение")); ActSave->setToolTip(tr("Сохранить Сообщение")); ActSave->setStatusTip(tr("Сохранить Сообщение")); connect(ActSave, SIGNAL(triggered()), this, SLOT(SlotSave())); QAction *ActCancel = new QAction(tr("Отменить"),this); ActCancel->setIcon(QPixmap(":img/Cancel.png")); ActCancel->setShortcut(QKeySequence("ESC")); ActCancel->setText(tr("&Отменить Сообщение")); ActCancel->setToolTip(tr("Отменить Сообщение")); ActCancel->setStatusTip(tr("Отменить Сообщение")); connect(ActCancel, SIGNAL(triggered()), this, SLOT(SlotCancel())); QHBoxLayout *ToolLayout = new QHBoxLayout(); ToolLayout->setMargin(0); QToolBar *ToolBar = new QToolBar(); ToolBar->setOrientation(Qt::Horizontal); ToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); ToolLayout->addWidget(ToolBar); ToolBar->addAction(ActSend); ToolBar->addSeparator(); ToolBar->addAction(ActSave); ToolBar->addSeparator(); ToolBar->addAction(ActCancel); QFrame *ToolFrame = new QFrame(); ToolFrame->setStyleSheet(QString("background-color: %1").arg(Global.Palette.color(QPalette::Window).name())); ToolFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Plain); ToolFrame->setLayout(ToolLayout); QVBoxLayout *TBox = new QVBoxLayout(); TBox->setMargin(0); Receiver = new QComboBox(); Subj = new QLineEdit(); Message = new QTextEdit(); QFormLayout *Form = new QFormLayout(); Form->addRow(tr("Получатель: "), Receiver); Form->addRow(tr("Тема: "), Subj); Form->setLabelAlignment(Qt::AlignRight); TBox->addLayout(Form,0); TBox->addWidget(Message,1); QFrame *Center = new QFrame(); Center->setLayout(TBox); QVBoxLayout *Out = new QVBoxLayout(); Out->addWidget(ToolFrame,0); Out->addSpacing(4); Out->addWidget(Center,1); setLayout(Out); setMinimumSize(480,320); Init(); }
PlotWizard::PlotWizard( QWidget* parent, Qt::WFlags fl ) : QDialog( parent, fl ) { setWindowTitle( tr("QtiPlot - Select Columns to Plot") ); setAttribute(Qt::WA_DeleteOnClose); setSizeGripEnabled( true ); // top part starts here groupBox1 = new QGroupBox(); QGridLayout *gl1 = new QGridLayout(); buttonX = new QPushButton("<->" + tr("&X")); buttonX->setAutoDefault( false ); gl1->addWidget( buttonX, 0, 0); buttonXErr = new QPushButton("<->" + tr("x&Err")); buttonXErr->setAutoDefault( false ); gl1->addWidget( buttonXErr, 0, 1); buttonY = new QPushButton("<->" + tr("&Y")); buttonY->setAutoDefault( false ); gl1->addWidget( buttonY, 1, 0); buttonYErr = new QPushButton("<->" + tr("yE&rr")); buttonYErr->setAutoDefault( false ); gl1->addWidget( buttonYErr, 1, 1); buttonZ = new QPushButton("<->" + tr("&Z")); buttonZ->setAutoDefault( false ); gl1->addWidget( buttonZ, 2, 0); gl1->setRowStretch(3,1); QHBoxLayout *hl2 = new QHBoxLayout(); buttonNew = new QPushButton(tr("&New curve")); buttonNew->setDefault( true ); buttonNew->setAutoDefault( true ); hl2->addWidget(buttonNew); buttonDelete = new QPushButton(tr("&Delete curve")); buttonDelete->setAutoDefault( false ); hl2->addWidget(buttonDelete); QVBoxLayout *vl = new QVBoxLayout(); vl->addLayout(gl1); vl->addStretch(); vl->addLayout(hl2); QGridLayout *gl2 = new QGridLayout(groupBox1); gl2->addWidget(new QLabel(tr( "Worksheet" )), 0, 0); boxTables = new QComboBox(); gl2->addWidget(boxTables, 0, 1); columnsList = new QListWidget(); gl2->addWidget(columnsList, 1, 0); gl2->addLayout(vl, 1, 1); // middle part is only one widget plotAssociations = new QListWidget(); // bottom part starts here QHBoxLayout * bottomLayout = new QHBoxLayout(); bottomLayout->addStretch(); buttonOk = new QPushButton(tr("&Plot")); buttonOk->setAutoDefault( false ); bottomLayout->addWidget( buttonOk ); buttonCancel = new QPushButton(tr("&Close")); buttonCancel->setAutoDefault( false ); bottomLayout->addWidget( buttonCancel ); QVBoxLayout* vlayout = new QVBoxLayout( this ); vlayout->addWidget( groupBox1 ); vlayout->addWidget( plotAssociations ); vlayout->addLayout( bottomLayout ); // signals and slots connections connect( boxTables, SIGNAL(activated(const QString &)),this, SLOT(changeColumnsList(const QString &))); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( buttonNew, SIGNAL( clicked() ), this, SLOT( addCurve() ) ); connect( buttonDelete, SIGNAL( clicked() ), this, SLOT( removeCurve() ) ); connect( buttonX, SIGNAL( clicked() ), this, SLOT(addXCol())); connect( buttonY, SIGNAL( clicked() ), this, SLOT(addYCol())); connect( buttonXErr, SIGNAL( clicked() ), this, SLOT(addXErrCol())); connect( buttonYErr, SIGNAL( clicked() ), this, SLOT(addYErrCol())); connect( buttonZ, SIGNAL( clicked() ), this, SLOT(addZCol())); }