コード例 #1
0
// --- StyleSheetEditorDialog
StyleSheetEditorDialog::StyleSheetEditorDialog(QDesignerFormEditorInterface *core, QWidget *parent, Mode mode):
    QDialog(parent),
    m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help)),
    m_editor(new StyleSheetEditor),
    m_validityLabel(new QLabel(tr("Valid Style Sheet"))),
    m_core(core),
    m_addResourceAction(new QAction(tr("Add Resource..."), this)),
    m_addGradientAction(new QAction(tr("Add Gradient..."), this)),
    m_addColorAction(new QAction(tr("Add Color..."), this)),
    m_addFontAction(new QAction(tr("Add Font..."), this))
{
    setWindowTitle(tr("Edit Style Sheet"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(m_buttonBox, SIGNAL(helpRequested()), this, SLOT(slotRequestHelp()));
    m_buttonBox->button(QDialogButtonBox::Help)->setShortcut(QKeySequence::HelpContents);

    connect(m_editor, SIGNAL(textChanged()), this, SLOT(validateStyleSheet()));

    QToolBar *toolBar = new QToolBar;

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(toolBar, 0, 0, 1, 2);
    layout->addWidget(m_editor, 1, 0, 1, 2);
    layout->addWidget(m_validityLabel, 2, 0, 1, 1);
    layout->addWidget(m_buttonBox, 2, 1, 1, 1);
    setLayout(layout);

    m_editor->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_editor, SIGNAL(customContextMenuRequested(QPoint)),
            this, SLOT(slotContextMenuRequested(QPoint)));

    QSignalMapper *resourceActionMapper = new QSignalMapper(this);
    QSignalMapper *gradientActionMapper = new QSignalMapper(this);
    QSignalMapper *colorActionMapper = new QSignalMapper(this);

    resourceActionMapper->setMapping(m_addResourceAction, QString());
    gradientActionMapper->setMapping(m_addGradientAction, QString());
    colorActionMapper->setMapping(m_addColorAction, QString());

    connect(m_addResourceAction, SIGNAL(triggered()), resourceActionMapper, SLOT(map()));
    connect(m_addGradientAction, SIGNAL(triggered()), gradientActionMapper, SLOT(map()));
    connect(m_addColorAction, SIGNAL(triggered()), colorActionMapper, SLOT(map()));
    connect(m_addFontAction, SIGNAL(triggered()), this, SLOT(slotAddFont()));

    m_addResourceAction->setEnabled(mode == ModePerForm);

    const char * const resourceProperties[] = {
        "background-image",
        "border-image",
        "image",
        0
    };

    const char * const colorProperties[] = {
        "color",
        "background-color",
        "alternate-background-color",
        "border-color",
        "border-top-color",
        "border-right-color",
        "border-bottom-color",
        "border-left-color",
        "gridline-color",
        "selection-color",
        "selection-background-color",
        0
    };

    QMenu *resourceActionMenu = new QMenu(this);
    QMenu *gradientActionMenu = new QMenu(this);
    QMenu *colorActionMenu = new QMenu(this);

    for (int resourceProperty = 0; resourceProperties[resourceProperty]; ++resourceProperty) {
        QAction *action = resourceActionMenu->addAction(QLatin1String(resourceProperties[resourceProperty]));
        connect(action, SIGNAL(triggered()), resourceActionMapper, SLOT(map()));
        resourceActionMapper->setMapping(action, QLatin1String(resourceProperties[resourceProperty]));
    }

    for (int colorProperty = 0; colorProperties[colorProperty]; ++colorProperty) {
        QAction *gradientAction = gradientActionMenu->addAction(QLatin1String(colorProperties[colorProperty]));
        QAction *colorAction = colorActionMenu->addAction(QLatin1String(colorProperties[colorProperty]));
        connect(gradientAction, SIGNAL(triggered()), gradientActionMapper, SLOT(map()));
        connect(colorAction, SIGNAL(triggered()), colorActionMapper, SLOT(map()));
        gradientActionMapper->setMapping(gradientAction, QLatin1String(colorProperties[colorProperty]));
        colorActionMapper->setMapping(colorAction, QLatin1String(colorProperties[colorProperty]));
    }

    connect(resourceActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddResource(QString)));
    connect(gradientActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddGradient(QString)));
    connect(colorActionMapper, SIGNAL(mapped(QString)), this, SLOT(slotAddColor(QString)));

    m_addResourceAction->setMenu(resourceActionMenu);
    m_addGradientAction->setMenu(gradientActionMenu);
    m_addColorAction->setMenu(colorActionMenu);

    toolBar->addAction(m_addResourceAction);
    toolBar->addAction(m_addGradientAction);
    toolBar->addAction(m_addColorAction);
    toolBar->addAction(m_addFontAction);

    m_editor->setFocus();

    QDesignerSettingsInterface *settings = core->settingsManager();
    settings->beginGroup(QLatin1String(StyleSheetDialogC));

    if (settings->contains(QLatin1String(Geometry)))
        restoreGeometry(settings->value(QLatin1String(Geometry)).toByteArray());

    settings->endGroup();
}
コード例 #2
0
void OptionsDialog::on_cancelButton_clicked()
{
    reject();
}
コード例 #3
0
ファイル: color_dialog.cpp プロジェクト: FEK10/mapper
ColorDialog::ColorDialog(const Map& map, const MapColor& source_color, QWidget* parent, Qt::WindowFlags f)
: QDialog(parent, f),
  map(map),
  source_color(source_color),
  color(source_color),
  color_modified(false),
  react_to_changes(true)
{
	setWindowTitle(tr("Edit map color"));
	setSizeGripEnabled(true);
	
	color_preview_label = new QLabel();
	mc_name_edit = new QLineEdit();
	
	prof_color_layout = new QGridLayout();
	int col = 0;
	prof_color_layout->setColumnStretch(col, 1);
	prof_color_layout->setColumnStretch(col+1, 3);
	
	int row = 0;
	prof_color_layout->addWidget(Util::Headline::create("Spot color printing"), row, col, 1, 2);
	
	QButtonGroup* spot_color_options = new QButtonGroup(this);
	
	++row;
	full_tone_option = new QRadioButton(tr("Defines a spot color:"));
	spot_color_options->addButton(full_tone_option, MapColor::SpotColor);
	prof_color_layout->addWidget(full_tone_option, row, col, 1, 2);
	
	++row;
	sc_name_edit = new QLineEdit();
	prof_color_layout->addWidget(sc_name_edit, row, col, 1, 2);
	
	++row;
	composition_option = new QRadioButton(tr("Mixture of spot colors (screens and overprint):"));
	spot_color_options->addButton(composition_option, MapColor::CustomColor);
	prof_color_layout->addWidget(composition_option, row, col, 1, 2);
	
	int num_components = 0 /*color.getComponents().size()*/; // FIXME: cleanup
	components_row0 = row+1;
	components_col0 = col;
	component_colors.resize(num_components+1);
	component_halftone.resize(num_components+1);
	for (int i = 0; i <= num_components; i++)
	{
		++row;
		component_colors[i] = new ColorDropDown(&map, &color, true);
		component_colors[i]->removeColor(&source_color);
		prof_color_layout->addWidget(component_colors[i], row, col);
		component_halftone[i] = Util::SpinBox::create(1, 0.0, 100.0, tr("%"), 10.0);
		prof_color_layout->addWidget(component_halftone[i], row, col+1);
	}
	
	++row;
	knockout_option = new QCheckBox(tr("Knockout: erases lower colors"));
	prof_color_layout->addWidget(knockout_option, row, col, 1, 2);
	knockout_option->setEnabled(false);
	
	row = 0, col += 2;
	prof_color_layout->setColumnStretch(col, 1);
	
	const int spacing = style()->pixelMetric(QStyle::PM_LayoutTopMargin);
	prof_color_layout->addItem(new QSpacerItem(3*spacing, spacing), row, col, 7, 1);
	
	row = 0, col +=1;
	prof_color_layout->setColumnStretch(col, 1);
	prof_color_layout->setColumnStretch(col+1, 3);
	prof_color_layout->addWidget(Util::Headline::create("CMYK"), row, col, 1, 2);
	
	QButtonGroup* cmyk_color_options = new QButtonGroup(this);
	
	++row;
	cmyk_spot_color_option = new QRadioButton(tr("Calculate from spot colors"));
	cmyk_color_options->addButton(cmyk_spot_color_option, MapColor::SpotColor);
	prof_color_layout->addWidget(cmyk_spot_color_option, row, col, 1, 2);
	
	++row;
	evaluate_rgb_option = new QRadioButton(tr("Calculate from RGB color"));
	cmyk_color_options->addButton(evaluate_rgb_option, MapColor::RgbColor);
	prof_color_layout->addWidget(evaluate_rgb_option, row, col, 1, 2);
	
	++row;
	custom_cmyk_option = new QRadioButton(tr("Custom process color:"));
	cmyk_color_options->addButton(custom_cmyk_option, MapColor::CustomColor);
	prof_color_layout->addWidget(custom_cmyk_option, row, col, 1, 2);
	
	++row;
	c_edit = Util::SpinBox::create(1, 0.0, 100.0, tr("%"), 10.0);
	prof_color_layout->addWidget(new QLabel(tr("Cyan")), row, col);
	prof_color_layout->addWidget(c_edit, row, col+1);
	
	++row;
	m_edit = Util::SpinBox::create(1, 0.0, 100.0, tr("%"), 10.0);
	prof_color_layout->addWidget(new QLabel(tr("Magenta")), row, col);
	prof_color_layout->addWidget(m_edit, row, col+1);
	
	++row;
	y_edit = Util::SpinBox::create(1, 0.0, 100.0, tr("%"), 10.0);
	prof_color_layout->addWidget(new QLabel(tr("Yellow")), row, col);
	prof_color_layout->addWidget(y_edit, row, col+1);
	
	++row;
	k_edit = Util::SpinBox::create(1, 0.0, 100.0, tr("%"), 10.0);
	prof_color_layout->addWidget(new QLabel(tr("Black")), row, col);
	prof_color_layout->addWidget(k_edit, row, col+1);
	
	++row;
	stretch_row0 = row;
	stretch_col0 = col;
	stretch = new QWidget();
	prof_color_layout->addWidget(stretch, row, col);
	prof_color_layout->setRowStretch(row, 1);
	
	QWidget* prof_color_widget = new QWidget();
	prof_color_widget->setLayout(prof_color_layout);
	prof_color_widget->setObjectName(QString::fromLatin1("professional"));
	
	
	QGridLayout* desktop_layout = new QGridLayout();
	col = 0;
	desktop_layout->setColumnStretch(col, 1);
	desktop_layout->setColumnStretch(col+1, 3);
	
	row = 0;
	desktop_layout->addWidget(Util::Headline::create("RGB"), row, col, 1, 2);
	
	QButtonGroup* rgb_color_options = new QButtonGroup(this);
	
	++row;
	rgb_spot_color_option = new QRadioButton(tr("Calculate from spot colors"));
	rgb_color_options->addButton(rgb_spot_color_option, MapColor::SpotColor);
	desktop_layout->addWidget(rgb_spot_color_option, row, col, 1, 2);
	
	++row;
	evaluate_cmyk_option = new QRadioButton(tr("Calculate from CMYK color"));
	rgb_color_options->addButton(evaluate_cmyk_option, MapColor::CmykColor);
	desktop_layout->addWidget(evaluate_cmyk_option, row, col, 1, 2);
	
	++row;
	custom_rgb_option = new QRadioButton(tr("Custom RGB color:"));
	rgb_color_options->addButton(custom_rgb_option, MapColor::CustomColor);
	desktop_layout->addWidget(custom_rgb_option, row, col, 1, 2);
	
	++row;
	r_edit = Util::SpinBox::create(1, 0.0, 255.0, {}, 5);
	desktop_layout->addWidget(new QLabel(tr("Red")), row, col);
	desktop_layout->addWidget(r_edit, row, col+1);
	
	++row;
	g_edit = Util::SpinBox::create(1, 0.0, 255.0, {}, 5);
	desktop_layout->addWidget(new QLabel(tr("Green")), row, col);
	desktop_layout->addWidget(g_edit, row, col+1);
	
	++row;
	b_edit = Util::SpinBox::create(1, 0.0, 255.0, {}, 5);
	desktop_layout->addWidget(new QLabel(tr("Blue")), row, col);
	desktop_layout->addWidget(b_edit, row, col+1);
	
	++row;
	html_edit = new QLineEdit();
	desktop_layout->addWidget(new QLabel(tr("#RRGGBB")), row, col);
	desktop_layout->addWidget(html_edit, row, col+1);
	
	++row;
	desktop_layout->addWidget(new QWidget(), row, col);
	desktop_layout->setRowStretch(row, 1);
	
	row = 0, col += 2;
	desktop_layout->setColumnStretch(col, 7);
	
	desktop_layout->addItem(new QSpacerItem(3*spacing, spacing), row, col, 7, 1);
	
	QWidget* desktop_color_widget = new QWidget();
	desktop_color_widget->setLayout(desktop_layout);
	desktop_color_widget->setObjectName(QString::fromLatin1("desktop"));
	
	
	properties_widget = new QTabWidget();
	properties_widget->addTab(desktop_color_widget, tr("Desktop"));
	properties_widget->addTab(prof_color_widget, tr("Professional printing"));
	
	QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok | QDialogButtonBox::Reset | QDialogButtonBox::Help);
	ok_button = button_box->button(QDialogButtonBox::Ok);
	reset_button = button_box->button(QDialogButtonBox::Reset);
	connect(button_box, SIGNAL(rejected()), this, SLOT(reject()));
	connect(button_box, SIGNAL(accepted()), this, SLOT(accept()));
	connect(reset_button, SIGNAL(clicked(bool)), this, SLOT(reset()));
	connect(button_box->button(QDialogButtonBox::Help), SIGNAL(clicked(bool)), this, SLOT(showHelp()));
	
	QGridLayout* layout = new QGridLayout();
	layout->addWidget(color_preview_label, 0, 0);
	layout->addWidget(mc_name_edit, 0, 1);
	layout->addWidget(properties_widget, 1, 0, 1, 2);
	layout->addWidget(button_box, 2, 0, 1, 2);
	layout->setColumnStretch(1, 1);
	setLayout(layout);
	
	updateWidgets();
	updateButtons();
	
	connect(mc_name_edit, SIGNAL(textChanged(QString)), this, SLOT(mapColorNameChanged()));
	
	connect(spot_color_options, SIGNAL(buttonClicked(int)), this, SLOT(spotColorTypeChanged(int)));
	connect(sc_name_edit, SIGNAL(textChanged(QString)), this, SLOT(spotColorNameChanged()));
	for (int i = 0; i < (int)component_colors.size(); i++)
	{
		connect(component_colors[i], SIGNAL(currentIndexChanged(int)), this, SLOT(spotColorCompositionChanged()));
		connect(component_halftone[i], SIGNAL(valueChanged(double)), this, SLOT(spotColorCompositionChanged()));
	}
	connect(knockout_option, SIGNAL(clicked(bool)), this, SLOT(knockoutChanged()));
	
	connect(cmyk_color_options, SIGNAL(buttonClicked(int)), this, SLOT(cmykColorTypeChanged(int)));
	connect(c_edit, SIGNAL(valueChanged(double)), this, SLOT(cmykValueChanged()));
	connect(m_edit, SIGNAL(valueChanged(double)), this, SLOT(cmykValueChanged()));
	connect(y_edit, SIGNAL(valueChanged(double)), this, SLOT(cmykValueChanged()));
	connect(k_edit, SIGNAL(valueChanged(double)), this, SLOT(cmykValueChanged()));
	
	connect(rgb_color_options, SIGNAL(buttonClicked(int)), this, SLOT(rgbColorTypeChanged(int)));
	connect(r_edit, SIGNAL(valueChanged(double)), this, SLOT(rgbValueChanged()));
	connect(g_edit, SIGNAL(valueChanged(double)), this, SLOT(rgbValueChanged()));
	connect(b_edit, SIGNAL(valueChanged(double)), this, SLOT(rgbValueChanged()));
	
	QSettings settings;
	settings.beginGroup(QString::fromLatin1("ColorDialog"));
	QString default_view = settings.value(QString::fromLatin1("view")).toString();
	settings.endGroup();
	properties_widget->setCurrentWidget(properties_widget->findChild<QWidget*>(default_view));
}
コード例 #4
0
ファイル: roadwaydlg.cpp プロジェクト: liye0005/QT_POJ
void RoadwayCoorSelDlg::OnCancelButtonClicked()
{
    coor_type_ = "";
    coor_int_type_ = -1;
    reject();
}
コード例 #5
0
ファイル: pinentrydialog.cpp プロジェクト: neopgp/pinentry
PinEntryDialog::PinEntryDialog( QWidget* parent, const char* name,
	int timeout, bool modal, bool enable_quality_bar )
  : QDialog( parent, Qt::WindowStaysOnTopHint ), _grabbed( false )
{
  setWindowFlags( windowFlags() & ~Qt::WindowContextHelpButtonHint );

  if ( modal ) {
    setWindowModality( Qt::ApplicationModal );
  }

  _icon = new QLabel( this );
  _icon->setPixmap( icon() );

  _error = new QLabel( this );
  _error->setWordWrap(true);
  QPalette pal;
  pal.setColor( QPalette::WindowText, Qt::red );
  _error->setPalette( pal );
  _error->hide();

  _desc = new QLabel( this );
  _desc->setWordWrap(true);
  _desc->hide();

  _prompt = new QLabel( this );
  _prompt->hide();

  _edit = new QSecureLineEdit( this );
  _edit->setMaxLength( 256 );

  _prompt->setBuddy( _edit );

  if (enable_quality_bar)
  {
    _quality_bar_label = new QLabel( this );
    _quality_bar_label->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
    _quality_bar = new QProgressBar( this );
    _quality_bar->setAlignment( Qt::AlignCenter );
    _have_quality_bar = true;
  }
  else
    _have_quality_bar = false;

  QDialogButtonBox* const buttons = new QDialogButtonBox( this );
  buttons->setStandardButtons( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
  _ok = buttons->button( QDialogButtonBox::Ok );
  _cancel = buttons->button( QDialogButtonBox::Cancel );

  _ok->setDefault(true);

  if ( style()->styleHint( QStyle::SH_DialogButtonBox_ButtonsHaveIcons ) )
    {
      _ok->setIcon( style()->standardIcon( QStyle::SP_DialogOkButton ) );
      _cancel->setIcon( style()->standardIcon( QStyle::SP_DialogCancelButton ) );
    }

  if (timeout > 0) {
      _timer = new QTimer(this);
      connect(_timer, SIGNAL(timeout()), this, SLOT(slotTimeout()));
      _timer->start(timeout*1000);
  }
  else
    _timer = NULL;

  connect( buttons, SIGNAL(accepted()), this, SLOT(accept()) );
  connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) );
  connect( _edit, SIGNAL( textChanged(secqstring) ),
	   this, SLOT( updateQuality(secqstring) ) );

  _edit->setFocus();

  QGridLayout* const grid = new QGridLayout( this );
  grid->addWidget( _icon, 0, 0, 5, 1, Qt::AlignTop|Qt::AlignLeft );
  grid->addWidget( _error, 1, 1, 1, 2 );
  grid->addWidget( _desc,  2, 1, 1, 2 );
  //grid->addItem( new QSpacerItem( 0, _edit->height() / 10, QSizePolicy::Minimum, QSizePolicy::Fixed ), 1, 1 );
  grid->addWidget( _prompt, 3, 1 );
  grid->addWidget( _edit, 3, 2 );
  if( enable_quality_bar )
  {
    grid->addWidget( _quality_bar_label, 4, 1 );
    grid->addWidget( _quality_bar, 4, 2 );
  }
  grid->addWidget( buttons, 5, 0, 1, 3 );

  grid->setSizeConstraint( QLayout::SetFixedSize );
}
コード例 #6
0
ファイル: CreateGameDialog.cpp プロジェクト: pasdam/pokerHN
CreateGameDialog::CreateGameDialog(QWidget *parent) : QDialog(parent)
{
	setWindowTitle(tr("Create game"));
	setWindowIcon(QIcon(":/res/hn_logo.png"));
	setMinimumWidth(300);
	
	QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
					  Qt::Horizontal, this);
	
	connect(buttonBox, SIGNAL(accepted()), this, SLOT(actionOk()));
	connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
	
	
	QGroupBox *groupGeneral = new QGroupBox(tr("General"), this);
	
	QLabel *labelName = new QLabel(tr("Game name"), this);
	editName = new QLineEdit(QString::fromStdString(config.get("player_name")) + "'s game", this);
	
	// FIXME:
	QLabel *labelGametype = new QLabel(tr("Game type"), this);
	QComboBox *comboGametype = new QComboBox(this);
	comboGametype->addItem("THNL");
	comboGametype->setEnabled(false);
	
	// FIXME:
	QLabel *labelGamemode = new QLabel(tr("Game mode"), this);
	QComboBox *comboGamemode = new QComboBox(this);
	comboGamemode->addItem("Sit'n'Go");
	comboGamemode->setEnabled(false);
	
	QGridLayout *layoutGeneral = new QGridLayout;
	layoutGeneral->addWidget(labelName, 0, 0);
	layoutGeneral->addWidget(editName, 0, 1);
	layoutGeneral->addWidget(labelGametype, 1, 0);
	layoutGeneral->addWidget(comboGametype, 1, 1);
	layoutGeneral->addWidget(labelGamemode, 2, 0);
	layoutGeneral->addWidget(comboGamemode, 2, 1);
	groupGeneral->setLayout(layoutGeneral);
	
	QGroupBox *groupPlayers = new QGroupBox(tr("Players"), this);
	
	QLabel *labelPlayers = new QLabel(tr("Max. players"), this);
	spinPlayers = new QSpinBox(this);
	spinPlayers->setMinimum(2);
	spinPlayers->setMaximum(10);
	spinPlayers->setSingleStep(1);
	spinPlayers->setValue(5);
	
	QLabel *labelTimeout = new QLabel(tr("Timeout"), this);
	spinTimeout = new QSpinBox(this);
	spinTimeout->setMinimum(5);
	spinTimeout->setMaximum(3*60);
	spinTimeout->setSingleStep(10);
	spinTimeout->setValue(30);
	
	QLabel *labelStake = new QLabel(tr("Initial stake"), this);
	spinStake = new QSpinBox(this);
	spinStake->setMinimum(500);
	spinStake->setMaximum(1000000);
	spinStake->setSingleStep(100);
	spinStake->setValue(1500);
	
	QGridLayout *layoutPlayers = new QGridLayout;
	layoutPlayers->addWidget(labelPlayers, 0, 0);
	layoutPlayers->addWidget(spinPlayers, 0, 1);
	layoutPlayers->addWidget(labelTimeout, 1, 0);
	layoutPlayers->addWidget(spinTimeout, 1, 1);
	layoutPlayers->addWidget(labelStake, 2, 0);
	layoutPlayers->addWidget(spinStake, 2, 1);
	groupPlayers->setLayout(layoutPlayers);
	
	
	QGroupBox *groupBlinds = new QGroupBox(tr("Blinds"), this);
	
	QLabel *labelBlindsStart = new QLabel(tr("Starting blinds"), this);
	spinBlindsStart = new QSpinBox(this);
	spinBlindsStart->setMinimum(5);
	spinBlindsStart->setMaximum(200);
	spinBlindsStart->setSingleStep(10);
	spinBlindsStart->setValue(20);
	
	QLabel *labelBlindsFactor = new QLabel(tr("Raise factor"), this);
	spinBlindsFactor = new QDoubleSpinBox(this);
	spinBlindsFactor->setDecimals(2);
	spinBlindsFactor->setMinimum(1.3);
	spinBlindsFactor->setMaximum(3.5);
	spinBlindsFactor->setSingleStep(0.1);
	spinBlindsFactor->setValue(2.0);
	
	QLabel *labelBlindsTime = new QLabel(tr("Raise time"), this);
	spinBlindsTime = new QSpinBox(this);
	spinBlindsTime->setMinimum(60);
	spinBlindsTime->setMaximum(10*60);
	spinBlindsTime->setSingleStep(60);
	spinBlindsTime->setValue(5*60);
	
	QGridLayout *layoutBlinds = new QGridLayout;
	layoutBlinds->addWidget(labelBlindsStart, 0, 0);
	layoutBlinds->addWidget(spinBlindsStart, 0, 1);
	layoutBlinds->addWidget(labelBlindsFactor, 1, 0);
	layoutBlinds->addWidget(spinBlindsFactor, 1, 1);
	layoutBlinds->addWidget(labelBlindsTime, 2, 0);
	layoutBlinds->addWidget(spinBlindsTime, 2, 1);
	groupBlinds->setLayout(layoutBlinds);
	
	
	QGroupBox *groupPrivate = new QGroupBox(tr("Private game"), this);
	
	QLabel *labelPrivate = new QLabel(tr("Password protected"), this);
	QCheckBox *checkPrivate = new QCheckBox(this);
	connect(checkPrivate, SIGNAL(stateChanged(int)), this, SLOT(slotCheckStatePrivate(int)));
	
	QLabel *labelPassword = new QLabel(tr("Password"), this);
	editPassword = new QLineEdit(this);
	editPassword->setEnabled(false);
	editPassword->setEchoMode(config.getBool("ui_echo_password") ? QLineEdit::Normal : QLineEdit::Password);
	
	
	QGridLayout *layoutPrivate = new QGridLayout;
	layoutPrivate->addWidget(labelPrivate, 0, 0);
	layoutPrivate->addWidget(checkPrivate, 0, 1);
	layoutPrivate->addWidget(labelPassword, 1, 0);
	layoutPrivate->addWidget(editPassword, 1, 1);
	groupPrivate->setLayout(layoutPrivate);
	
	
	QGridLayout *mainLayout = new QGridLayout;
	mainLayout->addWidget(groupGeneral, 0, 0);
	mainLayout->addWidget(groupPlayers, 0, 1);
	mainLayout->addWidget(groupBlinds, 1, 1);
	mainLayout->addWidget(groupPrivate, 1, 0);
	mainLayout->addWidget(buttonBox, 2, 0, 1, 2);
	setLayout(mainLayout);
}
コード例 #7
0
ファイル: newareadialog.cpp プロジェクト: ZebraQuake/AneMake
void NewAreaDialog::cancel() {
	reject();
}
コード例 #8
0
ファイル: PlotWizard.cpp プロジェクト: chaoqing/qtiplot
PlotWizard::PlotWizard( QWidget* parent, Qt::WFlags fl )
: QDialog( parent, fl )
{
	setWindowTitle( tr("QtiPlot - Select Columns to Plot") );
	setAttribute(Qt::WA_DeleteOnClose);
	setSizeGripEnabled( true );

	// top part starts here
	groupBox1 = new QGroupBox();

    QGridLayout *gl1 = new QGridLayout();
	buttonX = new QPushButton("<->" + tr("&X"));
	buttonX->setAutoDefault( false );
	gl1->addWidget( buttonX, 0, 0);

	buttonXErr = new QPushButton("<->" + tr("x&Err"));
	buttonXErr->setAutoDefault( false );
	gl1->addWidget( buttonXErr, 0, 1);

	buttonY = new QPushButton("<->" + tr("&Y"));
	buttonY->setAutoDefault( false );
	gl1->addWidget( buttonY, 1, 0);

	buttonYErr = new QPushButton("<->" + tr("yE&rr"));
	buttonYErr->setAutoDefault( false );
	gl1->addWidget( buttonYErr, 1, 1);

	buttonZ = new QPushButton("<->" + tr("&Z"));
	buttonZ->setAutoDefault( false );
	gl1->addWidget( buttonZ, 2, 0);
    gl1->setRowStretch(3,1);

    QHBoxLayout *hl2 = new QHBoxLayout();
    buttonNew = new QPushButton(tr("&New curve"));
    buttonNew->setDefault( true );
    buttonNew->setAutoDefault( true );
	hl2->addWidget(buttonNew);

	buttonDelete = new QPushButton(tr("&Delete curve"));
    buttonDelete->setAutoDefault( false );
	hl2->addWidget(buttonDelete);

    QVBoxLayout *vl = new QVBoxLayout();
    vl->addLayout(gl1);
    vl->addStretch();
    vl->addLayout(hl2);

    QGridLayout *gl2 = new QGridLayout(groupBox1);
    gl2->addWidget(new QLabel(tr( "Worksheet" )), 0, 0);
    boxTables = new QComboBox();
    gl2->addWidget(boxTables, 0, 1);
    columnsList = new QListWidget();
    gl2->addWidget(columnsList, 1, 0);
    gl2->addLayout(vl, 1, 1);

	// middle part is only one widget
	plotAssociations = new QListWidget();

	// bottom part starts here
	QHBoxLayout * bottomLayout = new QHBoxLayout();
    bottomLayout->addStretch();

	buttonOk = new QPushButton(tr("&Plot"));
    buttonOk->setAutoDefault( false );
	bottomLayout->addWidget( buttonOk );

	buttonCancel = new QPushButton(tr("&Close"));
    buttonCancel->setAutoDefault( false );
	bottomLayout->addWidget( buttonCancel );

	QVBoxLayout* vlayout = new QVBoxLayout( this );
	vlayout->addWidget( groupBox1 );
	vlayout->addWidget( plotAssociations );
	vlayout->addLayout( bottomLayout );

	// signals and slots connections
	connect( boxTables, SIGNAL(activated(const QString &)),this, SLOT(changeColumnsList(const QString &)));
	connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
	connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
	connect( buttonNew, SIGNAL( clicked() ), this, SLOT( addCurve() ) );
	connect( buttonDelete, SIGNAL( clicked() ), this, SLOT( removeCurve() ) );
	connect( buttonX, SIGNAL( clicked() ), this, SLOT(addXCol()));
	connect( buttonY, SIGNAL( clicked() ), this, SLOT(addYCol()));
	connect( buttonXErr, SIGNAL( clicked() ), this, SLOT(addXErrCol()));
	connect( buttonYErr, SIGNAL( clicked() ), this, SLOT(addYErrCol()));
	connect( buttonZ, SIGNAL( clicked() ), this, SLOT(addZCol()));
}
コード例 #9
0
ファイル: shutdowndlg.cpp プロジェクト: KDE/kde-workspace
KSMShutdownDlg::KSMShutdownDlg( QWindow* parent,
                                bool maysd, bool choose, KWorkSpace::ShutdownType sdtype,
                                const QString& theme)
  : QQuickView(parent), //krazy:exclude=qclasses
    m_result(false)
    // this is a WType_Popup on purpose. Do not change that! Not
    // having a popup here has severe side effects.
{
    // window stuff
    QSurfaceFormat format;
    format.setAlphaBufferSize(8);
    setFormat(format);
    setClearBeforeRendering(true);
    setColor(QColor(Qt::transparent));
    setFlags(Qt::FramelessWindowHint);

    winId(); // workaround for Qt4.3 setWindowRole() assert
//    setWindowRole( QStringLiteral("logoutdialog") );

    // Qt doesn't set this on unmanaged windows
    //FIXME: or does it?
    XChangeProperty( QX11Info::display(), winId(),
        XInternAtom( QX11Info::display(), "WM_WINDOW_ROLE", False ), XA_STRING, 8, PropModeReplace,
        (unsigned char *)"logoutdialog", strlen( "logoutdialog" ));

    setPosition(screen()->virtualGeometry().center().x() - width() / 2,
                screen()->virtualGeometry().center().y() - height() / 2);

     setMinimumSize(QSize(300, 200));
    //kDebug() << "Creating QML view";
    //QQuickView *windowContainer = QQuickView::createWindowContainer(m_view, this);
    //windowContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    QQmlContext *context = rootContext();
    context->setContextProperty(QStringLiteral("maysd"), maysd);
    context->setContextProperty(QStringLiteral("choose"), choose);
    context->setContextProperty(QStringLiteral("sdtype"), sdtype);

    QQmlPropertyMap *mapShutdownType = new QQmlPropertyMap(this);
    mapShutdownType->insert(QStringLiteral("ShutdownTypeDefault"), QVariant::fromValue((int)KWorkSpace::ShutdownTypeDefault));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeNone"), QVariant::fromValue((int)KWorkSpace::ShutdownTypeNone));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeReboot"), QVariant::fromValue((int)KWorkSpace::ShutdownTypeReboot));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeHalt"), QVariant::fromValue((int)KWorkSpace::ShutdownTypeHalt));
    mapShutdownType->insert(QStringLiteral("ShutdownTypeLogout"), QVariant::fromValue((int)KWorkSpace::ShutdownTypeLogout));
    context->setContextProperty(QStringLiteral("ShutdownType"), mapShutdownType);

    QQmlPropertyMap *mapSpdMethods = new QQmlPropertyMap(this);
    QSet<Solid::PowerManagement::SleepState> spdMethods = Solid::PowerManagement::supportedSleepStates();
    mapSpdMethods->insert(QStringLiteral("StandbyState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::StandbyState)));
    mapSpdMethods->insert(QStringLiteral("SuspendState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::SuspendState)));
    mapSpdMethods->insert(QStringLiteral("HibernateState"), QVariant::fromValue(spdMethods.contains(Solid::PowerManagement::HibernateState)));
    context->setContextProperty(QStringLiteral("spdMethods"), mapSpdMethods);

    QString bootManager = KConfig(QStringLiteral(KDE_CONFDIR "/kdm/kdmrc"), KConfig::SimpleConfig)
                          .group("Shutdown")
                          .readEntry("BootManager", "None");
    context->setContextProperty(QStringLiteral("bootManager"), bootManager);

    QStringList options;
    int def, cur;
    if ( KDisplayManager().bootOptions( rebootOptions, def, cur ) ) {
        if ( cur > -1 ) {
            def = cur;
        }
    }
    QQmlPropertyMap *rebootOptionsMap = new QQmlPropertyMap(this);
    rebootOptionsMap->insert(QStringLiteral("options"), QVariant::fromValue(rebootOptions));
    rebootOptionsMap->insert(QStringLiteral("default"), QVariant::fromValue(def));
    context->setContextProperty(QStringLiteral("rebootOptions"), rebootOptionsMap);

    setModality(Qt::ApplicationModal);

    // engine stuff
    KDeclarative::KDeclarative kdeclarative;
    kdeclarative.setDeclarativeEngine(engine());
    kdeclarative.initialize();
    kdeclarative.setupBindings();
//    windowContainer->installEventFilter(this);

    QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("ksmserver/themes/%1/main.qml").arg(theme));
    if (QFile::exists(fileName)) {
        //kDebug() << "Using QML theme" << fileName;
        setSource(QUrl::fromLocalFile(fileName));
    }

    connect(rootObject(), SIGNAL(logoutRequested()), SLOT(slotLogout()));
    connect(rootObject(), SIGNAL(haltRequested()), SLOT(slotHalt()));
    connect(rootObject(), SIGNAL(suspendRequested(int)), SLOT(slotSuspend(int)) );
    connect(rootObject(), SIGNAL(rebootRequested()), SLOT(slotReboot()));
    connect(rootObject(), SIGNAL(rebootRequested2(int)), SLOT(slotReboot(int)) );
    connect(rootObject(), SIGNAL(cancelRequested()), SLOT(reject()));
    connect(rootObject(), SIGNAL(lockScreenRequested()), SLOT(slotLockScreen()));

    show();
//    adjustSize();
}
コード例 #10
0
PreferencesDialog::PreferencesDialog( QWidget * parent )
  : QDialog( parent )
{
  Preferences *preferences = GetPreferences();
  m_restoreSearchPaths            = preferences->getSearchPaths();
  m_restoreEnvironmentEnabled     = preferences->getEnvironmentEnabled();
  m_restoreEnvironmentTextureName = preferences->getEnvironmentTextureName();
  m_restoreMaterialCatalogPath    = preferences->getMaterialCatalogPath();


  m_environmentMapLabel = new QLabel( m_restoreEnvironmentTextureName );
  m_environmentMapLabel->setFrameShadow( QFrame::Sunken );
  m_environmentMapLabel->setFrameShape( QFrame::StyledPanel );

  QPushButton * environmentMapButton = new QPushButton( "..." );
  connect( environmentMapButton, SIGNAL(clicked(bool)), this, SLOT(selectEnvironmentMap(bool)) );

  QHBoxLayout * environmentMapLayout = new QHBoxLayout();
  environmentMapLayout->addWidget( m_environmentMapLabel );
  environmentMapLayout->addWidget( environmentMapButton );

  QFormLayout * environmentLayout = new QFormLayout();
  environmentLayout->addRow( "Environment Map", environmentMapLayout );

  QGroupBox * environmentBox = new QGroupBox( "Environment" );
  environmentBox->setCheckable( true );
  environmentBox->setChecked( m_restoreEnvironmentEnabled );
  environmentBox->setLayout( environmentLayout );
  connect( environmentBox, SIGNAL(toggled(bool)), this, SLOT(toggledEnvironmentBox(bool)) );


  m_materialCatalogLabel = new QLabel( m_restoreMaterialCatalogPath );
  m_materialCatalogLabel->setFrameShadow( QFrame::Sunken );
  m_materialCatalogLabel->setFrameShape( QFrame::StyledPanel );

  QPushButton * materialCatalogButton = new QPushButton( "..." );
  connect( materialCatalogButton, SIGNAL(clicked(bool)), this, SLOT(selectMaterialCatalogPath(bool)) );

  QHBoxLayout * materialCatalogLayout = new QHBoxLayout();
  materialCatalogLayout->addWidget( m_materialCatalogLabel );
  materialCatalogLayout->addWidget( materialCatalogButton );

  QFormLayout * materialLayout = new QFormLayout();
  materialLayout->addRow( "Material Catalog", materialCatalogLayout );

  QGroupBox * materialBox = new QGroupBox( "Material" );
  materialBox->setLayout( materialLayout );


  m_searchPaths = new QListWidget();
  m_searchPaths->addItems( m_restoreSearchPaths );

  QPushButton * addPathButton = new QPushButton( "Add ..." );
  connect( addPathButton, SIGNAL(clicked(bool)), this, SLOT(addPath(bool)) );

  QPushButton * removePathButton = new QPushButton( "Remove" );
  connect( removePathButton, SIGNAL(clicked(bool)), this, SLOT(removePath(bool)) );

  QPushButton * moveUpPathButton = new QPushButton( "Move Up" );
  connect( moveUpPathButton, SIGNAL(clicked(bool)), this, SLOT(moveUpPath(bool)) );

  QPushButton * moveDownPathButton = new QPushButton( "Move Down" );
  connect( moveDownPathButton, SIGNAL(clicked(bool)), this, SLOT(moveDownPath(bool)) );

  QHBoxLayout * searchPathsButtons = new QHBoxLayout();
  searchPathsButtons->addWidget( addPathButton );
  searchPathsButtons->addWidget( removePathButton );
  searchPathsButtons->addWidget( moveUpPathButton );
  searchPathsButtons->addWidget( moveDownPathButton );

  QVBoxLayout * verticalLayout = new QVBoxLayout();
  verticalLayout->addWidget( m_searchPaths );
  verticalLayout->addLayout( searchPathsButtons );

  QGroupBox * searchPathsBox = new QGroupBox( "Search Paths" );
  searchPathsBox->setLayout( verticalLayout );

  QDialogButtonBox * buttonBox = new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
  connect( buttonBox, SIGNAL(accepted()), this, SLOT(accept()) );
  connect( buttonBox, SIGNAL(rejected()), this, SLOT(reject()) );

  verticalLayout = new QVBoxLayout();
  verticalLayout->addWidget( environmentBox );
  verticalLayout->addWidget( materialBox );
  verticalLayout->addWidget( searchPathsBox );
  verticalLayout->addWidget( buttonBox );

  setWindowTitle( "Preferences" );
  setLayout( verticalLayout );
}
コード例 #11
0
ファイル: qfontdialog.cpp プロジェクト: MarianMMX/MarianMMX
void QFontDialogPrivate::init()
{
    Q_Q(QFontDialog);

    q->setSizeGripEnabled(true);
    q->setWindowTitle(QFontDialog::tr("Select Font"));

    // grid
    familyEdit = new QLineEdit(q);
    familyEdit->setReadOnly(true);
    familyList = new QFontListView(q);
    familyEdit->setFocusProxy(familyList);

    familyAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    familyAccel->setBuddy(familyList);
#endif
    familyAccel->setIndent(2);

    styleEdit = new QLineEdit(q);
    styleEdit->setReadOnly(true);
    styleList = new QFontListView(q);
    styleEdit->setFocusProxy(styleList);

    styleAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    styleAccel->setBuddy(styleList);
#endif
    styleAccel->setIndent(2);

    sizeEdit = new QLineEdit(q);
    sizeEdit->setFocusPolicy(Qt::ClickFocus);
    QIntValidator *validator = new QIntValidator(1, 512, q);
    sizeEdit->setValidator(validator);
    sizeList = new QFontListView(q);

    sizeAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    sizeAccel->setBuddy(sizeEdit);
#endif
    sizeAccel->setIndent(2);

    // effects box
    effects = new QGroupBox(q);
    QVBoxLayout *vbox = new QVBoxLayout(effects);
    strikeout = new QCheckBox(effects);
    vbox->addWidget(strikeout);
    underline = new QCheckBox(effects);
    vbox->addWidget(underline);

    sample = new QGroupBox(q);
    QHBoxLayout *hbox = new QHBoxLayout(sample);
    sampleEdit = new QLineEdit(sample);
    sampleEdit->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
    sampleEdit->setAlignment(Qt::AlignCenter);
    // Note that the sample text is *not* translated with tr(), as the
    // characters used depend on the charset encoding.
    sampleEdit->setText(QLatin1String("AaBbYyZz"));
    hbox->addWidget(sampleEdit);

    writingSystemCombo = new QComboBox(q);

    writingSystemAccel = new QLabel(q);
#ifndef QT_NO_SHORTCUT
    writingSystemAccel->setBuddy(writingSystemCombo);
#endif
    writingSystemAccel->setIndent(2);

    size = 0;
    smoothScalable = false;

    QObject::connect(writingSystemCombo, SIGNAL(activated(int)), q, SLOT(_q_writingSystemHighlighted(int)));
    QObject::connect(familyList, SIGNAL(highlighted(int)), q, SLOT(_q_familyHighlighted(int)));
    QObject::connect(styleList, SIGNAL(highlighted(int)), q, SLOT(_q_styleHighlighted(int)));
    QObject::connect(sizeList, SIGNAL(highlighted(int)), q, SLOT(_q_sizeHighlighted(int)));
    QObject::connect(sizeEdit, SIGNAL(textChanged(QString)), q, SLOT(_q_sizeChanged(QString)));

    QObject::connect(strikeout, SIGNAL(clicked()), q, SLOT(_q_updateSample()));
    QObject::connect(underline, SIGNAL(clicked()), q, SLOT(_q_updateSample()));

    for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
        QFontDatabase::WritingSystem ws = QFontDatabase::WritingSystem(i);
        QString writingSystemName = QFontDatabase::writingSystemName(ws);
        if (writingSystemName.isEmpty())
            break;
        writingSystemCombo->addItem(writingSystemName);
    }

    updateFamilies();
    if (familyList->count() != 0) {
        familyList->setCurrentItem(0);
        sizeList->setCurrentItem(0);
    }

    // grid layout
    QGridLayout *mainGrid = new QGridLayout(q);

    int spacing = mainGrid->spacing();
    if (spacing >= 0) {     // uniform spacing
       mainGrid->setSpacing(0);

       mainGrid->setColumnMinimumWidth(1, spacing);
       mainGrid->setColumnMinimumWidth(3, spacing);

       int margin = 0;
       mainGrid->getContentsMargins(0, 0, 0, &margin);

       mainGrid->setRowMinimumHeight(3, margin);
       mainGrid->setRowMinimumHeight(6, 2);
       mainGrid->setRowMinimumHeight(8, margin);
    }

    mainGrid->addWidget(familyAccel, 0, 0);
    mainGrid->addWidget(familyEdit, 1, 0);
    mainGrid->addWidget(familyList, 2, 0);

    mainGrid->addWidget(styleAccel, 0, 2);
    mainGrid->addWidget(styleEdit, 1, 2);
    mainGrid->addWidget(styleList, 2, 2);

    mainGrid->addWidget(sizeAccel, 0, 4);
    mainGrid->addWidget(sizeEdit, 1, 4);
    mainGrid->addWidget(sizeList, 2, 4);

    mainGrid->setColumnStretch(0, 38);
    mainGrid->setColumnStretch(2, 24);
    mainGrid->setColumnStretch(4, 10);

    mainGrid->addWidget(effects, 4, 0);

    mainGrid->addWidget(sample, 4, 2, 4, 3);

    mainGrid->addWidget(writingSystemAccel, 5, 0);
    mainGrid->addWidget(writingSystemCombo, 7, 0);

    buttonBox = new QDialogButtonBox(q);
    mainGrid->addWidget(buttonBox, 9, 0, 1, 5);

    QPushButton *button
            = static_cast<QPushButton *>(buttonBox->addButton(QDialogButtonBox::Ok));
    QObject::connect(buttonBox, SIGNAL(accepted()), q, SLOT(accept()));
    button->setDefault(true);

    buttonBox->addButton(QDialogButtonBox::Cancel);
    QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));

