示例#1
0
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget),
    gen(this)
{
    ui->setupUi(this);

    this->setWindowTitle("Matematyczne Metody Wspomagania Decyzji");
    ui->tabWidget->setTabText(0, "setup");
    ui->tabWidget->setTabText(1, "stat");
    ui->tabWidget->setTabText(2, "route");

    connect(ui->plot, SIGNAL(mouseDoubleClick(QMouseEvent*)), this, SLOT(mouseDoubleClick()));
    connect(ui->run, SIGNAL(pressed()), this, SLOT(setStatusLabel()));
    ui->label_status->setText("Ready");
    gen.setToolchain(&toolchain);
    gen.setProblem(&problem);
    gen.setRunButton(ui->run);
}
示例#2
0
void MainPage::updaterResult(int exitCode, QProcess::ExitStatus exitStatus)
{
	// If it wasn't a clean exit then the exit code is invalid
	if(exitStatus != QProcess::NormalExit) {
		// Already logged reason
		return;
	}

	// Check the return code
#ifdef Q_OS_WIN
	switch(exitCode) {
	case 0: // Up-to-date
		appLog() << QStringLiteral("%1 is up-to-date")
			.arg(APP_NAME);
		break;
	default:
	case 1: // Updater general error
	case 3: // User cancelled update
	case 4: // Updater already running (Focuses the existing window)
		appLog(Log::Warning) << QStringLiteral(
			"Internal updater error (Return code = %1)")
			.arg(exitCode);
		setStatusLabel(tr(
			"Error checking for updates - Internal updater error (%1)")
			.arg(exitCode));
		break;
	case 2: // Updates available
		appLog(Log::Warning) << QStringLiteral(
			"A new version of %1 is available")
			.arg(APP_NAME);
		m_updatesAvailableButton.show();
		s_updatesAvail = true;
		break;
	}
#else
#error Unsupported platform
#endif // Q_OS_WIN
}
示例#3
0
void MainPage::updaterError(QProcess::ProcessError error)
{
	switch(error) {
	case QProcess::FailedToStart:
		appLog(Log::Warning) << QStringLiteral(
			"Updater process failed to start");
		setStatusLabel(tr(
			"Error checking for updates - Updater failed to start"));
		break;
	case QProcess::Crashed:
		appLog(Log::Warning) << QStringLiteral(
			"Updater process crashed");
		setStatusLabel(tr(
			"Error checking for updates - Updater crashed"));
		break;
	case QProcess::Timedout:
		appLog(Log::Warning) << QStringLiteral(
			"Updater process timed out");
		setStatusLabel(tr(
			"Error checking for updates - Updater timed out"));
		break;
	case QProcess::ReadError:
		appLog(Log::Warning) << QStringLiteral(
			"Updater process had a read error");
		setStatusLabel(tr(
			"Error checking for updates - Updater read error"));
		break;
	case QProcess::WriteError:
		appLog(Log::Warning) << QStringLiteral(
			"Updater process had a write error");
		setStatusLabel(tr(
			"Error checking for updates - Updater write error"));
		break;
	default:
	case QProcess::UnknownError:
		appLog(Log::Warning) << QStringLiteral(
			"Updater process had an unknown error");
		setStatusLabel(tr(
			"Error checking for updates - Updater had an unknown error"));
		break;
	}
}