Esempio n. 1
0
void MainWindow::createStatusBar()
{

    statusBar()->showMessage(tr("Ready"));
}
/**
 * @brief creates the status bar for the main window
 */
void VirtnosisWindow::createStatusBar()
{
    statusMessage = new QLabel();
    statusBar()->addPermanentWidget(statusMessage);
}
Esempio n. 3
0
/*
 *  Constructs a voucher as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
voucher::voucher(QWidget* parent, const char* name, Qt::WFlags fl)
    : XMainWindow(parent, name, fl)
{
  setupUi(this);

  (void)statusBar();

  // signals and slots connections
  connect(_poList, SIGNAL(clicked()), this, SLOT(sPoList()));
  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_distributions, SIGNAL(clicked()), this, SLOT(sDistributions()));
  connect(_distributeline, SIGNAL(clicked()), this, SLOT(sDistributeLine()));
  connect(_clear, SIGNAL(clicked()), this, SLOT(sClear()));
  connect(_distributeall, SIGNAL(clicked()), this, SLOT(sDistributeAll()));
  connect(_voucherNumber, SIGNAL(lostFocus()), this, SLOT(sHandleVoucherNumber()));
  connect(_poNumber, SIGNAL(vendAddress1Changed(const QString&)), _vendAddress1, SLOT(setText(const QString&)));
  connect(_poNumber, SIGNAL(newId(int)), this, SLOT(sFillList()));
  connect(_poitem, SIGNAL(itemSelected(int)), _distributions, SLOT(animateClick()));
  connect(_poitem, SIGNAL(valid(bool)), _distributions, SLOT(setEnabled(bool)));
  connect(_amountToDistribute, SIGNAL(valueChanged()), this, SLOT(sPopulateBalanceDue()));
  connect(_miscDistrib, SIGNAL(valid(bool)), _delete, SLOT(setEnabled(bool)));
  connect(_new, SIGNAL(clicked()), this, SLOT(sNewMiscDistribution()));
  connect(_edit, SIGNAL(clicked()), this, SLOT(sEditMiscDistribution()));
  connect(_delete, SIGNAL(clicked()), this, SLOT(sDeleteMiscDistribution()));
  connect(_miscDistrib, SIGNAL(itemSelected(int)), _edit, SLOT(animateClick()));
  connect(_miscDistrib, SIGNAL(valid(bool)), _edit, SLOT(setEnabled(bool)));
  connect(_invoiceDate, SIGNAL(newDate(const QDate&)), this, SLOT(sPopulateDistDate()));
  connect(_poNumber, SIGNAL(vendAddress2Changed(const QString&)), _vendAddress2, SLOT(setText(const QString&)));
  connect(_invoiceDate, SIGNAL(newDate(const QDate&)), this, SLOT(sPopulateDueDate()));
  connect(_poNumber, SIGNAL(newId(int)), this, SLOT(sPopulatePoInfo()));
  connect(_poNumber, SIGNAL(vendNameChanged(const QString&)), _vendName, SLOT(setText(const QString&)));
  connect(_poitem, SIGNAL(populateMenu(QMenu*,QTreeWidgetItem*,int)), this, SLOT(sPopulateMenu(QMenu*)));
  connect(_amountToDistribute, SIGNAL(idChanged(int)), _amountDistributed, SLOT(setId(int)));
  connect(_amountToDistribute, SIGNAL(idChanged(int)), _balance, SLOT(setId(int)));
  connect(_amountToDistribute, SIGNAL(idChanged(int)), this, SLOT(sFillList()));
  connect(_distributionDate, SIGNAL(newDate(const QDate&)), _amountToDistribute, SLOT(setEffective(const QDate&)));
  connect(_amountToDistribute, SIGNAL(effectiveChanged(const QDate&)), _amountDistributed, SLOT(setEffective(const QDate&)));
  connect(_amountToDistribute, SIGNAL(effectiveChanged(const QDate&)), _balance, SLOT(setEffective(const QDate&)));
  connect(_amountDistributed, SIGNAL(valueChanged()), this, SLOT(sPopulateBalanceDue()));

  statusBar()->hide();

#ifndef Q_WS_MAC
  _poList->setMaximumWidth(25);
#endif

  _terms->setType(XComboBox::APTerms);
  _poNumber->setType(cPOOpen);

  _poitem->addColumn(tr("#"),            _whsColumn,   Qt::AlignCenter );
  _poitem->addColumn(tr("Status"),       _uomColumn,   Qt::AlignCenter );
  _poitem->addColumn(tr("Item Number"),  _itemColumn,  Qt::AlignLeft   );
  _poitem->addColumn(tr("UOM"),          _uomColumn,   Qt::AlignCenter );
  _poitem->addColumn(tr("Vend. Item #"), -1,           Qt::AlignLeft   );
  _poitem->addColumn(tr("UOM"),          _uomColumn,   Qt::AlignCenter );
  _poitem->addColumn(tr("Ordered"),      _qtyColumn,   Qt::AlignRight  );
  _poitem->addColumn(tr("Invoiced"),     _qtyColumn,   Qt::AlignRight, false );
  _poitem->addColumn(tr("Uninvoiced"),   _qtyColumn,   Qt::AlignRight  );
  _poitem->addColumn(tr("Rejected"),     _qtyColumn,   Qt::AlignRight  );
  _poitem->addColumn(tr("Amount"),       _moneyColumn, Qt::AlignRight  );
  _poitem->addColumn(tr("PO Unit Price"), _moneyColumn, Qt::AlignRight );
  _poitem->addColumn(tr("PO Ext Price"), _moneyColumn, Qt::AlignRight  );
  _poitem->addColumn(tr("PO Line Freight"), _moneyColumn, Qt::AlignRight );

  _miscDistrib->addColumn(tr("Account"), -1,           Qt::AlignLeft  );
  _miscDistrib->addColumn(tr("Amount"),  _moneyColumn, Qt::AlignRight ); 
}
Esempio n. 4
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("Zugzwang") + " - " + 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();
}
Esempio n. 5
0
void MainWindow::openFile()
{
    // If the current model has been modified, warn the user before opening the new file
    QMessageBox::StandardButton proceed = QMessageBox::Ok;
    if (modelLoaded)
        if (model->wasModified())
            proceed = QMessageBox::question(this, tr("Network Editor for SUMO"), tr("Model has been modified and not saved. Continue opening a new file?"),
                                            QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Cancel);
    if (proceed == QMessageBox::Ok)
    {
        // Get file name from File Dialog
        QString filePath = QFileDialog::getOpenFileName(this, tr("Open SUMO Network file"),
            xmlPath, tr("XML Network files (*.net.xml)"));
        QCoreApplication::processEvents();

        // Open file
        if (!filePath.isEmpty())
        {
            QFile file(filePath);
            if (file.open(QIODevice::ReadOnly))
            {
                // Start counting opening time
                QTime t;
                t.start();

                // Create the model, parsing XML data first
                statusBar()->showMessage(tr("Loading XML file..."));
                Model *newModel = new Model(&file, this);

                // If the file has valid XML data, continue loading the model
                if (newModel->xmlDataParsed())
                {
                    // Delete the old model and connect the new one
                    if (modelLoaded) delete model;
                    connect(newModel, SIGNAL(statusUpdate(QString)), statusBar(), SLOT(showMessage(QString)));

                    // Create the item selection model so that it is passed onto the
                    // individual graphic elements as they are created
                    treeSelections = new QItemSelectionModel(newModel);
                    newModel->setSelectionModel(treeSelections);

                    // Interpret XML tree and create the traffic network elements
                    newModel->loadModel();

                    // Connect model with tree view
                    tView->setModel(newModel);
                    tView->setSelectionModel(treeSelections);
                    tView->resizeColumnToContents(0);
                    tView->resizeColumnToContents(1);

                    // Connect model with network view
                    nView->setScene(newModel->netScene);
                    nView->setSelectionModel(treeSelections);
                    nView->zoomExtents();
                    nView->setRenderHint(QPainter::Antialiasing, true);

                    // Connect model with controls and properties view
                    controls->reset();
                    controls->model = newModel;
                    pView->model = newModel;
                    eView->model = newModel;
                    controlWidget->show();
                    propsWidget->show();
                    editWidget->show();

                    // Replace old model by new model
                    model = newModel;
                    modelLoaded = true;
                    xmlPath = filePath;

                    // Update window title
                    QFileInfo fileInfo(file.fileName());
                    QString filename(fileInfo.fileName());
                    setWindowTitle(filename + tr(" - Network Editor for SUMO"));

                    // Connect signals and slots between all views
                    connect(tView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(showItem(QModelIndex)));
                    connect(nView, SIGNAL(updateStatusBar(QString)), statusBar(), SLOT(showMessage(QString)));
                    connect(treeSelections, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), model, SLOT(selectionChanged(QItemSelection, QItemSelection)));
                    connect(treeSelections, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), pView, SLOT(selectionChanged(QItemSelection, QItemSelection)));
                    connect(treeSelections, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), eView, SLOT(selectionChanged(QItemSelection, QItemSelection)));
                    connect(treeSelections, SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(scrollTo(QItemSelection, QItemSelection)));
                    connect(model, SIGNAL(attrUpdate(QItemSelection, QItemSelection)), pView, SLOT(selectionChanged(QItemSelection, QItemSelection)));
                    connect(model, SIGNAL(attrUpdate(QItemSelection, QItemSelection)), eView, SLOT(selectionChanged(QItemSelection, QItemSelection)));
                    statusBar()->showMessage(tr("Ready. Model loaded in %1ms.").arg(t.elapsed()));
                }
                else
                {
                    // The XML data in the file was not valid, so do not load the model
                    delete newModel;
                    QMessageBox::warning(this, tr("Network Editor for SUMO"), tr("Error parsing XML data."));
                }
                // Close file
                file.close();
            }
        }
    }
}
Esempio n. 6
0
// --------------------------------------------------------------
void QucsApp::slotAddToProject()
{
  slotHideEdit(); // disable text edit of component property

  if(ProjName.isEmpty()) {
    QMessageBox::critical(this, tr("Error"), tr("No project open!"));
    return;
  }


  QStringList List = QFileDialog::getOpenFileNames(this, tr("Select files to copy"),
    lastDir.isEmpty() ? QString(".") : lastDir, QucsFileFilter);

  if(List.isEmpty()) {
    statusBar()->showMessage(tr("No files copied."), 2000);
    return;
  }


  char *Buffer = (char*)malloc(0x10000);
  if(!Buffer) return;  // should never happen

  QStringList FileList = List;  // make a copy as recommended by Qt
  QStringList::Iterator it = FileList.begin();
  QFileInfo Info(*it);
  lastDir = Info.absolutePath();  // remember last directory

  // copy all files to project directory
  int Num;
  QFile origFile, destFile;
  while(it != FileList.end()) {
    Info.setFile(*it);
    origFile.setFileName(*it);
    destFile.setFileName(QucsSettings.QucsWorkDir.absolutePath() +
                     QDir::separator() + Info.fileName());

    if(!origFile.open(QIODevice::ReadOnly)) {
      QMessageBox::critical(this, tr("Error"), tr("Cannot open \"%1\" !").arg(*it));
      it++;
      continue;
    }

    if(destFile.exists())
      if(QMessageBox::information(this, tr("Overwrite"),
           tr("File \"%1\" already exists.\nOverwrite ?").arg(*it), QMessageBox::Yes,
           QMessageBox::No|QMessageBox::Default|QMessageBox::Escape)
         != QMessageBox::Yes) {
        origFile.close();
        it++;
        continue;
      }

    if(!destFile.open(QIODevice::WriteOnly)) {
      QMessageBox::critical(this, tr("Error"), tr("Cannot create \"%1\" !").arg(*it));
      origFile.close();
      it++;
      continue;
    }

    // copy data
    do {
      Num = origFile.read(Buffer, 0x10000);
      if(Num < 0) {
        QMessageBox::critical(this, tr("Error"), tr("Cannot read \"%1\" !").arg(*it));
        break;
      }
      Num = destFile.write(Buffer, Num);
      if(Num < 0) {
        QMessageBox::critical(this, tr("Error"), tr("Cannot write \"%1\" !").arg(*it));
        break;
      }
    } while(Num == 0x10000);

    origFile.close();
    destFile.close();
    it++;
  }

  free(Buffer);
  statusBar()->showMessage(tr("Ready."));
}
Esempio n. 7
0
void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
{
    // Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbelled text)
    statusBar()->clearMessage();

    // Acquire current block source
    enum BlockSource blockSource = clientModel->getBlockSource();
    switch (blockSource) {
        case BLOCK_SOURCE_NETWORK:
            progressBarLabel->setText(tr("Synchronizing with network..."));
            break;
        case BLOCK_SOURCE_DISK:
            progressBarLabel->setText(tr("Importing blocks from disk..."));
            break;
        case BLOCK_SOURCE_REINDEX:
            progressBarLabel->setText(tr("Reindexing blocks on disk..."));
            break;
        case BLOCK_SOURCE_NONE:
            // Case: not Importing, not Reindexing and no network connection
            progressBarLabel->setText(tr("No block source available..."));
            break;
    }

    QString tooltip;

    QDateTime lastBlockDate = clientModel->getLastBlockDate();
    QDateTime currentDate = QDateTime::currentDateTime();
    int secs = lastBlockDate.secsTo(currentDate);

    if(count < nTotalBlocks)
    {
        tooltip = tr("Processed %1 of %2 (estimated) blocks of transaction history.").arg(count).arg(nTotalBlocks);
    }
    else
    {
        tooltip = tr("Processed %1 blocks of transaction history.").arg(count);
    }

    // Set icon state: spinning if catching up, tick otherwise
    if(secs < 90*60 && count >= nTotalBlocks)
    {
        tooltip = tr("Up to date") + QString(".<br>") + tooltip;
        labelBlocksIcon->setPixmap(QIcon(":/icons/synced").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));

        walletFrame->showOutOfSyncWarning(false);

        progressBarLabel->setVisible(false);
        progressBar->setVisible(false);
    }
    else
    {
        // Represent time from last generated block in human readable text
        QString timeBehindText;
        if(secs < 48*60*60)
        {
            timeBehindText = tr("%n hour(s)","",secs/(60*60));
        }
        else if(secs < 14*24*60*60)
        {
            timeBehindText = tr("%n day(s)","",secs/(24*60*60));
        }
        else
        {
            timeBehindText = tr("%n week(s)","",secs/(7*24*60*60));
        }

        progressBarLabel->setVisible(true);
        progressBar->setFormat(tr("%1 behind").arg(timeBehindText));
        progressBar->setMaximum(1000000000);
        progressBar->setValue(clientModel->getVerificationProgress() * 1000000000.0 + 0.5);
        progressBar->setVisible(true);

        tooltip = tr("Catching up...") + QString("<br>") + tooltip;
        labelBlocksIcon->setMovie(syncIconMovie);
        if(count != prevBlocks)
            syncIconMovie->jumpToNextFrame();
        prevBlocks = count;

        walletFrame->showOutOfSyncWarning(true);

        tooltip += QString("<br>");
        tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
        tooltip += QString("<br>");
        tooltip += tr("Transactions after this will not yet be visible.");
    }

    // Don't word-wrap this (fixed-width) tooltip
    tooltip = QString("<nobr>") + tooltip + QString("</nobr>");

    labelBlocksIcon->setToolTip(tooltip);
    progressBarLabel->setToolTip(tooltip);
    progressBar->setToolTip(tooltip);
}
Esempio n. 8
0
void MainWindow::displayCopy(unsigned char rowNum, unsigned int lineNum)
{
    copyLine = *(lcd->getData()->getLine(rowNum,lineNum));
    copyFlag = true;
    statusBar()->showMessage("Строка скопирована в буфер обмена",2000);
}
Esempio n. 9
0
KJezzball::KJezzball()
    : m_gameWidget( 0 )
{
    // setup variables
    m_game.level = 1;
    m_game.score = 0;
    m_state = Idle;

    KConfig *config = kapp->config();
    m_backgroundDir = config->readPathEntry( "BackgroundDir" );
    m_showBackground = config->readBoolEntry( "ShowBackground", false );

    statusBar();
    initXMLUI();

    m_soundAction -> setChecked((config->readBoolEntry( "PlaySounds", true )));

    // create widgets
    m_view = new QWidget( this, "m_view" );
    setCentralWidget( m_view );

    m_layout = new QGridLayout( m_view, 1, 3 );
    m_layout->setColStretch( 2, 1 );

    QVBoxLayout *infoLayout = new QVBoxLayout;
    m_layout->addLayout( infoLayout, 0, 1 );

    QLabel *label = new QLabel( i18n("Level:"), m_view );
    infoLayout->addWidget( label );
    m_levelLCD = new QLCDNumber( 5, m_view );
    infoLayout->addWidget( m_levelLCD );

    label = new QLabel( i18n("Score:"), m_view );
    infoLayout->addWidget( label );
    m_scoreLCD = new QLCDNumber( 5, m_view );
    infoLayout->addWidget( m_scoreLCD );

    infoLayout->addSpacing( 20 );

    label = new QLabel( i18n("Filled area:"), m_view );
    infoLayout->addWidget( label );
    m_percentLCD  = new QLCDNumber( 5, m_view );
    infoLayout->addWidget( m_percentLCD );

    label = new QLabel( i18n("Lives:"), m_view );
    infoLayout->addWidget( label );
    m_lifesLCD  = new QLCDNumber( 5, m_view );
    infoLayout->addWidget( m_lifesLCD );

    label = new QLabel( i18n("Time:"), m_view );
    infoLayout->addWidget( label );
    m_timeLCD  = new QLCDNumber( 5, m_view );
    infoLayout->addWidget( m_timeLCD );

    // create timers
    m_nextLevelTimer = new QTimer( this, "m_nextLevelTimer" );
    connect( m_nextLevelTimer, SIGNAL(timeout()), this, SLOT(switchLevel()) );

    m_gameOverTimer = new QTimer( this, "m_gameOverTimer" );
    connect( m_gameOverTimer, SIGNAL(timeout()), this, SLOT(gameOverNow()) );

    m_timer = new QTimer( this, "m_timer" );
    connect( m_timer, SIGNAL(timeout()), this, SLOT(second()) );

    // create demo game
    createLevel( 1 );
    statusBar()->message( i18n("Press %1 to start a game!")
                          .arg(m_newAction->shortcut().toString()) );
    //m_gameWidget->display( i18n("Press <Space> to start a game!") );

    setFocusPolicy(QWidget::StrongFocus);
    setFocus();
    setupGUI();
}
Esempio n. 10
0
Void PlaYUVerApp::createStatusBar()
{
  //! Warning: the following widget cannot change size too much
  statusBar()->addPermanentWidget( m_appModuleVideo->createStatusBarMessage() );
  printMessage( "Ready!", LOG_INFO );
}
Esempio n. 11
0
void MainWin::OnStatusMessage(QString message)
{
    statusBar()->showMessage(message);
}
Esempio n. 12
0
BTS_Sales::BTS_Sales(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	//BTS_Sales::inst = this;
	//temp = this;
	
	zbarPreview = new zbar::QZBar;
	zbarPreview->setObjectName(QString::fromUtf8("zbar"));
	QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	sizePolicy.setHorizontalStretch(0);
	sizePolicy.setVerticalStretch(0);
	sizePolicy.setHeightForWidth(zbarPreview->sizePolicy().hasHeightForWidth());
	zbarPreview->setSizePolicy(sizePolicy);
	zbarPreview->setMinimumSize(QSize(320, 240));
	zbarPreview->setMaximumSize(QSize(640, 480));

	ui.verticalLayout_3->insertWidget(0, zbarPreview);
	
//	connect(zbarPreview, SIGNAL(decoded(int type, const QString&)),
//		this, SLOT(on_zbarPreview_decoded(int type, const QString&)));

	connect(zbarPreview, SIGNAL(decodedText(const QString&)),
		this, SLOT(on_zbarPreview_decodedText(const QString&)));
	
	connect(zbarPreview, SIGNAL(videoOpened(bool)),
		this, SLOT(on_zbarPreview_videoOpened(bool)));

	//ui.ticketID->append("sdfsdf");
	
	QStringList headerTitles;
	headerTitles << "Ticket #" << "Student Name" << "Time";
	ui.recentTicketsList->setHeaderLabels(headerTitles);
	
	
	//ui.recentTicketsList->addColumn("Ticket #");
	//ui.recentTicketsList->addColumn("Student #");
	//ui.recentTicketsList->addColumn("Name");

	loginStatusIcon = new QLabel(statusBar());
	loginStatusIcon->setObjectName(QString::fromUtf8("loginStatusIcon"));
	loginStatusIcon->setMinimumSize(QSize(16, 16));
	loginStatusIcon->setPixmap(QPixmap(QString::fromUtf8(":/BTS_Sales/rsrc/disconnect.png")));

	ui.statusBar->addWidget(loginStatusIcon);

	QFont font1;
	loginStatusText = new QLabel(statusBar());
	loginStatusText->setObjectName(QString::fromUtf8("loginStatusText"));
	font1.setPointSize(8);
	loginStatusText->setFont(font1);
	loginStatusText->setText(tr("Not connected. Please log in."));
	ui.statusBar->addWidget(loginStatusText);
	loginStatusText->setLineWidth(3);
	
	ui.ticketID->setText("");
	ui.studentID->setText("");
	ui.firstName->setText("");
	ui.lastName->setText("");
	ui.barcodeStatusLabel->setText("Please log in.");
	ui.barcodeStatusLabel->setStyleSheet(GUI_STATUS_COLOR_RED);
	ui.ticketNum->setText("");
	ui.ticketStatus->setText("");

	//console_open();
	config_load();

	
	//map["testparam"] = "sdfsdf";
	//map["asdf"] = "zzz";

	//signature_make("GET", "bts.example.com", "/api/access/login/", map, 
	//	"60026e856a7c93c1b459091a13e99db52315c6c97f5ecd1d3410c9f18ebccbb9");
}
Esempio n. 13
0
BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
    QMainWindow(parent),
    clientModel(0),
    walletFrame(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0),
    prevBlocks(0),
    spinnerFrame(0)
{
    GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);

    QString windowTitle = tr("Horuscoin Core") + " - ";
#ifdef ENABLE_WALLET
    /* if compiled with wallet support, -disablewallet can still disable the wallet */
    bool enableWallet = !GetBoolArg("-disablewallet", false);
