コード例 #1
0
ファイル: preferences.cpp プロジェクト: proton/SkypeRec
PreferencesDialog::PreferencesDialog()
{
	setWindowTitle(tr("%1 - Preferences").arg(PROGRAM_NAME));
	setAttribute(Qt::WA_DeleteOnClose);

	sm_writer_state = new QSignalMapper(this);
	sm_writer_format = new QSignalMapper(this);
	sm_writer_postfix = new QSignalMapper(this);

	QVBoxLayout* vbox = new QVBoxLayout(this);
	vbox->setSizeConstraint(QLayout::SetFixedSize);

	QTabWidget *tabWidget = new QTabWidget;
	vbox->addWidget(tabWidget);

	tabWidget->addTab(createRecordingTab(tabWidget), tr("Au&tomatic Recording"));
	tabWidget->addTab(createPathTab(tabWidget), tr("&File paths"));
	tabWidget->addTab(createFormatTab(tabWidget), tr("W&riters"));
	tabWidget->addTab(createMiscTab(tabWidget), tr("&Misc"));
	tabWidget->setUsesScrollButtons(false);

	QHBoxLayout *hbox = new QHBoxLayout;
	QPushButton* button = new QPushButton(tr("&Close"));
	button->setDefault(true);
	connect(button, SIGNAL(clicked(bool)), this, SLOT(accept()));
	hbox->addStretch();
	hbox->addWidget(button);
	vbox->addLayout(hbox);

	show();
}
コード例 #2
0
/**
 * Constructs the dialog.
 */
SettingsDialog::SettingsDialog(int tabIndex, QWidget* parent,
                               const char* name, bool modal,
                               WFlags fl)
    : QTabDialog(parent, name, modal, fl)
{
    setCaption(tr("Settings"));
    setApplyButton(tr("Apply"));
    setCancelButton(tr("Cancel"));
    setOkButton(tr("OK"));
    setHelpButton(tr("Help"));

    this->addTab(createGeneralTab(), tr("General"));
    this->addTab(createPathTab(), tr("Paths"));
    this->addTab(createDownloadTab(), tr("Download"));
    setup();

    if (tabIndex >= 0 && tabIndex < tabBar()->count()) {
        tabBar()->setCurrentTab(tabIndex);
    }

    resize(sizeHint());//resize(400, 400);

    connect(this, SIGNAL(applyButtonPressed()), this, SLOT(applySettings()));
}