Example #1
0
/** Trato de instalarla automaticamente el ghostscript*/
void GsRenderEngine::install(){
    QProcess proc;
    QString txt=tr("No se enconcuentra %1. Proceda instalar manualmente").arg(m_strInstaller);

    if (!QFile::exists(m_strInstaller)){
        QMessageBox::information(0,"ERROR",txt,QMessageBox::Ok);
        return;
    }
    proc.start(m_strInstaller);
    if (proc.waitForStarted()){
        if (proc.waitForFinished()){
            txt=tr("Instalado %1").arg(m_strInstaller);
            QMessageBox::information(0,"INFO",txt,QMessageBox::Ok);
            emit SendDebugInfo(LOGGER_DEBUG,txt);
        }
        else{
            txt=tr("No pudo finalizar %1").arg(m_strInstaller);
            QMessageBox::information(0,"ERROR",txt,QMessageBox::Ok);
            emit SendDebugInfo(LOGGER_DEBUG,txt);
        }
    }
    else{
        txt=tr("No pudo iniciarse %1").arg(m_strInstaller);
        QMessageBox::information(0,"ERROR",txt,QMessageBox::Ok);
        emit SendDebugInfo(LOGGER_DEBUG,txt);
    }
}
Example #2
0
void BitcoinGUI::createMenuBar()
{
#ifdef Q_OS_MAC
    // Create a decoupled menu bar on Mac which stays even if the window is closed
    appMenuBar = new QMenuBar();
#else
    // Get the main window's menu bar on other platforms
    appMenuBar = menuBar();
#endif

    // Configure the menus
    QMenu *file = appMenuBar->addMenu(tr("&File"));
    file->addAction(backupWalletAction);
    file->addAction(exportAction);
    file->addAction(signMessageAction);
    file->addAction(verifyMessageAction);
    file->addSeparator();
    file->addAction(quitAction);

    QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
    settings->addAction(encryptWalletAction);
    settings->addAction(changePassphraseAction);
    settings->addAction(lockWalletToggleAction);
    settings->addSeparator();
    settings->addAction(optionsAction);

    QMenu *help = appMenuBar->addMenu(tr("&Help"));
    help->addAction(openRPCConsoleAction);
    help->addSeparator();
    help->addAction(aboutAction);
    help->addAction(aboutQtAction);

	// QString ss("QMenuBar::item { background-color: #ceffee; color: black }"); 
    // appMenuBar->setStyleSheet(ss);
}
Example #3
0
ViewCert::ViewCert(QList<QSslCertificate> cl, QWidget *p) : QDialog(p) {
	qlCerts = cl;

	setWindowTitle(tr("Certificate Chain Details"));

	QHBoxLayout *h;
	QVBoxLayout *v;
	QGroupBox *qcbChain, *qcbDetails;

	qcbChain=new QGroupBox(tr("Certificate chain"), this);
	h = new QHBoxLayout(qcbChain);
	qlwChain = new QListWidget(qcbChain);
	qlwChain->setObjectName(QLatin1String("Chain"));

	foreach(QSslCertificate c, qlCerts)
		qlwChain->addItem(tr("%1 %2").arg(decode_utf8_qssl_string(c.subjectInfo(QSslCertificate::CommonName)), decode_utf8_qssl_string(c.subjectInfo(QSslCertificate::Organization))));
	h->addWidget(qlwChain);

	qcbDetails=new QGroupBox(tr("Certificate details"), this);
	h = new QHBoxLayout(qcbDetails);
	qlwCert = new QListWidget(qcbDetails);
	h->addWidget(qlwCert);

	QDialogButtonBox *qdbb = new QDialogButtonBox(QDialogButtonBox::Ok, Qt::Horizontal, this);

	v = new QVBoxLayout(this);
	v->addWidget(qcbChain);
	v->addWidget(qcbDetails);
	v->addWidget(qdbb);

	QMetaObject::connectSlotsByName(this);
	connect(qdbb, SIGNAL(accepted()), this, SLOT(accept()));

	resize(510,300);
}
Example #4
0
void BitcoinGUI::createMenuBar()
{
#ifdef Q_OS_MAC
    // Create a decoupled menu bar on Mac which stays even if the window is closed
    appMenuBar = new QMenuBar();
#else
    // Get the main window's menu bar on other platforms
    appMenuBar = menuBar();
#endif

    // Configure the menus
    QMenu *file = appMenuBar->addMenu(tr("&File"));
    file->addAction(backupWalletAction);
    file->addAction(signMessageAction);
    file->addAction(verifyMessageAction);
    file->addSeparator();
    file->addAction(quitAction);

    QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
    settings->addAction(encryptWalletAction);
    settings->addAction(changePassphraseAction);
    settings->addSeparator();
    settings->addAction(optionsAction);

    QMenu *help = appMenuBar->addMenu(tr("&Help"));
    help->addAction(openRPCConsoleAction);
    help->addSeparator();
    help->addAction(aboutAction);
    help->addAction(aboutQtAction);
}
Example #5
0
void widget::createSystemTrayIcon()
{
    trayIcon = new QSystemTrayIcon(this);
    trayIcon->setIcon(QIcon(tr(":/images/myIcon.ico")));
    trayIcon->setToolTip("阁楼音乐 - 音乐播放器");

    restoreAction = new QAction(tr("打开主面板"), this);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(show()));

    quitAction=new QAction(tr("退出"), this);
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    trayContextMenu=new QMenu(this);
    playModeMenu->setTitle("播放模式");
    trayContextMenu->addMenu(playModeMenu);
    trayContextMenu->addSeparator();
    trayContextMenu->addAction(ui->action_About);
    trayContextMenu->addSeparator();
    trayContextMenu->addAction(restoreAction);
    trayContextMenu->addAction(quitAction);
    trayIcon->setContextMenu(trayContextMenu);

    trayIcon->show();
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), \
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
}
Example #6
0
void AgrosSolver::solveProblem()
{
    // log stdout
    if (m_enableLog)
        m_log = new LogStdOut();

    QTime time;
    time.start();

    try
    {
        Agros2D::scene()->readFromFile(m_fileName);

        Agros2D::log()->printMessage(tr("Problem"), tr("Problem '%1' successfuly loaded").arg(m_fileName));

        // solve
        Agros2D::problem()->solve(true);
        // save solution
        Agros2D::scene()->writeSolutionToFile(m_fileName);

        Agros2D::log()->printMessage(tr("Solver"), tr("Problem was solved in %1").arg(milisecondsToTime(time.elapsed()).toString("mm:ss.zzz")));

        // clear all
        Agros2D::problem()->clearFieldsAndConfig();

        QApplication::exit(0);
    }
    catch (AgrosException &e)
    {
        Agros2D::log()->printError(tr("Problem"), e.toString());
        QApplication::exit(-1);
    }
}
CaptureFilePropertiesDialog::CaptureFilePropertiesDialog(QWidget &parent, CaptureFile &capture_file) :
    WiresharkDialog(parent, capture_file),
    ui(new Ui::CaptureFilePropertiesDialog)
{
    ui->setupUi(this);

    // XXX Use recent settings instead
    resize(parent.width() * 2 / 3, parent.height());

    QPushButton *button = ui->buttonBox->button(QDialogButtonBox::Reset);
    if (button) {
        button->setText(tr("Refresh"));
    }

    button = ui->buttonBox->button(QDialogButtonBox::Apply);
    if (button) {
        button->setText(tr("Copy To Clipboard"));
    }

    button = ui->buttonBox->button(QDialogButtonBox::Save);
    if (button) {
        button->setText(tr("Save Comments"));
    }

    setWindowSubtitle(tr("Capture File Properties"));
    updateWidgets();
}
void GitoriousRepositoryWizardPage::initializePage()
{
    // Populate the model
    ui->repositoryTreeView->selectionModel()->clearSelection();
    if (const int oldRowCount = m_model->rowCount())
        m_model->removeRows(0, oldRowCount);
    ui->filterLineEdit->clear();
    // fill model
    const QSharedPointer<GitoriousProject> proj = m_projectPage->project();
    setSubTitle(tr("Choose a repository of the project '%1'.").arg(proj->name));
    // Create a hierarchical list by repository type, sort by type
    QList<GitoriousRepository> repositories = proj->repositories;
    QStandardItem *firstEntry = 0;
    if (!repositories.empty()) {
        int lastRepoType = -1;
        QStandardItem *header = 0;
        qStableSort(repositories.begin(), repositories.end(), gitRepoLessThanByType);
        const QString types[GitoriousRepository::PersonalRepository + 1] =
            { tr("Mainline Repositories"), tr("Clones"), tr("Baseline Repositories"), tr("Shared Project Repositories"), tr("Personal Repositories") };
        foreach(const GitoriousRepository &r, repositories) {
            // New Header?
            if (r.type != lastRepoType || !header) {
                lastRepoType = r.type;
                const QList<QStandardItem *> headerRow = headerEntry(types[r.type]);
                m_model->appendRow(headerRow);
                header = headerRow.front();
            }
            // Repository row
            const QList<QStandardItem *> row = repositoryEntry(r);
            header->appendRow(row);
            if (!firstEntry)
                firstEntry = row.front();
        }
    }
Example #9
0
/*
void MainWindow::get_amp_hid()
{
	int g;
	g = amp_ops->poll_amp_hid();
	if (g < 0)
		return;
	//amp->update_gain(g);
}
*/
void MainWindow::stop_amp()
{
    int x;

    save->delete_items();
    load->delete_items();
    quickpres->delete_items();

    x = amp_ops->stop_amp();
    if(x == 0)    // if request succeded
    {
        // deactivate buttons
        amp->enable_set_button(false);
        effect1->enable_set_button(false);
        effect2->enable_set_button(false);
        effect3->enable_set_button(false);
        effect4->enable_set_button(false);
        ui->actionConnect->setDisabled(false);
        ui->actionDisconnect->setDisabled(true);
        ui->actionSave_to_amplifier->setDisabled(true);
        ui->action_Load_from_amplifier->setDisabled(true);
        ui->actionSave_effects->setDisabled(true);
        ui->action_Library_view->setDisabled(true);
        setWindowTitle(QString(tr("RePlug")));
        setAccessibleName(QString(tr("Main window: None")));
        ui->statusBar->showMessage(tr("Disconnected"), 5000);    // show message on the status bar

        connected = false;
    }
    else    // if request failed
        ui->statusBar->showMessage(QString(tr("Error: %1")).arg(x), 5000);
}
void AddAccountDialog::OK()
{
	{
		QString s;
		if (!QFile::exists(s = cert_filename->text()) || !QFile::exists(s = pkey_filename->text()) )
		{
			QMessageBox mbx;
			mbx.setText(tr("File %1 does not exist").arg(s));
			mbx.exec();
			return;
		}

		QByteArray id(PICA_ID_SIZE, 0);

		if (!PICA_get_id_from_cert_file(cert_filename->text().toUtf8().constData(), (unsigned char*)id.data()))
		{
			QMessageBox mbx;
			mbx.setText(tr("Invalid certificate file"));
			mbx.exec();
			return;
		}
	}

	done(1);

}
SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SignVerifyMessageDialog),
    model(0)
{
    ui->setupUi(this);

#if (QT_VERSION >= 0x040700)
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    ui->addressIn_SM->setPlaceholderText(tr("Enter a Spktr address (e.g. SpktrFervXqYkreSgJfrRLS9DepUcxbQci)"));
    ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature"));

    ui->addressIn_VM->setPlaceholderText(tr("Enter a Spktr address (e.g. SpktrFervXqYkreSgJfrRLS9DepUcxbQci)"));
    ui->signatureIn_VM->setPlaceholderText(tr("Enter Spktr signature"));
#endif

    GUIUtil::setupAddressWidget(ui->addressIn_SM, this);
    GUIUtil::setupAddressWidget(ui->addressIn_VM, this);

    ui->addressIn_SM->installEventFilter(this);
    ui->messageIn_SM->installEventFilter(this);
    ui->signatureOut_SM->installEventFilter(this);
    ui->addressIn_VM->installEventFilter(this);
    ui->messageIn_VM->installEventFilter(this);
    ui->signatureIn_VM->installEventFilter(this);

    ui->signatureOut_SM->setFont(GUIUtil::bitcoinAddressFont());
    ui->signatureIn_VM->setFont(GUIUtil::bitcoinAddressFont());
}
SignVerifyMessageDialog::SignVerifyMessageDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SignVerifyMessageDialog),
    model(0)
{
    ui->setupUi(this);

#if (QT_VERSION >= 0x040700)
    /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    ui->addressIn_SM->setPlaceholderText(tr("Enter a CircleCoin address (e.g. CircleCoinfwYhBmGXcFP2Po1NpRUEiK8km2)"));
    ui->signatureOut_SM->setPlaceholderText(tr("Click \"Sign Message\" to generate signature"));

    ui->addressIn_VM->setPlaceholderText(tr("Enter a CircleCoin address (e.g. CircleCoinfwYhBmGXcFP2Po1NpRUEiK8km2)"));
    ui->signatureIn_VM->setPlaceholderText(tr("Enter CircleCoin signature"));
#endif

    GUIUtil::setupAddressWidget(ui->addressIn_SM, this);
    GUIUtil::setupAddressWidget(ui->addressIn_VM, this);

    ui->addressIn_SM->installEventFilter(this);
    ui->messageIn_SM->installEventFilter(this);
    ui->signatureOut_SM->installEventFilter(this);
    ui->addressIn_VM->installEventFilter(this);
    ui->messageIn_VM->installEventFilter(this);
    ui->signatureIn_VM->installEventFilter(this);

    ui->signatureOut_SM->setFont(GUIUtil::bitcoinAddressFont());
    ui->signatureIn_VM->setFont(GUIUtil::bitcoinAddressFont());
}
/**
 * Initialize the menu items.
 */
