void QgsMapToolCapture::addError( QgsGeometry::Error e )
{
  mGeomErrors << e;
  QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
  if ( !vlayer )
    return;

  if ( !mTip.isEmpty() )
    mTip += "\n";

  mTip += e.what();

  if ( e.hasWhere() )
  {
    QgsVertexMarker *vm =  new QgsVertexMarker( mCanvas );
    vm->setCenter( mCanvas->mapSettings().layerToMapCoordinates( vlayer, e.where() ) );
    vm->setIconType( QgsVertexMarker::ICON_X );
    vm->setPenWidth( 2 );
    vm->setToolTip( e.what() );
    vm->setColor( Qt::green );
    vm->setZValue( vm->zValue() + 1 );
    mGeomErrorMarkers << vm;
  }

  QStatusBar *sb = QgisApp::instance()->statusBar();
  sb->showMessage( e.what() );
  if ( !mTip.isEmpty() )
    sb->setToolTip( mTip );
}
Beispiel #2
0
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	QWidget win;

	QVBoxLayout* mainLayout = new QVBoxLayout();

	// first row
	QHBoxLayout* firstRowLayout = new QHBoxLayout();
	firstRowLayout->addWidget(new QLabel("Label1", &win), 0);
	firstRowLayout->addWidget(new QCheckBox("Flip me", &win), 2);
	firstRowLayout->addWidget(new QPushButton("Push me", &win), 1);
	mainLayout->addLayout(firstRowLayout, 0);
	//
	// second row
	QHBoxLayout* secondRowLayout = new QHBoxLayout();
	secondRowLayout->addWidget(new QLabel("Label2", &win), 0);
	secondRowLayout->addWidget(new QTextEdit("Edit me", &win), 1);
	mainLayout->addLayout(secondRowLayout, 0);

	// button
	QPushButton* clickButton = new QPushButton("Click me", &win);
	mainLayout->addWidget(clickButton, 0, Qt::AlignCenter);

	// status bar
	QStatusBar* statusBar = new QStatusBar(&win);
	statusBar->showMessage("Status text");
	mainLayout->addWidget(statusBar, 0);

	win.setLayout(mainLayout);
	win.show();

	return a.exec();
}
Beispiel #3
0
void
App::loadStatusBar()
{
    //TODO maybe not use a statusbar for this
    QStatusBar *statusBar = _mainwindow->statusBar();
    QStringList players{"Human", "Random", "NegaMax", "NegaMaxWTt", "MTD-f"};

    _whiteCombo = new QComboBox();
    statusBar->addPermanentWidget(_whiteCombo);
    _whiteCombo->addItems(players);
    _whiteCombo->setCurrentIndex(4);
    connect(_whiteCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setWhitePlayer(int)));

    statusBar->addPermanentWidget(new QLabel("White"));

    statusBar->showMessage("Test");

    statusBar->addPermanentWidget(new QLabel("Black"));

    _blackCombo = new QComboBox();
    statusBar->addPermanentWidget(_blackCombo);
    _blackCombo->addItems(players);
    _blackCombo->setCurrentIndex(4);
    connect(_blackCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setBlackPlayer(int)));
}
void QgsSelectedFeature::validateGeometry( QgsGeometry *g )
{
  QSettings settings;
  if ( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() == 0 )
    return;

  if ( !g )
    g = mGeometry;

  mTip.clear();

  if ( mValidator )
  {
    mValidator->stop();
    mValidator->wait();
    mValidator->deleteLater();
    mValidator = 0;
  }

  mGeomErrors.clear();
  while ( !mGeomErrorMarkers.isEmpty() )
  {
    QgsVertexMarker *vm = mGeomErrorMarkers.takeFirst();
    QgsDebugMsg( "deleting " + vm->toolTip() );
    delete vm;
  }

  mValidator = new QgsGeometryValidator( g );
  connect( mValidator, SIGNAL( errorFound( QgsGeometry::Error ) ), this, SLOT( addError( QgsGeometry::Error ) ) );
  connect( mValidator, SIGNAL( finished() ), this, SLOT( validationFinished() ) );
  mValidator->start();

  QStatusBar *sb = QgisApp::instance()->statusBar();
  sb->showMessage( tr( "Validation started." ) );
}
	bool error ( const QXmlParseException & exception )
	{
		int line, col;
		line=exception.lineNumber();
		col=exception.columnNumber();
		QString _error="Line "+QString::number(line)+" Col "+QString::number(col)+": "+exception.message()+" "+svg_file_name;
		
		statusBar->showMessage(_error);
		
		return false;
	}
Beispiel #6
0
void Application::logStatusUpdate(int & pIdent, QString const & pMessage)
{
	pIdent = ++mLastStatusMessage;

	if (!mStatusBars.empty())
	{
		QStatusBar * lBar = mStatusBars.back();
		lBar->setProperty("last_ident", pIdent);
		lBar->showMessage(pMessage);
	}
}
Beispiel #7
0
void QgsMapToolCapture::validateGeometry()
{
  QSettings settings;
  if ( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() == 0 )
    return;

  if ( mValidator )
  {
    mValidator->deleteLater();
    mValidator = 0;
  }

  mTip = "";
  mGeomErrors.clear();
  while ( !mGeomErrorMarkers.isEmpty() )
  {
    delete mGeomErrorMarkers.takeFirst();
  }

  QgsGeometry *g = 0;

  switch ( mCaptureMode )
  {
    case CaptureNone:
    case CapturePoint:
      return;
    case CaptureLine:
      if ( size() < 2 )
        return;
      g = new QgsGeometry( mCaptureCurve.curveToLine() );
      break;
    case CapturePolygon:
      if ( size() < 3 )
        return;
      QgsLineStringV2* exteriorRing = mCaptureCurve.curveToLine();
      exteriorRing->close();
      QgsPolygonV2* polygon = new QgsPolygonV2();
      polygon->setExteriorRing( exteriorRing );
      g = new QgsGeometry( polygon );
      break;
  }

  if ( !g )
    return;

  mValidator = new QgsGeometryValidator( g );
  connect( mValidator, SIGNAL( errorFound( QgsGeometry::Error ) ), this, SLOT( addError( QgsGeometry::Error ) ) );
  connect( mValidator, SIGNAL( finished() ), this, SLOT( validationFinished() ) );
  mValidator->start();

  QStatusBar *sb = QgisApp::instance()->statusBar();
  sb->showMessage( tr( "Validation started." ) );
  delete g;
}
/**
 * Methode qui enregistre le template
 */
void EditTemplateWindow::save(){
    QFile file(QDir::fromNativeSeparators(QDir::homePath()+"/.QFacturation/template.html"));
    if (file.open(QFile::WriteOnly)){
        file.write(templateEdit->toPlainText().toUtf8());
        file.flush();
        file.close();
        QStatusBar *statBar = parent->statusBar();
        statBar->showMessage(trUtf8("Template sauvegardé"), 4000);
    }
    else
        QMessageBox::critical(this,trUtf8("Erreur d'écriture"),trUtf8("Ecriture du template impossible"));
}
/**
 * Methode permettant de valider un document
 * (redirige vers la page de recherche)
 */