#else
    bool enableWallet = false;
#endif
    if(enableWallet)
    {
        windowTitle += tr("Wallet");
    } else {
        windowTitle += tr("Node");
    }

    if (!fIsTestnet)
    {
#ifndef Q_OS_MAC
        QApplication::setWindowIcon(QIcon(":icons/bitcoin"));
        setWindowIcon(QIcon(":icons/bitcoin"));
#else
        MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin"));
#endif
    }
    else
    {
        windowTitle += " " + tr("[testnet]");
#ifndef Q_OS_MAC
        QApplication::setWindowIcon(QIcon(":icons/bitcoin_testnet"));
        setWindowIcon(QIcon(":icons/bitcoin_testnet"));
#else
        MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet"));
#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(enableWallet ? this : 0);
#ifdef ENABLE_WALLET
    if(enableWallet)
    {
        /** Create wallet frame and make it the central widget */
        walletFrame = new WalletFrame(this);
        setCentralWidget(walletFrame);
    } else
#endif
    {
        /* 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(fIsTestnet);

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create system tray icon and notification
    createTrayIcon(fIsTestnet);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = 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);

    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // prevents an oben debug window from becoming stuck/unusable on client shutdown
    connect(quitAction, SIGNAL(triggered()), rpcConsole, SLOT(hide()));

    // 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();
}
Esempio n. 14
0
void ndManager::initStatusBar()
{
    statusBar()->showMessage(tr("Ready."));
}
Esempio n. 15
0
ApplicationWindow::ApplicationWindow()
    : QMainWindow( 0, "example application main window", WDestructiveClose )
{
    int id;

    printer = new QPrinter;
    QPixmap openIcon, saveIcon, printIcon;

    fileTools = new QToolBar( this, "file operations" );
    fileTools->setLabel( tr( "File Operations" ) );

    openIcon = QPixmap( fileopen );
    QToolButton * fileOpen
	= new QToolButton( openIcon, "Open File", QString::null,
			   this, SLOT(load()), fileTools, "open file" );

    saveIcon = QPixmap( filesave );
    QToolButton * fileSave
	= new QToolButton( saveIcon, "Save File", QString::null,
			   this, SLOT(save()), fileTools, "save file" );

    printIcon = QPixmap( fileprint );
    QToolButton * filePrint
	= new QToolButton( printIcon, "Print File", QString::null,
			   this, SLOT(print()), fileTools, "print file" );

    (void)QWhatsThis::whatsThisButton( fileTools );

    QWhatsThis::add( fileOpen, fileOpenText );
    QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );
    QWhatsThis::add( fileSave, fileSaveText );
    QWhatsThis::add( filePrint, filePrintText );

    QPopupMenu * file = new QPopupMenu( this );
    menuBar()->insertItem( "&File", file );

    file->insertItem( "&New", this, SLOT(newDoc()), CTRL+Key_N );

    id = file->insertItem( openIcon, "&Open",
			   this, SLOT(load()), CTRL+Key_O );
    file->setWhatsThis( id, fileOpenText );

    id = file->insertItem( saveIcon, "&Save",
			   this, SLOT(save()), CTRL+Key_S );
    file->setWhatsThis( id, fileSaveText );
    id = file->insertItem( "Save &as...", this, SLOT(saveAs()) );
    file->setWhatsThis( id, fileSaveText );
    file->insertSeparator();
    id = file->insertItem( printIcon, "&Print",
			   this, SLOT(print()), CTRL+Key_P );
    file->setWhatsThis( id, filePrintText );
    file->insertSeparator();
    file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_W );
    file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

    QPopupMenu * help = new QPopupMenu( this );
    menuBar()->insertSeparator();
    menuBar()->insertItem( "&Help", help );

    help->insertItem( "&About", this, SLOT(about()), Key_F1 );
    help->insertItem( "About &Qt", this, SLOT(aboutQt()) );
    help->insertSeparator();
    help->insertItem( "What's &This", this, SLOT(whatsThis()), SHIFT+Key_F1 );

    e = new QMultiLineEdit( this, "editor" );
    e->setFocus();
    setCentralWidget( e );
    statusBar()->message( "Ready", 2000 );
    resize( 450, 600 );
}
Esempio n. 16
0
SqlEditor::SqlEditor(LiteManWindow * parent)
	: QMainWindow(parent),
   	  m_fileWatcher(0)
{
	creator = parent;
	ui.setupUi(this);

#ifdef Q_WS_MAC
    ui.toolBar->setIconSize(QSize(16, 16));
#endif


	m_fileName = QString();

	//m_fileWatcher = new QFileSystemWatcher(this);

	ui.sqlTextEdit->prefsChanged();
    // addon run sql shortcut

	changedLabel = new QLabel(this);
	cursorTemplate = tr("Col: %1 Line: %2/%3");
	cursorLabel = new QLabel(this);
	statusBar()->addPermanentWidget(changedLabel);
	statusBar()->addPermanentWidget(cursorLabel);
	sqlTextEdit_cursorPositionChanged(1, 1);

	toSQLParse::settings cur;
	cur.ExpandSpaces = false;
	cur.CommaBefore = false;
	cur.BlockOpenLine = false;
	cur.OperatorSpace = false;
	cur.KeywordUpper = false;
	cur.RightSeparator = false;
	cur.EndBlockNewline = false;
	cur.IndentLevel = true;
	cur.CommentColumn = false;
	toSQLParse::setSetting(cur);

	ui.searchFrame->hide();

	ui.previousToolButton->setIcon(Utils::getIcon("go-previous.png"));
	ui.nextToolButton->setIcon(Utils::getIcon("go-next.png"));
	ui.action_Run_SQL->setIcon(Utils::getIcon("runsql.png"));
	ui.actionRun_Explain->setIcon(Utils::getIcon("runexplain.png"));
	ui.actionRun_as_Script->setIcon(Utils::getIcon("runscript.png"));
	ui.action_Open->setIcon(Utils::getIcon("document-open.png"));
	ui.action_Save->setIcon(Utils::getIcon("document-save.png"));
	ui.action_New->setIcon(Utils::getIcon("document-new.png"));
	ui.actionSave_As->setIcon(Utils::getIcon("document-save-as.png"));
	ui.actionCreateView->setIcon(Utils::getIcon("view.png"));
	ui.actionSearch->setIcon(Utils::getIcon("system-search.png"));

    QShortcut * alternativeSQLRun = new QShortcut(this);
    alternativeSQLRun->setKey(Qt::CTRL + Qt::Key_Return);

	QSettings settings("yarpen.cz", "sqliteman");
	restoreState(settings.value("sqleditor/state").toByteArray());

    connect(ui.actionShow_History, SIGNAL(triggered()),
            this, SLOT(actionShow_History_triggered()));
    actionShow_History_triggered();

	connect(ui.action_Run_SQL, SIGNAL(triggered()),
			this, SLOT(action_Run_SQL_triggered()));
    // alternative run action for Ctrl+Enter
    connect(alternativeSQLRun, SIGNAL(activated()),
            this, SLOT(action_Run_SQL_triggered()));
	connect(ui.actionRun_Explain, SIGNAL(triggered()),
			this, SLOT(actionRun_Explain_triggered()));
	connect(ui.actionRun_as_Script, SIGNAL(triggered()),
			this, SLOT(actionRun_as_Script_triggered()));
	connect(ui.action_Open, SIGNAL(triggered()),
			this, SLOT(action_Open_triggered()));
	connect(ui.action_Save, SIGNAL(triggered()),
			this, SLOT(action_Save_triggered()));
	connect(ui.action_New, SIGNAL(triggered()),
			this, SLOT(action_New_triggered()));
	connect(ui.actionSave_As, SIGNAL(triggered()),
			this, SLOT(actionSave_As_triggered()));
	connect(ui.actionCreateView, SIGNAL(triggered()),
			this, SLOT(actionCreateView_triggered()));
	connect(ui.sqlTextEdit, SIGNAL(cursorPositionChanged(int,int)),
			this, SLOT(sqlTextEdit_cursorPositionChanged(int,int)));
	connect(ui.sqlTextEdit, SIGNAL(modificationChanged(bool)),
			this, SLOT(documentChanged(bool)));
	connect(parent, SIGNAL(prefsChanged()),
			ui.sqlTextEdit, SLOT(prefsChanged()));

	// search
	connect(ui.actionSearch, SIGNAL(triggered()), this, SLOT(actionSearch_triggered()));
	connect(ui.searchEdit, SIGNAL(textChanged(const QString &)),
			this, SLOT(searchEdit_textChanged(const QString &)));
	connect(ui.previousToolButton, SIGNAL(clicked()), this, SLOT(findPrevious()));
	connect(ui.nextToolButton, SIGNAL(clicked()), this, SLOT(findNext()));
	connect(ui.searchEdit, SIGNAL(returnPressed()), this, SLOT(findNext()));
}
Esempio n. 17
0
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("Aero") + " - " + 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->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")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 18
0
MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent)
    : QMainWindow(parent)
    , m_bookmarkWidget(0)
    , m_filterCombo(0)
    , m_toolBarMenu(0)
    , m_cmdLine(cmdLine)
    , m_progressWidget(0)
    , m_qtDocInstaller(0)
    , m_connectedInitSignals(false)
{
    TRACE_OBJ

    setToolButtonStyle(Qt::ToolButtonFollowStyle);
    setDockOptions(dockOptions() | AllowNestedDocks);

    QString collectionFile;
    if (usesDefaultCollection()) {
        MainWindow::collectionFileDirectory(true);
        collectionFile = MainWindow::defaultHelpCollectionFileName();
    } else {
        collectionFile = cmdLine->collectionFile();
    }
    HelpEngineWrapper &helpEngineWrapper =
        HelpEngineWrapper::instance(collectionFile);
    BookmarkManager *bookMarkManager = BookmarkManager::instance();

    if (!initHelpDB(!cmdLine->collectionFileGiven())) {
        qDebug("Fatal error: Help engine initialization failed. "
            "Error message was: %s\nAssistant will now exit.",
            qPrintable(HelpEngineWrapper::instance().error()));
        std::exit(1);
    }

    m_centralWidget = new CentralWidget(this);
    setCentralWidget(m_centralWidget);

    m_indexWindow = new IndexWindow(this);
    QDockWidget *indexDock = new QDockWidget(tr("Index"), this);
    indexDock->setObjectName(QLatin1String("IndexWindow"));
    indexDock->setWidget(m_indexWindow);
    addDockWidget(Qt::LeftDockWidgetArea, indexDock);

    m_contentWindow = new ContentWindow;
    QDockWidget *contentDock = new QDockWidget(tr("Contents"), this);
    contentDock->setObjectName(QLatin1String("ContentWindow"));
    contentDock->setWidget(m_contentWindow);
    addDockWidget(Qt::LeftDockWidgetArea, contentDock);

    m_searchWindow = new SearchWidget(helpEngineWrapper.searchEngine());
    m_searchWindow->setFont(!helpEngineWrapper.usesBrowserFont() ? qApp->font()
        : helpEngineWrapper.browserFont());
    QDockWidget *searchDock = new QDockWidget(tr("Search"), this);
    searchDock->setObjectName(QLatin1String("SearchWindow"));
    searchDock->setWidget(m_searchWindow);
    addDockWidget(Qt::LeftDockWidgetArea, searchDock);

    QDockWidget *bookmarkDock = new QDockWidget(tr("Bookmarks"), this);
    bookmarkDock->setObjectName(QLatin1String("BookmarkWindow"));
    bookmarkDock->setWidget(m_bookmarkWidget
        = bookMarkManager->bookmarkDockWidget());
    addDockWidget(Qt::LeftDockWidgetArea, bookmarkDock);

    QDockWidget *openPagesDock = new QDockWidget(tr("Open Pages"), this);
    openPagesDock->setObjectName(QLatin1String("Open Pages"));
    OpenPagesManager *openPagesManager
        = OpenPagesManager::createInstance(this, usesDefaultCollection(), m_cmdLine->url());
    openPagesDock->setWidget(openPagesManager->openPagesWidget());
    addDockWidget(Qt::LeftDockWidgetArea, openPagesDock);

    connect(m_centralWidget, SIGNAL(addBookmark(QString,QString)),
        bookMarkManager, SLOT(addBookmark(QString,QString)));
    connect(bookMarkManager, SIGNAL(escapePressed()), this,
            SLOT(activateCurrentCentralWidgetTab()));
    connect(bookMarkManager, SIGNAL(setSource(QUrl)), m_centralWidget,
            SLOT(setSource(QUrl)));
    connect(bookMarkManager, SIGNAL(setSourceInNewTab(QUrl)),
        openPagesManager, SLOT(createPage(QUrl)));

    QHelpSearchEngine *searchEngine = helpEngineWrapper.searchEngine();
    connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted()));
    connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));

    QString defWindowTitle = tr("Qt Assistant");
    setWindowTitle(defWindowTitle);

    setupActions();
    statusBar()->show();
    m_centralWidget->connectTabBar();

    setupFilterToolbar();
    setupAddressToolbar();

    const QString windowTitle = helpEngineWrapper.windowTitle();
    setWindowTitle(windowTitle.isEmpty() ? defWindowTitle : windowTitle);
    QByteArray iconArray = helpEngineWrapper.applicationIcon();
    if (iconArray.size() > 0) {
        QBuffer buffer(&iconArray);
        QImageReader reader(&buffer);
        QIcon appIcon;
        do {
            QPixmap pix;
            pix.convertFromImage(reader.read());
            appIcon.addPixmap(pix);
        } while (reader.jumpToNextImage());
        qApp->setWindowIcon(appIcon);
    } else {
        QIcon appIcon(QLatin1String(":/qt-project.org/assistant/images/assistant-128.png"));
        qApp->setWindowIcon(appIcon);
    }

    QToolBar *toolBar = addToolBar(tr("Bookmark Toolbar"));
    toolBar->setObjectName(QLatin1String("Bookmark Toolbar"));
    bookMarkManager->setBookmarksToolbar(toolBar);

    toolBar->hide();
    toolBarMenu()->addAction(toolBar->toggleViewAction());

    QByteArray ba(helpEngineWrapper.mainWindow());
    if (!ba.isEmpty())
        restoreState(ba);

    ba = helpEngineWrapper.mainWindowGeometry();
    if (!ba.isEmpty()) {
        restoreGeometry(ba);
    } else {
        tabifyDockWidget(contentDock, indexDock);
        tabifyDockWidget(indexDock, bookmarkDock);
        tabifyDockWidget(bookmarkDock, searchDock);
        contentDock->raise();
        const QRect screen = QApplication::desktop()->screenGeometry();
        resize(4*screen.width()/5, 4*screen.height()/5);

        adjustSize();   // make sure we won't start outside of the screen
        move(screen.center() - rect().center());
    }

    if (!helpEngineWrapper.hasFontSettings()) {
        helpEngineWrapper.setUseAppFont(false);
        helpEngineWrapper.setUseBrowserFont(false);
        helpEngineWrapper.setAppFont(qApp->font());
        helpEngineWrapper.setAppWritingSystem(QFontDatabase::Latin);
        helpEngineWrapper.setBrowserFont(qApp->font());
        helpEngineWrapper.setBrowserWritingSystem(QFontDatabase::Latin);
    } else {
        updateApplicationFont();
    }

    updateAboutMenuText();

    QTimer::singleShot(0, this, SLOT(insertLastPages()));
    if (m_cmdLine->enableRemoteControl())
        (void)new RemoteControl(this);

    if (m_cmdLine->contents() == CmdLineParser::Show)
        showContents();
    else if (m_cmdLine->contents() == CmdLineParser::Hide)
        hideContents();

    if (m_cmdLine->index() == CmdLineParser::Show)
        showIndex();
    else if (m_cmdLine->index() == CmdLineParser::Hide)
        hideIndex();

    if (m_cmdLine->bookmarks() == CmdLineParser::Show)
        showBookmarksDockWidget();
    else if (m_cmdLine->bookmarks() == CmdLineParser::Hide)
        hideBookmarksDockWidget();

    if (m_cmdLine->search() == CmdLineParser::Show)
        showSearch();
    else if (m_cmdLine->search() == CmdLineParser::Hide)
        hideSearch();

    if (m_cmdLine->contents() == CmdLineParser::Activate)
        showContents();
    else if (m_cmdLine->index() == CmdLineParser::Activate)
        showIndex();
    else if (m_cmdLine->bookmarks() == CmdLineParser::Activate)
        showBookmarksDockWidget();

    if (!m_cmdLine->currentFilter().isEmpty()) {
        const QString &curFilter = m_cmdLine->currentFilter();
        if (helpEngineWrapper.customFilters().contains(curFilter))
            helpEngineWrapper.setCurrentFilter(curFilter);
    }

    if (usesDefaultCollection())
        QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation()));
    else
        checkInitState();

    connect(&helpEngineWrapper, SIGNAL(documentationRemoved(QString)),
            this, SLOT(documentationRemoved(QString)));
    connect(&helpEngineWrapper, SIGNAL(documentationUpdated(QString)),
            this, SLOT(documentationUpdated(QString)));

    setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
    GlobalActions::instance()->updateActions();
    if (helpEngineWrapper.addressBarEnabled())
        showNewAddress();
}
Esempio n. 19
0
void FileMainWindow::setup()
{
    QSplitter *splitter = new QSplitter( this );

    dirlist = new DirectoryView( splitter, "dirlist", TRUE );
    dirlist->addColumn( "Name" );
    dirlist->addColumn( "Type" );
    Directory *root = new Directory( dirlist, "/" );
    root->setOpen( TRUE );
    splitter->setResizeMode( dirlist, QSplitter::KeepSize );

    fileview = new QtFileIconView( "/", splitter );
    fileview->setSelectionMode( QIconView::Extended );

    setCentralWidget( splitter );

    QToolBar *toolbar = new QToolBar( this, "toolbar" );
    setRightJustification( TRUE );

    (void)new QLabel( tr( " Path: " ), toolbar );

    pathCombo = new QComboBox( TRUE, toolbar );
    pathCombo->setAutoCompletion( TRUE );
    toolbar->setStretchableWidget( pathCombo );
    connect( pathCombo, SIGNAL( activated( const QString & ) ),
	     this, SLOT ( changePath( const QString & ) ) );

    toolbar->addSeparator();

    QPixmap pix;

    pix = QPixmap( cdtoparent_xpm );
    upButton = new QToolButton( pix, "One directory up", QString::null,
				this, SLOT( cdUp() ), toolbar, "cd up" );

    pix = QPixmap( newfolder_xpm );
    mkdirButton = new QToolButton( pix, "New Folder", QString::null,
				   this, SLOT( newFolder() ), toolbar, "new folder" );

    connect( dirlist, SIGNAL( folderSelected( const QString & ) ),
	     fileview, SLOT ( setDirectory( const QString & ) ) );
    connect( fileview, SIGNAL( directoryChanged( const QString & ) ),
	     this, SLOT( directoryChanged( const QString & ) ) );
    connect( fileview, SIGNAL( startReadDir( int ) ),
	     this, SLOT( slotStartReadDir( int ) ) );
    connect( fileview, SIGNAL( readNextDir() ),
	     this, SLOT( slotReadNextDir() ) );
    connect( fileview, SIGNAL( readDirDone() ),
	     this, SLOT( slotReadDirDone() ) );

    setDockEnabled( DockLeft, FALSE );
    setDockEnabled( DockRight, FALSE );

    label = new QLabel( statusBar() );
    statusBar()->addWidget( label, 2, TRUE );
    progress = new QProgressBar( statusBar() );
    statusBar()->addWidget( progress, 1, TRUE );

    connect( fileview, SIGNAL( enableUp() ),
	     this, SLOT( enableUp() ) );
    connect( fileview, SIGNAL( disableUp() ),
	     this, SLOT( disableUp() ) );
    connect( fileview, SIGNAL( enableMkdir() ),
	     this, SLOT( enableMkdir() ) );
    connect( fileview, SIGNAL( disableMkdir() ),
	     this, SLOT( disableMkdir() ) );
}
Esempio n. 20
0
void MainWindow::predict()
{
    if (!ui->lwModelsList->currentItem())
    {
        QMessageBox::warning(this, tr("Warning"), tr("No selected model to predict."));
        return;
    }
    if (ui->lineEditTextToPredict->text().isEmpty())
    {
        QMessageBox::warning(this, tr("Warning"), tr("Empty text for prediction."));
        return;
    }

    QString currentModel = ui->lwModelsList->currentItem()->text();
    QStringList texts;
    if(currentModel == "moscow_weather")
    {
        texts = ui->lineEditTextToPredict->text().split(",");
        for(int i = 0; i < texts.count(); ++i)
        {
            texts[i] = texts[i].trimmed();
        }
        if(texts.count() != 2)
        {
            QMessageBox::information(this, tr("Information"),
                                     tr("The string you entered cannot be splitted into two values.") + "\n\n\n" +
                                     tr("For prediction you need to enter the string:") + "\n\n"+
                                     tr("125, Spring") + "\n\n" +
                                     tr("Here 125 - is the day of the year (from 1 to 365)") + "\n" +
                                     tr("Spring - is the season, can be one of those:") +"\n\n" +
                                     tr("Winter, Spring, Summer, Fall."));
            return;
        }
        bool bOk;
        int n = texts[0].toInt(&bOk);
        if(!bOk)
        {
            QMessageBox::information(this, tr("Information"),
                                     tr("You entered a wrong day of the year '%1'.").arg(texts[0]) + "\n\n\n" +
                                     tr("For prediction you need to enter the string:") + "\n\n"+
                                     tr("125, Spring") + "\n\n" +
                                     tr("Here 125 - is the day of the year (from 1 to 365)") + "\n" +
                                     tr("Spring - is the season, can be one of those:") +"\n\n" +
                                     tr("Winter, Spring, Summer, Fall."));
            return;
        }
        if(n < 1 || n > 366)
        {
            QMessageBox::information(this, tr("Information"),
                                     tr("You entered a wrong day of the year '%1'.").arg(n) + "\n\n\n" +
                                     tr("For prediction you need to enter the string:") + "\n\n"+
                                     tr("125, Spring") + "\n\n" +
                                     tr("Here 125 - is the day of the year (from 1 to 365)") + "\n" +
                                     tr("Spring - is the season, can be one of those:") +"\n\n" +
                                     tr("Winter, Spring, Summer, Fall."));
            return;
        }
        QString season  = texts[1].trimmed();
        if(season != "Winter" && season != "Spring" && season != "Summer" && season != "Fall")
        {
            QMessageBox::information(this, tr("Information"),
                                     tr("You entered a wrong season name '%1'.").arg(season) + "\n\n\n" +
                                     tr("For prediction you need to enter the string:") + "\n\n"+
                                     tr("125, Spring") + "\n\n" +
                                     tr("Here 125 - is the day of the year (from 1 to 365)") + "\n" +
                                     tr("Spring - is the season, can be one of those:") +"\n\n" +
                                     tr("Winter, Spring, Summer, Fall."));
            return;
        }
    }
    else if(currentModel == "potential_buyers")
    {
        texts = ui->lineEditTextToPredict->text().split(",");
        for(int i = 0; i < texts.count(); ++i)
        {
            texts[i] = texts[i].trimmed();
        }
        if(texts.count() != 6)
        {
            QMessageBox::information(this, tr("Information"),
                                     tr("The string you entered cannot be splitted into six values.") + "\n\n\n" +
                                     tr("For prediction you need to enter the string:") + "\n\n"+
                                     tr("43, m, flat, 1, married, 6") + "\n\n" +
                                     tr("Here 43 - is the age of a person") + "\n" +
                                     tr("m - sex (m or f)") +"\n" +
                                     tr("flat - type of housing (can be flat or house)") +"\n" +
                                     tr("1 - number of cars in the family") +"\n" +
                                     tr("married - marital status (can be married or single)") +"\n" +
                                     tr("6 - number of children in the family."));
            return;
        }
    }
    else
    {
        //if(currentModel == "types_of_sentence" || currentModel == "lang_identifier" || currentModel == "lang_id_russian"
        //        || currentModel == "even-odd" || currentModel == "less-greater-100")
        //{

        //One string models.
        texts << ui->lineEditTextToPredict->text();
        //}

    }
    statusBar()->showMessage("Trying to predict.", 2000);
    m_managerPrediction.getPredict(ui->lwModelsList->currentItem()->text(), texts);
}
Esempio n. 21
0
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("Zestcoin") + " - " + tr("Wallet"));
#ifndef Q_OS_MAC
    QApplication::setWindowIcon(QIcon(":icons/zestcoin"));
    setWindowIcon(QIcon(":icons/zestcoin"));
#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);
}
Esempio n. 22
0
void MainWindow::updateModelsList()
{
    statusBar()->showMessage("Getting list of models.", 2000);
    m_managerPrediction.getModelsList();
}
Esempio n. 23
0
MainWindow::MainWindow() : QMainWindow()
{
    // Create network view
    nView = new NetworkView();
    QGraphicsScene *scene = new QGraphicsScene();
    scene->setBackgroundBrush(QBrush(QColor(192, 192, 192)));
    nView->setScene(scene);
    setCentralWidget(nView);

    // Create tree view
    tView = new QTreeView(this);
    QDockWidget *treeDockWidget = new QDockWidget(tr("Tree"), this);
    treeDockWidget->setWidget(tView);
    addDockWidget(Qt::LeftDockWidgetArea, treeDockWidget);

    // Create controls view
    controls = new Controls();
    controlWidget = new QDockWidget(tr("Controls"), this);
    controlWidget->setWidget(controls);
    addDockWidget(Qt::LeftDockWidgetArea, controlWidget);
    controlWidget->hide();

    // Create properties view
    pView = new PropsView(this);
    propsWidget = new QDockWidget(tr("Properties"), this);
    propsWidget->setWidget(pView);
    addDockWidget(Qt::RightDockWidgetArea, propsWidget);
    propsWidget->hide();

    // Create edit view
    eView = new EditView(this);
    editWidget = new QDockWidget(tr("Edit Properties"), this);
    editWidget->setWidget(eView);
    addDockWidget(Qt::RightDockWidgetArea, editWidget);
    editWidget->hide();

    // Create menu
    fileMenu = menuBar()->addMenu(tr("&File"));
    fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()), QKeySequence::Open);
    fileMenu->addAction(tr("Save &As..."), this, SLOT(saveAsFile()), QKeySequence::Save/*As*/);
    fileMenu->addSeparator();
    fileMenu->addAction(tr("Open in SUMO-GUI"), this, SLOT(openSUMO()));
    fileMenu->addAction(tr("Locate SUMO-GUI..."), this, SLOT(locateSUMO()));
    fileMenu->addSeparator();
    fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence::Quit);

    viewMenu = menuBar()->addMenu(tr("&View"));
    viewMenu->addAction(treeDockWidget->toggleViewAction());
    viewMenu->addAction(controlWidget->toggleViewAction());
    viewMenu->addAction(propsWidget->toggleViewAction());
    viewMenu->addAction(editWidget->toggleViewAction());

    specialEditorsMenu = menuBar()->addMenu(tr("&Special Editors"));
    nmlJuncIcon = QPixmap(":/icons/nmlJunc1616.png");
    tlLogicIcon = QPixmap(":/icons/tllogic1616.png");
    specialEditorsMenu->addAction(nmlJuncIcon, tr("&Junction Editor"), this, SLOT(openJunctionEditor()));
    specialEditorsMenu->addAction(tlLogicIcon, tr("&tlLogic Editor"), this, SLOT(openTLEditor()));

    // Read settings from the nefs.ini file
    QSettings settings(QCoreApplication::applicationDirPath() + "/nefs.ini", QSettings::IniFormat);
    xmlPath = settings.value("paths/work").toString();
    sumoguiPath = settings.value("paths/sumo").toString();

    // Status bar
    statusBar()->showMessage(tr("Ready"));

    // Title and icon
    setWindowTitle(tr("Network Editor for SUMO"));
    setWindowIcon(QIcon(QPixmap(":/icons/NE4S128.png")));

    modelLoaded = false;
}
Esempio n. 24
0
void MainWindow::loginDone()
{
    m_managerPrediction.setAccessToken(m_pOAuth2->accessToken());
    statusBar()->showMessage("Getting list of models.", 2000);
    m_managerPrediction.getModelsList();
}
Esempio n. 25
0
NoirSharesGUI::NoirSharesGUI(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("NoirShares") + " - " + tr("Wallet"));


    // QPalette pal = this->palette();
    // pal.setColor(QPalette::Window, Qt::black);
    // pal.setColor(QPalette::WindowText, Qt::white);
    // this->setPalette(pal);
    // this->setAutoFillBackground(true);

    this->setStyleSheet("QMainWindow {background-color: black; color: white;} "
#ifndef Q_OS_MAC
                        "QToolButton {background-color: black; color: white;} "
                        "QToolButton:hover {background-color: black; color: #ffff77;} "
                        "QToolButton:pressed {background-color: #0000bb; color: white;} "
                        "QToolButton:checked {background-color: #000099; color: white;} "
                        "QToolButton:disabled {background-color: #333333; color: white;} "
#endif
                        "QComboBox {border:1px solid white; border-radius: 3px; min-width: 5em; "
                        "           color:white; background-color:black;} "
                        "QComboBox::drop-down {border: 0px;} "
                        "QComboBox * {color: black;} "
                        "QComboBox:on {color: black} "
                        "QComboBox:on *:hover {background-color: blue} "
                        "QMessageBox QLabel {color: black;} "
                        "AddressBookPage {background-color: black; border-color: white;"
                        "                          color: white; border-width: 1px;} "
                        "TransactionView {background-color: black; color: white;} "
                        "transactionView {background-color: black; color: white;} "
                        "QLabel {color: white;} "
                        "QHeaderView::section{background-color: black; border-color:white;"
                        "                     color: white; font-weight:bold;"
                        "                     border-width: 1px; border-style: solid;} "
                        "QValidatedLineEdit {border-style: solid; border-width: 1px;"
                        "                    border-color: white;}"
                        "QDoubleSpinBox {color:white;background-color:#222222; "
                        "                border-color:white;border-width:1px;font-weight:bold;} "
                        "QLineEdit {border-style: solid; border-width: 1px;"
                        "           border-color: white;}"
                        //    "SendCoinsEntry {background-color: black; color: white; "
                        //    "                border-color: white; border-width: 1px;} "
                        //    "SendCoinsDialog {background-color: black; color: white; "
                        //    "        border-color: white; border-width: 1px;} "
                        //    "QScrollArea {background-color: white; border-color: white; "
                        //    "             color: white; border-width: 1px;} "
                        //    "scrollAreaWidgetContents {background-color: white; border-color: white; "
                        //    "                          color: white; border-width: 1px;} "
                       );