void PrimeSieveGUI::createMenuActions(QVector<QString>& primeText) {
  // file actions
  saveAct_ = new QAction("&Save", this);
  saveAct_->setShortcut(tr("Ctrl+S"));
  quitAct_ = new QAction("&Quit", this);
  quitAct_->setShortcut(tr("Ctrl+Q"));

  // count actions
  countAct_.push_back(new QAction(primeText[0], this));
  countAct_.back()->setCheckable(true);
  countAct_.push_back(new QAction("Prime k-tuplets", this));
  countAct_.back()->setCheckable(true);
  // default count prime numbers
  countAct_.front()->setChecked(true);

  // radio button like behaviour for print actions
  alignmentGroup_ = new QActionGroup(this);
  alignmentGroup_->setExclusive(false);

  // print actions
  for (int i = 0; i < primeText.size(); i++) {
    printAct_.push_back(new QAction(primeText[i], this));
    printAct_.back()->setCheckable(true);
    alignmentGroup_->addAction(printAct_.back());
  }
  // about action
  aboutAct_ = new QAction("About", this);
}
Example #14
0
bool is_analysis_fun::csv_generate()
{
    //only get the image name
    QString baseName = image_name.section('/', -1);

    QString fileDefaultName=baseName.remove(".v3draw")+"_ISprofile.csv";
    QString completName=QDir(basedir).filePath(fileDefaultName);
    csv_out_name=QFileDialog::getSaveFileName(this,tr("Save csv"),completName,tr("Supported file: (*.csv)"),0,0);
    if (csv_out_name.isEmpty())
        return false;
    QFile file(csv_out_name);
    if (!file.open(QIODevice::WriteOnly))
        return false;

    QTextStream out(&file);

    out<<"# "<<image_name<<endl;
    out<<"# "<<swc_name<<endl;
    out<<"# for location: on_dendrite=1; on_spine=0"<<endl;
    out<<"id,volume,nearest_node,location"<<endl;

    for (int kk=0;kk<voxel_groups.size();kk++)
    {
        QString tmp=QString::fromStdString(LList_out[kk].comments);
        if (tmp.contains("2"))  //delete
            continue;
        out<<kk+1<<","<<voxel_groups[kk].voxel.size()<<","<<voxel_groups[kk].nearest_node
          <<","<<voxel_groups[kk].on_dendrite<<endl;
    }
    file.close();
    qDebug()<<"voxel_group:"<<voxel_groups.size();
    return true;
}
Example #15
0
void TimeWidget::startState()
{
  // Save selected values
  saveValues();

  // Get max value
  const auto time_to_wait = timeToWait();

  // Protection against wrong value
  if( time_to_wait <= 0 )
  {
		QMessageBox::warning(this, tr("Wrong values"), tr("You need to specify a time superior to 0"));
		return;
  }

  // Set active and update button text
  m_active = true;
  m_widget_button->setText(tr("Cancel"));

  // Update the progresss bar
  m_widget_progress->setMaximum(time_to_wait);
  m_widget_progress->setValue(time_to_wait);
	updateProgressText(timesFromSeconds( remainingSeconds() ));
  m_widget_progress->setTextVisible(true);

  // Start the timer
  m_timer->start(1000); // In milliseconds

  emit started();
}
Example #16
0
int MainWindow::save_on_amp(char *name, int slot)
{
    int ret;

    if(!connected)
        return -1;

    ret = amp_ops->save_on_amp(name, slot);

    if(name[0] == 0x00)
    {
        setWindowTitle(QString(tr("RePlug: NONE")));
        setAccessibleName(QString(tr("Main window: NONE")));
    }
    else
    {
        setWindowTitle(QString(tr("RePlug: %1")).arg(name));
        setAccessibleName(QString(tr("Main window: %1")).arg(name));
    }

    current_name=name;
    memcpy(names[slot], name, 32);

    return ret;
}
Example #17
0
void AgrosSolver::runSuite()
{
    // log stdout
    if (m_enableLog)
         m_log = new LogStdOut();

    // silent mode
    setSilentMode(true);

    connect(currentPythonEngineAgros(), SIGNAL(pythonShowMessage(QString)), this, SLOT(stdOut(QString)));
    connect(currentPythonEngineAgros(), SIGNAL(pythonShowHtml(QString)), this, SLOT(stdHtml(QString)));

    QString testSuite = QString("from test_suite.scenario import run_suite; run_suite(test_suite.test_%1)").arg(m_suiteName);
    qDebug() << testSuite;

    bool successfulRun= currentPythonEngineAgros()->runScript(testSuite);

    if (successfulRun)
    {
        Agros2D::scene()->clear();
        Agros2D::clear();
        QApplication::exit(0);
    }
    else
    {
        ErrorResult result = currentPythonEngineAgros()->parseError();
        Agros2D::log()->printMessage(tr("Scripting Engine"), tr("%1\nLine: %2\nStacktrace:\n%3\n").
                                  arg(result.error()).
                                  arg(result.line()).
                                  arg(result.traceback()));

        QApplication::exit(-1);
    }
}
Example #18
0
void MainWindow::onLoadArea() {
	QString filename = QFileDialog::getOpenFileName(this, tr("Open Area file..."), "", tr("Area Files (*.xml)"));

	if (filename.isEmpty()) return;

	QApplication::setOverrideCursor(Qt::WaitCursor);

	{
		ExFeature feature;
		feature.load(filename, false);

		glWidget->selectedArea.clear();
		if (feature.area.size() > 0) {
			glWidget->selectedAreaBuilder.start(feature.area[0]);
			for (int i = 1; i < feature.area.size(); ++i) {
				glWidget->selectedAreaBuilder.addPoint(feature.area[i]);
			}
			glWidget->selectedAreaBuilder.end();
			glWidget->selectedArea = feature.area;
		}

		glWidget->hintLine.clear();
		if (feature.hintLine.size() > 0) {
			glWidget->hintLineBuilder.start(feature.hintLine[0]);
			for (int i = 1; i < feature.hintLine.size(); ++i) {
				glWidget->hintLineBuilder.addPoint(feature.hintLine[i]);
			}
			glWidget->hintLineBuilder.end();
			glWidget->hintLine = feature.hintLine;
		}
	}

	glWidget->updateGL();
	QApplication::restoreOverrideCursor();
}
Example #19
0
void MainWindow::about()
{
    QLabel *label = new QLabel;
    QLabel *pix   = new QLabel;
    label->setText(tr("<p><b>关于</b></p> "
                      "<p>版本:    1.0</p>"
                      "<p>库:      Qt 4.8.1</p>"
                      "<p>数据库:  Sqlite</p>"
                      "<p>作者:    唐昊</p> "
                      "<p>Email:thddaniel92gmail.com</p>"));
    pix->setPixmap(QPixmap("images/money.png"));
    QToolButton *btn = new QToolButton;
    btn->setMinimumSize(60,40);
    btn->setText(tr("关闭"));
    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(pix);
    layout->addWidget(label);
    QHBoxLayout *layout2 = new QHBoxLayout;
    //layout2->addStretch(12);
    layout2->addWidget(btn,Qt::AlignHCenter);
    //layout2->addStretch(12);
    QVBoxLayout *layout3 = new QVBoxLayout;
    layout3->addLayout(layout);
    layout3->addLayout(layout2);
    QDialog *dlg = new QDialog;
    connect(btn,SIGNAL(clicked()),dlg,SLOT(close()));
    dlg->setWindowTitle(tr("关于"));
    dlg->setAttribute(Qt::WA_DeleteOnClose);
    dlg->setLayout(layout3);
    dlg->exec();


}
Example #20
0
CWindowAlarm::CWindowAlarm(QWidget *parent, Qt::WindowFlags flags)
{
	//Groupe de la liste des alarmes
	formGroupBox = new QGroupBox(tr("Alarmes"));
	listWidget = new QListWidget();
	QFormLayout *formLayout = new QFormLayout(formGroupBox);
	formLayout->addWidget(listWidget);
	formGroupBox->setLayout(formLayout);
	
	//Groupe du bouton close
	btClose = new QPushButton("Close");
	btAcquitter = new QPushButton("Acquitter");
	verticalGroupBox = new QGroupBox(tr("Actions"));
	QHBoxLayout *HBoxLayout = new QHBoxLayout(verticalGroupBox);
	HBoxLayout->addWidget(btClose);
	HBoxLayout->addWidget(btAcquitter);

	verticalGroupBox->setLayout(HBoxLayout);


	mainLayout = new QGridLayout(this);
	//this->setLayout(mainLayout);

	mainLayout->addWidget(formGroupBox,0,0);
	mainLayout->addWidget(verticalGroupBox,1,0);
	mainLayout->setRowStretch ( 0, 90 );
	mainLayout->setRowStretch ( 1, 10 );
	//mainLayout->setColumnStretch( 1, 10 );

	setConnections();

}
Example #21
0
void EditDrumset::load()
      {
      QString name = mscore->getDrumsetFilename(true);
      if (name.isEmpty())
            return;

      QFile fp(name);
      if (!fp.open(QIODevice::ReadOnly))
            return;

      XmlReader e(&fp);
      nDrumset.clear();
      while (e.readNextStartElement()) {
            if (e.name() == "museScore") {
                  if (e.attribute("version") != MSC_VERSION) {
                        QMessageBox::critical(this, tr("Drumset too old"), tr("MuseScore cannot load this drumset file."));
                        return;
                        }
                  while (e.readNextStartElement()) {
                        if (e.name() == "Drum")
                              nDrumset.load(e);
                        else
                              e.unknown();
                        }
                  }
            }
      fp.close();
      updatePitchesList();
      }