void NewDocumentWindow::validate(){
    int ret = QMessageBox::question(this,trUtf8("Valider le document ?"),trUtf8("La validation d'un document empeche toutes modification ultérieure.<br/>Voulez-vous vraiment valider le document?"),QMessageBox::Yes | QMessageBox::No);

    if (ret == QMessageBox::Yes){
        save();
        Document d(idDocument);
        ValidDocument vd(d);
        vd.save();
        QStatusBar *statBar = parent->statusBar();
        statBar->showMessage(trUtf8("Informations du document sauvegardé et valider"), 4000);
        parent->setCentralWidget(new SearchWindow(parent));
    }
}
void QgsMapToolCapture::validateGeometry()
{
  QSettings settings;
  if ( settings.value( "/qgis/digitizing/validate_geometries", 1 ).toInt() == 0 )
    return;

  if ( mValidator )
  {
    mValidator->deleteLater();
    mValidator = 0;
  }

  mTip = "";
  mGeomErrors.clear();
  while ( !mGeomErrorMarkers.isEmpty() )
  {
    delete mGeomErrorMarkers.takeFirst();
  }

  QgsGeometry *g = 0;

  switch ( mCaptureMode )
  {
    case CaptureNone:
    case CapturePoint:
      return;
    case CaptureLine:
      if ( mCaptureList.size() < 2 )
        return;
      g = QgsGeometry::fromPolyline( mCaptureList.toVector() );
      break;
    case CapturePolygon:
      if ( mCaptureList.size() < 3 )
        return;
      g = QgsGeometry::fromPolygon( QgsPolygon() << ( QgsPolyline() << mCaptureList.toVector() << mCaptureList[0] ) );
      break;
  }

  if ( !g )
    return;

  mValidator = new QgsGeometryValidator( g );
  connect( mValidator, SIGNAL( errorFound( QgsGeometry::Error ) ), this, SLOT( addError( QgsGeometry::Error ) ) );
  connect( mValidator, SIGNAL( finished() ), this, SLOT( validationFinished() ) );
  mValidator->start();

  QStatusBar *sb = QgisApp::instance()->statusBar();
  sb->showMessage( tr( "Validation started." ) );
}
Beispiel #11
0
void MainWindow::readFromConfig()
{
    //switchLanguage(NULL);

    /* read saved state */
    readSettings(&settings, false);

    toggleASQLow(ui->checkBox_asq_detectLow->isChecked());
    toggleASQHigh(ui->checkBox_asq_detectHigh->isChecked());

    toggleTransmitPilot(ui->checkBox_transmitter_pilot->isChecked());
    toggleTransmitRds(ui->checkBox_transmitter_rds->isChecked());
    toggleTransmitEnabled(ui->checkBox_transmitter_enabled->isChecked());

    toggleRDSaf(ui->checkBox_rds_useaf->isChecked());
    toggleRDSfifo(ui->checkBox_rds_fifo->isChecked());
    toggleRDSPSVisibility(ui->spinBox_rds_ps_msgs->value());
    UpdateRDSRTFileEnabled(ui->checkBox_rds_title_file->isChecked());
    UpdateRDSRTPlusEnabled();
    //updateHTTPListener();

    createLanguageMenu();
    ui->actionSelect_Language->setMenu(languageMenu);

    setupTrayIcon();
    SetWindowMode(!ui->checkBox_mini_mode->isChecked());
    SetAudioCompLimPresetByParams();

    /* actions for querier */
    if(ui->checkBox_rds_time->isChecked()) {
        querier->rdsInterval = ui->spinBox_rds_time_int->value() * 1000;
    }

    /* try to connect */
    toggleConnection(false, false);
    if(ui->checkBox_sw_autoconnect->isChecked())
        querier->timer.start();
    else {
        QStatusBar *status = statusBar();
        status->showMessage(tr("Default config editing mode..."));
        status->show();
    }

    this->adjustSize();
    this->resize(1,1);
    this->updateGeometry();

    qDebug() << __FUNCTION__;
}
Beispiel #12
0
 void updateValue(const QPointF& position) {
   if (!frame.isEmpty()) {
     QPointF xy = position*1.0/scale;
     
     size_t x = floor(xy.x());
     if (x >= frame.getWidth())
       x = frame.getWidth()-1;
       
     size_t y = floor(xy.y());
     if (y >= frame.getHeight())
       y = frame.getHeight()-1;
     
     std::stringstream stream;
     stream << "(" << x << ", " << y << "): " << frame(x, y);
     
     statusBar.showMessage(stream.str().c_str());
   }
 }
/**
 * Methode permettant de sauvegarder le document
 */
void NewDocumentWindow::save(){
    Document d;
    if(idDocument==-1)
        d=Document();
    else
        d=Document(idDocument);

    d.m_idCustomer=customerName->currentIndex()+1;

    if(reglementMode->currentText()==trUtf8("Cheque"))
        d.m_payment=Document::Cheque;
    else if(reglementMode->currentText()==trUtf8("Espece"))
        d.m_payment=Document::Especes;
    else
        d.m_payment=Document::Virement;

    if(documentType->currentText()==trUtf8("Facture"))
        d.m_docType=Document::Facture;
    else
         d.m_docType=Document::Devis;

    d.m_tva=documentTva->value();

    d.save();
    idDocument=d.getId();

    ProductDocument::removeAllByIdDocument(idDocument);

    for(int i=0;i<productModel->rowCount();i++){
        int prodId=productModel->item(i,0)->text().toInt();
        int quantity=productModel->item(i,2)->text().toInt();
        QString reduction=productModel->item(i,5)->text();

        d.addProduct(prodId,quantity,reduction);
    }

    d.save();
    QStatusBar *statBar = parent->statusBar();
    statBar->showMessage(trUtf8("Informations du document sauvegardé"), 4000);
    parent->setCentralWidget(new SearchWindow(parent));

}
/**
 * Methode (Slot) qui va mettre a jour les infos du produit
 * (creation d'un nouveau produit ou mise a jour du produit)
 */
