// ------------------------------------------------------------------------------------------------- TriggerWidget::TriggerWidget(QWidget* parent, const char* name) throw () : QWidget(parent, name) { Q3VBoxLayout* boxLayout = new Q3VBoxLayout(this, 0, 0); Q3HBox* hbox = new Q3HBox(this); hbox->setSpacing(2); // create the checkboxes with their labels for (int i = 0; i < NUMBER_OF_BITS_PER_BYTE; i++) { Q3VBox* box = new Q3VBox(hbox); box->setSpacing(2); m_labels[i] = new QLabel(QString::number(i+1), box); m_labels[i]->setAlignment(Qt::AlignHCenter); m_checkboxes[i] = new QCheckBox(box); m_checkboxes[i]->setTristate(true); m_checkboxes[i]->setNoChange(); connect(m_checkboxes[i], SIGNAL(stateChanged(int)), SLOT(valueChangedHandler())); } boxLayout->addWidget(hbox); boxLayout->addStretch(5); }
//=========================================================== // void ImportWizard::setupDstType() { m_dstTypePage = new QWidget(this); KexiDB::DriverManager manager; KexiDB::Driver::InfoHash drvs = manager.driversInfo(); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_dstTypePage, KDialog::marginHint()); Q3HBoxLayout *hbox = new Q3HBoxLayout(vbox); QLabel *lbl = new QLabel(i18n("Destination database type:") + " ", m_dstTypePage); lbl->setAlignment(Qt::AlignAuto | Qt::AlignTop); hbox->addWidget(lbl); m_dstPrjTypeSelector = new KexiPrjTypeSelector(m_dstTypePage); hbox->addWidget(m_dstPrjTypeSelector); m_dstPrjTypeSelector->option_file->setText(i18n("Database project stored in a file")); m_dstPrjTypeSelector->option_server->setText(i18n("Database project stored on a server")); QVBoxLayout *frame_server_vbox = new QVBoxLayout( m_dstPrjTypeSelector->frame_server, KDialog::spacingHint()); m_dstServerTypeCombo = new KexiDBDriverComboBox(m_dstPrjTypeSelector->frame_server, drvs, KexiDBDriverComboBox::ShowServerDrivers); frame_server_vbox->addWidget(m_dstServerTypeCombo); hbox->addStretch(1); vbox->addStretch(1); lbl->setBuddy(m_dstServerTypeCombo); //! @todo hardcoded: find a way to preselect default engine item //m_dstTypeCombo->setCurrentText("SQLite3"); addPage(m_dstTypePage, i18n("Select Destination Database Type")); }
//=========================================================== // void ImportWizard::setupImporting() { m_importingPage = new QWidget(this); m_importingPage->hide(); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_importingPage, KDialog::marginHint()); m_lblImportingTxt = new QLabel(m_importingPage); m_lblImportingTxt->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_lblImportingTxt->setWordWrap(true); m_lblImportingErrTxt = new QLabel(m_importingPage); m_lblImportingErrTxt->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_lblImportingErrTxt->setWordWrap(true); m_progressBar = new QProgressBar(m_importingPage); m_progressBar->setRange(0, 100); m_progressBar->hide(); vbox->addWidget(m_lblImportingTxt); vbox->addWidget(m_lblImportingErrTxt); vbox->addStretch(1); QWidget *options_widget = new QWidget(m_importingPage); vbox->addWidget(options_widget); QVBoxLayout *options_vbox = new QVBoxLayout(options_widget); options_vbox->setSpacing(KDialog::spacingHint()); m_importOptionsButton = new KPushButton(KIcon("configure"), i18n("Advanced Options"), options_widget); connect(m_importOptionsButton, SIGNAL(clicked()), this, SLOT(slotOptionsButtonClicked())); options_vbox->addWidget(m_importOptionsButton); options_vbox->addStretch(1); vbox->addWidget(m_progressBar); vbox->addStretch(2); m_importingPage->show(); addPage(m_importingPage, i18n("Importing")); }
StringListEdit::StringListEdit(const QStringList &list, UntitledList* unamedList, QWidget *parent) : QDialog(parent), ask(false), duplicatesOk(false), _suggestedStringsList(unamedList) { addCaption = "Add String"; addLabel = "String:"; editCaption = "Edit String"; editLabel = addLabel; Q3HBoxLayout *hbox = new Q3HBoxLayout(this, 5, 5); Q3VBoxLayout *vbox = new Q3VBoxLayout; listBox = new Q3ListBox(this); connect(listBox, SIGNAL(currentChanged(Q3ListBoxItem*)), this, SLOT(updateButtons())); hbox->addWidget(listBox, 1); QPushButton *button = new QPushButton(tr("&Add..."), this); connect(button, SIGNAL(clicked()), this, SLOT(addString())); vbox->addWidget(button); editButton = new QPushButton(tr("&Edit..."), this); connect(editButton, SIGNAL(clicked()), this, SLOT(editString())); vbox->addWidget(editButton); removeButton = new QPushButton(tr("&Remove..."), this); connect(removeButton, SIGNAL(clicked()), this, SLOT(removeString())); vbox->addWidget(removeButton); upButton = new QPushButton(tr("&Up"), this); connect(upButton, SIGNAL(clicked()), this, SLOT(moveUp())); vbox->addWidget(upButton); downButton = new QPushButton(tr("&Down"), this); connect(downButton, SIGNAL(clicked()), this, SLOT(moveDown())); vbox->addWidget(downButton); vbox->addStretch(1); button = new QPushButton(tr("OK"), this); connect(button, SIGNAL(clicked()), this, SLOT(accept())); vbox->addWidget(button); button = new QPushButton(tr("Cancel"), this); connect(button, SIGNAL(clicked()), this, SLOT(reject())); vbox->addWidget(button); hbox->addLayout(vbox); setList(list); }
//=========================================================== // void ImportWizard::setupFinish() { m_finishPage = new QWidget(this); m_finishPage->hide(); Q3VBoxLayout *vbox = new Q3VBoxLayout(m_finishPage, KDialog::marginHint()); m_finishLbl = new QLabel(m_finishPage); m_finishLbl->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_finishLbl->setWordWrap(true); vbox->addWidget(m_finishLbl); m_openImportedProjectCheckBox = new QCheckBox(i18n("Open imported project"), m_finishPage); m_openImportedProjectCheckBox->setChecked(true); vbox->addSpacing(KDialog::spacingHint()); vbox->addWidget(m_openImportedProjectCheckBox); vbox->addStretch(1); addPage(m_finishPage, i18n("Success")); }
OptionsExportMusixtex::OptionsExportMusixtex(KSharedConfigPtr &conf, QWidget *parent, const char *name) : OptionsPage(conf, parent, name) { // Create option widgets Q3VButtonGroup *layoutGroup = new Q3VButtonGroup(i18n("MusiXTeX Layout"), this); showBarNumber = new QCheckBox(i18n("Show Bar Number"), layoutGroup); showStr = new QCheckBox(i18n("Show Tuning"), layoutGroup); showPageNumber = new QCheckBox(i18n("Show Page Number"), layoutGroup); exportModeGroup = new Q3VButtonGroup(i18n("Export as..."), this); exportMode[0] = new QRadioButton(i18n("Tabulature"), exportModeGroup); exportMode[1] = new QRadioButton(i18n("Notes"), exportModeGroup); tabSizeGroup = new Q3VButtonGroup(i18n("Tab Size"), this); tabSize[0] = new QRadioButton(i18n("Smallest"), tabSizeGroup); tabSize[1] = new QRadioButton(i18n("Small"), tabSizeGroup); tabSize[2] = new QRadioButton(i18n("Normal"), tabSizeGroup); tabSize[3] = new QRadioButton(i18n("Big"), tabSizeGroup); always = new QCheckBox(i18n("Always show this dialog on export"), this); // Set widget layout Q3VBoxLayout *box = new Q3VBoxLayout(this); box->addWidget(layoutGroup); box->addWidget(tabSizeGroup); box->addWidget(exportModeGroup); box->addStretch(1); box->addWidget(always); box->activate(); // Fill in current config tabSizeGroup->setButton(Settings::texTabSize()); showBarNumber->setChecked(Settings::texShowBarNumber()); showStr->setChecked(Settings::texShowStr()); showPageNumber->setChecked(Settings::texShowPageNumber()); exportModeGroup->setButton(Settings::texExportMode()); always->setChecked(config->group("MusiXTeX").readEntry("AlwaysShow", TRUE)); }
void StocksDialog::createSplitPage () { QWidget *w = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(5); Q3GridLayout *grid = new Q3GridLayout(vbox); grid->setMargin(0); grid->setSpacing(5); QLabel *label = new QLabel(tr("Split Date"), w); grid->addWidget(label, 0, 0); Bar bar; db->getLastBar(bar); QDateTime dt; bar.getDate(dt); if (! bar.getEmptyFlag()) splitDate = new Q3DateEdit(dt.date(), w); else splitDate = new Q3DateEdit(QDate::currentDate(), w); splitDate->setOrder(Q3DateEdit::YMD); grid->addWidget(splitDate, 0, 1); label = new QLabel(tr("Split Ratio"), w); grid->addWidget(label, 1, 0); splitRatio = new QLineEdit("2:1", w); grid->addWidget(splitRatio, 1, 1); QPushButton *button = new QPushButton(tr("Perform Split"), w); connect(button, SIGNAL(clicked()), this, SLOT(split())); vbox->addWidget(button); vbox->addStretch(1); addTab(w, tr("Split")); }
KAstTopLevel::KAstTopLevel( QWidget *parent, const char *name ) : Q3MainWindow( parent, name, 0 ) { QWidget *border = new QWidget( this ); border->setBackgroundColor( Qt::black ); setCentralWidget( border ); Q3VBoxLayout *borderLayout = new Q3VBoxLayout( border ); borderLayout->addStretch( 1 ); QWidget *mainWin = new QWidget( border ); mainWin->setFixedSize(640, 480); borderLayout->addWidget( mainWin, 0, Qt::AlignHCenter ); borderLayout->addStretch( 1 ); view = new KAsteroidsView( mainWin ); view->setFocusPolicy( Qt::StrongFocus ); connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) ); connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) ); connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) ); connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) ); Q3VBoxLayout *vb = new Q3VBoxLayout( mainWin ); Q3HBoxLayout *hb = new Q3HBoxLayout; Q3HBoxLayout *hbd = new Q3HBoxLayout; vb->addLayout( hb ); QFont labelFont( "helvetica", 24 ); QColorGroup grp( Qt::darkGreen, Qt::black, QColor( 128, 128, 128 ), QColor( 64, 64, 64 ), Qt::black, Qt::darkGreen, Qt::black ); QPalette pal( grp, grp, grp ); mainWin->setPalette( pal ); hb->addSpacing( 10 ); QLabel *label; label = new QLabel( tr("Score"), mainWin ); label->setFont( labelFont ); label->setPalette( pal ); label->setFixedWidth( label->sizeHint().width() ); hb->addWidget( label ); scoreLCD = new QLCDNumber( 6, mainWin ); scoreLCD->setFrameStyle( Q3Frame::NoFrame ); scoreLCD->setSegmentStyle( QLCDNumber::Flat ); scoreLCD->setFixedWidth( 150 ); scoreLCD->setPalette( pal ); hb->addWidget( scoreLCD ); hb->addStretch( 10 ); label = new QLabel( tr("Level"), mainWin ); label->setFont( labelFont ); label->setPalette( pal ); label->setFixedWidth( label->sizeHint().width() ); hb->addWidget( label ); levelLCD = new QLCDNumber( 2, mainWin ); levelLCD->setFrameStyle( Q3Frame::NoFrame ); levelLCD->setSegmentStyle( QLCDNumber::Flat ); levelLCD->setFixedWidth( 70 ); levelLCD->setPalette( pal ); hb->addWidget( levelLCD ); hb->addStretch( 10 ); label = new QLabel( tr("Ships"), mainWin ); label->setFont( labelFont ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hb->addWidget( label ); shipsLCD = new QLCDNumber( 1, mainWin ); shipsLCD->setFrameStyle( Q3Frame::NoFrame ); shipsLCD->setSegmentStyle( QLCDNumber::Flat ); shipsLCD->setFixedWidth( 40 ); shipsLCD->setPalette( pal ); hb->addWidget( shipsLCD ); hb->addStrut( 30 ); vb->addWidget( view, 10 ); // -- bottom layout: vb->addLayout( hbd ); QFont smallFont( "helvetica", 14 ); hbd->addSpacing( 10 ); QString sprites_prefix = ":/trolltech/examples/graphicsview/portedasteroids/sprites/"; /* label = new QLabel( tr( "T" ), mainWin ); label->setFont( smallFont ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); teleportsLCD = new QLCDNumber( 1, mainWin ); teleportsLCD->setFrameStyle( QFrame::NoFrame ); teleportsLCD->setSegmentStyle( QLCDNumber::Flat ); teleportsLCD->setPalette( pal ); teleportsLCD->setFixedHeight( 20 ); hbd->addWidget( teleportsLCD ); hbd->addSpacing( 10 ); */ QPixmap pm( sprites_prefix + "powerups/brake.png" ); label = new QLabel( mainWin ); label->setPixmap( pm ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); brakesLCD = new QLCDNumber( 1, mainWin ); brakesLCD->setFrameStyle( Q3Frame::NoFrame ); brakesLCD->setSegmentStyle( QLCDNumber::Flat ); brakesLCD->setPalette( pal ); brakesLCD->setFixedHeight( 20 ); hbd->addWidget( brakesLCD ); hbd->addSpacing( 10 ); pm.load( sprites_prefix + "powerups/shield.png" ); label = new QLabel( mainWin ); label->setPixmap( pm ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); shieldLCD = new QLCDNumber( 1, mainWin ); shieldLCD->setFrameStyle( Q3Frame::NoFrame ); shieldLCD->setSegmentStyle( QLCDNumber::Flat ); shieldLCD->setPalette( pal ); shieldLCD->setFixedHeight( 20 ); hbd->addWidget( shieldLCD ); hbd->addSpacing( 10 ); pm.load( sprites_prefix + "powerups/shoot.png" ); label = new QLabel( mainWin ); label->setPixmap( pm ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); shootLCD = new QLCDNumber( 1, mainWin ); shootLCD->setFrameStyle( Q3Frame::NoFrame ); shootLCD->setSegmentStyle( QLCDNumber::Flat ); shootLCD->setPalette( pal ); shootLCD->setFixedHeight( 20 ); hbd->addWidget( shootLCD ); hbd->addStretch( 1 ); label = new QLabel( tr( "Fuel" ), mainWin ); label->setFont( smallFont ); label->setFixedWidth( label->sizeHint().width() + 10 ); label->setPalette( pal ); hbd->addWidget( label ); powerMeter = new KALedMeter( mainWin ); powerMeter->setFrameStyle( Q3Frame::Box | Q3Frame::Plain ); powerMeter->setRange( MAX_POWER_LEVEL ); powerMeter->addColorRange( 10, Qt::darkRed ); powerMeter->addColorRange( 20, QColor(160, 96, 0) ); powerMeter->addColorRange( 70, Qt::darkGreen ); powerMeter->setCount( 40 ); powerMeter->setPalette( pal ); powerMeter->setFixedSize( 200, 12 ); hbd->addWidget( powerMeter ); shipsRemain = 3; showHiscores = FALSE; actions.insert( Qt::Key_Up, Thrust ); actions.insert( Qt::Key_Left, RotateLeft ); actions.insert( Qt::Key_Right, RotateRight ); actions.insert( Qt::Key_Space, Shoot ); actions.insert( Qt::Key_Z, Teleport ); actions.insert( Qt::Key_X, Brake ); actions.insert( Qt::Key_S, Shield ); actions.insert( Qt::Key_P, Pause ); actions.insert( Qt::Key_L, Launch ); actions.insert( Qt::Key_N, NewGame ); view->showText( tr( "Press N to start playing" ), Qt::yellow ); }
void StocksDialog::createDetailsPage () { QWidget *w = new QWidget(this); Q3VBoxLayout *vbox = new Q3VBoxLayout(w); vbox->setMargin(5); vbox->setSpacing(5); Q3GridLayout *grid = new Q3GridLayout(vbox); grid->setMargin(0); grid->setSpacing(5); QLabel *label = new QLabel(tr("Symbol"), w); grid->addWidget(label, 0, 0); QString s; DBIndexItem item; index->getIndexItem(symbol, item); item.getSymbol(s); label = new QLabel(s, w); label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken); grid->addWidget(label, 0, 1); label = new QLabel(tr("Name"), w); grid->addWidget(label, 1, 0); item.getTitle(s); title = new QLineEdit(s, w); grid->addWidget(title, 1, 1); label = new QLabel(tr("Exchange"), w); grid->addWidget(label, 2, 0); item.getExchange(s); Exchange ex; ex.getExchange(s.toInt(), s); label = new QLabel(s, w); label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken); grid->addWidget(label, 2, 1); label = new QLabel(tr("Type"), w); grid->addWidget(label, 3, 0); item.getType(s); label = new QLabel(s, w); label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken); grid->addWidget(label, 3, 1); label = new QLabel(tr("First Date"), w); grid->addWidget(label, 4, 0); Bar bar; db->getFirstBar(bar); if (! bar.getEmptyFlag()) { bar.getDateTimeString(TRUE, s); label = new QLabel(s, w); label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken); grid->addWidget(label, 4, 1); } label = new QLabel(tr("Last Date"), w); grid->addWidget(label, 5, 0); Bar bar2; db->getLastBar(bar2); if (! bar2.getEmptyFlag()) { bar2.getDateTimeString(TRUE, s); label = new QLabel(s, w); label->setFrameStyle(Q3Frame::WinPanel | Q3Frame::Sunken); grid->addWidget(label, 5, 1); } grid->expand(grid->numRows() + 1, grid->numCols()); grid->setColStretch(1, 1); vbox->addStretch(1); addTab(w, tr("Details")); }