#ifndef Q_OS_MAC
    qApp->setWindowIcon(QIcon(":icons/NoirShares"));
    setWindowIcon(QIcon(":icons/NoirShares"));
#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);

#ifdef Q_OS_MAC
    progressBarLabel->setStyleSheet("color:black");
#endif

    // Override style sheet for progress bar for styles that have a segmented progress bar,
    // as they make the text unreadable (workaround for issue #1071)
    // See https://qt-project.org/doc/qt-4.8/gallery.html
    QString curStyle = qApp->style()->metaObject()->className();
    if(curStyle == "QWindowsStyle" || curStyle == "QWindowsXPStyle")
    {
        progressBar->setStyleSheet("QProgressBar { background-color: #e8e8e8; border: 1px solid grey; border-radius: 7px; padding: 1px; text-align: center; } QProgressBar::chunk { background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange); border-radius: 7px; margin: 0px; }");
    }

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Esempio n. 26
0
/*! MyWindow constructor
 * \param w - window width
 * \param h - window hight
 */
MyWindow::MyWindow(int w, int h) : num_of_colors(18)
{
    myBar = new QTabWidget(this);
    setCentralWidget(myBar);
    m_width = w;
    m_height = h;
    tab_number = 0;
    number_of_tabs = 0;
    testlayer = new Qt_layer( myBar );
    colors_flag = true;
    statusBar();

    m_scailing_factor = 2;

    // Traits Group
    QActionGroup *traitsGroup = new QActionGroup( this ); // Connected later
    traitsGroup->setExclusive( TRUE );

    setSegmentTraits = new QAction("Segment Traits",
                                   QPixmap( (const char**)line_xpm ),
                                   "&Segment Traits", 0 ,traitsGroup,
                                   "Segment Traits" );
    setSegmentTraits->setToggleAction( TRUE );

    setPolylineTraits = new QAction("Polyline Traits",
                                    QPixmap( (const char**)polyline_xpm ),
                                    "&Polyline Traits", 0 , traitsGroup,
                                    "Polyline Traits" );
    setPolylineTraits->setToggleAction( TRUE );

#ifdef CGAL_USE_CORE
    setConicTraits = new QAction("Conic Traits",
                                 QPixmap( (const char**)conic_xpm ),
                                 "&Conic Traits", 0 , traitsGroup,
                                 "Conic Traits" );
    setConicTraits->setToggleAction( TRUE );
#endif

    // Snap Mode Group

    setSnapMode = new QAction("Snap Mode", QPixmap( (const char**)snapvertex_xpm ),
                              "&Snap Mode", 0 , this, "Snap Mode" );
    setSnapMode->setToggleAction( TRUE );

    setGridSnapMode = new QAction("Grid Snap Mode",
                                  QPixmap( (const char**)snapgrid_xpm ),
                                  "&Grid Snap Mode", 0 , this,
                                  "Grid Snap Mode" );
    setGridSnapMode->setToggleAction( TRUE );

    // insert - delete - point_location Mode Group
    QActionGroup *modeGroup = new QActionGroup( this ); // Connected later
    modeGroup->setExclusive( TRUE );

    insertMode = new QAction("Insert", QPixmap( (const char**)insert_xpm ),
                             "&Insert", 0 , modeGroup, "Insert" );
    insertMode->setToggleAction( TRUE );

    deleteMode = new QAction("Delete", QPixmap( (const char**)delete_xpm ),
                             "&Delete", 0 , modeGroup, "Delete" );
    deleteMode->setToggleAction( TRUE );

    pointLocationMode = new QAction("PointLocation",
                                    QPixmap( (const char**)pointlocation_xpm ),
                                    "&Point Location", 0 , modeGroup,
                                    "Point Location" );
    pointLocationMode->setToggleAction( TRUE );

    rayShootingUpMode = new QAction("RayShootingUp",
                                    QPixmap( (const char**)demo_rayshoot_up_xpm ),
                                    "&Ray Shooting Up", 0 , modeGroup,
                                    "Ray Shooting Up" );
    rayShootingUpMode->setToggleAction( TRUE );

    rayShootingDownMode = new QAction("RayShootingDown",
                                      QPixmap( (const char**)demo_rayshoot_down_xpm ),
                                      "&Ray Shooting Down", 0 , modeGroup,
                                      "Ray Shooting Down" );
    rayShootingDownMode->setToggleAction( TRUE );

    dragMode = new QAction("Drag", QPixmap( (const char**)hand_xpm ),
                           "&Drag", 0 , modeGroup, "Drag" );
    dragMode->setToggleAction( TRUE );

    mergeMode = new QAction("Merge", QPixmap( (const char**)merge_xpm ),
                            "&Merge", 0 , modeGroup, "Merge" );
    mergeMode->setToggleAction( TRUE );

    splitMode = new QAction("Split", QPixmap( (const char**)split_xpm ),
                            "&Split", 0 , modeGroup, "Split" );
    splitMode->setToggleAction( TRUE );

    fillfaceMode = new QAction("Fill", QPixmap( (const char**)demo_fill_xpm ),
                               "&Fill", 0 , modeGroup, "Fill" );
    fillfaceMode->setToggleAction( TRUE );



    // zoom in
    zoominBt = new QAction("Zoom in", QPixmap( (const char**)zoomin_xpm ),
                           "&Zoom in", 0 , this, "Zoom in" );
    // zoom out
    zoomoutBt = new QAction("Zoom out", QPixmap( (const char**)zoomout_xpm ),
                            "&Zoom out", 0 , this, "Zoom out" );

    // color dialog
    color_dialog_bt = new QAction("Choose color", QPixmap( (const char**)demo_colors_xpm ),
                                  "&choose color", 0 , this, "choose color" );

    lower_env_dialog_bt = new QAction("Lower envelope", QPixmap( (const char**)lower_env_xpm ),
                                      "&lower envelope", 0, this, "Lower envelop" );
    lower_env_dialog_bt->setToggleAction( TRUE );

    upper_env_dialog_bt = new QAction("Upper envelope", QPixmap( (const char**)upper_env_xpm ),
                                      "&upper envelope", 0, this, "Upper envelop" );
    upper_env_dialog_bt->setToggleAction( TRUE );

#ifdef CGAL_USE_CORE
    // Conic Type Group
    QActionGroup *conicTypeGroup = new QActionGroup( this ); // Connected later
    conicTypeGroup->setExclusive( TRUE );

    setCircle = new QAction("Circle",
                            QPixmap( (const char**)demo_conic_circle_xpm ),
                            "&Circle", 0 ,conicTypeGroup,
                            "Circle" );
    setCircle->setToggleAction( TRUE );
    setSegment = new QAction("Segment",
                             QPixmap( (const char**)demo_conic_segment_xpm ),
                             "&Segment", 0 ,conicTypeGroup,
                             "Segment" );
    setSegment->setToggleAction( TRUE );
    setEllipse = new QAction("Ellipse",
                             QPixmap( (const char**)demo_conic_ellipse_xpm ),
                             "&Ellipse", 0 ,conicTypeGroup,
                             "Ellipse" );
    setEllipse->setToggleAction( TRUE );
    setParabola = new QAction("3 Points Arc",
                              QPixmap( (const char**)demo_conic_3points_xpm ),
                              "&3 Points Arc", 0 ,conicTypeGroup,
                              "3 Points Arc" );
    setParabola->setToggleAction( TRUE );
    setHyperbola = new QAction("5 Points Arc",
                               QPixmap( (const char**)demo_conic_5points_xpm ),
                               "&5 Points Arc", 0 ,conicTypeGroup,
                               "5 Points Arc" );
    setHyperbola->setToggleAction( TRUE );
#endif

    //create a timer for checking if somthing changed
    QTimer *timer = new QTimer( this );
    connect( timer, SIGNAL(timeout()),
             this, SLOT(timer_done()) );
    timer->start( 200, FALSE );

    // file menu
    QPopupMenu * file = new QPopupMenu( this );
    menuBar()->insertItem( "&File", file );
    file->insertItem("&Open Segment File...", this, SLOT(fileOpenSegment()));
    file->insertItem("&Open Polyline File...", this, SLOT(fileOpenPolyline()));
    \

#ifdef CGAL_USE_CORE
    file->insertItem("&Open Conic File...", this, SLOT(fileOpenConic()));
#endif

    file->insertItem("&Open Segment Arr File...", this, SLOT(fileOpenSegmentPm()));
    file->insertItem("&Open Polyline Arr File...", this, SLOT(fileOpenPolylinePm()));
    //file->insertItem("&Open Conic Pm File", this, SLOT(fileOpenConicPm()));
    file->insertItem("&Save...", this, SLOT(fileSave()));
    file->insertItem("&Save As...", this, SLOT(fileSaveAs()));
    //file->insertItem("&Save to ps...", this, SLOT(fileSave_ps()));
    file->insertSeparator();
    file->insertItem("&Print...", this , SLOT(print()));
    file->insertSeparator();
    file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X );
    file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );
    menuBar()->insertSeparator();

    // tab menu
    QPopupMenu * tab = new QPopupMenu( this );
    menuBar()->insertItem( "&Tab", tab );
    tab->insertItem("Add &Segment Tab", this, SLOT(add_segment_tab()));
    tab->insertItem("Add &Polyline Tab", this, SLOT(add_polyline_tab()));