void Calendar::editEvent()
{
    QListIterator<QListWidgetItem*> itr(m_eventsList->selectedItems());
    while(itr.hasNext())
    {
        QString id = itr.next()->text();
        EventDialog dialog;
        dialog.setWindowTitle(tr("Edit Event"));
        dialog.setModal(true);
        dialog.setDefault(m_events[id].getDate(),
                          m_events[id].getName(),
                          m_events[id].getDescription());

        if(dialog.exec() == QDialog::Accepted)
        {
            Event tmpEvent = dialog.getUserEvent();

            if((!tmpEvent.getName().isEmpty()) && (!tmpEvent.getDescription().isEmpty()))
            {
                m_events[id].setDate(tmpEvent.getDate());
                m_events[id].setDescription(tmpEvent.getDescription());
                m_events[id].setName(tmpEvent.getName());
            }

            else
            {
                QMessageBox::warning(this, tr("Warning"),
                                     tr("can not create event with empty name or description!"));
            }
        }

    }

}
Example #23
0
void MainWindow::on_OpenFile_triggered()
{
    //Check if data configs are valid
    if( configs.check() )
    {
        LogCritical(QString("Error! *.INI configs not loaded"));
        QMessageBox::warning(this, tr("Configuration is loaded with errors"),
                             tr("Editor cannot open files:\nConfiguration package is loaded with errors.").arg(ConfStatus::configPath));
        //Show configuration status window
        on_actionCurConfig_triggered();
        return;
    }

     QString fileName_DATA = QFileDialog::getOpenFileName(this,
        trUtf8("Open file"),GlobalSettings::openPath,
        QString("All supported formats (*.lvlx *.wldx *.lvl *.wld npc-*.txt *.sav);;"
        "All SMBX files (*.lvl *.wld npc-*.txt);;"
        "All PGE files (*.lvlx *.wldx npc-*.txt);;"
        "SMBX Level (*.lvl);;"
        "PGE Level (*.lvlx);;"
        "SMBX World (*.wld);;"
        "PGE World (*.wldx);;"
        "SMBX NPC Config (npc-*.txt);;"
        "SMBX Game Save file (*.sav);;"
        "All Files (*.*)"),0);

        if(fileName_DATA==NULL) return;

        OpenFile(fileName_DATA);
}
Example #24
0
void RPCConsole::clear()
{
    ui->messagesWidget->clear();
    history.clear();
    historyPtr = 0;
    ui->lineEdit->clear();
    ui->lineEdit->setFocus();

    // Add smoothly scaled icon images.
    // (when using width/height on an img, Qt uses nearest instead of linear interpolation)
    for(int i=0; ICON_MAPPING[i].url; ++i)
    {
        ui->messagesWidget->document()->addResource(
                    QTextDocument::ImageResource,
                    QUrl(ICON_MAPPING[i].url),
                    QImage(ICON_MAPPING[i].source).scaled(ICON_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
    }

    // Set default style sheet
    ui->messagesWidget->document()->setDefaultStyleSheet(
                "table { }"
                "td.time { color: #808080; padding-top: 3px; } "
                "td.message { font-family: Monospace; font-size: 12px; } "
                "td.cmd-request { color: #00C0C0; } "
                "td.cmd-error { color: red; } "
                "b { color: #00C0C0; } "
                );

    message(CMD_REPLY, (tr("Welcome to the OGC RPC console.") + "<br>" +
                        tr("Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.") + "<br>" +
                        tr("Type <b>help</b> for an overview of available commands.")), true);
}
HRESULT HostUSBDeviceFilter::setAction(USBDeviceFilterAction_T aAction)
{
    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);

    USBFILTERTYPE filterType;
    switch (aAction)
    {
        case USBDeviceFilterAction_Ignore:   filterType = USBFILTERTYPE_IGNORE; break;
        case USBDeviceFilterAction_Hold:     filterType = USBFILTERTYPE_CAPTURE; break;
        case USBDeviceFilterAction_Null:
            return setError(E_INVALIDARG,
                            tr("Action value InvalidUSBDeviceFilterAction is not permitted"));
        default:
            return setError(E_INVALIDARG,
                            tr("Invalid action %d"),
                            aAction);
    }
    if (USBFilterGetFilterType(&bd->mUSBFilter) != filterType)
    {
        int vrc = USBFilterSetFilterType(&bd->mUSBFilter, filterType);
        if (RT_FAILURE(vrc))
            return setError(E_INVALIDARG,
                            tr("Unexpected error %Rrc"),
                            vrc);

        /* leave the lock before informing callbacks */
        alock.release();

        return mParent->i_onUSBDeviceFilterChange(this);
    }

    return S_OK;
}
Example #26
0
QLayout* DSceneNode::createContent()
{
    logMessage("DSceneNode::createContent()");

    txtPointX = new ValueLineEdit();
    txtPointY = new ValueLineEdit();
    connect(txtPointX, SIGNAL(editingFinished()), this, SLOT(doEditingFinished()));
    connect(txtPointY, SIGNAL(editingFinished()), this, SLOT(doEditingFinished()));
    connect(txtPointX, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    connect(txtPointY, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    lblDistance = new QLabel();
    lblAngle = new QLabel();

    // coordinates must be greater then or equal to 0 (axisymmetric case)
    if (Util::scene()->problemInfo()->problemType == ProblemType_Axisymmetric)
        txtPointX->setMinimum(0.0);

    QFormLayout *layout = new QFormLayout();
    layout->addRow(Util::scene()->problemInfo()->labelX() + " (m):", txtPointX);
    layout->addRow(Util::scene()->problemInfo()->labelY() + " (m):", txtPointY);
    layout->addRow(tr("Distance:"), lblDistance);
    layout->addRow(tr("Angle:"), lblAngle);

    return layout;
}
Example #27
0
void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int end)
{
    if(!walletModel || !clientModel)
        return;
    TransactionTableModel *ttm = walletModel->getTransactionTableModel();
    qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent)
                    .data(Qt::EditRole).toULongLong();
    if(!clientModel->inInitialBlockDownload())
    {
        // On new transaction, make an info balloon
        // Unless the initial block download is in progress, to prevent balloon-spam
        QString date = ttm->index(start, TransactionTableModel::Date, parent)
                        .data().toString();
        QString type = ttm->index(start, TransactionTableModel::Type, parent)
                        .data().toString();
        QString address = ttm->index(start, TransactionTableModel::ToAddress, parent)
                        .data().toString();
        QIcon icon = qvariant_cast<QIcon>(ttm->index(start,
                            TransactionTableModel::ToAddress, parent)
                        .data(Qt::DecorationRole));

        notificator->notify(Notificator::Information,
                            (amount)<0 ? tr("Sent transaction") :
                                         tr("Incoming transaction"),
                              tr("Date: %1\n"
                                 "Amount: %2\n"
                                 "Type: %3\n"
                                 "Address: %4\n")
                              .arg(date)
                              .arg(BitcoinUnits::formatWithUnit(walletModel->getOptionsModel()->getDisplayUnit(), amount, true))
                              .arg(type)
                              .arg(address), icon);
    }
}
Example #28
0
bool DSceneNode::save()
{
    logMessage("DSceneNode::save()");

    if (!txtPointX->evaluate(false)) return false;
    if (!txtPointY->evaluate(false)) return false;

    SceneNode *sceneNode = dynamic_cast<SceneNode *>(m_object);

    Point point(txtPointX->number(), txtPointY->number());

    // check if node doesn't exists
    if (Util::scene()->getNode(point) && ((sceneNode->point != point) || isNew))
    {
        QMessageBox::warning(this, tr("Node"), tr("Node already exists."));
        return false;
    }

    if (!isNew)
    {
        if (sceneNode->point != point)
        {
            Util::scene()->undoStack()->push(new SceneNodeCommandEdit(sceneNode->point, point));

            Util::scene()->doClearSolution();
        }
    }

    sceneNode->point = point;

    return true;
}
Example #29
0
EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::EditAddressDialog), mapper(0), mode(mode), model(0)
{
    ui->setupUi(this);

    GUIUtil::setupAddressWidget(ui->addressEdit, this);

    switch(mode)
    {
    case NewReceivingAddress:
        setWindowTitle(tr("New receiving address"));
        ui->addressEdit->setEnabled(false);
        break;
    case NewSendingAddress:
        setWindowTitle(tr("New sending address"));
        break;
    case EditReceivingAddress:
        setWindowTitle(tr("Edit receiving address"));
        ui->addressEdit->setDisabled(true);
        break;
    case EditSendingAddress:
        setWindowTitle(tr("Edit sending address"));
        break;
    }

    mapper = new QDataWidgetMapper(this);
    mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
}
void MainWindow::showEvent(QShowEvent *)
{
	if (!_device)
	{
		if (!reconnectToDevice())
			return;

		QSettings settings;
		restoreGeometry("main-window", *this);
		restoreState(settings.value("state/main-window").toByteArray());

		qDebug() << "device found, opening session...";
		mtp::SessionPtr session;
		static const int MaxAttempts = 3;
		for(int attempt = 0; attempt < MaxAttempts; ++attempt)
		{
			try
			{
				session = _device->OpenSession(1);
				mtp::msg::DeviceInfo di = session->GetDeviceInfo();
				qDebug() << "device info" << fromUtf8(di.Manufacturer) << " " << fromUtf8(di.Model);
				break;
			}
			catch(const mtp::usb::TimeoutException &ex)
			{
				qDebug() << "timed out getting device info: " << fromUtf8(ex.what()) << ", retrying...";
				if (attempt + 1 == MaxAttempts)
				{
					QMessageBox::critical(this, tr("MTP"), tr("MTP device does not respond"));
					_device.reset();
					return;
				}
			}
			catch(const mtp::usb::DeviceNotFoundException &ex)
			{
				qDebug() << "device disconnected, retrying...";
				if (!reconnectToDevice())
					return;
			}
		}

		_storageModel = new MtpStoragesModel(this);
		while (!_storageModel->update(session))
		{
			int r = QMessageBox::warning(this, tr("No MTP Storages"),
				tr("No MTP storage found, your device might be locked.\nPlease unlock and press Retry to continue or Abort to exit."),
				QMessageBox::Retry | QMessageBox::Abort);
			if (r & QMessageBox::Abort)
			{
				_device.reset();
				return;
			}
		}
		_ui->storageList->setModel(_storageModel);
		_objectModel->setSession(session);
		onStorageChanged(_ui->storageList->currentIndex());
		qDebug() << "session opened, starting";
		_proxyModel->setSourceModel(_objectModel);
	}
}