void NewProductWindow::validateProduct(){
    if(idProduct==-1){
        // creation d'un nouveau produit
        Product p;
        p.name=name->text();
        p.description=description->text();
        p.price=price->value();
        p.save();
    }
    else{
        // mise a jour d'un produit
        Product p(idProduct);
        p.name=name->text();
        p.description=description->text();
        p.price=price->value();
        p.save();
        p.updateDocumentPrice();
    }

    QStatusBar *statBar = parent->statusBar();
    statBar->showMessage(trUtf8("Informations produit sauvegardé"), 4000);
    clean();
}
Beispiel #15
0
void QgsSelectedFeature::addError( QgsGeometry::Error e )
{
  mGeomErrors << e;
  if ( !mTip.isEmpty() )
    mTip += "\n";
  mTip += e.what();

  if ( e.hasWhere() )
  {
    QgsVertexMarker *marker = new QgsVertexMarker( mCanvas );
    marker->setCenter( mCanvas->mapRenderer()->layerToMapCoordinates( mVlayer, e.where() ) );
    marker->setIconType( QgsVertexMarker::ICON_X );
    marker->setColor( Qt::green );
    marker->setZValue( marker->zValue() + 1 );
    marker->setPenWidth( 2 );
    marker->setToolTip( e.what() );
    mGeomErrorMarkers << marker;
  }

  QStatusBar *sb = QgisApp::instance()->statusBar();
  sb->showMessage( e.what() );
  sb->setToolTip( mTip );
}
Beispiel #16
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    setWindowFlags(Qt::WindowCloseButtonHint);
    ui->setupUi(this);
    QStatusBar *statusBar = this->statusBar();
    QLabel *mode = new QLabel( tr("  Time  ") );
    mode->setMinimumSize( mode->sizeHint() );
    mode->setAlignment( Qt::AlignCenter );
    mode->setText( tr("Ready") );
    mode->setToolTip( tr("The current working mode.") );
    statusBar->addPermanentWidget( mode );

    connect(ui->tableWidget_resultat,SIGNAL(clicked(QModelIndex)),this,SLOT(modifierPatient(QModelIndex)));
    connect(ui->lineEdit_search,SIGNAL(editingFinished()),this,SLOT(on_btn_search_clicked()));

    this->setWidget();
    this->afficherRess();
    this->on_btn_search_clicked();

    statusBar->showMessage( tr("Ready!!"));
}
Beispiel #17
0
void MainWindow::RedrawEverything(bool bFound)
{
    int ret, transmitting;
    char cpuid[32];
    char rev[32];
    QStatusBar *status = statusBar();
    qDebug() << __FUNCTION__;
    fmtxEEPROMInfoClean();

    liveEditingEnabled=false;
    querier->is_ready=false;
    deviceStatus=bFound;

    toggleConnection(bFound, false);
    if(!bFound) {
        querier->is_ready=ui->checkBox_sw_autoconnect->isChecked();
        if(!ui->checkBox_sw_autoconnect->isChecked())
            querier->timer.stop();
        qDebug() << "frontend flagged as" << bFound << " returning.";
        if(!is_normal || !this->isVisible())
            trayIcon->showMessage(tr("FmStick disconnected"),
                        tr("Device disconnected!"),
                        QSystemTrayIcon::Information, 5 * 1000);
        return;
    }

    status->showMessage(tr("(Re)Reading frontend info..."), 10000);
    status->show();

    cpuid[0] = '\0';
    rev[0] = '\0';
    querier->HidAccessMutex.lock();
    ret = fmtxIoAppIdString(cpuid, rev);
    querier->HidAccessMutex.unlock();
    if(ret!=FMTX_MODE_OK) {
        qDebug() << "can't get id string";
        goto redraw_err;
    }
    qDebug() << "got CPU ID: "<<QString(cpuid)<<" rev.:"<<QString(rev);
    ui->lineEdit_hw_id_cpuid->setText(QString(cpuid));
    ui->lineEdit_hw_id_cpufwid->setText(QString(rev));


    status->showMessage(tr("Reading EEPROM..."), 10000);
    status->show();
    qDebug() << "Reading EEPROM...";
    querier->HidAccessMutex.lock();
    fmtxCmdSpecial = FMTX_SPECIAL_EEPROM;   ///< now work with eeprom instead of frontend
    ret=fmtxEEPROMReadConfig();
    fmtxCmdSpecial = FMTX_SPECIAL_FRONTEND;
    querier->HidAccessMutex.unlock();

    ui->checkBox_hw_run_txAtPowerUp->blockSignals(true);
    ui->checkBox_hw_run_txAtPowerUp->setChecked(fmtxEEPROMGetStartupFlag());
    ui->checkBox_hw_run_txAtPowerUp->blockSignals(false);

    if(ret==FMTX_MODE_POWER_DOWN) {
        qDebug() << "EEPROM is empty yet!";
    } else if(ret!=FMTX_MODE_OK) {
        qDebug() << "Can't read EEPROM";
        goto redraw_err;
    }
    qDebug() << "EEPROM Readed..";


    transmitting = 0;
    querier->HidAccessMutex.lock();
    ret = fmtxIoAppFeGetMode(&transmitting);
    querier->HidAccessMutex.unlock();
    qDebug() << "Frontend mode: " << ret << "transmitting: " << transmitting;
    if(ret == FMTX_MODE_POWER_DOWN){
        qDebug() << "Frontend powered down!";
        ret = SetFrontendPowerUp();
    }

    if(ret!=FMTX_MODE_POWER_UP && ret!=FMTX_MODE_TRANSMITTING) {
        qDebug() << "Frontend not found..";
        SetTransmitIcon(ICON_WARN);
        goto redraw_err;
    }

    if(transmitting) {
        qDebug() << "Already transmitting!";
        SetTransmitIcon(ICON_TX);
    }

    /* needed to detect if hardware supports rds */
    querier->HidAccessMutex.lock();
    DisplayFirmwareInfo();
    querier->HidAccessMutex.unlock();
    if(fmtxCmdStatus!=FMTX_MODE_OK)
        goto redraw_err;

    if(ui->checkBox_rewriteCfg->isChecked()) {
        qDebug() << "Forcing configuration from software, instead of hardware!";
        status->showMessage("Writing running config...", 10000);
        status->show();
        if(SetFrontendParams()!=FMTX_MODE_OK)
            goto redraw_err;
        //hack for digital audio
        if(! SetDigitalAudioHack())
                goto redraw_err;
    }

    status->showMessage(tr("Reading running config..."), 10000);
    status->show();
    querier->HidAccessMutex.lock();
    ret=GetFrontendParams();
    querier->HidAccessMutex.unlock();

    if(ret!=FMTX_MODE_OK)
        goto redraw_err;

    liveEditingEnabled=ui->checkBox_sw_live_edit->isChecked();
    statusBar()->hide();
    this->adjustSize();
    this->resize(1,1);
    this->updateGeometry();
    querier->is_ready=true;

    qDebug() << "Redraw everything done! transmitting: " << transmitting;
    if(!is_normal || !this->isVisible())
        trayIcon->showMessage(tr("FmStick connected"),
                    tr("Device found and connected!%1")
                              .arg( transmitting ? tr("\nAnd transmitter is powered on!") : ""),
                    QSystemTrayIcon::Information, 5 * 1000);
    return;

redraw_err:
    if(!is_normal || !this->isVisible())
        trayIcon->showMessage(tr("FmStick not connected"), tr("Can't connect to frontend!"),
                          QSystemTrayIcon::Critical, 5 * 1000);
    status->showMessage(tr("Can't connect to frontend!"), 10000);
    status->show();
    qDebug() << "Error while redraw everything";
    querier->is_ready=true;
    SetTransmitIcon(ICON_ERR);
}
Beispiel #18
0
void MainWindow::createStatusBar()
{
    QStatusBar *bar = this->statusBar();
    bar->showMessage(tr("Ready."));
}
Beispiel #19
0
void YUKON_GUI::status(char * texto = NULL) {
    QStatusBar * sb = window->statusBar();

    sb->showMessage(texto);
}
Beispiel #20
0
void QgsSelectedFeature::validationFinished()
{
  QStatusBar *sb = QgisApp::instance()->statusBar();
  sb->showMessage( tr( "Validation finished (%n error(s) found).", "number of geometry errors", mGeomErrorMarkers.size() ) );
}
Beispiel #21
0
void
MainWindow::onProcStdoutReady() {

    // NOTE: We read both channels stdout and stderr.

    char data[1024];
    memset(&data, 0, sizeof(data));

    QStatusBar *sb = statusBar();
    bool appendLogFlag = true;

    while (process.readLine(data, sizeof(data))) {

        appendLogFlag = true;
        
        QString ln = QString::fromLocal8Bit(data);
        ln.remove("\n");

        if (ln.startsWith("fetch http://")) {
            sb->showMessage( tr("Fetching ...") );
            totalProgressbar->setValue( totalProgressbar->value()+1 );
        }

        else if (ln.startsWith("verify"))
            sb->showMessage( tr("Verifying link ...") );

        else if (ln.startsWith("file:")) {
            QRegExp re("file: (.*)  (\\d+.\\d+)M");
            re.indexIn(ln);
            fileLabel->setText( re.capturedTexts()[1].simplified() );
            sb->showMessage( tr("Downloading video ...") );
        }

        else if (ln.startsWith("error:")) {
            // Log it.
        }

        else {

            appendLogFlag = false;

            // In some parallel world I have written a cleaner regexp.
            static const char progress_re[] =
                "(\\d+)%" // percent 
                "\\s+(\\d+)\\.(\\d+)M\\s+\\/\\s+(\\d+)\\.(\\d+)M" // xxM / yyM
                "\\s+(\\d+)\\.(\\d+)(\\w)\\/\\w" // speed
                "\\s+(.*)"; // eta

            QRegExp re(progress_re);

            if (re.indexIn(ln)) {
                QStringList cap = re.capturedTexts();

                cap.removeFirst();

                if (cap[0].isEmpty())
                    continue;

                //qDebug() << cap;

                enum {
                    PERCENT = 0,
                    SIZE_NOW_X,
                    SIZE_NOW_Y,
                    SIZE_EXPECTED_X,
                    SIZE_EXPECTED_Y,
                    SPEED_X,
                    SPEED_Y,
                    SPEED_TYPE,
                    ETA,
                };

                progressBar ->setValue( cap[PERCENT].toInt() );

                sizeLabel   ->setText(QString("%1.%2M / %3.%4M")
                    .arg(cap[SIZE_NOW_X])
                    .arg(cap[SIZE_NOW_Y])
                    .arg(cap[SIZE_EXPECTED_X])
                    .arg(cap[SIZE_EXPECTED_Y]));

                rateLabel   ->setText(QString("%1.%2%3/s")
                    .arg(cap[SPEED_X])
                    .arg(cap[SPEED_Y])
                    .arg(cap[SPEED_TYPE]));

                etaLabel    ->setText(cap[ETA].simplified());
            }
        }

        if (appendLogFlag)
            Util::appendLog(logEdit, ln);

        memset(&data, 0, sizeof(data));
    }
}
BackgroundWidget::BackgroundWidget(QWidget *parent) :
    QWidget(parent)
{

    this->setWindowTitle("Background");
    this->setWindowIcon(QIcon(":/resources/icons/resources/background.png"));

    zoomInAction = new QAction(QIcon(":/icons/actions/zoom-in.png"), "Zoom In", NULL);
    connect(zoomInAction, SIGNAL(triggered()), this, SLOT(zoomIn()));
    zoomOutAction = new QAction(QIcon(":/icons/actions/zoom-out.png"), "Zoom Out", NULL);
    connect(zoomOutAction, SIGNAL(triggered()), this, SLOT(zoomOut()));
    QAction* openAction = new QAction(QIcon(":/icons/actions/open.png"), "Load from file", NULL);
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
    QAction* saveAction = new QAction(QIcon(":/icons/actions/save.png"), "Save to file", NULL);
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
    QAction* printAction = new QAction(QIcon(":/icons/actions/print.png"), "Print", NULL);
    connect(printAction, SIGNAL(triggered()), this, SLOT(print()));

    QVBoxLayout* propertiesLayout = new QVBoxLayout();

    QLabel* nameLabel = new QLabel("Name: ");
    QLineEdit* nameEdit = new QLineEdit("bg_0", this);

    QToolBar* toolBar = new QToolBar();
    toolBar->addAction(QIcon(":/icons/actions/accept.png"), "Save Changes");
    toolBar->addAction(openAction);
    toolBar->addAction(saveAction);
    toolBar->addAction(printAction);

    toolBar->addSeparator();
    toolBar->addAction(zoomInAction);
    toolBar->addAction(zoomOutAction);
    toolBar->addSeparator();
    toolBar->addWidget(nameLabel);
    toolBar->addWidget(nameEdit);

    toolBar->setStyleSheet(" QToolBar { height: 18px; width: 18px; icon-size: 18px; } ");

    QCheckBox* smoothCheckBox = new QCheckBox("Smooth", this);
    QCheckBox* transparentCheckBox = new QCheckBox("Transparent", this);
    QCheckBox* preloadCheckBox = new QCheckBox("Preload", this);
    QCheckBox* tilesetCheckBox = new QCheckBox("Tileset", this);

    imageLabel = new QLabel;
    imageLabel->setBackgroundRole(QPalette::Base);
    imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    imageLabel->setScaledContents(true);


    scrollArea = new QScrollArea;
    scrollArea->setBackgroundRole(QPalette::Dark);
    scrollArea->setWidget(imageLabel);
    scrollArea->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

    propertiesLayout->addWidget(smoothCheckBox);
    propertiesLayout->addWidget(transparentCheckBox);
    propertiesLayout->addWidget(preloadCheckBox);
    propertiesLayout->addWidget(tilesetCheckBox);
    QSplitter* horizontalSplitter = new QSplitter(this);
    QWidget* propertiesWidget = new QWidget(this, Qt::WindowTitleHint);
    QFormLayout* propertiesFormLayout = new QFormLayout();
    propertiesFormLayout->setLayout(0, QFormLayout::SpanningRole, propertiesLayout);
    propertiesWidget->setLayout(propertiesFormLayout);

    horizontalSplitter->addWidget(propertiesWidget);
    horizontalSplitter->addWidget(scrollArea);
    horizontalSplitter->setStretchFactor(0, 0);
    horizontalSplitter->setStretchFactor(1, 1);

    QVBoxLayout* verticalLayout = new QVBoxLayout();
    verticalLayout->addWidget(toolBar);
    verticalLayout->addWidget(horizontalSplitter);
    QStatusBar* statusBar = new QStatusBar();
    statusBar->showMessage("Width: 0 | Height: 0 | Memory: 0 B | Zoom: 100%");
    statusBar->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
    verticalLayout->addWidget(statusBar);
    verticalLayout->setContentsMargins(2, 2, 2, 2);
    this->setLayout(verticalLayout);
}
Beispiel #23
0
/* TextEdit */
TextEdit::TextEdit(QWidget *parent)
    : QMainWindow(parent)
{
    setIconSize(QSize(16, 16));
    setToolButtonStyle(Qt::ToolButtonFollowStyle);
    setupFileActions();
    setupEditActions();
    setupViewActions();
    setupTextActions();

    QStatusBar *pStatusBar = statusBar();
    pStatusBar->showMessage(tr("Ready"));

    {
        QMenu *helpMenu = new QMenu(tr("Help"), this);
        menuBar()->addMenu(helpMenu);
        helpMenu->addAction(tr("About"), this, SLOT(about()));
    }

    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();

    QRect geom = QApplication::desktop()->availableGeometry();
    resize( 2 * geom.width() / 3, 2 * geom.height() / 3 );
}
Beispiel #24
0
MainWindow::MainWindow(QWidget *parent,Qt::WindowFlags flags):QMainWindow(parent,flags){
	
	setAcceptDrops(true);	// 讓拖曳可以實現
	
	this->setWindowTitle("HiTSim");

	// 建立主畫面
	CentralWidget *centralwidget = new CentralWidget(this);

	this->setCentralWidget(centralwidget);

	// 建立工具列 - start
	// 建立工具列 - 建立第一個選單項目File - start
	QMenu *fileMenu = new QMenu("&File",this);
	QAction *fileAction = new QAction("Open..",fileMenu);
	fileAction->setEnabled(false);
	// 快捷鍵 Ctrl+O:當焦點在選單時,ctrl+o才會有效果,且下面兩行在一起才會有效果
	fileAction->setShortcut(Qt::CTRL + Qt::Key_O);
	fileMenu->addAction(fileAction);
	
	fileAction = new QAction("Save",fileMenu);
	fileAction->setEnabled(false);
	fileMenu->addAction(fileAction);

	// 快捷鍵 Ctrl+X,動作連接至 QApplication 的 quit()

	// 建立分格線
	fileMenu->addSeparator();
	
	fileMenu->addAction("Close",this,SLOT(close()),Qt::CTRL + Qt::Key_X);
	// 把建立好的選單加入主畫面中
	this->menuBar()->addMenu(fileMenu);
	// 建立工具列 - 建立第一個選單項目File - end
	// 建立工具列 - 建立第二個選單項目About - start
	QMenu *aboutMenu = new QMenu("&About");
	aboutMenu->addAction("About Qt",this,SLOT(aboutQt()));
	aboutMenu->addAction("About HiTSim",this,SLOT(aboutHiTSim()));
	this->menuBar()->addMenu(aboutMenu);
	// 建立工具列 - 建立第二個選單項目About - end
	// 建立建立工具列 - end
	
	// 建立工具列 - start
	QToolBar *toolBar = new QToolBar("QToolBar");
	QAction *toolBarAction = new QAction(QIcon(":open.png"),"open",toolBar);
	toolBarAction->setEnabled(false);	// 設定成按扭不能按,因為,還沒有功能
	toolBar->addAction(toolBarAction);
	toolBarAction = new QAction(QIcon(":icon_save"),"save",toolBar);
	toolBarAction->setEnabled(false);	// 設定成不能按,因為功能還沒有做好
	toolBar->addAction(toolBarAction);
	toolBar->addAction(QIcon(":/icon_clock.jpg"),"addCar",centralwidget,SLOT(addCar()));
	toolBar->addSeparator();
	toolBar->addAction(QIcon(":/icon_close.jpg"),"close",this,SLOT(close()));
	this->addToolBar(toolBar);
	// 建立工具列 - end
	
	// 建立狀態列 - start
	QStatusBar *statusBar = this->statusBar();
	statusBar->showMessage("Status here...");
	// 建立狀態列 - end
	
	// 建立停駐元件 - start
	QDockWidget *dockWidget = new QDockWidget("QDockWidget");
	QLabel *label = new QLabel(dockWidget);
	label->setPixmap(QPixmap(":/caterpillar.jpg"));
	dockWidget->setWidget(label);

	this->addDockWidget(Qt::RightDockWidgetArea,dockWidget);
	// 建立停駐元件 - end
	
	// 設定最大化 - start
	showMaximized();
	// 設定最大化 - end
}
void QgsMapToolCapture::validationFinished()
{
  QStatusBar *sb = QgisApp::instance()->statusBar();
  sb->showMessage( tr( "Validation finished." ) );
}
Beispiel #26
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{

    // set working dir to executable work directory
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    QString resDir = ResourceFinder::getPath();
    
    //chess::FuncT *f = new chess::FuncT();
    //f->run_pgn_speedtest();
    //f->run_polyglot();
    /*
    f->run_pgnt();
    f->run_pgn_scant();
    */

    // reconstruct gameModel
    this->gameModel = new GameModel();
    this->gameModel->restoreGameState();
    this->gameModel->getGame()->setTreeWasChanged(true);

    this->boardViewController = new BoardViewController(gameModel, this);
    this->moveViewController = new MoveViewController(gameModel, this);
    this->moveViewController->setFocus();
    this->engineViewController = new EngineView(gameModel, this);
    engineViewController->setFocusPolicy(Qt::NoFocus);
    moveViewController->setFocusPolicy(Qt::ClickFocus);

    this->name = new QLabel();
    name->setText("<b>Robert James Fisher - Reuben Fine</b><br/>New York(USA) 1963.03.??");
    name->setAlignment(Qt::AlignCenter);
    name->setBuddy(moveViewController);

    QHBoxLayout *hbox_name_editHeader = new QHBoxLayout();
    QPushButton *editHeader = new QPushButton();
    QPixmap pxEditHeader(*this->fromSvgToPixmap(editHeader->iconSize(),resDir + "/res/icons/document-properties.svg"));
    editHeader->setIcon(QIcon(pxEditHeader));

    hbox_name_editHeader->addStretch(1);
    hbox_name_editHeader->addWidget(this->name);
    hbox_name_editHeader->addStretch(1);
    hbox_name_editHeader->addWidget(editHeader);

    this->uciController     = new UciController();
    this->modeController    = new ModeController(gameModel, uciController, this);
    this->editController    = new EditController(gameModel, this);
    this->fileController    = new FileController(gameModel, this);

    QSize btnSize           = QSize(this->height()/19, this->height()/19);
    QSize btnSizeLR         = QSize(this->height()/14, this->height()/14);
    QPushButton *left       = new QPushButton();
    QPushButton *right      = new QPushButton();
    QPushButton *beginning  = new QPushButton();
    QPushButton *end        = new QPushButton();

    left->setIconSize(btnSizeLR);
    right->setIconSize(btnSizeLR);
    beginning->setIconSize(btnSize);
    end->setIconSize(btnSize);

    QPixmap pxRight(*this->fromSvgToPixmap(right->iconSize(),resDir + "/res/icons/go-next.svg"));
    QPixmap pxLeft(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-previous.svg"));
    QPixmap pxBeginning(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-first.svg"));
    QPixmap pxEnd(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-last.svg"));

    right->setIcon(QIcon(pxRight));
    left->setIcon(QIcon(pxLeft));
    beginning->setIcon(QIcon(pxBeginning));
    end->setIcon(QIcon(pxEnd));

    QWidget *mainWidget = new QWidget();

    // setup the main window
    // consisting of:
    //
    // <-------menubar---------------------------->
    // <chess-     ->   <label w/ game data      ->
    // <board      ->   <moves_edit_view---------->
    // <view       ->   <engine output view      ->


    QSizePolicy *spLeft = new QSizePolicy();
    spLeft->setHorizontalStretch(1);

    QSizePolicy *spRight = new QSizePolicy();
    spRight->setHorizontalStretch(2);

    QHBoxLayout *hbox_buttons = new QHBoxLayout();
    hbox_buttons->addStretch(1);
    hbox_buttons->addWidget(beginning);
    hbox_buttons->addWidget(left);
    hbox_buttons->addWidget(right);
    hbox_buttons->addWidget(end);
    hbox_buttons->addStretch(1);

    QHBoxLayout *hbox_right_engine_buttons = new QHBoxLayout();

    this->pbEngineOnOff = new OnOffButton(this); //new QPushButton("OFF");
    this->lblMultiPv    = new QLabel(this->tr("Lines:"), this);
    this->spinMultiPv   = new QSpinBox(this);
    this->spinMultiPv->setRange(1,4);
    this->spinMultiPv->setValue(1);
    this->lblMultiPv->setBuddy(this->spinMultiPv);

    QPushButton *editEngines = new QPushButton();
    QPixmap pxEditEngines(*this->fromSvgToPixmap(editEngines->iconSize(),resDir + "/res/icons/document-properties.svg"));
    editEngines->setIcon(QIcon(pxEditEngines));

    hbox_right_engine_buttons->addWidget(pbEngineOnOff);
    hbox_right_engine_buttons->addWidget(this->lblMultiPv);
    hbox_right_engine_buttons->addWidget(this->spinMultiPv);
    hbox_right_engine_buttons->addStretch(1);
    hbox_right_engine_buttons->addWidget(editEngines);

    QVBoxLayout *vbox_right = new QVBoxLayout();
    vbox_right->addLayout(hbox_name_editHeader);
    vbox_right->addWidget(moveViewController);
    vbox_right->addLayout(hbox_buttons);

    vbox_right->setStretch(0,1);
    vbox_right->setStretch(1,4);
    vbox_right->setStretch(2,1);

    QVBoxLayout *vbox_left = new QVBoxLayout();
    vbox_left->addWidget(boardViewController);

    QWidget *lHboxWidget = new QWidget(this);
    lHboxWidget->setLayout(vbox_left);
    QWidget *rHboxWidget = new QWidget(this);
    rHboxWidget->setLayout(vbox_right);
    this->splitterLeftRight = new QSplitter(this);
    splitterLeftRight->addWidget(lHboxWidget);
    splitterLeftRight->addWidget(rHboxWidget);

    QSplitterHandle *handleLeftRight = splitterLeftRight->handle(1);
    QHBoxLayout *layoutSplitterLeftRight = new QHBoxLayout(handleLeftRight);
    layoutSplitterLeftRight->setSpacing(0);
    layoutSplitterLeftRight->setMargin(0);

    QFrame *frameLeftRight = new QFrame(handleLeftRight);
    frameLeftRight->setFrameShape(QFrame::VLine);
    frameLeftRight->setFrameShadow(QFrame::Sunken);
    layoutSplitterLeftRight->addWidget(frameLeftRight);


    this->splitterTopDown = new QSplitter(this);
    splitterTopDown->addWidget(splitterLeftRight);
    splitterTopDown->setOrientation(Qt::Vertical);

    QVBoxLayout *completeLayout = new QVBoxLayout();
    completeLayout->addLayout(hbox_right_engine_buttons);
    completeLayout->addWidget(engineViewController);
    QWidget* bottomWidget = new QWidget(this);
    bottomWidget->setLayout(completeLayout);
    splitterTopDown->addWidget(bottomWidget);

    QHBoxLayout *completeLayoutWithSplitter = new QHBoxLayout();
    completeLayoutWithSplitter->addWidget(splitterTopDown);

    QSplitterHandle *handleTopDown = splitterTopDown->handle(1);
    QHBoxLayout *layoutSplitterTopDown = new QHBoxLayout(handleTopDown);
    layoutSplitterTopDown->setSpacing(0);
    layoutSplitterTopDown->setMargin(0);

    QFrame *frameTopDown = new QFrame(handleTopDown);
    frameTopDown->setFrameShape(QFrame::HLine);
    frameTopDown->setFrameShadow(QFrame::Sunken);
    layoutSplitterTopDown->addWidget(frameTopDown);


    QMenu *m_game = this->menuBar()->addMenu(this->tr("Game"));
    QAction* actionNewGame = m_game->addAction(this->tr("New..."));
    QAction* actionOpen = m_game->addAction(this->tr("Open File"));
    QAction* actionSaveAs =  m_game->addAction("Save Current Game As");
    m_game->addSeparator();
    QAction* actionPrintGame = m_game->addAction(this->tr("Print Game"));
    QAction* actionPrintPosition = m_game->addAction(this->tr("Print Position"));
    QAction *save_diagram = m_game->addAction(this->tr("Save Position as Image..."));
    m_game->addSeparator();
    QAction *actionQuit = m_game->addAction(this->tr("Quit"));

    actionNewGame->setShortcut(QKeySequence::New);
    actionOpen->setShortcut(QKeySequence::Open);
    //save_game->setShortcut(QKeySequence::Save);
    actionSaveAs->setShortcut(QKeySequence::SaveAs);
    actionPrintGame->setShortcut(QKeySequence::Print);
    actionQuit->setShortcut(QKeySequence::Quit);

    // EDIT MENU
    QMenu *m_edit = this->menuBar()->addMenu(this->tr("Edit"));
    QAction *actionCopyGame = m_edit->addAction(this->tr("Copy Game"));
    QAction *actionCopyPosition = m_edit->addAction(this->tr("Copy Position"));
    QAction *actionPaste = m_edit->addAction(this->tr("Paste"));
    m_edit->addSeparator();
    QAction *actionEditGameData = m_edit->addAction(this->tr("Edit Game Data"));
    QAction *actionEnterPosition = m_edit->addAction(this->tr("&Enter Position"));
    m_edit->addSeparator();
    QAction *actionFlipBoard = m_edit->addAction(this->tr("&Flip Board"));
    this->actionShowSearchInfo = m_edit->addAction(this->tr("Show Search &Info"));
    QAction *actionColorStyle = m_edit->addAction(this->tr("Color Style..."));
    QAction *actionResetLayout = m_edit->addAction(this->tr("Reset Layout"));
    actionCopyGame->setShortcut(QKeySequence::Copy);
    actionPaste->setShortcut(QKeySequence::Paste);
    actionEnterPosition->setShortcut('e');
    actionFlipBoard->setCheckable(true);
    actionFlipBoard->setChecked(false);
    actionShowSearchInfo->setCheckable(true);
    actionShowSearchInfo->setChecked(true);

    // MODE MENU
    QMenu *m_mode = this->menuBar()->addMenu(this->tr("Mode"));
    QActionGroup *mode_actions = new QActionGroup(this);
    this->actionAnalysis = mode_actions->addAction(this->tr("&Analysis Mode"));
    this->actionPlayWhite = mode_actions->addAction(this->tr("Play as &White"));
    this->actionPlayBlack = mode_actions->addAction(this->tr("Play as &Black"));
    this->actionEnterMoves = mode_actions->addAction(this->tr("Enter &Moves"));
    actionAnalysis->setCheckable(true);
    actionPlayWhite->setCheckable(true);
    actionPlayBlack->setCheckable(true);
    actionEnterMoves->setCheckable(true);
    mode_actions->setExclusive(true);
    m_mode->addAction(actionAnalysis);
    m_mode->addAction(actionPlayWhite);
    m_mode->addAction(actionPlayBlack);
    m_mode->addAction(actionEnterMoves);
    m_mode->addSeparator();
    QAction* actionFullGameAnalysis = m_mode->addAction(this->tr("Full Game Analysis"));
    QAction* actionEnginePlayout = m_mode->addAction(this->tr("Playout Position"));
    m_mode->addSeparator();
    QAction *actionSetEngines = m_mode->addAction(this->tr("Engines..."));
    QShortcut *sc_analysis_mode = new QShortcut(QKeySequence(Qt::Key_A), this);
    sc_analysis_mode->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_play_white = new QShortcut(QKeySequence(Qt::Key_W), this);
    sc_play_white->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_play_black = new QShortcut(QKeySequence(Qt::Key_B), this);
    sc_play_black->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_enter_move_mode_m = new QShortcut(QKeySequence(Qt::Key_M), this);
    QShortcut *sc_enter_move_mode_esc = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    sc_enter_move_mode_m->setContext(Qt::ApplicationShortcut);
    sc_enter_move_mode_esc->setContext(Qt::ApplicationShortcut);

    // DATABASE MENU
    QMenu *m_database = this->menuBar()->addMenu(this->tr("Database"));
    QAction* actionDatabaseWindow = m_database->addAction(this->tr("Browse Games"));
    QAction* actionLoadNextGame = m_database->addAction(this->tr("Next Game"));
    QAction* actionLoadPreviousGame = m_database->addAction(this->tr("Previous Game"));

    // HELP MENU
    QMenu *m_help = this->menuBar()->addMenu(this->tr("Help "));
    QAction *actionAbout = m_help->addAction(this->tr("About"));
    QAction *actionHomepage = m_help->addAction(this->tr("Jerry-Homepage"));


    // TOOLBAR
    this->toolbar = addToolBar("main toolbar");
    this->toolbar->setMovable(false);
    //this->toolbar->setFixedHeight(72);
    //this->toolbar->setIconSize(QSize(72,72));
    QSize iconSize = toolbar->iconSize() * this->devicePixelRatio();
    toolbar->setIconSize(iconSize);
    if(SHOW_ICON_TEXT) {
        toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    }
    QString doc_new(resDir + "/res/icons/document-new.svg");
    QPixmap *tbNew = this->fromSvgToPixmap(iconSize,doc_new);
    QAction *tbActionNew = toolbar->addAction(QIcon(*tbNew), this->tr("New"));

    QString doc_open(resDir + "/res/icons/document-open.svg");
    QPixmap *tbOpen = this->fromSvgToPixmap(iconSize, doc_open);
    QAction *tbActionOpen = toolbar->addAction(QIcon(*tbOpen), this->tr("Open"));

    QString doc_save(resDir + "/res/icons/document-save.svg");
    QPixmap *tbSaveAs = this->fromSvgToPixmap(iconSize, doc_save);
    QAction *tbActionSaveAs = toolbar->addAction(QIcon(*tbSaveAs), this->tr("Save As"));

    QString doc_print(resDir + "/res/icons/document-print.svg");
    QPixmap *tbPrint = this->fromSvgToPixmap(iconSize, doc_print);
    QAction *tbActionPrint = toolbar->addAction(QIcon(*tbPrint), this->tr("Print"));

    toolbar->addSeparator();

    QString view_ref(resDir + "/res/icons/view-refresh.svg");
    QPixmap *tbFlip = this->fromSvgToPixmap(iconSize, view_ref);
    QAction *tbActionFlip = toolbar->addAction(QIcon(*tbFlip), this->tr("Flip Board"));

    toolbar->addSeparator();

    QString edt_cpy(resDir + "/res/icons/edit-copy-pgn.svg");
    QPixmap *tbCopyGame = this->fromSvgToPixmap(iconSize, edt_cpy);
    QAction *tbActionCopyGame = toolbar->addAction(QIcon(*tbCopyGame), this->tr("Copy Game"));

    QString cpy_fen(resDir + "/res/icons/edit-copy-fen.svg");
    QPixmap *tbCopyPosition = this->fromSvgToPixmap(iconSize, cpy_fen);
    QAction *tbActionCopyPosition = toolbar->addAction(QIcon(*tbCopyPosition), this->tr("Copy Position"));

    QString edt_pst(resDir + "/res/icons/edit-paste.svg");
    QPixmap *tbPaste = this->fromSvgToPixmap(iconSize, edt_pst);
    QAction *tbActionPaste = toolbar->addAction(QIcon(*tbPaste), this->tr("Paste"));

    QString new_brd(resDir + "/res/icons/document-enter-position.svg");
    QPixmap *tbEnterPosition = this->fromSvgToPixmap(iconSize, new_brd);
    QAction *tbActionEnterPosition = toolbar->addAction(QIcon(*tbEnterPosition), this->tr("Enter Position"));

    toolbar->addSeparator();

    QString brd_ana(resDir + "/res/icons/emblem-system.svg");
    QPixmap *tbAnalysis = this->fromSvgToPixmap(iconSize, brd_ana);
    QAction *tbActionAnalysis = toolbar->addAction(QIcon(*tbAnalysis), this->tr("Full Analysis"));

    toolbar->addSeparator();

    QString db_icn(resDir + "/res/icons/database.svg");
    QPixmap *tbDatabase = this->fromSvgToPixmap(iconSize, db_icn);
    QAction *tbActionDatabase = toolbar->addAction(QIcon(*tbDatabase), this->tr("Browse Games"));

    QString prevGame_icn(resDir + "/res/icons/go-previous.svg");
    QPixmap *tbPrevGame = this->fromSvgToPixmap(iconSize, prevGame_icn);
    QAction *tbActionPrevGame = toolbar->addAction(QIcon(*tbPrevGame), this->tr("Prev. Game"));

    QString nextGame_icn(resDir + "/res/icons/go-next.svg");
    QPixmap *tbNextGame = this->fromSvgToPixmap(iconSize, nextGame_icn);
    QAction *tbActionNextGame = toolbar->addAction(QIcon(*tbNextGame), this->tr("Next Game"));

    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    toolbar->addWidget(spacer);

    QString hlp_clc(resDir + "/res/icons/help-browser.svg");
    QPixmap *tbHelp = this->fromSvgToPixmap(iconSize, hlp_clc);
    QAction *tbActionHelp = toolbar->addAction(QIcon(*tbHelp), this->tr("About"));

    // toolbar shortcuts
    QShortcut *sc_flip = new QShortcut(QKeySequence(Qt::Key_F), this);
    sc_flip->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_enter_pos = new QShortcut(QKeySequence(Qt::Key_E), this);
    sc_enter_pos->setContext(Qt::ApplicationShortcut);


    /*
    // FILE
    // Game
    QAction* actionNewGame = this->createAction("document-new", this->tr("New Game"), iconSize);
    QAction* actionOpen = this->createAction("document-open", this->tr("Open File"), iconSize);
    QAction* actionSaveAs = this->createAction("document-save", this->tr("Save Current\nGame As"), iconSize);
    // Print
    QAction* actionPrintGame = this->createAction("document-print", this->tr("Print Game"), iconSize);
    QAction* actionPrintPosition = this->createAction("document-print-board", this->tr("Print Position"), iconSize);
    // Layout
    QAction* actionColorStyle = this->createAction("applications-graphics", this->tr("Board Style"), iconSize);
    QAction* actionResetLayout = this->createAction("preferences-system-session", this->tr("Reset Layout"), iconSize);
    // Quit
    QAction* actionQuit = this->createAction("system-log-out", this->tr("Exit"), iconSize);
    // Homepage
    QAction* actionHomepage = this->createAction("internet-web-browser", this->tr("Homepage"), iconSize);
    // Help (About)
    QAction* actionAbout = this->createAction("help-browser", this->tr("About"), iconSize);

    // START
    // Game
    QAction* actionPaste = this->createAction("edit-paste", this->tr("Paste\nGame/Position"), iconSize);
    QAction* actionCopyGame = this->createAction("edit-copy-pgn", this->tr("Copy Game"), iconSizeSmall);
    QAction* actionCopyPosition = this->createAction("edit-copy-fen", this->tr("Copy Position"), iconSizeSmall);
    // Edit
    QAction* actionEditGameData = this->createAction("edit-copy-fen", this->tr("Edit\nMeta Data"), iconSize);
    QAction* actionEnterPosition = this->createAction("document-enter-position", this->tr("Setup\nNew Position"), iconSize);
    QAction* actionFlipBoard = this->createAction("view-refresh", this->tr("Flip Board"), iconSize);
    //QAction* actionShowSearchInfo = this->createAction("view-refresh", this->tr("Show\nSearch Info"), iconSize);
    // Mode
    QAction* actionAnalysis = this->createAction("edit-find", this->tr("Infinite\nAnalysis"), iconSize);
    QAction* actionPlayWhite = this->createAction("play-white", this->tr("Play\nWhite"), iconSize);
    QAction* actionPlayBlack = this->createAction("play-black", this->tr("Play\nBlack"), iconSize);
    QAction* actionEnterMoves = this->createAction("text-pencil", this->tr("Enter\nMoves"), iconSize);
    // Analysis
    QAction* actionFullGameAnalysis = this->createAction("edit-find-replace", this->tr("Full\nGame Analysis"), iconSize);
    QAction* actionEnginePlayout = this->createAction("dialog-information", this->tr("Engine\nPlayout"), iconSize);
    // Database
    QAction* actionDatabaseWindow = this->createAction("database", this->tr("Show\nDatabase"), iconSize);
    QAction* actionLoadPreviousGame = this->createAction("go-previous", this->tr("Previous Game"), iconSizeSmall);
    QAction* actionLoadNextGame = this->createAction("go-previous", this->tr("Next Game"), iconSizeSmall);
    */

    mainWidget->setLayout(completeLayoutWithSplitter);

    this->setCentralWidget(mainWidget);
    QStatusBar *statusbar = this->statusBar();
    statusbar->showMessage("");
    this->setContextMenuPolicy(Qt::NoContextMenu);

    // SIGNALS AND SLOTS

    connect(actionNewGame, &QAction::triggered, this->fileController, &FileController::newGame);
    connect(actionOpen, &QAction::triggered, this->fileController, &FileController::openGame);
    connect(actionSaveAs, &QAction::triggered, this->fileController, &FileController::saveAsNewGame);
    connect(actionPrintGame, &QAction::triggered, this->fileController, &FileController::printGame);
    connect(actionPrintPosition, &QAction::triggered, this->fileController, &FileController::printPosition);

    connect(actionColorStyle, &QAction::triggered, modeController, &ModeController::onOptionsClicked);
    connect(actionResetLayout, &QAction::triggered, this, &MainWindow::resetLayout);
    connect(actionQuit, &QAction::triggered, this, &QCoreApplication::quit);
    connect(actionHomepage, &QAction::triggered, this, &MainWindow::goToHomepage);
    connect(actionAbout, &QAction::triggered, this, &MainWindow::showAbout);

    connect(actionPaste, &QAction::triggered, this->editController, &EditController::paste);
    connect(actionCopyGame, &QAction::triggered, this->editController, &EditController::copyGameToClipBoard);
    connect(actionCopyPosition, &QAction::triggered, this->editController, &EditController::copyPositionToClipBoard);

    connect(actionEditGameData, &QAction::triggered, editController, &EditController::editHeaders);
    connect(actionEnterPosition, &QAction::triggered, editController, &EditController::enterPosition);
    connect(actionFlipBoard, &QAction::triggered, this->boardViewController, &BoardViewController::flipBoard);
    //connect(actionShowSearchInfo, &QAction::triggered, this->engineViewController, &EngineView::flipShowEval);

    connect(actionShowSearchInfo, &QAction::triggered, this->engineViewController, &EngineView::flipShowEval);

    connect(actionAnalysis, &QAction::triggered, modeController, &ModeController::onActivateAnalysisMode);
    connect(actionEnterMoves, &QAction::triggered, modeController, &ModeController::onActivateEnterMovesMode);
    connect(actionPlayWhite, &QAction::triggered, modeController, &ModeController::onActivatePlayWhiteMode);
    connect(actionPlayBlack, &QAction::triggered, modeController, &ModeController::onActivatePlayBlackMode);
    connect(actionFullGameAnalysis, &QAction::triggered, modeController, &ModeController::onActivateGameAnalysisMode);
    connect(actionEnginePlayout, &QAction::triggered, modeController, &ModeController::onActivatePlayoutPositionMode);

    connect(actionSetEngines, &QAction::triggered, this->modeController, &ModeController::onSetEnginesClicked);

    connect(actionDatabaseWindow, &QAction::triggered, fileController, &FileController::openDatabase);
    connect(actionLoadNextGame, &QAction::triggered, fileController, &FileController::toolbarNextGameInPGN);
    connect(actionLoadPreviousGame, &QAction::triggered, fileController, &FileController::toolbarPrevGameInPGN);

    // toolbar buttons

    connect(sc_flip, &QShortcut::activated, actionFlipBoard, &QAction::trigger);

    connect(tbActionNew,  &QAction::triggered, actionNewGame, &QAction::trigger);
    connect(tbActionOpen,  &QAction::triggered, actionOpen, &QAction::trigger);
    connect(tbActionSaveAs,  &QAction::triggered, actionSaveAs, &QAction::trigger);
    connect(tbActionPrint,  &QAction::triggered, actionPrintGame, &QAction::trigger);
    connect(tbActionFlip,  &QAction::triggered, actionFlipBoard, &QAction::trigger);
    connect(tbActionCopyGame,  &QAction::triggered, actionCopyGame, &QAction::trigger);
    connect(tbActionCopyPosition,  &QAction::triggered, actionCopyPosition, &QAction::trigger);
    connect(tbActionPaste,  &QAction::triggered, actionPaste, &QAction::trigger);
    connect(tbActionEnterPosition,  &QAction::triggered, actionEnterPosition, &QAction::trigger);
    connect(tbActionAnalysis,  &QAction::triggered, actionFullGameAnalysis, &QAction::trigger);
    connect(tbActionDatabase,  &QAction::triggered, actionDatabaseWindow, &QAction::trigger);
    connect(tbActionPrevGame,  &QAction::triggered, actionLoadPreviousGame, &QAction::trigger);
    connect(tbActionNextGame,  &QAction::triggered, actionLoadNextGame, &QAction::trigger);
    connect(tbActionHelp,  &QAction::triggered, actionAbout, &QAction::trigger);

    // other signals
    connect(gameModel, &GameModel::stateChange, this, &MainWindow::onStateChange);

    connect(gameModel, &GameModel::stateChange, this->boardViewController, &BoardViewController::onStateChange);
    connect(gameModel, &GameModel::stateChange, this->moveViewController, &MoveViewController::onStateChange);
    connect(gameModel, &GameModel::stateChange, this->modeController, &ModeController::onStateChange);

    connect(right, &QPushButton::clicked, this->moveViewController, &MoveViewController::onForwardClick);
    connect(left, &QPushButton::clicked, this->moveViewController, &MoveViewController::onBackwardClick);

    connect(editEngines, &QPushButton::clicked, this->modeController, &ModeController::onSetEnginesClicked);
    connect(pbEngineOnOff, &QPushButton::toggled, this, &MainWindow::onEngineToggle);
    connect(editHeader, &QPushButton::clicked, editController, &EditController::editHeaders);

    //connect(enter_moves, &QAction::triggered, modeController, &ModeController::onActivateEnterMovesMode);

    connect(uciController, &UciController::bestmove, modeController, &ModeController::onBestMove);
    connect(uciController, &UciController::updateInfo, this->engineViewController, &EngineView::onNewInfo);
    connect(uciController, &UciController::bestPv, modeController, &ModeController::onBestPv);
    connect(uciController, &UciController::mateDetected, modeController, &ModeController::onMateDetected);
    connect(uciController, &UciController::eval, modeController, &ModeController::onEval);

    connect(fileController, &FileController::newGameEnterMoves, modeController, &ModeController::onActivateEnterMovesMode);
    connect(fileController, &FileController::newGamePlayBlack, modeController, &ModeController::onActivatePlayBlackMode);
    connect(fileController, &FileController::newGamePlayWhite, modeController, &ModeController::onActivatePlayWhiteMode);   

    connect(beginning, &QPushButton::pressed, this->moveViewController, &MoveViewController::onSeekToBeginning);
    connect(end, &QPushButton::pressed, this->moveViewController, &MoveViewController::onSeekToEnd);

    connect(this->spinMultiPv, qOverload<int>(&QSpinBox::valueChanged), this->modeController, &ModeController::onMultiPVChanged);

    this->gameModel->setMode(MODE_ENTER_MOVES);
    this->actionEnterMoves->setChecked(true);
    gameModel->triggerStateChange();

    this->resetLayout();

}