#ifdef CGAL_USE_CORE
    tab->insertItem("Add &Conic Tab", this, SLOT(add_conic_tab()));
    tab->insertSeparator();
#endif

    tab->insertItem("Remove &Tab", this, SLOT(remove_tab()));
    menuBar()->insertSeparator();

    // mode menu
    QPopupMenu * mode = new QPopupMenu( this );
    menuBar()->insertItem( "&Mode", mode );
    insertMode->addTo( mode );
    deleteMode->addTo( mode );
    pointLocationMode->addTo( mode );
    rayShootingUpMode->addTo( mode );
    rayShootingDownMode->addTo( mode );
    dragMode->addTo( mode );
    mergeMode->addTo( mode );
    splitMode->addTo( mode );
    fillfaceMode->addTo( mode );
    menuBar()->insertSeparator();

    // snap mode menu
    QPopupMenu * snap_mode = new QPopupMenu( this );
    menuBar()->insertItem( "&Snap mode", snap_mode );
    setSnapMode->addTo(snap_mode);
    setGridSnapMode->addTo(snap_mode);
    menuBar()->insertSeparator();

    // traits menu
    QPopupMenu * traits = new QPopupMenu( this );
    menuBar()->insertItem( "&Traits Type", traits );
    setSegmentTraits->addTo(traits);
    setPolylineTraits->addTo(traits);
