PdfViewer::PdfViewer() : QMainWindow() , m_currentPage(0) , m_showMenuBar(false) , m_reloadTimer(0) , m_findWidget(0) { //QTime t = QTime::currentTime(); setWindowTitle(QCoreApplication::applicationName()); // set icon theme search paths QStringList themeSearchPaths; themeSearchPaths << QDir::homePath() + "/.local/share/icons/"; themeSearchPaths << QIcon::themeSearchPaths(); QIcon::setThemeSearchPaths(themeSearchPaths); // setup shortcut handler #ifndef QT_NO_SHORTCUT ShortcutHandler *shortcutHandler = new ShortcutHandler(this); #endif // QT_NO_SHORTCUT QSettings *settingsObject = new QSettings(this); #ifndef QT_NO_SHORTCUT shortcutHandler->setSettingsObject(settingsObject); #endif // QT_NO_SHORTCUT // setup recent files menu m_fileOpenRecentAction = new RecentFilesAction(Icon("document-open-recent"), tr("Open &Recent", "Action: open recent file"), this); m_fileOpenRecentAction->setSettingsObject(settingsObject); connect(m_fileOpenRecentAction, SIGNAL(fileSelected(QString)), this, SLOT(slotLoadDocument(QString))); // setup the main view m_pdfView = new PdfView(this); connect(m_pdfView, SIGNAL(scrollPositionChanged(qreal,int)), this, SLOT(slotViewScrollPositionChanged(qreal,int))); connect(m_pdfView, SIGNAL(openTexDocument(QString,int)), this, SLOT(slotOpenTexDocument(QString,int))); connect(m_pdfView, SIGNAL(mouseToolChanged(PdfView::MouseTool)), this, SLOT(slotSelectMouseTool(PdfView::MouseTool))); // setup the central widget QWidget *mainWidget = new QWidget(this); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(m_pdfView); mainLayout->setContentsMargins(0, 0, 0, 0); mainLayout->setSpacing(0); mainWidget->setLayout(mainLayout); setCentralWidget(mainWidget); createActions(); // must happen after the setup of m_pdfView QSettings settings; settings.beginGroup("MainWindow"); m_showMenuBar = settings.value("ShowMenuBar", false).toBool(); settings.endGroup(); if (m_showMenuBar) { createMenus(); createToolBars(); } else createToolBarsWhenNoMenuBar(); createDocks(); Q_FOREACH(DocumentObserver *obs, m_observers) { obs->m_viewer = this; } // activate AA by default m_settingsTextAAAction->setChecked(true); m_settingsGfxAAAction->setChecked(true); // watch file changes m_watcher = new QFileSystemWatcher(this); // commented out by amkhlv: // connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(slotReloadWhenIdle(QString))); // setup presentation view (we must do this here in order to have access to the shortcuts) m_presentationWidget = new PresentationWidget; connect(m_presentationWidget, SIGNAL(pageChanged(int)), this, SLOT(slotGoToPage(int))); connect(m_presentationWidget, SIGNAL(doAction(Poppler::LinkAction::ActionType)), this, SLOT(slotDoAction(Poppler::LinkAction::ActionType))); readSettings(); m_pdfView->setFocus(); //qCritical() << t.msecsTo(QTime::currentTime()); }
MainWindow::MainWindow() { fullScreen_ = false; // Set Title and window properties setWindowTitle(tr("Examinationroom")); QMainWindow::setDockOptions(AnimatedDocks | AllowNestedDocks | AllowTabbedDocks); // Add Dock Widgets dockDesign_ = new DesignWidget("Design", this); dockCode_ = new CodeWidget("Code", this); dockConsole_ = new ConsoleWidget("Console", this); dockDesign_->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); dockCode_->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); dockConsole_->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable); addDockWidget(Qt::RightDockWidgetArea, dockDesign_); addDockWidget(Qt::RightDockWidgetArea, dockCode_); addDockWidget(Qt::RightDockWidgetArea, dockConsole_); tabifyDockWidget(dockDesign_, dockCode_); tabifyDockWidget(dockDesign_, dockConsole_); // Set up logging early LogTool::initLogFile(); LogTool::setConsoleWidget(dockConsole_); // File dialogs #ifdef Q_WS_MACX Qt::WindowFlags dialogFlags = Qt::Sheet; QString defaultPath = QString("res/"); #else Qt::WindowFlags dialogFlags = Qt::Dialog; QString defaultPath = QString("res/"); #endif loadDialog_ = new QFileDialog(this, dialogFlags); loadDialog_->setFilter("Lua Scene File (*.lua)"); loadDialog_->setWindowTitle("Open Lua Scene..."); loadDialog_->setDirectory(defaultPath); storeDialog_ = new QFileDialog(this, dialogFlags); storeDialog_->setAcceptMode(QFileDialog::AcceptSave); storeDialog_->setFilter("Lua Scene File (*.lua)"); storeDialog_->setWindowTitle("Save Lua Scene..."); storeDialog_->setDirectory(defaultPath); storeDialog_->setDefaultSuffix("lua"); connect(loadDialog_, SIGNAL(fileSelected(const QString &)), this, SLOT(loadLuaFile(const QString &))); connect(storeDialog_, SIGNAL(fileSelected(const QString &)), this, SLOT(storeLuaFile(const QString &))); // Create GL Widgets QGLFormat glFormat = QGLFormat::defaultFormat(); // Stereo Buffering seems to work in SnowLeopard... // but is incompatible with other renderers and might cause problems. // enable at your own risk glFormat.setStereo(false); glFormat.setSwapInterval(1); // Enable VSync on platforms that support it QGLFormat::setDefaultFormat(glFormat); // Checking for errors here leads to a crash on OS X // Probably because OpenGL was not initialized yet? //ErrorTool::getErrors("MainWindow::MainWindow:1"); mainGlWidget_ = new GLWidget(this); fsGlWidget_ = new GLWidget(0, mainGlWidget_); fsGlWidget_->setCursor(Qt::BlankCursor); mainGlWidget_->setStyle(GLWidget::single); fsGlWidget_->setStyle(GLWidget::single); mainGlWidget_->makeCurrent(); GlErrorTool::getErrors("MainWindow::MainWindow:2"); GlErrorTool::logVersionStrings(); aboutWindow_ = 0; // Add menu QMenu *menu = menuBar()->addMenu(tr("&File")); menu->addAction(tr("&About Examinationroom..."), this, SLOT(showAbout())); menu->addAction(tr("&Open Scene..."), loadDialog_, SLOT(open()), QKeySequence(QKeySequence::Open)); menu->addAction(tr("Close Scene"), this, SLOT(newScene()), QKeySequence(QKeySequence::Close)); menu->addAction(tr("&Save Copy As..."), storeDialog_, SLOT(open()), QKeySequence(QKeySequence::Save)); menu->addAction(tr("&Revert Scene"), this, SLOT(revert())); menu->addSeparator(); menu->addAction(tr("&Quit"), this, SLOT(close()), QKeySequence(tr("ctrl-Q"))); // Signal mapper for display types signalMapper_ = new QSignalMapper(this); // Add display menu QAction * action; menu = menuBar()->addMenu(tr("&Output Mode")); action = menu->addAction(tr("&Fullscreen"), this, SLOT(toggleFullscreen()), QKeySequence(Qt::Key_F | Qt::CTRL)); fsGlWidget_->addAction(action); menu->addSeparator(); action = menu->addAction(tr("&Anaglyph")); action->setShortcut(QKeySequence(Qt::Key_1 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::anaglyph); fsGlWidget_->addAction(action); action = menu->addAction(tr("&Side by Side")); action->setShortcut(QKeySequence(Qt::Key_2 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::sidebyside); fsGlWidget_->addAction(action); action = menu->addAction(tr("&Line interlacing (Experimental)")); action->setShortcut(QKeySequence(Qt::Key_3 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::line); fsGlWidget_->addAction(action); action = menu->addAction(tr("Quad Buffering (Experimental)")); action->setShortcut(QKeySequence(Qt::Key_4 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::quad); fsGlWidget_->addAction(action); action = menu->addAction(tr("Matrix Anaglyph (Experimental)")); action->setShortcut(QKeySequence(Qt::Key_5 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::matrix); fsGlWidget_->addAction(action); menu->addSeparator(); action = menu->addAction(tr("&Shader (Line interlacing)")); action->setShortcut(QKeySequence(Qt::Key_6 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::shaderLine); fsGlWidget_->addAction(action); action = menu->addAction(tr("&Shader (Mayan)")); action->setShortcut(QKeySequence(Qt::Key_7 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::shaderMayan); fsGlWidget_->addAction(action); menu->addSeparator(); action = menu->addAction(tr("Si&ngle")); action->setShortcut(QKeySequence(Qt::Key_0 | Qt::CTRL)); connect(action, SIGNAL(triggered()), signalMapper_, SLOT(map())); signalMapper_->setMapping(action, GLWidget::single); fsGlWidget_->addAction(action); connect(signalMapper_, SIGNAL(mapped(int)), this, SLOT(setDrawStyle(int))); // Object Creation Menu and signal mapper objectMenu_ = menuBar()->addMenu(tr("&Create Object")); objectMapper_ = new QSignalMapper(this); connect(objectMapper_, SIGNAL(mapped(int)), this, SLOT(onObjectCreate(int))); #ifdef Q_WS_MACX // Make menu bar the default menu bar menuBar()->setParent(0); #endif // Set up layout setFocusPolicy(Qt::StrongFocus); setCentralWidget(mainGlWidget_); // Create Scene setProgram(Program::create()); // Set up redraw timer timer_ = new QTimer(this); connect(timer_, SIGNAL(timeout()), this, SLOT(onTimeout())); timer_->start(15); // ~60 fps }
QucsFilter::QucsFilter() { QWidget *centralWidget = new QWidget(this); setCentralWidget(centralWidget); // set application icon setWindowIcon(QPixmap(":/bitmaps/big.qucs.xpm")); setWindowTitle("Qucs Filter " PACKAGE_VERSION); // -------- create menubar ------------------- QMenu *fileMenu = new QMenu(tr("&File")); QAction * fileQuit = new QAction(tr("E&xit"), this); fileQuit->setShortcut(Qt::CTRL+Qt::Key_Q); connect(fileQuit, SIGNAL(activated()), SLOT(slotQuit())); fileMenu->addAction(fileQuit); QMenu *helpMenu = new QMenu(tr("&Help"), this); QAction * helpHelp = new QAction(tr("Help..."), this); helpHelp->setShortcut(Qt::Key_F1); connect(helpHelp, SIGNAL(activated()), SLOT(slotHelpIntro())); QAction * helpAbout = new QAction(tr("&About QucsFilter..."), this); helpMenu->addAction(helpAbout); connect(helpAbout, SIGNAL(activated()), SLOT(slotHelpAbout())); QAction * helpAboutQt = new QAction(tr("About Qt..."), this); helpMenu->addAction(helpAboutQt); connect(helpAboutQt, SIGNAL(activated()), SLOT(slotHelpAboutQt())); helpMenu->addAction(helpHelp); helpMenu->addSeparator(); helpMenu->addAction(helpAbout); helpMenu->addAction(helpAboutQt); menuBar()->addMenu(fileMenu); menuBar()->addSeparator(); menuBar()->addMenu(helpMenu); // ------- create main windows widgets -------- all = new QGridLayout(); all->setSpacing(3); // assign layout to central widget centralWidget->setLayout(all); // ........................................................... box1 = new QGroupBox(tr("Filter"), this); all->addWidget(box1,0,0); gbox1 = new QGridLayout(); gbox1->setSpacing(3); box1->setLayout(gbox1); QLabel *Label0 = new QLabel(tr("Realization:"), this); gbox1->addWidget(Label0, 0,0); ComboRealize = new QComboBox(this); ComboRealize->addItem("LC ladder (pi type)"); ComboRealize->addItem("LC ladder (tee type)"); ComboRealize->addItem("C-coupled transmission lines"); ComboRealize->addItem("Microstrip end-coupled"); ComboRealize->addItem("Coupled transmission lines"); ComboRealize->addItem("Coupled microstrip"); ComboRealize->addItem("Stepped-impedance"); ComboRealize->addItem("Stepped-impedance microstrip"); ComboRealize->addItem("Quarter wave"); ComboRealize->addItem("Quarter wave microstrip"); ComboRealize->addItem("Equation-defined"); gbox1->addWidget(ComboRealize, 0,1); connect(ComboRealize, SIGNAL(activated(int)), SLOT(slotRealizationChanged(int))); QLabel *Label1 = new QLabel(tr("Filter type:"), this); gbox1->addWidget(Label1, 1,0); ComboType = new QComboBox(this); ComboType->addItem("Bessel"); ComboType->addItem("Butterworth"); ComboType->addItem("Chebyshev"); ComboType->addItem("Cauer"); gbox1->addWidget(ComboType, 1,1); connect(ComboType, SIGNAL(activated(int)), SLOT(slotTypeChanged(int))); QLabel *Label2 = new QLabel(tr("Filter class:"), this); gbox1->addWidget(Label2, 2,0); ComboClass = new QComboBox(this); ComboClass->addItem(tr("Low pass")); ComboClass->addItem(tr("High pass")); ComboClass->addItem(tr("Band pass")); ComboClass->addItem(tr("Band stop")); gbox1->addWidget(ComboClass, 2,1); connect(ComboClass, SIGNAL(activated(int)), SLOT(slotClassChanged(int))); IntVal = new QIntValidator(1, 200, this); DoubleVal = new QDoubleValidator(this); LabelOrder = new QLabel(tr("Order:"), this); gbox1->addWidget(LabelOrder, 3,0); EditOrder = new QLineEdit("3", this); EditOrder->setValidator(IntVal); gbox1->addWidget(EditOrder, 3,1); LabelStart = new QLabel(tr("Corner frequency:"), this); gbox1->addWidget(LabelStart, 4,0); EditCorner = new QLineEdit("1", this); EditCorner->setValidator(DoubleVal); gbox1->addWidget(EditCorner, 4,1); ComboCorner = new QComboBox(this); ComboCorner->addItem("Hz"); ComboCorner->addItem("kHz"); ComboCorner->addItem("MHz"); ComboCorner->addItem("GHz"); ComboCorner->setCurrentIndex(3); gbox1->addWidget(ComboCorner, 4,2); LabelStop = new QLabel(tr("Stop frequency:"), this); gbox1->addWidget(LabelStop, 5,0); EditStop = new QLineEdit("2", this); EditStop->setValidator(DoubleVal); gbox1->addWidget(EditStop, 5,1); ComboStop = new QComboBox(this); ComboStop->addItem("Hz"); ComboStop->addItem("kHz"); ComboStop->addItem("MHz"); ComboStop->addItem("GHz"); ComboStop->setCurrentIndex(3); gbox1->addWidget(ComboStop, 5,2); LabelBandStop = new QLabel(tr("Stop band frequency:"), this); gbox1->addWidget(LabelBandStop, 6,0); EditBandStop = new QLineEdit("3", this); EditBandStop->setValidator(DoubleVal); gbox1->addWidget(EditBandStop, 6,1); ComboBandStop = new QComboBox(this); ComboBandStop->addItem("Hz"); ComboBandStop->addItem("kHz"); ComboBandStop->addItem("MHz"); ComboBandStop->addItem("GHz"); ComboBandStop->setCurrentIndex(3); gbox1->addWidget(ComboBandStop, 6,2); LabelRipple = new QLabel(tr("Pass band ripple:"), this); gbox1->addWidget(LabelRipple, 7,0); EditRipple = new QLineEdit("1", this); EditRipple->setValidator(DoubleVal); gbox1->addWidget(EditRipple, 7,1); LabelRipple_dB = new QLabel("dB", this); gbox1->addWidget(LabelRipple_dB, 7,2); LabelAtten = new QLabel(tr("Stop band attenuation:"), this); gbox1->addWidget(LabelAtten, 8,0); EditAtten = new QLineEdit("20", this); EditAtten->setValidator(DoubleVal); gbox1->addWidget(EditAtten, 8,1); LabelAtten_dB = new QLabel("dB", this); gbox1->addWidget(LabelAtten_dB, 8,2); LabelImpedance = new QLabel(tr("Impedance:"), this); gbox1->addWidget(LabelImpedance, 9,0); EditImpedance = new QLineEdit("50", this); EditImpedance->setValidator(DoubleVal); gbox1->addWidget(EditImpedance, 9,1); LabelOhm = new QLabel("Ohm", this); gbox1->addWidget(LabelOhm, 9,2); // ........................................................... box2 = new QGroupBox(tr("Microstrip Substrate"), this); box2->setEnabled(false); all->addWidget(box2,0,1); gbox2 = new QGridLayout(); gbox2->setSpacing(3); box2->setLayout(gbox2); QLabel *Label3 = new QLabel(tr("Relative permittivity:"), this); gbox2->addWidget(Label3, 0,0); ComboEr = new QComboBox(this); ComboEr->setEditable(true); ComboEr->lineEdit()->setValidator(DoubleVal); connect(ComboEr, SIGNAL(activated(const QString&)), SLOT(slotTakeEr(const QString&))); gbox2->addWidget(ComboEr, 0,1); const char **p = List_er; while(*(++p)) ComboEr->addItem(*p); // put material properties into combobox ComboEr->lineEdit()->setText("9.8"); QLabel *Label4 = new QLabel(tr("Substrate height:"), this); gbox2->addWidget(Label4, 1,0); EditHeight = new QLineEdit("1.0", this); EditHeight->setValidator(DoubleVal); gbox2->addWidget(EditHeight, 1,1); QLabel *Label5 = new QLabel("mm", this); gbox2->addWidget(Label5, 1,2); QLabel *Label6 = new QLabel(tr("metal thickness:"), this); gbox2->addWidget(Label6, 2,0); EditThickness = new QLineEdit("12.5", this); EditThickness->setValidator(DoubleVal); gbox2->addWidget(EditThickness, 2,1); QLabel *Label7 = new QLabel("um", this); gbox2->addWidget(Label7, 2,2); QLabel *Label8 = new QLabel(tr("minimum width:"), this); gbox2->addWidget(Label8, 3,0); EditMinWidth = new QLineEdit("0.4", this); EditMinWidth->setValidator(DoubleVal); gbox2->addWidget(EditMinWidth, 3,1); QLabel *Label9 = new QLabel("mm", this); gbox2->addWidget(Label9, 3,2); QLabel *Label10 = new QLabel(tr("maximum width:"), this); gbox2->addWidget(Label10, 4,0); EditMaxWidth = new QLineEdit("5.0", this); EditMaxWidth->setValidator(DoubleVal); gbox2->addWidget(EditMaxWidth, 4,1); QLabel *Label11 = new QLabel("mm", this); gbox2->addWidget(Label11, 4,2); QSpacerItem *mySpacer=new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding); gbox2->addItem(mySpacer, 5, 0, 1, -1); // ........................................................... QPushButton *ButtonGo = new QPushButton(tr("Calculate and put into Clipboard"), this); connect(ButtonGo, SIGNAL(clicked()), SLOT(slotCalculate())); all->addWidget(ButtonGo, 1, 0, 1, -1); LabelResult = new QLabel(this); ResultState = 100; slotShowResult(); LabelResult->setAlignment(Qt::AlignHCenter); all->addWidget(LabelResult, 2, 0, 1, -1); // ------- finally set initial state -------- slotTypeChanged(0); slotClassChanged(0); }
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("Redcoin") + " - " + tr("Wallet")); #ifndef Q_WS_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(); 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 bar statusBar(); // Status bar 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 bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); progressBar = new QProgressBar(); progressBar->setAlignment(Qt::AlignCenter); progressBar->setVisible(false); 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))); // 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(); }
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("Blackwhitecoin") + " - " + 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(); 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); setCentralWidget(centralWidget); // Create status bar statusBar(); // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setMinimumWidth(56); frameBlocks->setMaximumWidth(56); 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); // this->setStyleSheet("background-color: #effbef;"); // 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(); }
//! [0] MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), completer(0), lineEdit(0) { createMenu(); QWidget *centralWidget = new QWidget; QLabel *modelLabel = new QLabel; modelLabel->setText(tr("Model")); modelCombo = new QComboBox; modelCombo->addItem(tr("QFileSytemModel")); modelCombo->addItem(tr("QFileSytemModel that shows full path")); modelCombo->addItem(tr("Country list")); modelCombo->addItem(tr("Word list")); modelCombo->setCurrentIndex(0); QLabel *modeLabel = new QLabel; modeLabel->setText(tr("Completion Mode")); modeCombo = new QComboBox; modeCombo->addItem(tr("Inline")); modeCombo->addItem(tr("Filtered Popup")); modeCombo->addItem(tr("Unfiltered Popup")); modeCombo->setCurrentIndex(1); QLabel *caseLabel = new QLabel; caseLabel->setText(tr("Case Sensitivity")); caseCombo = new QComboBox; caseCombo->addItem(tr("Case Insensitive")); caseCombo->addItem(tr("Case Sensitive")); caseCombo->setCurrentIndex(0); //! [0] //! [1] QLabel *maxVisibleLabel = new QLabel; maxVisibleLabel->setText(tr("Max Visible Items")); maxVisibleSpinBox = new QSpinBox; maxVisibleSpinBox->setRange(3,25); maxVisibleSpinBox->setValue(10); wrapCheckBox = new QCheckBox; wrapCheckBox->setText(tr("Wrap around completions")); wrapCheckBox->setChecked(true); //! [1] //! [2] contentsLabel = new QLabel; contentsLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); connect(modelCombo, SIGNAL(activated(int)), this, SLOT(changeModel())); connect(modeCombo, SIGNAL(activated(int)), this, SLOT(changeMode(int))); connect(caseCombo, SIGNAL(activated(int)), this, SLOT(changeCase(int))); connect(maxVisibleSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeMaxVisible(int))); //! [2] //! [3] lineEdit = new QLineEdit; QGridLayout *layout = new QGridLayout; layout->addWidget(modelLabel, 0, 0); layout->addWidget(modelCombo, 0, 1); layout->addWidget(modeLabel, 1, 0); layout->addWidget(modeCombo, 1, 1); layout->addWidget(caseLabel, 2, 0); layout->addWidget(caseCombo, 2, 1); layout->addWidget(maxVisibleLabel, 3, 0); layout->addWidget(maxVisibleSpinBox, 3, 1); layout->addWidget(wrapCheckBox, 4, 0); layout->addWidget(contentsLabel, 5, 0, 1, 2); layout->addWidget(lineEdit, 6, 0, 1, 2); centralWidget->setLayout(layout); setCentralWidget(centralWidget); changeModel(); setWindowTitle(tr("Completer")); lineEdit->setFocus(); }
MainWindow::MainWindow(Application *app) : QMainWindow(), m_application(app) { app->setMainWindow(this); setUnifiedTitleAndToolBarOnMac(true); setDocumentMode(true); QCoreApplication::setOrganizationName("Dunnart"); QCoreApplication::setOrganizationDomain("dunnart.org"); QCoreApplication::setApplicationName("Dunnart"); // Correct the look of the tab bar on OS X cocoa. app->setStyleSheet( "QGraphicsView {" "border: 0px;" "}" #ifdef Q_WS_MAC "QTabBar::tab:top {" "font-family: \"Lucida Grande\";" "font-size: 11px;" "}" #endif ); // Set the window title. setWindowTitle("Dunnart"); m_tab_widget = new CanvasTabWidget(this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), this, SLOT(canvasChanged(Canvas*))); connect(m_tab_widget, SIGNAL(currentCanvasFileInfoChanged(QFileInfo)), this, SLOT(canvasFileInfoChanged(QFileInfo))); m_tab_widget->newTab(); setCentralWidget(m_tab_widget); app->setCanvasTabWidget(m_tab_widget); // Inital window size. resize(1020, 743); m_new_action = new QAction("New", this); m_new_action->setShortcut(QKeySequence::New); connect(m_new_action, SIGNAL(triggered()), this, SLOT(documentNew())); m_open_action = new QAction("Open...", this); m_open_action->setShortcut(QKeySequence::Open); connect(m_open_action, SIGNAL(triggered()), this, SLOT(documentOpen())); for (int i = 0; i < MAX_RECENT_FILES; ++i) { m_action_open_recent_file[i] = new QAction(this); m_action_open_recent_file[i]->setVisible(false); connect(m_action_open_recent_file[i], SIGNAL(triggered()), this, SLOT(documentOpenRecent())); } m_close_action = new QAction("Close", this); m_close_action->setShortcut(QKeySequence::Close); connect(m_close_action, SIGNAL(triggered()), m_tab_widget, SLOT(currentCanvasClose())); m_save_action = new QAction("Save", this); m_save_action->setShortcut(QKeySequence::Save); connect(m_save_action, SIGNAL(triggered()), m_tab_widget, SLOT(currentCanvasSave())); m_save_as_action = new QAction("Save As...", this); m_save_as_action->setShortcut(QKeySequence::SaveAs); connect(m_save_as_action, SIGNAL(triggered()), m_tab_widget, SLOT(currentCanvasSaveAs())); m_export_action = new QAction("Export...", this); connect(m_export_action, SIGNAL(triggered()), this, SLOT(documentExport())); m_print_action = new QAction("Print...", this); m_print_action->setShortcut(QKeySequence::Print); connect(m_print_action, SIGNAL(triggered()), this, SLOT(documentPrint())); m_quit_action = new QAction(tr("Quit"), this); m_quit_action->setShortcut(QKeySequence::Quit); connect(m_quit_action, SIGNAL(triggered()), this, SLOT(close())); m_about_action = new QAction(tr("About"), this); connect(m_about_action, SIGNAL(triggered()), this, SLOT(about())); m_homepage_action = new QAction(tr("Dunnart homepage"), this); connect(m_homepage_action, SIGNAL(triggered()), this, SLOT(openHomepage())); m_action_show_zoom_level_dialog = new QAction( tr("Zoom Level"), this); m_action_show_zoom_level_dialog->setCheckable(true); m_action_show_properties_editor_dialog = new QAction( tr("Properties Editor"), this); m_action_show_properties_editor_dialog->setCheckable(true); m_action_show_layout_properties_dialog = new QAction( tr("Layout Properties"), this); m_action_show_layout_properties_dialog->setCheckable(true); m_action_show_connector_properties_dialog = new QAction( tr("Connector Properties"), this); m_action_show_connector_properties_dialog->setCheckable(true); m_action_show_create_alignment_dialog = new QAction( tr("Create Alignments"), this); m_action_show_create_alignment_dialog->setCheckable(true); m_action_show_create_distribution_dialog = new QAction( tr("Create Distributions"), this); m_action_show_create_distribution_dialog->setCheckable(true); m_action_show_create_separation_dialog = new QAction( tr("Create Separations"), this); m_action_show_create_separation_dialog->setCheckable(true); m_action_show_create_template_dialog = new QAction( tr("Create Templates"), this); m_action_show_create_template_dialog->setShortcut(tr("Ctrl+T")); m_action_show_create_template_dialog->setCheckable(true); m_action_show_shape_picker_dialog = new QAction( tr("Shape Picker"), this); m_action_show_shape_picker_dialog->setCheckable(true); m_action_clear_recent_files = new QAction(tr("Clear Menu"), this); connect(m_action_clear_recent_files, SIGNAL(triggered()), this, SLOT(clearRecentFileMenu())); m_action_show_undo_history_dialog = new QAction( tr("Undo History"), this); m_action_show_undo_history_dialog->setCheckable(true); m_action_show_canvas_overview_dialog = new QAction( tr("Canvas Overview"), this); m_action_show_canvas_overview_dialog->setCheckable(true); CanvasView *canvasview = m_tab_widget->currentCanvasView(); Canvas *canvas = m_tab_widget->currentCanvas(); m_action_auto_align_selection = new QAction(tr("Auto-align Selection"), this); connect(m_action_auto_align_selection, SIGNAL(triggered()), m_tab_widget, SLOT(alignSelection())); // Create statusBar, and assign it to the canvas. canvas->setStatusBar(statusBar()); #ifdef Q_WS_MAC // Make the status bar font size slightly smaller. QFont statusBarFont = statusBar()->font(); statusBarFont.setPointSize(statusBarFont.pointSize() - 2); statusBar()->setFont(statusBarFont); #endif m_file_menu = menuBar()->addMenu("File"); m_file_menu->addAction(m_new_action); m_file_menu->addAction(m_open_action); QMenu *recentsMenu = m_file_menu->addMenu(tr("Open Recent")); for (int i = 0; i < MAX_RECENT_FILES; ++i) { recentsMenu->addAction(m_action_open_recent_file[i]); } m_action_recent_file_separator = recentsMenu->addSeparator(); recentsMenu->addAction(m_action_clear_recent_files); updateRecentFileActions(); m_file_menu->addSeparator(); m_file_menu->addAction(m_close_action); m_file_menu->addAction(m_save_action); m_file_menu->addAction(m_save_as_action); m_file_menu->addSeparator(); m_file_menu->addAction(m_export_action); m_file_menu->addSeparator(); m_file_menu->addAction(m_print_action); m_file_menu->addSeparator(); m_file_menu->addAction(m_quit_action); m_edit_menu = menuBar()->addMenu(tr("Edit")); m_tab_widget->addEditMenuActions(m_edit_menu); m_view_menu = menuBar()->addMenu(tr("View")); QMenu *dialogs_menu = m_view_menu->addMenu(tr("Show Dialogs")); dialogs_menu->addAction(m_action_show_canvas_overview_dialog); dialogs_menu->addAction(m_action_show_zoom_level_dialog); dialogs_menu->addSeparator(); dialogs_menu->addAction(m_action_show_shape_picker_dialog); dialogs_menu->addAction(m_action_show_undo_history_dialog); dialogs_menu->addAction(m_action_show_properties_editor_dialog); dialogs_menu->addSeparator(); dialogs_menu->addAction(m_action_show_create_alignment_dialog); dialogs_menu->addAction(m_action_show_create_distribution_dialog); dialogs_menu->addAction(m_action_show_create_separation_dialog); dialogs_menu->addAction(m_action_show_create_template_dialog); dialogs_menu->addSeparator(); dialogs_menu->addAction(m_action_show_layout_properties_dialog); dialogs_menu->addAction(m_action_show_connector_properties_dialog); QMenu *overlays_menu = m_view_menu->addMenu(tr("Canvas Debug Layers")); m_tab_widget->addDebugOverlayMenuActions(overlays_menu); m_layout_menu = menuBar()->addMenu("Layout"); m_tab_widget->addLayoutMenuActions(m_layout_menu); m_layout_menu->addAction(m_action_auto_align_selection); m_edit_toolbar = addToolBar(tr("Edit toolbar")); m_edit_toolbar->setIconSize(QSize(24, 24)); m_edit_toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_tab_widget->addEditToolBarActions(m_edit_toolbar); m_dialog_zoomLevel = new ZoomLevel(canvasview); connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)), m_dialog_zoomLevel, SLOT(changeCanvasView(CanvasView*))); connect(m_action_show_zoom_level_dialog, SIGNAL(triggered(bool)), m_dialog_zoomLevel, SLOT(setVisible(bool))); connect(m_dialog_zoomLevel, SIGNAL(visibilityChanged(bool)), m_action_show_zoom_level_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_zoomLevel); m_dialog_zoomLevel->show(); m_dialog_properties_editor = new PropertiesEditorDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_properties_editor, SLOT(changeCanvas(Canvas*))); connect(m_action_show_properties_editor_dialog, SIGNAL(triggered(bool)), m_dialog_properties_editor, SLOT(setVisible(bool))); connect(m_dialog_properties_editor, SIGNAL(visibilityChanged(bool)), m_action_show_properties_editor_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::BottomDockWidgetArea, m_dialog_properties_editor); m_dialog_properties_editor->hide(); m_dialog_shape_picker = new ShapePickerDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_shape_picker, SLOT(changeCanvas(Canvas*))); connect(m_action_show_shape_picker_dialog, SIGNAL(triggered(bool)), m_dialog_shape_picker, SLOT(setVisible(bool))); connect(m_dialog_shape_picker, SIGNAL(visibilityChanged(bool)), m_action_show_shape_picker_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_shape_picker); m_dialog_shape_picker->show(); m_dialog_layoutProps = new LayoutPropertiesDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_layoutProps, SLOT(changeCanvas(Canvas*))); connect(m_action_show_layout_properties_dialog, SIGNAL(triggered(bool)), m_dialog_layoutProps, SLOT(setVisible(bool))); connect(m_dialog_layoutProps, SIGNAL(visibilityChanged(bool)), m_action_show_layout_properties_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_layoutProps); m_dialog_layoutProps->show(); m_dialog_connectorProps = new ConnectorPropertiesDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_connectorProps, SLOT(changeCanvas(Canvas*))); connect(m_action_show_connector_properties_dialog, SIGNAL(triggered(bool)), m_dialog_connectorProps, SLOT(setVisible(bool))); connect(m_dialog_connectorProps, SIGNAL(visibilityChanged(bool)), m_action_show_connector_properties_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_connectorProps); m_dialog_connectorProps->hide(); m_dialog_alignment = new CreateAlignmentDialog(canvas); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_alignment, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_alignment_dialog, SIGNAL(triggered(bool)), m_dialog_alignment, SLOT(setVisible(bool))); connect(m_dialog_alignment, SIGNAL(visibilityChanged(bool)), m_action_show_create_alignment_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_alignment); m_dialog_alignment->show(); m_dialog_distribution = new CreateDistributionDialog(canvas, this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_distribution, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_distribution_dialog, SIGNAL(triggered(bool)), m_dialog_distribution, SLOT(setVisible(bool))); connect(m_dialog_distribution, SIGNAL(visibilityChanged(bool)), m_action_show_create_distribution_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_distribution); m_dialog_distribution->show(); m_dialog_separation = new CreateSeparationDialog(canvas, this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_separation, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_separation_dialog, SIGNAL(triggered(bool)), m_dialog_separation, SLOT(setVisible(bool))); connect(m_dialog_separation, SIGNAL(visibilityChanged(bool)), m_action_show_create_separation_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::RightDockWidgetArea, m_dialog_separation); m_dialog_separation->show(); m_dialog_template = new CreateTemplateDialog(canvas, this); connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)), m_dialog_template, SLOT(changeCanvas(Canvas*))); connect(m_action_show_create_template_dialog, SIGNAL(triggered(bool)), m_dialog_template, SLOT(setVisible(bool))); connect(m_dialog_template, SIGNAL(visibilityChanged(bool)), m_action_show_create_template_dialog, SLOT(setChecked(bool))); m_dialog_template->hide(); m_dialog_undo_history = new UndoHistoryDialog( m_tab_widget->undoGroup(), this); connect(m_action_show_undo_history_dialog, SIGNAL(triggered(bool)), m_dialog_undo_history, SLOT(setVisible(bool))); connect(m_dialog_undo_history, SIGNAL(visibilityChanged(bool)), m_action_show_undo_history_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_undo_history); m_dialog_undo_history->hide(); m_dialog_canvas_overview = new CanvasOverviewDialog(canvasview, this); connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)), m_dialog_canvas_overview, SLOT(changeCanvasView(CanvasView*))); connect(m_action_show_canvas_overview_dialog, SIGNAL(triggered(bool)), m_dialog_canvas_overview, SLOT(setVisible(bool))); connect(m_dialog_canvas_overview, SIGNAL(visibilityChanged(bool)), m_action_show_canvas_overview_dialog, SLOT(setChecked(bool))); addDockWidget(Qt::LeftDockWidgetArea, m_dialog_canvas_overview); m_dialog_canvas_overview->hide(); // Allow plugins to initialise themselves and add things like // menu items and dock widgets to the main window. PluginApplicationManager *appPluginManager = sharedPluginApplicationManager(); appPluginManager->applicationMainWindowInitialised(app); // Add help menu after everything else (if should be rightmost). m_help_menu = menuBar()->addMenu(tr("Help")); m_help_menu->addAction(m_homepage_action); m_help_menu->addSeparator(); m_help_menu->addAction(m_about_action); // Restore window geometry and Dock Widget geometry. QSettings settings; restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); }
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), nWeight(0) { setFixedSize(970, 550); QFontDatabase::addApplicationFont(":/fonts/Bebas"); setWindowTitle(tr("Pentacoin") + " - " + tr("Wallet")); qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none; } #frame { } QToolBar QLabel { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} QToolBar QLabel:item { padding-top: 0px;padding-bottom: 0px;spacing: 10px;} #spacer { background: transparent;border:none; } #toolbar2 { border:none;width:0px;hight:0px;padding-top:40px;padding-bottom:0px; background-color: transparent; } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:black; } QMenu { background-color: qlineargradient(spread:pad, x1:0.511, y1:1, x2:0.482909, y2:0, stop:0 rgba(232,232,232), stop:1 rgba(232,232,232)); color: black; padding-bottom:10px; } QMenu::item { color: black; background: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); } QMenuBar { background-color: white; color: white; } QMenuBar::item { font-size:12px;padding-bottom:3px;padding-top:3px;padding-left:15px;padding-right:15px;color: black; background-color: white; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgba(99,99,99,45), stop: 1 rgba(99,99,99,45)); }"); #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(); 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); masternodeManagerPage = new MasternodeManager(this); centralWidget = new QStackedWidget(this); centralWidget->addWidget(overviewPage); centralWidget->addWidget(transactionsPage); centralWidget->addWidget(addressBookPage); centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); centralWidget->addWidget(masternodeManagerPage); 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(); labelStakingIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelStakingIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); if (GetBoolArg("-staking", true)) { QTimer *timerStakingIcon = new QTimer(labelStakingIcon); connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon())); timerStakingIcon->start(30 * 1000); updateStakingIcon(); } // Progress bar and label for blocks download progressBarLabel = new QLabel(); progressBarLabel->setVisible(false); progressBar = new QProgressBar(); addToolBarBreak(Qt::LeftToolBarArea); QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar")); addToolBar(Qt::LeftToolBarArea,toolbar2); toolbar2->setOrientation(Qt::Vertical); toolbar2->setMovable( false ); toolbar2->setObjectName("toolbar2"); toolbar2->setFixedWidth(28); toolbar2->setIconSize(QSize(28,54)); toolbar2->addWidget(labelEncryptionIcon); toolbar2->addWidget(labelStakingIcon); toolbar2->addWidget(labelConnectionsIcon); toolbar2->addWidget(labelBlocksIcon); toolbar2->setStyleSheet("#toolbar2 QToolButton { background: transparent;border:none;padding:0px;margin:0px;height:54px;width:28px; }"); syncIconMovie = new QMovie(":/movies/update_spinner", "gif", 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(); }
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(840, 550); setWindowTitle(tr("Global ") + tr("Wallet")); #ifndef Q_OS_MAC qApp->setWindowIcon(QIcon(":icons/bitcoin")); setWindowIcon(QIcon(":icons/bitcoin")); #else setUnifiedTitleAndToolBarOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif QApplication::setStyle(QStyleFactory::create("Fusion")); // 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(); // QFile style(":/styles/styles"); // style.open(QFile::ReadOnly); // qApp->setStyleSheet(QString::fromUtf8(style.readAll())); // setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(210,192,123);border:none; } #toolbar3 { border:none;width:1px; background-color: rgb(63,109,186); } #toolbar2 { border:none;width:28px; background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195),stop: 2 rgb(59,62,65)); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(210,192,123); text-align: left; color: white;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195),stop: 2 rgb(59,62,65));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:150px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(210,192,123) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(210,192,123); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195)); } QMenuBar { background: rgb(210,192,123); color:white; } QMenuBar::item { font-size:12px;padding-bottom:8px;padding-top:8px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(210,192,123), stop: 1 rgb(227,213,195)); }"); qApp->setStyleSheet("QMainWindow { background-image:url(:images/bkg);border:none;font-family:'Open Sans,sans-serif'; } #frame { } QToolBar QLabel { padding-top:15px;padding-bottom:10px;margin:0px; } #spacer { background:rgb(63,109,186);border:none; } #toolbar3 { border:none;width:1px; background-color: rgb(63,109,186); } #toolbar2 { border:none;width:28px; background-color:rgb(63,109,186); } #toolbar { border:none;height:100%;padding-top:20px; background: rgb(63,109,186); text-align: left; color: white;min-width:150px;max-width:150px;} QToolBar QToolButton:hover {background-color:qlineargradient(x1: 0, y1: 0, x2: 2, y2: 2,stop: 0 rgb(63,109,186), stop: 1 rgb(216,252,251),stop: 2 rgb(59,62,65));} QToolBar QToolButton { font-family:Century Gothic;padding-left:20px;padding-right:150px;padding-top:10px;padding-bottom:10px; width:100%; color: white; text-align: left; background-color: rgb(63,109,186) } #labelMiningIcon { padding-left:5px;font-family:Century Gothic;width:100%;font-size:10px;text-align:center;color:white; } QMenu { background: rgb(63,109,186); color:white; padding-bottom:10px; } QMenu::item { color:white; background-color: transparent; } QMenu::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(63,109,186), stop: 1 rgb(149,204,244)); } QMenuBar { background: rgb(63,109,186); color:white; } QMenuBar::item { font-size:12px;padding-bottom:8px;padding-top:8px;padding-left:15px;padding-right:15px;color:white; background-color: transparent; } QMenuBar::item:selected { background-color:qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,stop: 0 rgb(63,109,186), stop: 1 rgb(149,204,244)); }"); //#ifdef Q_OS_MAC // toolbar->setStyleSheet("QToolBar { background-color: transparent; border: 0px solid black; padding: 3px; }"); //#endif // Create tabs overviewPage = new OverviewPage(); 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); setCentralWidget(centralWidget); // Create status bar statusBar(); // Status bar notification icons labelEncryptionIcon = new QLabel(); labelStakingIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); if (GetBoolArg("-staking", true)) { QTimer *timerStakingIcon = new QTimer(labelStakingIcon); connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon())); timerStakingIcon->start(30 * 1000); updateStakingIcon(); } // 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 #007FFF, stop: 1 #3B5998); border-radius: 7px; margin: 0px; }"); } statusBar()->addWidget(progressBarLabel); statusBar()->addWidget(progressBar); addToolBarBreak(Qt::LeftToolBarArea); QToolBar *toolbar2 = addToolBar(tr("Tabs toolbar")); addToolBar(Qt::LeftToolBarArea,toolbar2); toolbar2->setOrientation(Qt::Vertical); toolbar2->setMovable( false ); toolbar2->setObjectName("toolbar2"); toolbar2->setFixedWidth(28); toolbar2->setIconSize(QSize(28,28)); toolbar2->addWidget(labelEncryptionIcon); toolbar2->addWidget(labelStakingIcon); toolbar2->addWidget(labelConnectionsIcon); toolbar2->addWidget(labelBlocksIcon); toolbar2->setStyleSheet("#toolbar2 QToolButton { border:none;padding:0px;margin:0px;height:20px;width:28px;margin-top:36px; }"); // toolbar2->setStyleSheet(QString::fromUtf8(style.readAll())); addToolBarBreak(Qt::TopToolBarArea); QToolBar *toolbar3 = addToolBar(tr("Green bar")); addToolBar(Qt::TopToolBarArea,toolbar3); toolbar3->setOrientation(Qt::Horizontal); toolbar3->setMovable( false ); toolbar3->setObjectName("toolbar3"); toolbar3->setFixedHeight(2); 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(); }
void MainWindow::initGui(){ this->setWindowTitle("Framework for empirical virtual agent studies"); vGroup = new QGroupBox; vlayout = new QVBoxLayout; createAction(); menu = new QMenuBar(); fileMenu = new QMenu(tr("&Datei"), this); fileMenu->addAction(openAct); fileMenu->addAction(exitAct); menu->addMenu(fileMenu); extraMenu = new QMenu(tr("&Extras"), this); //extraMenu->addAction(loggerAct); menu->addMenu(extraMenu); logMenu = new QMenu(tr("&Logging"), this); extraMenu->addMenu(logMenu); logMenu->addAction(noLog); logMenu->addAction(logToConsole); logMenu->addAction(logToFile); QSize pixMapSize(80,50); QPixmap image(pixMapSize); developerPath = std::getenv("WBS_DEVELOPER_ROOT"); image.load(developerPath + "/projects/StateMachine/image.bmp"); //QPixmap image(); label = new QLabel(); label->setPixmap(image); hlayout = new QHBoxLayout(); agentAdapterLabel = new QLabel("Select Agent Adapter"); agentAdapterCombo = new QComboBox; agentAdapterCombo->setEnabled(false); agentAdaperBox = new QGroupBox(tr("Select Agent Adapter")); agentAdapterLayout = new QVBoxLayout; agentAdapterLayout->addWidget(agentAdapterCombo); startAgent = new QCheckBox("Start the agent"); startAgent->setEnabled(false); agentAdapterLayout->addWidget(startAgent); agentAdaperBox->setLayout(agentAdapterLayout); MainWindow::firstUseBox = new QCheckBox("Nehmen Sie erste mal teil?"); MainWindow::loadExistingProfile = new QPushButton("Profil laden"); MainWindow::createSm = new QPushButton("execute state machine"); MainWindow::loadSm = new QPushButton("load state machine"); MainWindow::loadDataFile = new QPushButton("load Datafile"); MainWindow::loadUtteranceFile = new QPushButton("load utterance file"); loadLayout = new QVBoxLayout; loadBox = new QGroupBox(tr("Load Files")); loadLayout->addWidget(loadSm); //vlayout->addWidget(firstUseBox); firstUseBox->setEnabled(false); loadLayout->addWidget(loadUtteranceFile); loadUtteranceFile->setEnabled(false); loadLayout->addWidget(loadDataFile); loadBox->setLayout(loadLayout); vlayout->addWidget(loadBox); vlayout->addWidget(agentAdaperBox); startLayout = new QVBoxLayout; startLayout->addWidget(createSm); startBox = new QGroupBox(tr("Start StateMachine")); startBox->setLayout(startLayout); vlayout->addWidget(startBox); vlayout->addSpacing(30); //TODO:for testing onlay //vlayout->addLayout(testLayout); vlayout->addWidget(quit); createSm->setEnabled(false); loadDataFile->setEnabled(false); hlayout->addWidget(label); hlayout->addLayout(vlayout); vGroup->setLayout(hlayout); setCentralWidget(vGroup); this->show(); }
PianorollEditor::PianorollEditor(QWidget* parent) : QMainWindow(parent) { setWindowTitle(QString("MuseScore")); waveView = 0; _score = 0; staff = 0; QWidget* mainWidget = new QWidget; QToolBar* tb = addToolBar(tr("toolbar 1")); tb->addAction(getAction("undo")); tb->addAction(getAction("redo")); tb->addSeparator(); #ifdef HAS_MIDI tb->addAction(getAction("midi-on")); #endif tb->addSeparator(); tb->addAction(getAction("rewind")); tb->addAction(getAction("play")); tb->addSeparator(); tb->addAction(getAction("loop")); tb->addSeparator(); tb->addAction(getAction("repeat")); tb->addAction(getAction("follow")); tb->addSeparator(); tb->addAction(getAction("metronome")); showWave = new QAction(tr("Wave"), tb); showWave->setToolTip(tr("show wave display")); showWave->setCheckable(true); showWave->setChecked(false); connect(showWave, SIGNAL(toggled(bool)), SLOT(showWaveView(bool))); tb->addAction(showWave); //------------- tb = addToolBar(tr("toolbar 2")); static const char* sl3[] = { "voice-1", "voice-2", "voice-3", "voice-4" }; QActionGroup* voiceGroup = new QActionGroup(this); for (const char* s : sl3) { QAction* a = getAction(s); a->setCheckable(true); voiceGroup->addAction(a); tb->addAction(getAction(s)); } tb->addSeparator(); tb->addWidget(new QLabel(tr("Cursor:"))); pos = new Awl::PosLabel; pos->setFrameStyle(QFrame::NoFrame | QFrame::Plain); tb->addWidget(pos); Awl::PitchLabel* pl = new Awl::PitchLabel(); pl->setFrameStyle(QFrame::NoFrame | QFrame::Plain); tb->addWidget(pl); tb->addSeparator(); tb->addWidget(new QLabel(tr("Velocity:"))); veloType = new QComboBox; veloType->addItem(tr("offset"), MScore::OFFSET_VAL); veloType->addItem(tr("user"), MScore::USER_VAL); tb->addWidget(veloType); velocity = new QSpinBox; velocity->setRange(-1, 127); velocity->setSpecialValueText("--"); velocity->setReadOnly(true); tb->addWidget(velocity); tb->addWidget(new QLabel(tr("Pitch:"))); pitch = new Awl::PitchEdit; pitch->setReadOnly(true); tb->addWidget(pitch); //------------- qreal xmag = .1; ruler = new Ruler; ruler->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); ruler->setFixedHeight(rulerHeight); ruler->setMag(xmag, 1.0); Piano* piano = new Piano; piano->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); piano->setFixedWidth(pianoWidth); gv = new PianoView; gv->scale(xmag, 1.0); gv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); gv->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); hsb = new QScrollBar(Qt::Horizontal); connect(gv->horizontalScrollBar(), SIGNAL(rangeChanged(int,int)), SLOT(rangeChanged(int,int))); // layout QHBoxLayout* hbox = new QHBoxLayout; hbox->setSpacing(0); hbox->addWidget(piano); hbox->addWidget(gv); split = new QSplitter(Qt::Vertical); split->setFrameShape(QFrame::NoFrame); QWidget* split1 = new QWidget; // piano - pianoview split1->setLayout(hbox); split->addWidget(split1); QGridLayout* layout = new QGridLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); layout->setColumnMinimumWidth(0, pianoWidth + 5); layout->addWidget(tb, 0, 0, 1, 2); layout->addWidget(ruler, 1, 1); layout->addWidget(split, 2, 0, 1, 2); layout->addWidget(hsb, 3, 1); mainWidget->setLayout(layout); setCentralWidget(mainWidget); connect(gv->verticalScrollBar(), SIGNAL(valueChanged(int)), piano, SLOT(setYpos(int))); connect(gv, SIGNAL(magChanged(double,double)), ruler, SLOT(setMag(double,double))); connect(gv, SIGNAL(magChanged(double,double)), piano, SLOT(setMag(double,double))); connect(gv, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(pitchChanged(int)), piano, SLOT(setPitch(int))); connect(piano, SIGNAL(pitchChanged(int)), pl, SLOT(setPitch(int))); connect(gv, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(gv, SIGNAL(posChanged(const Pos&)), ruler, SLOT(setPos(const Pos&))); connect(ruler, SIGNAL(posChanged(const Pos&)), pos, SLOT(setValue(const Pos&))); connect(hsb, SIGNAL(valueChanged(int)), SLOT(setXpos(int))); connect(gv, SIGNAL(xposChanged(int)), SLOT(setXpos(int))); connect(gv->horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(setXpos(int))); connect(ruler, SIGNAL(locatorMoved(int, const Pos&)), SLOT(moveLocator(int, const Pos&))); connect(veloType, SIGNAL(activated(int)), SLOT(veloTypeChanged(int))); connect(velocity, SIGNAL(valueChanged(int)), SLOT(velocityChanged(int))); connect(gv->scene(), SIGNAL(selectionChanged()), SLOT(selectionChanged())); connect(piano, SIGNAL(keyPressed(int)), SLOT(keyPressed(int))); connect(piano, SIGNAL(keyReleased(int)), SLOT(keyReleased(int))); resize(800, 400); QActionGroup* ag = new QActionGroup(this); QAction* a = new QAction(this); a->setData("delete"); a->setShortcut(Qt::Key_Delete); ag->addAction(a); addActions(ag->actions()); connect(ag, SIGNAL(triggered(QAction*)), SLOT(cmd(QAction*))); setXpos(0); }
SequenceNumber::SequenceNumber(MainWindow* main) : QuasarWindow(main, "SequenceNumber") { _helpSource = "seq_number.html"; QFrame* frame = new QFrame(this); QScrollView* sv = new QScrollView(frame); _nums = new QButtonGroup(4, Horizontal, tr("Seq Numbers"), sv->viewport()); new QLabel("Type", _nums); new QLabel("Minimum", _nums); new QLabel("Maximum", _nums); new QLabel("Next", _nums); addIdEdit(tr("Data Object:"), "data_object", "object_id"); addIdEdit(tr("Journal Entry:"), "gltx", "Journal Entry"); addIdEdit(tr("Ledger Transfer:"), "gltx", "Ledger Transfer"); addIdEdit(tr("Card Adjustment:"), "gltx", "Card Adjustment"); addIdEdit(tr("Customer Invoice:"), "gltx", "Customer Invoice"); addIdEdit(tr("Customer Return:"), "gltx", "Customer Return"); addIdEdit(tr("Customer Payment:"), "gltx", "Customer Payment"); addIdEdit(tr("Customer Quote:"), "quote", "number"); addIdEdit(tr("Vendor Invoice:"), "gltx", "Vendor Invoice"); addIdEdit(tr("Vendor Claim:"), "gltx", "Vendor Claim"); addIdEdit(tr("Purchase Order:"), "porder", "number"); addIdEdit(tr("Packing Slip:"), "slip", "number"); addIdEdit(tr("Nosale:"), "gltx", "Nosale"); addIdEdit(tr("Payout:"), "gltx", "Payout"); addIdEdit(tr("Withdraw:"), "gltx", "Withdraw"); addIdEdit(tr("Shift:"), "gltx", "Shift"); addIdEdit(tr("Item Adjustment:"), "gltx", "Item Adjustment"); addIdEdit(tr("Item Transfer:"), "gltx", "Item Transfer"); addIdEdit(tr("Physical Count:"), "pcount", "number"); addIdEdit(tr("Label Batch:"), "label_batch", "number"); addIdEdit(tr("Price Batch:"), "price_batch", "number"); addIdEdit(tr("Promo Batch:"), "promo_batch", "number"); addIdEdit(tr("Company Number:"), "company", "number"); addIdEdit(tr("Store Number:"), "store", "number"); addIdEdit(tr("Station Number:"), "station", "number"); addIdEdit(tr("Tender Count #:"), "tender_count", "number"); addIdEdit(tr("Tender Menu #:"), "tender", "menu_num"); QFrame* buttons = new QFrame(frame); QPushButton* ok = new QPushButton(tr("&OK"), buttons); QPushButton* quit = new QPushButton(tr("&Close"), buttons); connect(ok, SIGNAL(clicked()), SLOT(slotOk())); connect(quit, SIGNAL(clicked()), SLOT(close())); QGridLayout* buttonGrid = new QGridLayout(buttons); buttonGrid->setSpacing(3); buttonGrid->setMargin(3); buttonGrid->setColStretch(0, 1); buttonGrid->addWidget(ok, 0, 1); buttonGrid->addWidget(quit, 0, 2); _nums->resize(_nums->sizeHint()); sv->setVScrollBarMode(QScrollView::AlwaysOn); sv->resizeContents(_nums->width() + 20, _nums->height()); QGridLayout* grid = new QGridLayout(frame); grid->setSpacing(6); grid->setMargin(6); grid->setRowStretch(0, 1); grid->addWidget(sv, 0, 0); grid->addWidget(buttons, 1, 0); for (unsigned int i = 0; i < _ids.size(); ++i) { IdInfo& info = _ids[i]; _quasar->db()->getSequence(info.seq); info.minNum->setFixed(info.seq.minNumber()); info.maxNum->setFixed(info.seq.maxNumber()); info.nextNum->setFixed(info.seq.nextNumber()); } statusBar()->hide(); setCentralWidget(frame); setCaption(tr("Sequence Numbers")); finalize(); if (!allowed("View")) { QTimer::singleShot(50, this, SLOT(slotNotAllowed())); return; } }
kd::kd() { ready_to_die = false; /* Creating top-right area (Line input and button) */ item_input = new QLineEdit; item_button = new QPushButton(tr("Add")); item_button->setDefault(true); bottom_h_layout = new QHBoxLayout; bottom_h_layout->addWidget(item_input); bottom_h_layout->addWidget(item_button); items_tree = new QTreeWidget; items_tree->setColumnCount(2); items_tree->setHeaderLabels(QStringList() << tr("Goods") << tr("Price") ); added_items = new QTextBrowser; central_widget = new QSplitter; central_widget->addWidget(items_tree); central_widget->addWidget(added_items); central_widget->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); /* Create right side (top area, suggest label and list of added items) */ item_suggest = new QLabel; right_v_layout = new QVBoxLayout; right_v_layout->addWidget(item_suggest); right_v_layout->addWidget(central_widget); right_v_layout->addLayout(bottom_h_layout); right_widget = new QWidget; right_widget->setLayout(right_v_layout); setCentralWidget( right_widget ); item_input->setFocus(); /* Restore window settings */ app_settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, "Stinky", "Celtic House Menu"); app_settings->beginGroup("MainWindow"); resize(app_settings->value("Size", QSize(400, 400)).toSize()); move(app_settings->value("Position", QPoint(200, 200)).toPoint()); central_widget->restoreState( app_settings->value("Splitter").toByteArray() ); app_settings->endGroup(); menu_file = new QSettings(QSettings::IniFormat, QSettings::SystemScope, "Stinky", "Celtic House Menu"); qDebug() << "Menu in " << menu_file->fileName(); cards = new QSettings(QSettings::IniFormat, QSettings::SystemScope, "Stinky", "cards"); qDebug() << "Menu in " << cards->fileName(); // Cards debug QStringList ckeys = cards->allKeys(); for(int i = 0; i < ckeys.size(); ++i) { qDebug() << "Value:" << ckeys.at(i) << " = " << QString::fromUtf8( cards->value( ckeys.at(i), "Ы" ).toString().toAscii() ); } QString logs_dir = menu_file->value("Settings/LogsDir", "").toString(); if(logs_dir.length() > 1) logger = new Logger(logs_dir); else logger = new Logger; QString errmsg; if(logger->getError(errmsg) != QFile::NoError) { QMessageBox msgBox; msgBox.setIcon(QMessageBox::Critical); msgBox.setText(tr("Can not open log file.")); msgBox.setInformativeText(errmsg); msgBox.exec(); ready_to_die = true; return; } // readMenu QString tmpstr = QString("root"); readMenu(*items_tree->invisibleRootItem(), tmpstr, tmpstr); tmpstr = QString("launcher"); QTreeWidgetItem *tmpitem = new QTreeWidgetItem; QBrush *red = new QBrush(Qt::red); tmpitem->setForeground(0, *red); readMenu(*tmpitem, tmpstr, tmpstr); tmpitem->setText( 2, "/" ); items_tree->addTopLevelItem(tmpitem); /*End read menu*/ items_tree->expandAll(); items_tree->resizeColumnToContents(1); items_tree->resizeColumnToContents(0); items_tree->collapseAll(); totalprice = 0; QAction* a_quit = new QAction(this); QAction* a_rotate = new QAction(this); a_quit->setText( "Quit" ); a_rotate->setText( "Rotate" ); QMenu *filemenu = menuBar()->addMenu( "File" ); filemenu->addAction( a_quit ); filemenu->addAction( a_rotate ); //status_bar = new QStatusBar(central_widget); //statusBar(); updateCurrentTotal(); connect(a_quit, SIGNAL(triggered()), SLOT(close()) ); connect(a_rotate, SIGNAL(triggered()), SLOT(onRotate()) ); connect(item_button, SIGNAL(clicked()), SLOT(onAddButtonPress()) ); connect(item_input, SIGNAL(returnPressed()), SLOT(onAddButtonPress()) ); connect(item_input, SIGNAL(textChanged(QString)), SLOT(onTextChange(QString)) ); connect(items_tree, SIGNAL(itemClicked(QTreeWidgetItem*,int)), SLOT(onItemClick(QTreeWidgetItem*,int)) ); connect(items_tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(onDoubleClick(QTreeWidgetItem*,int)) ); }
MainWindow::MainWindow(const QUrl& url) : m_dongle(new mobot_t) { progress = 0; QFile file; file.setFileName(":/jquery.min.js"); file.open(QIODevice::ReadOnly); jQuery = file.readAll(); jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };"); file.close(); //! [1] QNetworkProxyFactory::setUseSystemConfiguration(true); m_interface = new JsInterface(this); //! [2] view = new QWebView(this); view->load(url); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(populateJavaScriptWindowObject())); locationEdit = new QLineEdit(this); locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy()); connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); QToolBar *toolBar = addToolBar(tr("Navigation")); toolBar->addAction(view->pageAction(QWebPage::Back)); toolBar->addAction(view->pageAction(QWebPage::Forward)); toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit); //! [2] QMenu *viewMenu = menuBar()->addMenu(tr("&View")); QAction* viewSourceAction = new QAction("Page Source", this); connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource())); viewMenu->addAction(viewSourceAction); //! [3] QMenu *effectMenu = menuBar()->addMenu(tr("&Effect")); effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks())); rotateAction = new QAction(this); rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView)); rotateAction->setCheckable(true); rotateAction->setText(tr("Turn images upside down")); connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool))); effectMenu->addAction(rotateAction); QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools")); toolsMenu->addAction(tr("Remove GIF images"), this, SLOT(removeGifImages())); toolsMenu->addAction(tr("Remove all inline frames"), this, SLOT(removeInlineFrames())); toolsMenu->addAction(tr("Remove all object elements"), this, SLOT(removeObjectElements())); toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements())); setCentralWidget(view); setUnifiedTitleAndToolBarOnMac(true); baroboInit(); qDebug() << "App path : " << qApp->applicationDirPath(); }
MainWindow::MainWindow(QAction* actionQuit, QAction* actionNewTab, QAction* actionFullscreen, QAction* actionLoadSession, QAction* actionSaveSession, QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow), fetcher(new Fetcher), local(new LocalFetcher), source(IMAGE_SOURCE_UNKNOWN) { ui->setupUi(this); QStringList sources; sources.append("Google"); sources.append("Local file"); // sources.append("Picsearch"); ui->cbSource->addItems(sources); ui->cbSource->setCurrentIndex(IMAGE_SOURCE_GOOGLE); fetcher->hide(); local->hide(); ui->menuFile->addAction(actionNewTab); ui->menuFile->addAction(actionLoadSession); ui->menuFile->addAction(actionSaveSession); ui->menuFile->addAction(actionQuit); ui->menuView->insertAction(ui->actionResetTransforms,actionFullscreen); ui->tbFullScreen->setDefaultAction(actionFullscreen); ui->tbNewTab->setDefaultAction(actionNewTab); ui->tbResetTransform->setDefaultAction(ui->actionResetTransforms); ui->tbSave->setDefaultAction(actionSaveSession); ui->glTools->addWidget(fetcher,0,6,2,1); ui->glTools->addWidget(local,0,6,2,1); updateSource(); connect(ui->cbSource,SIGNAL(currentIndexChanged(int)),this,SLOT(updateSource())); ui->actionViewOnlyMode->setShortcut(Qt::Key_Tab); QList<QKeySequence> keys; keys << Qt::Key_Delete << Qt::Key_Backspace; ui->actionDeleteSelected->setShortcuts(keys); // These are necessary if the actions are to remain accessible when the menubar is hidden: this->addAction(ui->actionViewOnlyMode); this->addAction(ui->actionResetTransforms); this->addAction(ui->actionZoomToFit); this->addAction(ui->actionIntroduction); this->addAction(ui->actionTips); this->addAction(ui->actionOpenDirectory); this->addAction(ui->actionOpenFile); this->addAction(ui->actionDeleteSelected); this->addAction(ui->actionUncropSelected); this->addAction(ui->actionCentreInView); this->addAction(ui->actionResetRotation); this->addAction(ui->actionResetScale); this->addAction(ui->actionScaleToFit); this->addAction(actionFullscreen); this->addAction(actionLoadSession); this->addAction(actionSaveSession); this->addAction(actionNewTab); this->addAction(actionQuit); connect(ui->actionIntroduction,SIGNAL(triggered()),this,SLOT(showHelp())); connect(ui->actionTips,SIGNAL(triggered()),this,SLOT(showTips())); connect(ui->actionViewOnlyMode,SIGNAL(triggered(bool)),this,SLOT(enterViewOnlyMode(bool))); connect(ui->actionPreferences,SIGNAL(triggered()),this,SLOT(showPreferences())); connect(fetcher,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString))); connect(fetcher,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool))); connect(local,SIGNAL(imageResult(QUrl,QUrl,bool)),this,SLOT(processImageResult(QUrl,QUrl,bool))); connect(local,SIGNAL(queryChanged(QString)),this,SIGNAL(queryChanged(QString))); initBlacklistDocker(); initInfoDocker(); initView(parent); dlDir = QString(DEFAULT_DOWNLOAD_DIRECTORY); dlMgr = new QNetworkAccessManager(this); connect(ui->actionResetTransforms,SIGNAL(triggered()),gvMain,SLOT(resetTransforms())); connect(ui->actionZoomToFit,SIGNAL(triggered()),gvMain,SLOT(zoomToFit())); connect(ui->actionOpenDirectory,SIGNAL(triggered()),local,SLOT(selectDirectory())); connect(ui->actionOpenFile,SIGNAL(triggered()),local,SLOT(selectFile())); connect(ui->actionDeleteSelected,SIGNAL(triggered()),gsMain,SLOT(deleteSelected())); connect(ui->actionUncropSelected,SIGNAL(triggered()),gsMain,SLOT(uncropSelected())); connect(ui->actionCentreInView,SIGNAL(triggered()),gsMain,SLOT(centreSelection())); connect(ui->actionResetRotation,SIGNAL(triggered()),gsMain,SLOT(resetSelectionRotation())); connect(ui->actionResetScale,SIGNAL(triggered()),gsMain,SLOT(resetSelectionScale())); connect(ui->actionScaleToFit,SIGNAL(triggered()),this,SLOT(scaleSelectedToFit())); ui->verticalLayout->removeWidget(ui->toolWidget); ui->toolBar->addWidget(ui->toolWidget); setCentralWidget(gvMain); ui->thumbBar->addWidget(gvCarousel); ui->statusBar->addWidget(fetcher->getStatusText(),0); ui->statusBar->addWidget(fetcher->getProgressBar(),1); connect(this,SIGNAL(settingsChanged()),this,SLOT(loadSettings())); loadSettings(); }
BefungeMainWindow::BefungeMainWindow(QWidget *parent) : QMainWindow(parent) { interpreter = new BefungeInterpreter(this); setCentralWidget(new QFrame(this)); QHBoxLayout *layout_central = new QHBoxLayout(); QVBoxLayout *layout_main = new QVBoxLayout(); QVBoxLayout *layout_buttons = new QVBoxLayout(); centralWidget()->setLayout(layout_central); QGridLayout *layout_befunge_editor = new QGridLayout(); QHBoxLayout *layout_input_output = new QHBoxLayout(); QHBoxLayout *layout_aux_widgets = new QHBoxLayout(); QVBoxLayout *layout_input = new QVBoxLayout(); QVBoxLayout *layout_output = new QVBoxLayout(); QVBoxLayout *layout_stack = new QVBoxLayout(); QVBoxLayout *layout_help = new QVBoxLayout(); befunge_editor = new QTextEdit(this); befunge_editor->setFont(QFont("Verdana", 12)); befunge_editor->ensureCursorVisible(); befunge_editor->setLineWrapMode(QTextEdit::NoWrap); befunge_editor->setMinimumHeight(400); layout_befunge_editor->addWidget(befunge_editor); befunge_input = new QTextEdit(this); befunge_input->setFont(QFont("Verdana", 12)); befunge_input->ensureCursorVisible(); befunge_input->setLineWrapMode(QTextEdit::NoWrap); layout_input->addWidget(new QLabel("Input", this)); layout_input->addWidget(befunge_input); befunge_output = new QTextEdit(this); befunge_output->setFont(QFont("Verdana", 12)); befunge_output->ensureCursorVisible(); befunge_output->setLineWrapMode(QTextEdit::NoWrap); befunge_output->setReadOnly(true); layout_output->addWidget(new QLabel("Output", this)); layout_output->addWidget(befunge_output); stack_view = new QTableView(this); layout_stack->addWidget(new QLabel("Stack", this)); layout_stack->addWidget(stack_view); befunge_help = new QTextEdit(this); befunge_help->setFont(QFont("Verdana", 12)); befunge_help->setMinimumWidth(550); befunge_help->setHtml(QString("<table border=\"1\"> <tr> <th>COMMAND</th> <th>INITIAL STACK (bot->top)</th> <th>RESULT STACK</th> </tr>") % QString("<tr> <td>+ (add)</td> <td>'value1' 'value2'</td> <td>'value1 + value2'</td> </tr>") % QString("<tr> <td>- (subtract)</td> <td>'value1' 'value2'</td> <td>'value1 - value2'</td> </tr>") % QString("<tr> <td>* (multiply)</td> <td>'value1' 'value2'</td> <td>'value1 * value2'</td> </tr>") % QString("<tr> <td>/ (divide)</td> <td>'value1' 'value2'</td> <td>'value1 / value2' (nb. integer)</td> </tr>") % QString("<tr> <td>% (modulo)</td> <td>'value1' 'value2'</td> <td>'value1 mod value2'</td> </tr>") % QString("<tr> <td>! (not)</td> <td>'value'</td> <td>'0' if value non-zero, '1' otherwise</td> </tr>") % QString("<tr> <td>` (greater)</td> <td>'value1' 'value2'</td> <td>'1' if value1 > value2, '0' otherwise</td> </tr>") % QString("<tr> <td>> (right)</td> <td> </td> <td>PC -> right</td> </tr>") % QString("<tr> <td>< (left)</td> <td> </td> <td>PC -> left</td> </tr>") % QString("<tr> <td>^ (up)</td> <td> </td> <td>PC -> up</td> </tr>") % QString("<tr> <td>v (down)</td> <td> </td> <td>PC -> down</td> </tr>") % QString("<tr> <td>? (random)</td> <td> </td> <td>PC -> random direction</td> </tr>") % QString("<tr> <td>_ (horizontal if)</td> <td>'boolean value'</td> <td>PC -> left if 'value', else PC -> right</td> </tr>") % QString("<tr> <td>| (vertical if)</td> <td>'boolean value'</td> <td>PC -> up if 'value', else PC -> down</td> </tr>") % QString("<tr> <td>\" (stringmode)</td> <td> </td> <td>toggles 'stringmode'</td> </tr>") % QString("<tr> <td>: (dup)</td> <td>'value'</td> <td>'value' 'value'</td> </tr>") % QString("<tr> <td>\\ (swap)</td> <td>'value1' 'value2'</td> <td>'value2' 'value1'</td> </tr>") % QString("<tr> <td>$ (pop)</td> <td>'value'</td> <td>just pops 'value'</td> </tr>") % QString("<tr> <td>. (pop)</td> <td>'value'</td> <td>pops 'value' and outputs as integer</td> </tr>") % QString("<tr> <td>, (pop)</td> <td>'value'</td> <td>pops 'value' and outputs as ASCII</td> </tr>") % QString("<tr> <td># (bridge)</td> <td> </td> <td>PC jumps over next cell</td> </tr>") % QString("<tr> <td>g (get)</td> <td>'x' 'y'</td> <td>'value at (x, y)'</td> </tr>") % QString("<tr> <td>p (put)</td> <td>'value' 'x' 'y'</td> <td>puts 'value' at (x, y)</td> </tr>") % QString("<tr> <td>& (input value)</td> <td> </td> <td>value user entered</td> </tr>") % QString("<tr> <td>~ (input char)</td> <td> </td> <td>character user entered</td> </tr>") % QString("<tr> <td>@ (end)</td> <td> </td> <td>ends program</td> </tr> </table>")); befunge_help->setReadOnly(true); layout_help->addWidget(new QLabel("Befunge command summary", this)); layout_help->addWidget(befunge_help); btn_run = new QPushButton("Run", this); btn_step = new QPushButton("Step", this); btn_stop = new QPushButton("Stop", this); btn_exit = new QPushButton("Exit", this); layout_buttons->addWidget(btn_run); layout_buttons->addSpacing(5); layout_buttons->addWidget(btn_step); layout_buttons->addSpacing(5); layout_buttons->addWidget(btn_stop); layout_buttons->addStretch(); layout_buttons->addWidget(btn_exit); layout_aux_widgets->addItem(layout_stack); layout_aux_widgets->addItem(layout_help); layout_input_output->addItem(layout_input); layout_input_output->addItem(layout_output); layout_main->addItem(layout_befunge_editor); layout_main->addItem(layout_input_output); layout_main->addItem(layout_aux_widgets); layout_central->addItem(layout_main); layout_central->addItem(layout_buttons); connect(btn_exit, SIGNAL(clicked()), this, SLOT(close())); connect(btn_run, SIGNAL(clicked()), interpreter, SLOT(Run())); connect(btn_step, SIGNAL(clicked()), interpreter, SLOT(Step())); }
BpdeMainWindow::BpdeMainWindow(RInside& R, const QString& sourceFile, QObject *parent) : R(R), sourceFile(sourceFile), x(), y(), H(), solver(NULL) { tempfile = QString::fromStdString(Rcpp::as<std::string>(R.parseEval("tfile <- tempfile()"))); svgfile = QString::fromStdString(Rcpp::as<std::string>(R.parseEval("sfile <- tempfile()"))); QWidget *window = new QWidget; window->setWindowTitle("BpdeGUI"); setCentralWidget(window); QGroupBox *runParameters = new QGroupBox("Параметры запуска"); openMPEnabled = new QRadioButton("&OpenMP"); openClEnabled = new QRadioButton("&OpenCL"); openMPEnabled->setChecked(true); connect(openMPEnabled, SIGNAL(clicked()), this, SLOT(loadSource())); connect(openClEnabled, SIGNAL(clicked()), this, SLOT(loadSource())); QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget(openMPEnabled); vbox->addWidget(openClEnabled); QLabel *threadsLabel = new QLabel("Количество потоков"); threadsLineEdit = new QLineEdit("4"); QHBoxLayout *threadNumber = new QHBoxLayout; threadNumber->addWidget(threadsLabel); threadNumber->addWidget(threadsLineEdit); QHBoxLayout *deviceLayout = new QHBoxLayout; QLabel *deviceLabel = new QLabel("Устройство"); deviceComboBox = new QComboBox(); scanDevices(); for (std::vector<cl::Device>::iterator it = devices.begin(); it != devices.end(); it++) deviceComboBox->addItem((*it).getInfo<CL_DEVICE_NAME>().c_str()); connect(deviceComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(loadSource())); deviceLayout->addWidget(deviceLabel); deviceLayout->addWidget(deviceComboBox); QHBoxLayout* runLayout = new QHBoxLayout; runButton = new QPushButton("Начать вычисления", this); qDebug() << "Connect : " << connect(runButton, SIGNAL(clicked()), this, SLOT(solve())); runLayout->addWidget(runButton); QVBoxLayout* ulLayout = new QVBoxLayout; ulLayout->addLayout(vbox); ulLayout->addLayout(threadNumber); ulLayout->addLayout(deviceLayout); ulLayout->addLayout(runLayout); runParameters->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); runParameters->setLayout(ulLayout); QButtonGroup *kernelGroup = new QButtonGroup; kernelGroup->addButton(openMPEnabled, 0); kernelGroup->addButton(openClEnabled, 1); QGroupBox *solveParamBox = new QGroupBox("Настройки вычислительного метода"); QHBoxLayout *iterationsLayout = new QHBoxLayout; QHBoxLayout *stepLayout = new QHBoxLayout; QLabel *sourceFileLabel = new QLabel("SourceFile"); sourceFileEdit = new QLineEdit(sourceFile); iterationsEdit = new QLineEdit("10000"); stepEdit = new QLineEdit("3600"); QLabel *iterationsLabel = new QLabel("Итерации"); QLabel *stepLabel = new QLabel("Шаг "); QHBoxLayout *exportLayout = new QHBoxLayout; exportImage = new QPushButton("Экспорт изотерм"); export3D = new QPushButton("Экспорт 3D модели"); connect(exportImage, SIGNAL(clicked()), this, SLOT(exportIsoterms())); connect(export3D, SIGNAL(clicked()), this, SLOT(export3DModel())); iterationsLayout->addWidget(iterationsLabel); iterationsLayout->addWidget(iterationsEdit); stepLayout->addWidget(stepLabel); stepLayout->addWidget(stepEdit); exportLayout->addWidget(exportImage); exportLayout->addWidget(export3D); svg = new QSvgWidget(); loadSource(); QVBoxLayout *solveParamLayout = new QVBoxLayout; solveParamLayout->addWidget(sourceFileLabel); solveParamLayout->addWidget(sourceFileEdit); solveParamLayout->addLayout(iterationsLayout); solveParamLayout->addLayout(stepLayout); solveParamLayout->addLayout(exportLayout); solveParamBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); solveParamBox->setLayout(solveParamLayout); QHBoxLayout *upperlayout = new QHBoxLayout; upperlayout->addWidget(runParameters); upperlayout->addWidget(solveParamBox); QHBoxLayout *lowerlayout = new QHBoxLayout; lowerlayout->addWidget(svg); QVBoxLayout *outer = new QVBoxLayout; outer->addLayout(upperlayout); outer->addLayout(lowerlayout); window->setLayout(outer); }
ZLViewWidget *ZLQtApplicationWindow::createViewWidget() { ZLQtViewWidget *viewWidget = new ZLQtViewWidget(this, &application()); setCentralWidget(viewWidget->widget()); viewWidget->widget()->show(); return viewWidget; }
MainView::MainView(QWidget *parent, const char *name, WFlags fl) : QMainWindow(parent, name, fl) { setIcon( Resource::loadPixmap( "remote" ) ); setCaption(tr("uBrowser")); setToolBarsMovable( false ); QToolBar *toolbar = new QToolBar(this, "toolbar"); back = new QToolButton(Resource::loadPixmap("ubrowser/back"), 0, 0, 0, 0, toolbar, "back"); forward = new QToolButton(Resource::loadPixmap("ubrowser/forward"), 0, 0, 0, 0, toolbar, "forward"); home = new QToolButton(Resource::loadPixmap("ubrowser/home"), 0, 0, 0, 0, toolbar, "home"); location = new QComboBox(true, toolbar, "location"); go = new QToolButton(Resource::loadPixmap("ubrowser/go"), 0, 0, 0, 0, toolbar, "go"); toolbar->setStretchableWidget(location); toolbar->setHorizontalStretchable(true); location->setAutoCompletion( true ); addToolBar(toolbar); browser = new QTextBrowser(this, "browser"); setCentralWidget(browser); //make the button take you to the location connect(go, SIGNAL(clicked()), this, SLOT(goClicked()) ); connect(location->lineEdit(), SIGNAL(returnPressed()), this, SLOT(goClicked()) ); //make back, forward and home do their thing (isnt QTextBrowser great?) connect(back, SIGNAL(clicked()), browser, SLOT(backward()) ); connect(forward, SIGNAL(clicked()), browser, SLOT(forward()) ); connect(home, SIGNAL(clicked()), browser, SLOT(home()) ); //make back and forward buttons be enabled, only when you can go back or forward (again, i love QTextBrowser) //this doesnt seem to work, but doesnt break anything either... connect(browser, SIGNAL(backwardAvailable(bool)), back, SLOT(setOn(bool)) ); connect(browser, SIGNAL(forwardAvailable(bool)), forward, SLOT(setOn(bool)) ); //notify me when the text of the browser has changed (like when the user clicks a link) connect(browser, SIGNAL(textChanged()), this, SLOT(textChanged()) ); http = new HttpFactory(browser); if( qApp->argc() > 1 ) { char **argv = qApp->argv(); int i = 0; QString *openfile = new QString( argv[0] ); while( openfile->contains( "ubrowser" ) == 0 && i < qApp->argc() ) { i++; *openfile = argv[i]; } *openfile = argv[i+1]; if( !openfile->startsWith( "http://" ) && !openfile->startsWith( "/" ) ) { openfile->insert( 0, QDir::currentDirPath()+"/" ); } location->setEditText( *openfile ); goClicked(); } }
TextEdit::TextEdit(QWidget *parent) : QMainWindow(parent) { setToolButtonStyle(Qt::ToolButtonFollowStyle); setupFileActions(); setupEditActions(); setupTextActions(); { QMenu *helpMenu = new QMenu(tr("Help"), this); menuBar()->addMenu(helpMenu); helpMenu->addAction(tr("About"), this, SLOT(about())); helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt())); } textEdit = new QTextEdit(this); connect(textEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(currentCharFormatChanged(QTextCharFormat))); connect(textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChanged())); setCentralWidget(textEdit); textEdit->setFocus(); setCurrentFileName(QString()); fontChanged(textEdit->font()); colorChanged(textEdit->textColor()); alignmentChanged(textEdit->alignment()); connect(textEdit->document(), SIGNAL(modificationChanged(bool)), actionSave, SLOT(setEnabled(bool))); connect(textEdit->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setWindowModified(bool))); connect(textEdit->document(), SIGNAL(undoAvailable(bool)), actionUndo, SLOT(setEnabled(bool))); connect(textEdit->document(), SIGNAL(redoAvailable(bool)), actionRedo, SLOT(setEnabled(bool))); setWindowModified(textEdit->document()->isModified()); actionSave->setEnabled(textEdit->document()->isModified()); actionUndo->setEnabled(textEdit->document()->isUndoAvailable()); actionRedo->setEnabled(textEdit->document()->isRedoAvailable()); connect(actionUndo, SIGNAL(triggered()), textEdit, SLOT(undo())); connect(actionRedo, SIGNAL(triggered()), textEdit, SLOT(redo())); actionCut->setEnabled(false); actionCopy->setEnabled(false); connect(actionCut, SIGNAL(triggered()), textEdit, SLOT(cut())); connect(actionCopy, SIGNAL(triggered()), textEdit, SLOT(copy())); connect(actionPaste, SIGNAL(triggered()), textEdit, SLOT(paste())); connect(textEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool))); connect(textEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool))); #ifndef QT_NO_CLIPBOARD connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged())); #endif QString initialFile = ":/example.html"; const QStringList args = QCoreApplication::arguments(); if (args.count() == 2) initialFile = args.at(1); if (!load(initialFile)) fileNew(); }
MainWindow::MainWindow() : QMainWindow() , m_view(new SvgView) { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); QAction *quitAction = fileMenu->addAction(tr("E&xit")); quitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); menuBar()->addMenu(fileMenu); QMenu *viewMenu = new QMenu(tr("&View"), this); m_backgroundAction = viewMenu->addAction(tr("&Background")); m_backgroundAction->setEnabled(false); m_backgroundAction->setCheckable(true); m_backgroundAction->setChecked(false); connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool))); m_outlineAction = viewMenu->addAction(tr("&Outline")); m_outlineAction->setEnabled(false); m_outlineAction->setCheckable(true); m_outlineAction->setChecked(true); connect(m_outlineAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewOutline(bool))); menuBar()->addMenu(viewMenu); QMenu *rendererMenu = new QMenu(tr("&Renderer"), this); m_nativeAction = rendererMenu->addAction(tr("&Native")); m_nativeAction->setCheckable(true); m_nativeAction->setChecked(true); #ifndef QT_NO_OPENGL m_glAction = rendererMenu->addAction(tr("&OpenGL")); m_glAction->setCheckable(true); #endif m_imageAction = rendererMenu->addAction(tr("&Image")); m_imageAction->setCheckable(true); #ifndef QT_NO_OPENGL rendererMenu->addSeparator(); m_highQualityAntialiasingAction = rendererMenu->addAction(tr("&High Quality Antialiasing")); m_highQualityAntialiasingAction->setEnabled(false); m_highQualityAntialiasingAction->setCheckable(true); m_highQualityAntialiasingAction->setChecked(false); connect(m_highQualityAntialiasingAction, SIGNAL(toggled(bool)), m_view, SLOT(setHighQualityAntialiasing(bool))); #endif QActionGroup *rendererGroup = new QActionGroup(this); rendererGroup->addAction(m_nativeAction); #ifndef QT_NO_OPENGL rendererGroup->addAction(m_glAction); #endif rendererGroup->addAction(m_imageAction); menuBar()->addMenu(rendererMenu); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(rendererGroup, SIGNAL(triggered(QAction *)), this, SLOT(setRenderer(QAction *))); setCentralWidget(m_view); setWindowTitle(tr("SVG Viewer")); }
MainWindow::MainWindow(QWidget * parent, FormBar * bar): QMainWindow(parent), m_formbar(bar) { setMenuBar(new QMenuBar(this)); QMenu *fileMenu = menuBar() -> addMenu(tr("&File")); QAction *openAct = new QAction(tr("&Open"), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open")); connect(openAct, SIGNAL(triggered()), this, SLOT(openFile())); // Quit action QAction *quitAct = new QAction(tr("&Quit"), this); quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit")); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); fileMenu->addAction(openAct); fileMenu->addAction(quitAct); QGLFormat glFormat; std::cout << glFormat.openGLVersionFlags() << std::endl; std::cout << (QGLFormat::OpenGL_Version_3_0 <= glFormat.openGLVersionFlags()) << std::endl; if(QGLFormat::OpenGL_Version_3_3 & glFormat.openGLVersionFlags()) { glFormat.setVersion( 3,3 ); } else { glFormat.setVersion( 2, 1 ); } std::cout << "GL Version: " << glFormat.majorVersion() << " " << glFormat.minorVersion() << std::endl; glFormat.setProfile( QGLFormat::CompatibilityProfile ); glFormat.setSampleBuffers( true ); m_glwidget = new GLWidget(glFormat,this); connect(this,SIGNAL(meshLoaded(std::shared_ptr<const MeshPackage>)), m_glwidget,SLOT(receiveMesh(std::shared_ptr<const MeshPackage>))); connect(this,SIGNAL(formLoaded(const FormPackage &)) , m_glwidget,SLOT(receiveForm(const FormPackage &))); setCentralWidget(m_glwidget); QDockWidget * dock = new QDockWidget(tr("Form Chooser"),this); if(!m_formbar) { m_formbar = new FormBar(this); } dock->setWidget(m_formbar); addDockWidget(Qt::LeftDockWidgetArea, dock); connect(this,SIGNAL(loadingNewMesh()) , m_glwidget,SLOT(unloadMesh())); connect(this,SIGNAL(formLoaded(const FormPackage &)) , m_formbar,SLOT(receiveForm(const FormPackage &))); connect(this,SIGNAL(particlesLoaded(std::shared_ptr<VertexBufferObject>)) , m_glwidget,SLOT(receiveParticles(std::shared_ptr<VertexBufferObject>))); connect( m_formbar, SIGNAL(enableForm(const QString &)), m_glwidget, SLOT(enableForm(const QString &))); connect( m_formbar, SIGNAL(disableForm(const QString &)), m_glwidget, SLOT(disableForm(const QString &))); connect( m_formbar, SIGNAL(clearForms(void)), m_glwidget, SLOT(clearForms(void))); }
MainWindow::MainWindow ( const char * name ) : KMainWindow ( 0L, name ) { // QPopupMenu *filemenu; // KMenuBar *menu; setCaption("Flickr Wallpaper Grabber"); setIcon( QPixmap( QString( "%1/flickr.png" ).arg( PWD ) ) ); // filemenu = new QPopupMenu; // filemenu->insertItem( i18n( "&Quit" ), kapp, SLOT( quit() ) ); // menu = menuBar(); // menu->insertItem( i18n( "&File" ), filemenu); // global color scheme info KConfig *cfg = KGlobal::config(); cfg->setGroup( "General" ); alternateBackground = cfg->readColorEntry( "alternateBackground" ); // desktop info dwidth = KApplication::desktop()->width(); dheight = KApplication::desktop()->height(); dratio = (float)dwidth / (float)dheight; desktops = KWin::numberOfDesktops(); // layout vbox = new QVBox(this); sv = new KScrollView(vbox); central = new QWidget(sv->viewport()); grid = new QGridLayout(central, 10, 1, 0, 5); vbox->setSpacing(5); sv->addChild(central); sv->setResizePolicy(QScrollView::AutoOneFit); count = 0; page = 0; // setup photo rows PhotoRow *row; for (int i = 0; i < 10; i++) { row = new PhotoRow( central, desktops ); row->hide(); row->setSpacing(5); if (i % 2 == 1) row->setPaletteBackgroundColor( alternateBackground ); grid->addWidget(row, i, 0); rows.append(row); } // button setup QHBox *box = new QHBox( vbox ); backButton = new KPushButton( "Back", box ); goButton = new KPushButton( "Go!", box ); nextButton = new KPushButton( "Next", box ); connect(backButton, SIGNAL(clicked()), this, SLOT(back())); connect(goButton, SIGNAL(clicked()), this, SLOT(go())); connect(nextButton, SIGNAL(clicked()), this, SLOT(next())); backButton->setEnabled(false); setCentralWidget(vbox); grabPhotos(); }
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(850, 550); setWindowTitle(tr("Zimstake") + " - " + tr("Wallet")); #ifndef Q_OS_MAC qApp->setWindowIcon(QIcon(":icons/zimstake")); setWindowIcon(QIcon(":icons/zimstake")); #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(); blockExplorer = new BlockExplorer(this); chatWindow = new ChatWindow(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(blockExplorer); centralWidget->addWidget(chatWindow); centralWidget->addWidget(transactionsPage); centralWidget->addWidget(addressBookPage); centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); 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(); labelStakingIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelStakingIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); if (GetBoolArg("-staking", true)) { QTimer *timerStakingIcon = new QTimer(labelStakingIcon); connect(timerStakingIcon, SIGNAL(timeout()), this, SLOT(updateStakingIcon())); timerStakingIcon->start(30 * 1000); updateStakingIcon(); } // 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") { //statusBar()->setObjectName("QProgressBar"); } 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(); }
BitcoinGUI::BitcoinGUI(const NetworkStyle &networkStyle, QWidget *parent) : QMainWindow(parent), clientModel(0), walletFrame(0), unitDisplayControl(0), labelEncryptionIcon(0), labelConnectionsIcon(0), labelBlocksIcon(0), progressBarLabel(0), progressBar(0), progressDialog(0), appMenuBar(0), overviewAction(0), historyAction(0), quitAction(0), sendCoinsAction(0), sendCoinsMenuAction(0), usedSendingAddressesAction(0), usedReceivingAddressesAction(0), signMessageAction(0), verifyMessageAction(0), aboutAction(0), receiveCoinsAction(0), receiveCoinsMenuAction(0), optionsAction(0), toggleHideAction(0), encryptWalletAction(0), backupWalletAction(0), changePassphraseAction(0), aboutQtAction(0), openRPCConsoleAction(0), openAction(0), showHelpMessageAction(0), trayIcon(0), trayIconMenu(0), notificator(0), rpcConsole(0), infoQueue(this), prevBlocks(0), spinnerFrame(0) { GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this); QString windowTitle = tr("Bitcoin XT") + " - "; #ifdef ENABLE_WALLET /* if compiled with wallet support, -disablewallet can still disable the wallet */ enableWallet = !GetBoolArg("-disablewallet", false); #else enableWallet = false; #endif // ENABLE_WALLET if(enableWallet) { windowTitle += tr("Wallet"); } else { windowTitle += tr("Node"); } windowTitle += " " + networkStyle.getTitleAddText(); #ifndef Q_OS_MAC QApplication::setWindowIcon(networkStyle.getTrayAndWindowIcon()); setWindowIcon(networkStyle.getTrayAndWindowIcon()); #else // TODO we convert a QImage to a pixmap, to an icon and in the MacDockIconHandler we // do it in the opposite directoin just go arrive at a QImage again. // A mac hacker should fix that so we just pass a QImage (networkStyle::getAppIcon()). MacDockIconHandler::instance()->setIcon(networkStyle.getTrayAndWindowIcon()); #endif setWindowTitle(windowTitle); #if defined(Q_OS_MAC) && QT_VERSION < 0x050000 // This property is not implemented in Qt 5. Setting it has no effect. // A replacement API (QtMacUnifiedToolBar) is available in QtMacExtras. setUnifiedTitleAndToolBarOnMac(true); #endif rpcConsole = new RPCConsole(0); #ifdef ENABLE_WALLET if(enableWallet) { /** Create wallet frame and make it the central widget */ walletFrame = new WalletFrame(this); setCentralWidget(walletFrame); } else #endif // ENABLE_WALLET { /* When compiled without wallet or -disablewallet is provided, * the central widget is the rpc console. */ setCentralWidget(rpcConsole); } // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon // Needs walletFrame to be initialized createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create system tray icon and notification createTrayIcon(networkStyle); // Create status bar statusBar(); // Disable size grip because it looks ugly and nobody needs it statusBar()->setSizeGripEnabled(false); // 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); unitDisplayControl = new UnitDisplayStatusBarControl(); labelEncryptionIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); if(enableWallet) { frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(unitDisplayControl); 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 GUIUtil::ProgressBar(); 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 = QApplication::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); // prevents an open debug window from becoming stuck/unusable on client shutdown connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide())); // ditto for the notification dialog connect(quitAction, SIGNAL(triggered()), &infoQueue, SLOT(hideDialog())); // Install event filter to be able to catch status tip events (QEvent::StatusTip) this->installEventFilter(this); // Initially wallet actions should be disabled setWalletActionsEnabled(false); // Subscribe to notifications from core subscribeToCoreSignals(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), quitDialog(0), saveChanges(false), newJobFileName(""), newJobDestinationDirectory("") { m_has_error_happend = false; QMetaObject::invokeMethod(this, "loadSettings", Qt::QueuedConnection); setWindowIcon(QIcon(":/ui/icons/motocool.jpg")); // Initiallize headers QStringList headers; headers << tr("Name") << tr("Downloaded/Total") << tr("Progress") << tr("Speed") << tr("Status") << tr("Remaining time"); // Main job list jobView = new JobView(this); jobView->setHeaderLabels(headers); jobView->setSelectionBehavior(QAbstractItemView::SelectRows); jobView->setAlternatingRowColors(true); jobView->setRootIsDecorated(false); setCentralWidget(jobView); // Set header resize modes and initial section sizes QFontMetrics fm = fontMetrics(); QHeaderView *header = jobView->header(); header->resizeSection(0, fm.width("typical-name-length-for-a-download-task")); header->resizeSection(1, fm.width(headers.at(1) + "100MB/999MB")); header->resizeSection(2, fm.width(headers.at(2) + "100%")); header->resizeSection(3, qMax(fm.width(headers.at(3) + " "), fm.width(" 1023.0 KB/s"))); header->resizeSection(4, qMax(fm.width(headers.at(4) + " "), fm.width(tr("Downloading ") + " "))); header->resizeSection(5, qMax(fm.width(headers.at(5) + " "), fm.width(tr("--:--") + " "))); // Create common actions QAction *newJobAction = new QAction(QIcon(":/ui/icons/bottom.png"), tr("Add &new job"), this); pauseJobAction = new QAction(QIcon(":/ui/icons/player_pause.png"), tr("&Pause job"), this); removeJobAction = new QAction(QIcon(":/ui/icons/player_stop.png"), tr("&Remove job"), this); openDirAction = new QAction(QIcon(":/ui/icons/folder.png"), tr("Open file &directory"), this); // File menu QMenu *fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(newJobAction); fileMenu->addAction(pauseJobAction); fileMenu->addAction(removeJobAction); fileMenu->addAction(openDirAction); fileMenu->addSeparator(); fileMenu->addAction(QIcon(":/ui/icons/exit.png"), tr("E&xit"), this, SLOT(close())); // Help Menu QMenu *helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(tr("&About"), this, SLOT(about())); // Top toolbar QToolBar *topBar = new QToolBar(tr("Tools")); addToolBar(Qt::TopToolBarArea, topBar); topBar->setMovable(false); topBar->addAction(newJobAction); topBar->addAction(pauseJobAction); topBar->addAction(removeJobAction); topBar->addAction(openDirAction); pauseJobAction->setEnabled(false); removeJobAction->setEnabled(false); openDirAction->setEnabled(false); // Set up connections connect(jobView, SIGNAL(itemSelectionChanged()), this, SLOT(setActionsEnabled())); connect(newJobAction, SIGNAL(triggered()), this, SLOT(addJob())); connect(pauseJobAction, SIGNAL(triggered()), this, SLOT(pauseJob())); connect(removeJobAction, SIGNAL(triggered()), this, SLOT(removeJob())); connect(openDirAction, SIGNAL(triggered()), this, SLOT(openDir())); }
void MainWindow::creaClassifica(){ exportAct->setEnabled(false); resetPartitaAct->setEnabled(false); closePartitaAct->setEnabled(false); classificaWidget = new QWidget(this); QFont font; font.setBold(true); font.setPointSize(16); QLabel* header[8]; header[0] = new QLabel("N°", classificaWidget); header[1] = new QLabel(tr("Nome"), classificaWidget); header[2] = new QLabel(tr("Punti"), classificaWidget); header[3] = new QLabel(tr("V"), classificaWidget); //Vittorie header[4] = new QLabel(tr("P"), classificaWidget); //Pareggi header[5] = new QLabel(tr("S"), classificaWidget); //Sconfitte header[6] = new QLabel(tr("Pen"), classificaWidget); //Penalità header[7] = new QLabel(tr("DR"), classificaWidget); //Differenza Reti squadre->sort(); QLabel* teamsLabel[squadre->size()][8]; for(unsigned int i=0; i<squadre->size(); ++i){ teamsLabel[i][0] = new QLabel(QString::number(i+1), classificaWidget); teamsLabel[i][1] = new QLabel(squadre->at(i)->getNome(), classificaWidget); teamsLabel[i][2] = new QLabel(QString::number(squadre->at(i)->getPunti()), classificaWidget); teamsLabel[i][3] = new QLabel(QString::number(squadre->at(i)->getVittorie()), classificaWidget); teamsLabel[i][4] = new QLabel(QString::number(squadre->at(i)->getPareggi()), classificaWidget); teamsLabel[i][5] = new QLabel(QString::number(squadre->at(i)->getSconfitte()), classificaWidget); teamsLabel[i][6] = new QLabel(QString::number(squadre->at(i)->getPenalita()), classificaWidget); teamsLabel[i][7] = new QLabel(QString::number(squadre->at(i)->getDifferenzaReti()), classificaWidget); } QGridLayout* classifica = new QGridLayout; for(int i=0; i<8; ++i){ header[i]->setFont(font); header[i]->setAlignment(Qt::AlignHCenter); classifica->addWidget(header[i], 1, i+1); } font.setBold(false); for(unsigned int i=0; i<squadre->size(); ++i){ for(int j=0; j<8; ++j){ teamsLabel[i][j]->setFont(font); teamsLabel[i][j]->setAlignment(Qt::AlignHCenter); classifica->addWidget(teamsLabel[i][j], i+2, j+1); } } QWidget* topFiller = new QWidget(classificaWidget); topFiller->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QWidget* bottomFiller = new QWidget(classificaWidget); bottomFiller->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); QHBoxLayout* classificaLayout = new QHBoxLayout; classificaLayout->addStretch(20); classificaLayout->addLayout(classifica); classificaLayout->addStretch(20); QVBoxLayout* layout = new QVBoxLayout; layout->addWidget(topFiller); layout->addLayout(classificaLayout); layout->addWidget(bottomFiller); classifica->setAlignment(layout, Qt::AlignHCenter); classificaWidget->setLayout(layout); setCentralWidget(classificaWidget); }
BitcoinGUI::BitcoinGUI(QWidget *parent): QMainWindow(parent), clientModel(0), walletModel(0), encryptWalletAction(0), changePassphraseAction(0), lockWalletToggleAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0) { resize(850, 550); this -> setWindowFlags ( this -> windowFlags () & ~ Qt :: WindowMaximizeButtonHint ); //disable Max window this -> setFixedSize(this->width(), this->height()); //diaable draw window setWindowTitle(tr("FundCoin") + " - " + 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); setObjectName("FundCoinWallet"); setStyleSheet("#FundCoinWallet { background-image: url(:/images/bgsplatter) repeat-xy; } QToolTip { color: #8b12d0; background-color: #7412D0; border:0px;} "); // 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(); 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); 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(); labelMintingIcon = new QLabel(); labelConnectionsIcon = new QLabel(); labelBlocksIcon = new QLabel(); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelEncryptionIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelMintingIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelConnectionsIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(labelBlocksIcon); frameBlocksLayout->addStretch(); labelEncryptionIcon->setObjectName("labelEncryptionIcon"); labelConnectionsIcon->setObjectName("labelConnectionsIcon"); labelBlocksIcon->setObjectName("labelBlocksIcon"); labelMintingIcon->setObjectName("labelMintingIcon"); labelEncryptionIcon->setStyleSheet("#labelEncryptionIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}"); labelConnectionsIcon->setStyleSheet("#labelConnectionsIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}"); labelBlocksIcon->setStyleSheet("#labelBlocksIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}"); labelMintingIcon->setStyleSheet("#labelMintingIcon QToolTip {color:#ffcc66;background-color:#333333;border:0px;}"); // Set minting pixmap labelMintingIcon->setPixmap(QIcon(":/icons/minting").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE)); labelMintingIcon->setEnabled(false); // Add timer to update minting icon QTimer *timerMintingIcon = new QTimer(labelMintingIcon); timerMintingIcon->start(MODEL_UPDATE_DELAY); connect(timerMintingIcon, SIGNAL(timeout()), this, SLOT(updateMintingIcon())); // Add timer to update minting weights QTimer *timerMintingWeights = new QTimer(labelMintingIcon); timerMintingWeights->start(30 * 1000); connect(timerMintingWeights, SIGNAL(timeout()), this, SLOT(updateMintingWeights())); // Set initial values for user and network weights nWeight, nNetworkWeight = 0; // 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); statusBar()->setObjectName("FundCoinStatusBar"); statusBar()->setStyleSheet("#FundCoinStatusBar { border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:0.5 #8b12d0, stop:1.0 #7412d0); border-top-width: 1px; border-top-style: inset; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:1.0 #7412d0); color: #aadda6; } QToolTip { color: #e1eee1; background-color: #0fc42c; border:0px;}"); //statusBar()->setStyleSheet("#FundCoinStatusBar { border-top-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #8b12d0, stop:0.5 #8b12d0, stop:1.0 #7412d0); border-top-width: 1px; border-top-style: inset; background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #主色, stop:1.0 #过度色); color: #8b12d0; } QToolTip { color: #8b12d0; background-color: #7412d0; border:0px;}"); syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this); // this->setStyleSheet("background-color: #8b12d0;"); // 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(); }
BitcoinGUI::BitcoinGUI(QWidget *parent) : QMainWindow(parent), clientModel(0), encryptWalletAction(0), changePassphraseAction(0), aboutQtAction(0), trayIcon(0), notificator(0), rpcConsole(0), prevBlocks(0) { restoreWindowGeometry(); setWindowTitle(tr("FuMPCoin") + " - " + tr("Wallet")); #ifndef Q_OS_MAC QApplication::setWindowIcon(QIcon(":icons/FuMPCoin")); setWindowIcon(QIcon(":icons/FuMPCoin")); #else setUnifiedTitleAndToolBarOnMac(true); QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif // Create wallet frame and make it the central widget walletFrame = new WalletFrame(this); setCentralWidget(walletFrame); // Accept D&D of URIs setAcceptDrops(true); // Create actions for the toolbar, menu bar and tray/dock icon // Needs walletFrame to be initialized createActions(); // Create application menu bar createMenuBar(); // Create the toolbars createToolBars(); // Create system tray icon and notification createTrayIcon(); // Create status bar statusBar(); // Status bar notification icons QFrame *frameBlocks = new QFrame(); frameBlocks->setContentsMargins(0,0,0,0); frameBlocks->setMinimumWidth(56); frameBlocks->setMaximumWidth(56); 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 = QApplication::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); rpcConsole = new RPCConsole(this); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); // Install event filter to be able to catch status tip events (QEvent::StatusTip) this->installEventFilter(this); // Initially wallet actions should be disabled setWalletActionsEnabled(false); }
MainWindow::MainWindow(QApplication* app) { m_modified = true; m_tmp_file = NULL; // load the splash screen SplashScreen splash(100); splash.show(); app->processEvents(); util::ErrorAdapter::instance().addListener(new QtErrorListerner()); initialize(); splash.updateProgress(5, "Creating UI – Menues"); createMenu(); splash.updateProgress(15, "Creating UI – Notification area"); app->processEvents(); createStatusBar(); splash.updateProgress(20, "Creating UI – Building interfaces"); app->processEvents(); m_toolBox = new ToolBox(); splash.updateProgress(50, "Loading materials"); m_toolBox->loadMaterials(QString::fromStdString(util::Config::instance().get<std::string>("materialsxml", "data/materials.xml"))); splash.updateProgress(60, "Loading sounds"); snd::SoundMgr::instance().LoadSound(util::Config::instance().get<std::string>("sounds", "data/sounds")); splash.updateProgress(70, "Loading music"); snd::SoundMgr::instance().LoadMusic(util::Config::instance().get<std::string>("music", "data/music")); snd::SoundMgr::instance().setMusicEnabled(util::Config::instance().get("enableMusic", false)); app->processEvents(); splash.updateProgress(80, "Creating UI – Apply screen resolution"); m_renderWidget = new RenderWidget(this); m_renderWidget->setMinimumWidth(400); m_renderWidget->show(); app->processEvents(); splash.updateProgress(85, "Creating UI – Building dependencies"); m_splitter = new QSplitter(Qt::Horizontal); m_splitter->insertWidget(0, m_toolBox); m_splitter->insertWidget(1, m_renderWidget); QList<int> sizes; sizes.append(200); sizes.append(1300); m_splitter->setSizes(sizes); m_splitter->setStretchFactor(0, 1); m_splitter->setStretchFactor(1, 1); m_splitter->setChildrenCollapsible(false); setCentralWidget(m_splitter); // connect the newly created widgets with specific slots connect(m_renderWidget, SIGNAL(framesPerSecondChanged(int)), this, SLOT(updateFramesPerSecond(int))); connect(m_renderWidget, SIGNAL(objectsCountChanged(int)), this, SLOT(updateObjectsCount(int))); connect(m_renderWidget, SIGNAL(objectSelected(sim::Object)), m_toolBox, SLOT(updateData(sim::Object))); connect(m_renderWidget, SIGNAL(objectSelected(sim::__Object::Type)), m_toolBox, SLOT(showModificationWidgets(sim::__Object::Type))); connect(m_renderWidget, SIGNAL(objectSelected()), m_toolBox, SLOT(deselectInteraction())); connect(m_renderWidget, SIGNAL(objectSelected()), m_toolBox, SLOT(hideModificationWidgets())); connect(m_toolBox, SIGNAL(interactionSelected(sim::Simulation::InteractionType)), this, SLOT(selectInteraction(sim::Simulation::InteractionType))); splash.updateProgress(90, "Finished loading"); showMaximized(); m_renderWidget->updateGL(); m_renderWidget->m_timer->start(); m_toolBox->updateMaterials(); splash.updateProgress(100, "Starting ..."); splash.finish(this); }