bool ProjectNewGeneral::eventFilter ( QObject * watched, QEvent * e )
{
  if (e->type() == QEvent::FocusOut)
  {
    if (watched == linePrjTmpl)
    {
      KURL url = baseUrl;
      QuantaCommon::setUrl(url, linePrjTmpl->text());
      url = QExtFileInfo::toAbsolute(url, baseUrl);
      if (!baseUrl.isParentOf(url))
      {
        KMessageBox::sorry(this,i18n("<qt>The project templates must be stored under the main project folder: <br><br><b>%1</b></qt>").arg(baseUrl.prettyURL(0, KURL::StripFileProtocol)));
        linePrjTmpl->setFocus();
        emit enableNextButton(this, false);
      } else
        emit enableNextButton(this, true);
    } else
    if (watched == linePrjToolbar)
    {
      KURL url = baseUrl;
      QuantaCommon::setUrl(url, linePrjToolbar->text());
      url = QExtFileInfo::toAbsolute(url, baseUrl);
      if (!baseUrl.isParentOf(url))
      {
        KMessageBox::sorry(0,i18n("<qt>The project toolbars must be stored under the main project folder: <br><br><b>%1</b></qt>")
                                    .arg(baseUrl.prettyURL(0, KURL::StripFileProtocol)));
        linePrjToolbar->setFocus();
        emit enableNextButton(this, false);
      } else
        emit enableNextButton(this, true);
    }
  }
  return false;  
}
SelectPositionPage::SelectPositionPage(QWidget *parent) :
    Page(parent)
{
    addTitle(trUtf8("Choisir une position\n(2 / 5)"));

    CarteScene *scene = CarteScene::readSceneFile("data/xml/map_montreal.osm");
    CarteWidget::setScene(scene);

    mapWidget = new CarteWidget(this);
    addWidget(mapWidget);

    QPushButton *btnPrevious = new QPushButton(this);
    btnPrevious->setIcon(QIcon(":/icones/data/icons/arrow_left.png"));
    btnNext = new QPushButton(this);
    btnNext->setIcon(QIcon(":/icones/data/icons/arrow_right.png"));
    QPushButton *btnMenu = new QPushButton(trUtf8("Menu"), this);
    btnNext->setEnabled(false);

    addBottomButtons(btnPrevious, btnMenu, btnNext);

    connect(mapWidget, SIGNAL(editFinished()), this, SLOT(enableNextButton()));
    connect(btnPrevious, SIGNAL(clicked()), SIGNAL(Previous()));
    connect(btnMenu, SIGNAL(clicked()), SIGNAL(Menu()));
    connect(btnNext, SIGNAL(clicked()), SIGNAL(Next()));
}
void DataImporterImportPage::startWorkerThread()
{
    Q_ASSERT(workerThread == 0);

    QTimer::singleShot(0, this, SLOT(enableBackButton()));
    QTimer::singleShot(0, this, SLOT(enableNextButton()));
    QTimer::singleShot(0, this, SLOT(enableCancelButton()));

    importedCount = 0;

    DataImporter *importerWizard = static_cast<DataImporter*>(wizard());

    workerThread = new DataImporterThread(field("schemaName").toString().trimmed().toUpper(),
                                          this->queryScheduler->getDb(),
                                          field("tableName").toString().trimmed().toUpper(),
                                          importerWizard->getColumnMappings(),
                                          field("beforeImportGroupBox").toBool() ? field("beforeImportQuery").toString().trimmed() : "",
                                          field("importQuery").toString(),
                                          field("afterImportGroupBox").toBool() ? field("afterImportQuery").toString().trimmed() : "",
                                          importerWizard->getImporter(),
                                          this);
    connect(workerThread, SIGNAL(statusChanged(QString)), this, SLOT(setStatus(QString)));
    connect(workerThread, SIGNAL(chunkImported(int)), this, SLOT(chunkImported(int)));
    connect(workerThread, SIGNAL(comparisonCompleted()), this, SLOT(importCompleted()));
    connect(workerThread, SIGNAL(compareError(QString,OciException)), this, SLOT(importError(QString,OciException)));

    timer.start();
    workerThread->start();

    stopButton->setEnabled(true);
    stopButton->setText(tr("Stop"));
    stopButton->setVisible(true);
}
void DataImporterImportPage::importError(const QString &taskName, const OciException &ex)
{
    deleteWorkerThread();

    enableBackButton(true);
    enableNextButton(false);
    enableCancelButton(true);

    QMessageBox::critical(this, tr("Data import error"),
                          tr("Task name: %1\nError: %2").arg(taskName, ex.getErrorMessage()));
    setStatus(tr("Completed with error"));
}
void DataImporterImportPage::importCompleted()
{
    bool stopped = workerThread->isStopped();

    deleteWorkerThread();

    if(stopped){
        setStatus(tr("Data import was cancelled and transaction was rolled back."));
        enableBackButton(true);
    }else{
        setStatus(tr("Data import successfully completed. %1 records were imported in %2.\n"
                     "Press Next to review changes and COMMIT/ROLLBACK as necessary.\n"
                     "Press Finish to exit wizard").arg(importedCount).arg(formatMsecs(timer.elapsed(), true)));
    }

    enableNextButton(true);
    enableCancelButton(true);
}
void ProjectNewGeneral::slotLinePrjFile( const QString & )
{

  bool valid = !(linePrjFile->text().isEmpty() ||
                 linePrjName->text().isEmpty() ||
                 linePrjDir ->text().isEmpty() ||
                 linePrjTmpl->text().isEmpty() ||
                 linePrjToolbar->text().isEmpty());
  KURL url;
  QString s = lineHost->text();
  if (! s.isEmpty())
    url.setHost(s);

  s = lineUser->text();
  if (! s.isEmpty())
    url.setUser(s);
  s = linePasswd->text();
  if (! s.isEmpty())
    url.setPass(s);

  s = linePort->text();
  if (! s.isEmpty())
    url.setPort(linePort->text().toInt());

  url.setProtocol(comboProtocol->currentText());
  if (url.protocol() == i18n("Local")) url.setProtocol("file");
  url.setPath(linePrjDir->text());
  url.adjustPath(1);
  if (!url.path().startsWith("/")) url.setPath("/"+url.path());

  if (url.isValid())
  {
    emit setBaseURL(url);
    baseUrl = url;
    if (baseUrl.isLocalFile())
    {
      s = QExtFileInfo::canonicalPath(baseUrl.path());
      if (!s.isEmpty())
        baseUrl.setPath(s);
    }
  }
  emit enableNextButton( this, valid );
}
示例#7
0
void WebImportWizardPage::slotStart()
{
    if ( !start )
    {
        emit enableMessagesWidget();

        if (QuantaNetAccess::mkdir(baseURL, 0L, -1, false))
        {
            if (baseURL.protocol() == "file")
            {
                ::chdir(baseURL.path(KUrl::AddTrailingSlash).toLocal8Bit());

                proc = new K3Process();
                proc ->clearArguments();

                QStringList list = commandLine->text().split(" ");

                for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
                {
                    *proc << *it;
                }

                connect( proc, SIGNAL(receivedStdout(   K3Process*,char*,int)), this,
                         SLOT(  slotGetWgetOutput(K3Process*,char*,int)));
                connect( proc, SIGNAL(receivedStderr(   K3Process*,char*,int)), this,
                         SLOT(  slotGetWgetOutput(K3Process*,char*,int)));
                connect( proc, SIGNAL(processExited(    K3Process *)), this,
                         SLOT(  slotGetWgetExited(K3Process *)));

                if (proc->start(K3Process::NotifyOnExit, K3Process::AllOutput))
                {
                    start = true;
                    button->setText( i18n("Stop") );
                    emit enableNextButton((QWidget *)this->parent(),false);
                } else
                {
                    KMessageBox::error(this, i18n("<qt>There was an error while trying to run the <b>wget</b> application.<br />Check first that it is present on your system and that it is in your PATH.</qt>"));
                    delete proc;
                }
            } else
            {
示例#8
0
SaveCHEAsDialog::SaveCHEAsDialog(const QString user, const CHEInfoBasic* info, const QString path)
{
	mLastPath = path;

	mUserNameLabel = new QLabel(tr("User Name:"));
	mUserNameLineEdit = new QLineEdit();
	mUserNameLineEdit->setFixedWidth(350);
	mUserNameLineEdit->setText(user);
    mUserNameLabel->setBuddy(mUserNameLineEdit);
	mUserNameHBox = new QHBoxLayout();
	mUserNameHBox->addWidget(mUserNameLabel);
	mUserNameHBox->addWidget(mUserNameLineEdit, 0 , Qt::AlignRight);

    mProjectNameLabel = new QLabel(tr("Name:  "));
	mProjectNameEdit = new QLineEdit();
	mProjectNameEdit->setFixedWidth(350);
    mProjectNameLabel->setBuddy(mProjectNameEdit);
	connect(mProjectNameEdit, SIGNAL(textChanged(QString)), this, SLOT(projectNameChanged(QString)));
	mProjectHBox = new QHBoxLayout();
	mProjectHBox->addWidget(mProjectNameLabel, 0 , Qt::AlignLeft);
    mProjectHBox->addWidget(mProjectNameEdit, 0 , Qt::AlignRight);
	
    mLocationLabel = new QLabel(tr("Location:"));
	mLocationLineEdit = new QLineEdit();
    mLocationLabel->setBuddy(mLocationLineEdit);
	connect(mLocationLineEdit, SIGNAL(textChanged(QString)), this, SLOT(projectPathChanged(QString)));
	mLocationLineEdit->setText(QCoreApplication::applicationDirPath());
	mProjectPath = QDir::toNativeSeparators(QCoreApplication::applicationDirPath());
	mLocationLineEdit->setFixedWidth(270);
	mLocationBrowseButton = new QPushButton("Browse");
	connect(mLocationBrowseButton, SIGNAL(clicked()), this, SLOT(locationBrowse()));
	mLocationHBox = new QHBoxLayout();
	mLocationHBox->addWidget(mLocationLabel);
	mLocationHBox->addWidget(mLocationLineEdit, 0 , Qt::AlignRight);
    mLocationHBox->addWidget(mLocationBrowseButton);

	mObjectContent->setText(info->object);
	mMeasurementContent->setText(info->measurement);
	mCreationContent->setText(info->creation);
	mMaterialContent->setText(info->material);
	mDescriptionContent->setText(info->description);
	mConservationContent->setText(info->conservation);
	mAnalysesContent->setText(info->analyses);
	mRelatedContent->setText(info->related);
	mAdministrationContent->setText(info->administration);
	mDocumentsContent->setText(info->documents);
	mOtherContent->setText(info->other);

	mButtonGridBox = new QGridLayout();
	mNextButton = new QPushButton("Next");
	mNextButton->setEnabled(false);
	connect(mNextButton, SIGNAL(clicked()), this, SLOT(next()));
	mCancelButton = new QPushButton("Cancel");
	connect(mCancelButton, SIGNAL(clicked()), this, SLOT(cancel()));
	mButtonGridBox->addWidget(mNextButton, 0, 5, 1, 4,  Qt::AlignVCenter | Qt::AlignRight);
	mButtonGridBox->addWidget(mCancelButton, 0, 5, 1, 5, Qt::AlignVCenter | Qt::AlignRight);

	mDialog->setWindowTitle(tr("Save Cultural Heritage As.."));

	mVBox->addLayout(mProjectHBox);
	mVBox->addLayout(mLocationHBox);
	mVBox->addLayout(mUserNameHBox);
	mVBox->addLayout(mGrid);
	mVBox->addLayout(mButtonGridBox);
	
	connect(this, SIGNAL(infoUpdate()), this, SLOT(enableNextButton()));

    mDialog->setMinimumWidth(350);
    //mDialog->adjustSize();
	mDialog->setLayout(mVBox);
}
示例#9
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // Create our market
    market = new Market(":/market-data",this,5000);

    // Create the windows
    sim = new SimulationWindow(market, 0);
    dec = new DecryptionWindow(market, 0);
    title = new TitleScreen(0);
    inst1 = new InstructionScreen1(0);
    inst2 = new InstructionScreen2(0);
    //inst3 = new InstructionScreen3(0);
    inst4 = new InstructionScreen4(0);
    inst5 = new InstructionScreen5(0);
    inst6 = new InstructionScreen6(0);
    inst7 = new InstructionScreen7(0);
    inst8 = new InstructionScreen8(0);
    instTest1 = new InstructionScreenTest1(0);
    instTest2 = new InstructionScreenTest2(0);
    instTest3 = new InstructionScreenTest3(0);
    initAlloc = new InitialAllocationScreen(market, 0);
    quest1 = new QuestionScreen1(0);
    fin = new FinalScreen(0);

    ui->stackedWidget->addWidget(title);
    ui->stackedWidget->addWidget(inst1);
    ui->stackedWidget->addWidget(inst2);
    //ui->stackedWidget->addWidget(inst3);
    ui->stackedWidget->addWidget(inst4);
    ui->stackedWidget->addWidget(inst5);
    ui->stackedWidget->addWidget(inst6);
    ui->stackedWidget->addWidget(inst7);
    ui->stackedWidget->addWidget(inst8);
    ui->stackedWidget->addWidget(instTest1);
    ui->stackedWidget->addWidget(instTest2);
    ui->stackedWidget->addWidget(instTest3);
    ui->stackedWidget->addWidget(initAlloc);
    ui->stackedWidget->addWidget(dec);
    ui->stackedWidget->addWidget(sim);
    ui->stackedWidget->addWidget(quest1);
    ui->stackedWidget->addWidget(fin);


    // Make a list of widget pointers, so we can easily swap between them
    widgets = new QList<QWidget*>();
    widgets->push_back(title); //1
    widgets->push_back(inst1); //2
    widgets->push_back(inst2); //3
    //widgets->push_back(inst3); //4
    widgets->push_back(instTest1); //5
    widgets->push_back(instTest2); //6
    widgets->push_back(inst4); //7
    widgets->push_back(inst5); //8
    widgets->push_back(inst6); //9
    widgets->push_back(inst7); //10
    widgets->push_back(instTest3); //11
    widgets->push_back(inst8); //12
    widgets->push_back(initAlloc);
    widgets->push_back(dec);
    widgets->push_back(sim);
    widgets->push_back(quest1);
    widgets->push_back(fin);

    pos = widgets->begin();
    ui->stackedWidget->setCurrentWidget(*pos);
    preNavigation();

    simStarted = false;
    finishedExperiment = false;
    test1Passed = false;
    test2Passed = false;
    test3Passed = false;

    connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextScreen()));
    connect(ui->prevButton, SIGNAL(clicked()), this, SLOT(prevScreen()));

    connect(instTest1,SIGNAL(testPassed()),this,SLOT(passTest1()));
    connect(instTest2,SIGNAL(testPassed()),this,SLOT(passTest2()));
    connect(instTest3->win, SIGNAL(DecryptionCompleted()), this, SLOT(passTest3()));
    connect(market, SIGNAL(newTime(QString)), this, SLOT(updateTime(QString)));
    connect(market, SIGNAL(allocationUpdated(double)), this, SLOT(waitForInitialAlocation(double)));

    connect(quest1, SIGNAL(gimmeANextButton()), this, SLOT(enableNextButton()));

    connect(market, SIGNAL(priceChange(double)), this, SLOT(updateIndex()) );

    // Hide the labels (until the right time)
    ui->simulationDisplay->setHidden(true);

    this->setWindowFlags(Qt::FramelessWindowHint);
    this->showFullScreen();
}