#if defined(Q_OS_WINCE)
    q->resize(180, 120);
#else
    q->resize(500, 360);
#endif // Q_OS_WINCE

    sizeEdit->installEventFilter(q);
    familyList->installEventFilter(q);
    styleList->installEventFilter(q);
    sizeList->installEventFilter(q);

    familyList->setFocus();
    retranslateStrings();
    sampleEdit->setObjectName(QLatin1String("qt_fontDialog_sampleEdit"));
}
void ScriptPromiseResolver::reject(ScriptValue value)
{
    ASSERT(v8::Context::InContext());
    reject(value.v8Value());
}
コード例 #13
0
ファイル: newftpgui.cpp プロジェクト: KDE/krusader
/**
 * Constructs a newFTPGUI which is a child of 'parent',
 * with the name 'name' and widget flags set to 'f'
 */
newFTPGUI::newFTPGUI(QWidget* parent) : QDialog(parent)
{
    setModal(true);
    setWindowTitle(i18n("New Network Connection"));
    resize(400, 240);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    QSizePolicy policy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    policy.setHeightForWidth(sizePolicy().hasHeightForWidth());
    setSizePolicy(policy);

    iconLabel = new QLabel(this);
    iconLabel->setPixmap(krLoader->loadIcon("network-wired", KIconLoader::Desktop, 32));
    iconLabel->setSizePolicy(SIZE_MINIMUM);

    aboutLabel = new QLabel(i18n("About to connect to..."), this);
    QFont font(aboutLabel->font());
    font.setBold(true);
    aboutLabel->setFont(font);

    protocolLabel = new QLabel(i18n("Protocol:"), this);
    hostLabel = new QLabel(i18n("Host:"), this);
    portLabel = new QLabel(i18n("Port:"), this);

    prefix = new KComboBox(this);
    prefix->setObjectName(QString::fromUtf8("protocol"));
    prefix->setSizePolicy(SIZE_MINIMUM);

    url = new KHistoryComboBox(this);
    url->setMaxCount(50);
    url->setMinimumContentsLength(10);

    QStringList protocols = KProtocolInfo::protocols();
    if (protocols.contains("ftp"))
        prefix->addItem(i18n("ftp://"));
    if (protocols.contains("smb"))
        prefix->addItem(i18n("smb://"));
    if (protocols.contains("fish"))
        prefix->addItem(i18n("fish://"));
    if (protocols.contains("sftp"))
        prefix->addItem(i18n("sftp://"));

    // load the history and completion list after creating the history combo
    KConfigGroup group(krConfig, "Private");
    QStringList list = group.readEntry("newFTP Completion list", QStringList());
    url->completionObject()->setItems(list);
    list = group.readEntry("newFTP History list", QStringList());
    url->setHistoryItems(list);

    // Select last used protocol
    QString lastUsedProtocol = group.readEntry("newFTP Protocol", QString());
    if(!lastUsedProtocol.isEmpty()) {
        prefix->setCurrentItem(lastUsedProtocol);
    }


    port = new QSpinBox(this);
    port->setMaximum(65535);
    port->setValue(21);
    port->setSizePolicy(SIZE_MINIMUM);

    usernameLabel = new QLabel(i18n("Username:"******"Password:"******"&Connect"));
    okButton->setDefault(true);
    okButton->setShortcut(Qt::CTRL | Qt::Key_Return);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    connect(prefix, SIGNAL(activated(const QString &)),
            this, SLOT(slotTextChanged(const QString &)));
    connect(url, SIGNAL(activated(const QString &)),
            url, SLOT(addToHistory(const QString &)));

    if(!lastUsedProtocol.isEmpty()) {
        // update the port field
        slotTextChanged(lastUsedProtocol);
    }

    setTabOrder(url, username);
    setTabOrder(username, password);
    setTabOrder(password, prefix);
}
コード例 #14
0
ファイル: Dialog_Mail.cpp プロジェクト: Majestio/RegClient
void Dialog_Mail::SlotCancel()
{
    reject();
}
コード例 #15
0
ファイル: pinentrydialog.cpp プロジェクト: neopgp/pinentry
void PinEntryDialog::slotTimeout()
{
    reject();
}
コード例 #16
0
reserveSalesOrderItem::reserveSalesOrderItem(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl)
    : XDialog(parent, name, modal, fl)
{
  setupUi(this);

  connect(_save, SIGNAL(clicked()), this, SLOT(sSave()));
  connect(_close, SIGNAL(clicked()), this, SLOT(reject()));

  _item->setReadOnly(true);

  _qtyToReserve->setValidator(omfgThis->qtyVal());

  _ordered->setPrecision(omfgThis->qtyVal());
  _shipped->setPrecision(omfgThis->qtyVal());
  _atShipping->setPrecision(omfgThis->qtyVal());
  _reserved->setPrecision(omfgThis->qtyVal());
  _onHand->setPrecision(omfgThis->qtyVal());
  _allocated->setPrecision(omfgThis->qtyVal());
  _unreserved->setPrecision(omfgThis->qtyVal());

  if (_metrics->boolean("SOManualReservations"))
  {
    connect(_bcReserve,       SIGNAL(clicked()), this, SLOT(sBcReserve()));
    connect(_reserve,         SIGNAL(clicked()), this, SLOT(sReserveLocation()));
    connect(_unreserve,       SIGNAL(clicked()), this, SLOT(sUnreserveLocation()));
    connect(_itemloc, SIGNAL(itemSelected(int)), this, SLOT(sReserveLocation()));
    connect(_bc,   SIGNAL(textChanged(QString)), this, SLOT(sBcChanged(QString)));
    
    omfgThis->inputManager()->notify(cBCLotSerialNumber, this, this, SLOT(sCatchLotSerialNumber(QString)));
    
    _itemloc->addColumn(tr("Location"),       _itemColumn, Qt::AlignLeft,  true, "location");
    _itemloc->addColumn(tr("Lot/Serial #"),   -1,          Qt::AlignLeft,  true, "lotserial");
    _itemloc->addColumn(tr("Expiration"),     _dateColumn, Qt::AlignCenter,true, "f_expiration");
    _itemloc->addColumn(tr("This Reserved"),  _qtyColumn,  Qt::AlignRight, true, "reserved");
    _itemloc->addColumn(tr("Total Reserved"), _qtyColumn,  Qt::AlignRight, true, "totalreserved");
    _itemloc->addColumn(tr("Unreserved"),     _qtyColumn,  Qt::AlignRight, true, "unreserved");

    //If not lot serial control, hide info
    if (!_metrics->boolean("LotSerialControl"))
    {
      _bcLit->hide();
      _bc->hide();
      _bcQtyLit->hide();
      _bcQty->hide();
      _bcReserve->hide();
    }
    else
    {
      // Add columns for lotserial characteristics
      QString column;
      QString name;
      QString sql = QString("SELECT char_id, char_name, char_type "
                            "FROM char "
                            "WHERE (char_lotserial) "
                            " AND (char_search) "
                            "ORDER BY char_name;");
      XSqlQuery chars;
      chars.exec(sql);
      while (chars.next())
      {
        characteristic::Type chartype = (characteristic::Type)chars.value("char_type").toInt();
        column = QString("char%1").arg(chars.value("char_id").toString());
        name = chars.value("char_name").toString();
        _itemloc->addColumn(name, -1, Qt::AlignLeft , true, column );
        if (chartype == characteristic::Text)
        {
          _charidstext.append(chars.value("char_id").toInt());
        }
        else if (chartype == characteristic::List)
        {
          _charidslist.append(chars.value("char_id").toInt());
        }
        else if (chartype == characteristic::Date)
        {
          _charidsdate.append(chars.value("char_id").toInt());
        }
      }
    }
  }
コード例 #17
0
ファイル: CharmNewReleaseDialog.cpp プロジェクト: KDAB/Charm
void CharmNewReleaseDialog::slotRemindMe()
{
    reject();
}