Пример #1
0
UpdateDialog::UpdateDialog(QWidget *parent, const QString& releaseNotes, const QString& latestVersion, const QUrl& downloadURL) :
    QDialog(parent),
    _latestVersion(latestVersion),
    _downloadUrl(downloadURL)
{
    Ui::Dialog dialogUI;
    dialogUI.setupUi(this);
    
    QString updateRequired = QString("You are currently running build %1, the latest build released is %2."
                                     "\n\nPlease download and install the most recent release to access the latest features and bug fixes.")
                                      .arg(Application::getInstance()->applicationVersion(), latestVersion);
    
    setAttribute(Qt::WA_DeleteOnClose);
    
    QPushButton* downloadButton = findChild<QPushButton*>("downloadButton");
    QPushButton* skipButton = findChild<QPushButton*>("skipButton");
    QPushButton* closeButton = findChild<QPushButton*>("closeButton");
    QLabel* updateContent = findChild<QLabel*>("updateContent");
    
    updateContent->setText(updateRequired);
    
    connect(downloadButton, SIGNAL(released()), this, SLOT(handleDownload()));
    connect(skipButton, SIGNAL(released()), this, SLOT(handleSkip()));
    connect(closeButton, SIGNAL(released()), this, SLOT(close()));
    
    QMetaObject::invokeMethod(this, "show", Qt::QueuedConnection);
}
Пример #2
0
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	Ui::Dialog ui;
	QDialog *dialog = new QDialog;
	ui.setupUi(dialog);
	dialog->show();
	return app.exec();
}
Пример #3
0
void MainWindow::OpenDialog()
{
    std::clog<<"MainWindow::OpenDialog()"<<std::endl;
    QDialog d;
    Ui::Dialog* dg = new Ui::Dialog;
    if(!dg)
        return;
    dg->setupUi(&d);
    delete dg;
    d.exec();
}
Пример #4
0
Icons::Icons() :
CoastalDialog()
{
    ui.setupUi((QDialog *)this);

    QApplication::setQuitOnLastWindowClosed(true);

    connect(ui.close, SIGNAL(clicked()), qApp, SLOT(quit()));
    connect(ui.name, SIGNAL(textChanged(const QString&)),
        this, SLOT(input(const QString&)));

	ui.image->setToolButtonStyle(Qt::ToolButtonIconOnly);
	ui.image->setIconSize(QSize(64, 64));

    show();
}
void ApplicationManager::start(){
	//LOGO DISPLAY
	QDialog dialog;
	Ui::Dialog ui;
	ui.setupUi(&dialog);
	ui.hrIconLabel->setPixmap(QPixmap(":Sample/Resources/appIcon.png"));
	dialog.setWindowIcon(QIcon(":Sample/Resources/appIcon.ico"));
	dialog.show();
	QApplication::processEvents();

	//VARIABLE INITIALIZATION
	bool firstTime;
	std::string camera;
	float threshold;
	if (Utils::readPropertiesFile(firstTime, camera, threshold)){
		FIRSTTIME = firstTime;
		CAMERA = camera;
		THRESHOLD = threshold;
	}
	else{
		//error reading file or wrong parameters
		std::cout << "Exiting..." << std::endl;
		exit(0);
	}

	//SDK VARIABLE CREATION
	//In order to create use the Facial Recognition SDk you need to create the HrDLib variable.
	HrDLib hrd("./config", "./config/hrd_publicKey.txt", true);
		
	// Now that the sdk variable is created we need to tell him what camera are we going to use, \
	and to do so, we do one of the following:
	int license = hrd.getLicenseType();
	if (license != 2 && license != 3){		
		QMessageBox::critical(NULL, "Error!", "Invalid license.\n Please purchase a license to use this software.", QMessageBox::Close);
		return;
	}

	
	if (isdigit(camera[0])){
		//To use a USB camera or a webcam, we need to select what device is going to be used.
		//We use the device read in the properties file,\
		but for simplicity use 0, as it uses the first camera available in the computer.
		//It's also needed a pointer to the image so we can access it at any time (img).
		int device = atoi(&camera[0]);
		hrd.easySetImgFromDevice(device, img);
	}
	else{
Пример #6
0
QPair<QByteArray, QByteArray> backendIdAndSecret(const QString &exampleName)
{
    QSettings *settings;

    QString fileName = QStringLiteral("EnginioExamples.conf");
    for (int i = 0; i < 4; ++i) {
        if (QFile::exists(fileName))
            break;
        fileName = fileName.prepend("../");
    }

    QFileInfo settingsFile = QFileInfo(fileName);

    if (settingsFile.exists()) {
        settings = new QSettings(settingsFile.absoluteFilePath(), QSettings::IniFormat);
    } else {
        settings = new QSettings("com.digia", "EnginioExamples");
    }

    settings->beginGroup(exampleName);
    QByteArray id = settings->value(backendIdKey).toByteArray();
    QByteArray secret= settings->value(backendSecretKey).toByteArray();
    bool askAgain = settings->value(showAgainKey, true).toBool();

    if (askAgain || id.isEmpty() || secret.isEmpty()) {
        Ui::Dialog dialog;
        QDialog d;
        dialog.setupUi(&d);
        dialog.backendId->setText(id);
        dialog.backendSecret->setText(secret);

        if (d.exec() == QDialog::Accepted) {
            id = dialog.backendId->text().toLocal8Bit();
            secret = dialog.backendSecret->text().toLocal8Bit();
            askAgain = !dialog.askAgain->isChecked();
            settings->setValue(backendIdKey, id);
            settings->setValue(backendSecretKey, secret);
            settings->setValue(showAgainKey, askAgain);
        }
    }

    settings->endGroup();
    settings->sync();
    delete settings;

    return qMakePair(id, secret);
}
Пример #7
0
void HttpWindow::slotAuthenticationRequired(QNetworkReply*,QAuthenticator *authenticator)
{
    QDialog dlg;
    Ui::Dialog ui;
    ui.setupUi(&dlg);
    dlg.adjustSize();
    ui.siteDescription->setText(tr("%1 at %2").arg(authenticator->realm()).arg(url.host()));

    // Did the URL have information? Fill the UI
    // This is only relevant if the URL-supplied credentials were wrong
    ui.userEdit->setText(url.userName());
    ui.passwordEdit->setText(url.password());

    if (dlg.exec() == QDialog::Accepted) {
        authenticator->setUser(ui.userEdit->text());
        authenticator->setPassword(ui.passwordEdit->text());
    }
}
Пример #8
0
void MainWindow::authentication_required(QNetworkReply * reply, QAuthenticator *authenticator)
{
	QDialog dialog;
	Ui::Dialog ui;
	ui.setupUi(&dialog);
	ui.site->setText(tr("%1").arg(authenticator->realm()));
	dialog.adjustSize();
	this->hide();
	if(dialog.exec() == QDialog::Accepted)
	{
		authenticator->setUser(ui.user->text());
		authenticator->setPassword(ui.password->text());
	}
	else
	{
	    exit(-1);
	}
	this->show();
}
Пример #9
0
void Viewer::LoadExperiment(){
    for (int i=0; i<terrains.size(); i++)
        DeleteTerrain(i);
    curTerr=-1;
    experimentID = QDate::currentDate().toString() +" "+ QTime::currentTime().toString();

    QString faculty, department, studyyear, age, sex, gameexperience;

    Ui::Dialog dia;
    QDialog *dialog = new QDialog;
    dia.setupUi(dialog);
    dialog->exec();

    connect(dia.buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
    connect(dia.buttonBox, SIGNAL(rejected()), dialog, SLOT(reject()));

    //if (dialog->Rejected)   return;

    faculty = dia.FacultyEdit->displayText();
    department = dia.DepartmentEdit->displayText();
    studyyear = dia.YearStudyEdit->displayText();
    age = dia.AgeEdit->displayText();
    sex = dia.SexBox->currentText();
    gameexperience = dia.gamingBox->currentText();

    QString pname = experimentID+".results";
    FILE * pFile = fopen( (char*) pname.toStdString().c_str(),"a");
    fprintf (pFile,"Experiment conducted at %s\n", experimentID.toStdString().c_str());
    fprintf (pFile,"Demographics\n");
    fprintf (pFile,"faculty: %s\n",faculty.toStdString().c_str());
    fprintf (pFile,"department: %s\n",department.toStdString().c_str());
    fprintf (pFile,"year_of_study: %s\n", studyyear.toStdString().c_str());
    fprintf (pFile,"age: %s\n",age.toStdString().c_str());
    fprintf (pFile,"sex: %s\n",sex.toStdString().c_str());
    fprintf (pFile,"game_experience: %s\n",gameexperience.toStdString().c_str());
    fclose(pFile);

    startTask1("task1_files.txt");
    updateGL();
}