#ifdef CGAL_USE_CORE
    setConicTraits->addTo(traits);
#endif

    // options menu
    QPopupMenu * options = new QPopupMenu( this );
    menuBar()->insertItem( "&Options", options );
    options->insertSeparator();
    options->insertItem("Overlay...", this, SLOT(overlay_pm()));
    options->insertSeparator();
    options->insertItem("Properties...", this, SLOT(properties()));
    options->insertSeparator();
    options->insertItem("Show Grid", this, SLOT(showGrid()));
    options->insertItem("Hide Grid", this, SLOT(hideGrid()));
    options->insertSeparator();
    //options->insertItem("Conic Type", this, SLOT(conicType()));
    //options->insertSeparator();
    options->insertItem("Unbounded Face Color...", this, SLOT(backGroundColor()));
    options->insertSeparator();
    options->insertItem("Edge Color...", this, SLOT(changeEdgeColor()));
    options->insertSeparator();
    options->insertItem("Vertex Color...", this, SLOT(changeVertexColor()));
    options->insertSeparator();
    options->insertItem("Point-Locaiton Strategy....", this ,
                        SLOT(pointLocationStrategy()));


    // help menu
    QPopupMenu * help = new QPopupMenu( this );
    menuBar()->insertItem( "&Help", help );
    help->insertItem("How To...", this, SLOT(howto()), Key_F1);
    help->insertSeparator();
    help->insertItem("&About...", this, SLOT(about()), CTRL+Key_A );
    help->insertItem("About &Qt...", this, SLOT(aboutQt()) );

    QToolBar *modeTools = new QToolBar( this, "mode operations" );
    modeTools->setLabel( "Mode Operations" );
    insertMode->addTo( modeTools );
    deleteMode->addTo( modeTools );
    dragMode->addTo( modeTools );
    pointLocationMode->addTo( modeTools );
    rayShootingUpMode->addTo( modeTools );
    rayShootingDownMode->addTo( modeTools );
    mergeMode->addTo( modeTools );
    splitMode->addTo( modeTools );
    fillfaceMode->addTo( modeTools );
    modeTools->addSeparator();

    QToolBar *snapModeTools = new QToolBar( this, "snapMode operations" );
    snapModeTools->setLabel( "Snap Mode Operations" );
    snapModeTools->addSeparator();
    setSnapMode->addTo( snapModeTools );
    setGridSnapMode->addTo( snapModeTools );
    snapModeTools->addSeparator();

    QToolBar *traitsTool = new QToolBar( this, "traits type" );
    traitsTool->setLabel( "Traits Type" );
    traitsTool->addSeparator();
    setSegmentTraits->addTo( traitsTool );
    setPolylineTraits->addTo( traitsTool );
