コード例 #1
0
SettingsForm::SettingsForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SettingsForm)
{
    ui->setupUi(this);

    ui->cbxAutocheckUpdates->setChecked(
        Settings->value("autocheck_updates", QVariant(true)).toBool());

    ui->sbxDownloads->setValue(
        Settings->value("sim_downloads", QVariant(4)).toInt());

    ui->cbxAutostart->setChecked(
        Settings->value("autostart", QVariant(true)).toBool());

    ui->txtSavepath->setText(Settings->value("download_path").toString());


    connect (ui->btnBrowse, SIGNAL(clicked()), this, SLOT(onBrowseClicked()));
    connect (ui->btnSave, SIGNAL(clicked()), this, SLOT(onSaveClicked()));


    // Load languages found in languages directory

    QDir directory (QString("translations"), QString("*.qm"));
    QStringList languages = directory.entryList();
    foreach (QString language, languages)
    {
        QString languageName = language.replace(".qm","");
        ui->cbxLanguage->addItem(languageName);
    }
コード例 #2
0
SettingDialog::SettingDialog(QWidget* parent)
  : QDialog(parent)
  , ui(new Ui::SettingDialog)
{
  ui->setupUi(this);

  connect(ui->saveButton, SIGNAL(clicked()),
          this, SLOT(onSaveClicked()));
  connect(ui->cancelButton, SIGNAL(clicked()),
          this, SLOT(onCancelClicked()));
}
コード例 #3
0
MainWindow::MainWindow(QWidget *parent) :
	QWidget(parent),
	ui(new Ui::MainWindow),
	hasNotLoadedImage(true)
{
	ui->setupUi(this);
	this->setWindowTitle("Hulixerian Game Engine: Normal Map Creator.");
	connect(ui->loadPB, SIGNAL(clicked()), this, SLOT(onLoadClicked()));
	connect(ui->openPB, SIGNAL(clicked()), this, SLOT(onOpenClicked()));
	connect(ui->savePB, SIGNAL(clicked()), this, SLOT(onSaveClicked()));
	connect(ui->generateNormalPB, SIGNAL(clicked()), this, SLOT(onGenerateClicked()));
}
コード例 #4
0
ファイル: pdfpres.c プロジェクト: betagram/pdfPres
static gboolean handleUnsavedNotes()
{
	GtkWidget *dialog = NULL;
	gint response = 0;

	/* See if there are unsaved changes. */
	if (!isSaved)
	{
		/* What to do? */
		if (savedAsFilename == NULL)
		{
			dialog = gtk_message_dialog_new(GTK_WINDOW(win_preview),
					GTK_DIALOG_DESTROY_WITH_PARENT,
					GTK_MESSAGE_QUESTION,
					GTK_BUTTONS_NONE,
					"There are unsaved notes. Save them now?");
		}
		else
		{
			dialog = gtk_message_dialog_new(GTK_WINDOW(win_preview),
					GTK_DIALOG_DESTROY_WITH_PARENT,
					GTK_MESSAGE_QUESTION,
					GTK_BUTTONS_NONE,
					"There are unsaved notes. Save them now?\n"
					"\n"
					"They will be saved to: `%s'.",
					savedAsFilename);
		}
		gtk_dialog_add_buttons(GTK_DIALOG(dialog),
				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
				GTK_STOCK_NO, GTK_RESPONSE_NO,
				GTK_STOCK_YES, GTK_RESPONSE_YES,
				NULL);

		response = gtk_dialog_run(GTK_DIALOG(dialog));
		gtk_widget_destroy(GTK_WIDGET(dialog));

		/* Just abort. */
		if (response == GTK_RESPONSE_CANCEL)
			return FALSE;

		/* Abandon notes. Consider them saved and get out of here. */
		else if (response == GTK_RESPONSE_NO)
		{
			isSaved = TRUE;
			return TRUE;
		}

		/* Give the user the opportunity to save them. */
		if (savedAsFilename == NULL)
			onSaveAsClicked(NULL, NULL);
		else
			onSaveClicked(NULL, NULL);

		/* Are they saved now? That is, don't quit if he cancelled. */
		if (!isSaved)
			return FALSE;
	}

	return TRUE;
}
コード例 #5
0
        QTextCodec *codec = QTextCodec::codecForMib(mib);
        _textEncoding->addItem(codec->name(), codec->mibEnum());
    }
    _textEncoding->setCurrentIndex(_textEncoding->findData(pr->textEncoding()));
    form->addRow(__("use_spaces_for_tabs", "forms"), _useSpacesForTabs = new QCheckBox(this));
    _showWhitespaces->setChecked(pr->showWhitespaces());
    _useSpacesForTabs->setChecked(pr->useSpacesForTabs());
    // Form : End
    QVBoxLayout *layout = new QVBoxLayout(this);
    QDialogButtonBox *buttons = new QDialogButtonBox(this);
    buttons->addButton(new QPushButton(__("cancel", "buttons"), buttons), QDialogButtonBox::RejectRole);
    buttons->addButton(new QPushButton(__("save", "buttons"), buttons), QDialogButtonBox::AcceptRole);
    layout->addLayout(form);
    layout->addWidget(buttons);
    _connections << connect(browse, SIGNAL(clicked()), this, SLOT(onBrowseVendor()));
    _connections << connect(buttons, SIGNAL(accepted()), this, SLOT(onSaveClicked()));
    _connections << connect(buttons, SIGNAL(rejected()), this, SLOT(close()));
}

void SettingsEditor::onBrowseVendor()
{
    QFileDialog d(this, __("choose_vendor_path", "titles"), _vendorPath->text());
    d.setAcceptMode(QFileDialog::AcceptOpen);
    d.setFileMode(QFileDialog::Directory);
    d.setOptions(QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
#ifdef NO_NATIVE_DIALOG
    d.setOption(QFileDialog::DontUseNativeDialog);
#endif
    if (d.exec() == QFileDialog::Accepted)
    {
        QStringList files;