#ifdef CGAL_USE_CORE
    setConicTraits->addTo( traitsTool );
#endif
    traitsTool->addSeparator();

    QToolBar *zoomTool = new QToolBar( this, "zoom" );
    zoomTool->setLabel( "Zoom" );
    zoomTool->addSeparator();
    zoomoutBt->addTo( zoomTool );
    zoominBt->addTo( zoomTool );
    zoomTool->addSeparator();

    QToolBar *colorTool = new QToolBar( this, "color" );
    colorTool->addSeparator();
    colorTool->setLabel("Choose color");
    color_dialog_bt->addTo(colorTool);
    colorTool->addSeparator();

    QToolBar *envelopeTool = new QToolBar( this, "envelopes" );
    envelopeTool->addSeparator();
    envelopeTool->setLabel("Envelopes");
    lower_env_dialog_bt->addTo(envelopeTool);
    upper_env_dialog_bt->addTo(envelopeTool);
    envelopeTool->addSeparator();


#ifdef CGAL_USE_CORE
    conicTypeTool = new QToolBar( this, "conic type" );
    conicTypeTool->setLabel( "Conic Type" );
    conicTypeTool->addSeparator();
    setSegment->addTo( conicTypeTool );
    setCircle->addTo( conicTypeTool );
    setEllipse->addTo( conicTypeTool );
    setParabola->addTo( conicTypeTool );
    setHyperbola->addTo( conicTypeTool );
#endif

    connect( zoomoutBt, SIGNAL( activated () ) ,
             this, SLOT( zoomout() ) );

    connect( zoominBt, SIGNAL( activated () ) ,
             this, SLOT( zoomin() ) );

    connect (color_dialog_bt , SIGNAL( activated()) ,
             this , SLOT(openColorDialog() ) );

    connect (lower_env_dialog_bt, SIGNAL(toggled(bool)) ,
             this, SLOT(lowerEnvelope(bool) ));

    connect (upper_env_dialog_bt, SIGNAL(toggled(bool)) ,
             this, SLOT(upperEnvelope(bool) ));
    // connect mode group
    connect( modeGroup, SIGNAL( selected(QAction*) ),
             this, SLOT( updateMode(QAction*) ) );

    // connect Traits Group
    connect( traitsGroup, SIGNAL( selected(QAction*) ),
             this, SLOT( updateTraitsType(QAction*) ) );

#ifdef CGAL_USE_CORE
    // connect Conic Type Group
    connect( conicTypeGroup, SIGNAL( selected(QAction*) ),
             this, SLOT( updateConicType(QAction*) ) );
#endif

    // connect Snap Mode

    connect( setSnapMode, SIGNAL( toggled( bool ) ) ,
             this, SLOT( updateSnapMode( bool ) ) );

    connect( setGridSnapMode, SIGNAL( toggled( bool ) ) ,
             this, SLOT( updateGridSnapMode( bool ) ) );

    // connect the change of current tab
    connect( myBar, SIGNAL( currentChanged(QWidget * )  ),
             this, SLOT( update() ) );

    colors = new QColor[num_of_colors];
    colors[0]  =  Qt::blue;
    colors[1]  =  Qt::gray;
    colors[2]  =  Qt::green;
    colors[3]  =  Qt::cyan;
    colors[4]  =  Qt::magenta;
    colors[5]  =  Qt::darkRed;
    colors[6]  =  Qt::darkGreen;
    colors[7]  =  Qt::darkBlue;
    colors[8]  =  Qt::darkMagenta;
    colors[9]  =  Qt::darkCyan;
    colors[10] =  Qt::yellow;
    colors[11] =  Qt::white;
    colors[12] =  Qt::darkGray;
    colors[13] =  Qt::gray;
    colors[14] =  Qt::red;
    colors[15] =  Qt::cyan;
    colors[16] =  Qt::darkYellow;
    colors[17] =  Qt::lightGray;

    //state flag
    old_state = 0;
    add_segment_tab();
    resize(m_width,m_height);
}
void MainWindow::onStatusBarMsgChange(const QString &strMsg)
{
    statusBar()->showMessage(strMsg,3*1000);
}
Esempio n. 28
0
void MainWindow::createStatusBar()
{
	statusLabel->setText("game loading");
	statusBar()->addWidget(statusLabel);
}