void K3bInteractionDialog::slotStartClickedInternal() { saveLastSettings(); KConfigGroup c( k3bcore->config(), "General Options" ); if( !c.readNumEntry( "action dialog startup settings", 0 ) ) { // first time saving last used settings switch( K3bMultiChoiceDialog::choose( i18n("Action Dialog Settings"), i18n("<p>K3b handles three sets of settings in action dialogs: " "the defaults, the saved settings, and the last used settings. " "Please choose which of these sets should be loaded if an action " "dialog is opened again." "<p><em>Be aware that this choice can always be changed from the K3b " "configuration dialog.</em>"), QMessageBox::Question, this, 0, 3, i18n("Default Settings"), i18n("Saved Settings"), i18n("Last Used Settings") ) ) { case 1: c.writeEntry( "action dialog startup settings", LOAD_K3B_DEFAULTS ); break; case 2: c.writeEntry( "action dialog startup settings", LOAD_SAVED_SETTINGS ); break; case 3: c.writeEntry( "action dialog startup settings", LOAD_LAST_SETTINGS ); break; } } slotStartClicked(); }
NewGameView::NewGameView( QWidget *parent ) : QWidget( parent ) { QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setSpacing( 8 ); topLayout->setMargin( 8 ); topLayout->addStretch( 1 ); m_timesTableCheck = new QCheckBox( i18n("Times Table"), this ); topLayout->addWidget( m_timesTableCheck ); m_timesTableCheck->setChecked( true ); topLayout->addLayout( createRowChecks( m_multiplicationRowChecks ) ); m_divisionCheck = new QCheckBox( i18n("Division"), this ); topLayout->addWidget( m_divisionCheck ); topLayout->addLayout( createRowChecks( m_divisionRowChecks ) ); m_squareNumbersCheck = new QCheckBox( i18n("Square Numbers"), this ); topLayout->addWidget( m_squareNumbersCheck ); m_cubicNumbersCheck = new QCheckBox( i18n("Cubic Numbers"), this ); topLayout->addWidget( m_cubicNumbersCheck ); topLayout->addStretch( 1 ); QPushButton *startButton = new QPushButton( i18n("Start"), this ); topLayout->addWidget( startButton ); connect( startButton, SIGNAL( clicked() ), SLOT( slotStartClicked() ) ); topLayout->addStretch( 1 ); }
Appl1::Appl1(QWidget* pwgt) : QWidget(pwgt) { // фреймы fr1 = new QFrame; fr2 = new QFrame; fr21 = new QFrame; fr22 = new QFrame; fr20 = new QFrame; fr21->setMinimumWidth(200); fr22->setMinimumWidth(200); fr20->setMinimumWidth(410); //fr20->setMinimumHeight(170); l_try = new QLabel; QPalette pa3 = l_try->palette(); pa3.setColor(l_try->foregroundRole(), Qt::darkCyan); l_try->setPalette(pa3); l_try->setAutoFillBackground(true); l_try->setFont(QFont("Arial",60,QFont::Normal)); //l_try->setMinimumWidth(600); q = qrand() % 10; asas[0]=48+q; xx[k][0]=q; l01:q = qrand() % 10; asas[1]=48+q; if(asas[0]!=asas[1]) ; else goto l01; xx[k][1]=q; l02:q = qrand() % 10; asas[2]=48+q; if((asas[0]!=asas[2]) && (asas[1]!=asas[2])) ; else goto l02; xx[k][2]=q; l03:q = qrand() % 10; asas[3]=48+q; if((asas[0]!=asas[3]) && (asas[1]!=asas[3]) && (asas[2]!=asas[3])) ; else goto l03; xx[k][3]=q; //startString = new QString; ////////////////////////startString = "1234"; l_try->setText(asas);//"1234"); //l_try->setAlignment(Qt::AlignJustify); le1 = new QLineEdit; QPalette pal = le1->palette(); pal.setColor(le1->foregroundRole(), Qt::darkBlue); le1->setPalette(pal); le1->setAutoFillBackground(true); le1->setTextMargins(3,3,3,3); le1->setFont(QFont("Arial",40,QFont::Normal)); le1->setMaxLength(1); le1->setText("2"); le1->setSelection(0,1); validator = new QIntValidator(0,4,this); //можно ввести только цифры 0,1,2,3,4 le1->setValidator(validator); le1->setMaximumWidth(42); le2 = new QLineEdit; QPalette pa2 = le2->palette(); pa2.setColor(le2->foregroundRole(), Qt::darkBlue); le2->setPalette(pa2); le2->setAutoFillBackground(true); le2->setTextMargins(3,3,3,3); le2->setFont(QFont("Arial",40,QFont::Normal)); le2->setMaxLength(1); le2->setText("1"); validato2 = new QIntValidator(0,4,this); le2->setValidator(validato2); le2->setMaximumWidth(42); l_compa_m = new QLabel; l_compa_m->setText( "<p><span style=font-size:14pt><CENTER>"+ QObject::tr("Compare this number with your number:")+ "</span></p>" ); l_compare = new QLabel; l_compare->setText(//"5555555" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("Enter")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("the number of digits,")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("the program correctly predicted:")+ "</span></p>" ); l_comp1_5 = new QLabel; l_comp1_5->setMinimumWidth(30); l_compar2 = new QLabel; l_compar2->setText(//"5555555" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("How many of them")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("stands")+ "</span></p>" "<p><span style=font-size:16pt><CENTER>"+ QObject::tr("in its place?")+ "</span></p>" ); // начальный текст llll = new QLabel; llll->setText( "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("Take a number")+ "</span></p>" "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("consisting of four")+ "</span></p>" "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("different digits.")+ "</span></p>" "<p><span style=font-size:20pt><CENTER><font color=darkCyan>"+ QObject::tr("I'm going to try to guess")+ "</span></p>" ); l_error = new QLabel; l_error->setText( "<p><span style=font-size:14pt><CENTER>"+ QObject::tr("Error. Check your moves")+ "</span></p>" ); l_more = new QLabel; l_more->setText( "<p><span style=font-size:14pt><CENTER>"+ QObject::tr("Play again?")+ "</span></p>" ); bttnStart = new QPushButton; bttnStart->setText(tr("Start")); // Вогонь bttnNext = new QPushButton; bttnNext->setText(tr("Next")); // Далі bttnMore = new QPushButton; bttnMore->setText(tr("More")); // Ще bttnUk = new QPushButton; // Uk //bttnEn->setText(tr("More")); bttnEn = new QPushButton; // En bttnRu = new QPushButton; // Ru QHBoxLayout* forUkLayout = new QHBoxLayout; QHBoxLayout* forEnLayout = new QHBoxLayout; QHBoxLayout* forRuLayout = new QHBoxLayout; QHBoxLayout* forllllLayout = new QHBoxLayout; QHBoxLayout* forbttnLayout = new QHBoxLayout; QHBoxLayout* forbttnnLayout = new QHBoxLayout; QHBoxLayout* forErrorLayout = new QHBoxLayout; QHBoxLayout* forMoreLayout = new QHBoxLayout; QHBoxLayout* forbttnmLayout = new QHBoxLayout; QVBoxLayout* startLayout = new QVBoxLayout; QHBoxLayout* h_for1Layout = new QHBoxLayout; QVBoxLayout* v_gameLayout = new QVBoxLayout; QHBoxLayout* h_framesLayout = new QHBoxLayout; h_framesLayout->setMargin(5); QHBoxLayout* fr21Layout = new QHBoxLayout; QHBoxLayout* fr22Layout = new QHBoxLayout; QHBoxLayout* fr20Layout = new QHBoxLayout; QVBoxLayout* infr21Layout = new QVBoxLayout; QVBoxLayout* infr22Layout = new QVBoxLayout; QVBoxLayout* infr20Layout = new QVBoxLayout; QHBoxLayout* forle1Layout = new QHBoxLayout; QHBoxLayout* forle2Layout = new QHBoxLayout; QHBoxLayout* forle3Layout = new QHBoxLayout; // QVBoxLayout* forTableLayout = new QVBoxLayout; // QHBoxLayout* h_blendLayout = new QHBoxLayout; QHBoxLayout* h_bttnLayout = new QHBoxLayout; pixUk = new QPixmap; pixEn = new QPixmap; pixRu = new QPixmap; pixUk->load("uk.png"); pixEn->load("en.png"); pixRu->load("ru.png"); bttnUk->setIcon(*pixUk); bttnEn->setIcon(*pixEn); bttnRu->setIcon(*pixRu); table = new QTableWidget; table->setColumnCount(2); //table->setColumnWidth(0,75); table->setColumnWidth(1,70); table->setRowCount(7); table->setRowHeight(0,23); table->setRowHeight(1,23); table->setRowHeight(2,23); table->setRowHeight(3,23); table->setRowHeight(4,23); table->setRowHeight(5,23); table->setRowHeight(6,23); listTable = new QStringList; *listTable << "Number"<<"Result"; table->setHorizontalHeaderLabels(*listTable); h_framesLayout->addWidget(fr1); h_framesLayout->addWidget(fr2); fr20Layout->addWidget(fr20); fr21Layout->addWidget(fr21); fr22Layout->addWidget(fr22); fr1->setFrameStyle( QFrame::Raised | QFrame::Panel); fr1->setLineWidth(2); fr2->setFrameStyle( QFrame::Raised | QFrame::Panel); fr2->setLineWidth(2); setLayout(h_framesLayout); fr20->setFrameStyle( QFrame::Sunken | QFrame::Panel); fr20->setLineWidth(2); setLayout(fr20Layout); fr21->setFrameStyle( QFrame::Sunken | QFrame::Panel); fr21->setLineWidth(2); setLayout(fr21Layout); fr22->setFrameStyle( QFrame::Sunken | QFrame::Panel); fr22->setLineWidth(2); setLayout(fr22Layout); // fr1 //startLayout->addStretch(1); //h_bttnLayout->addStretch(1); //forUkLayout->addStretch(1); forUkLayout->addWidget(bttnUk); //forUkLayout->addStretch(1); h_bttnLayout->addLayout(forUkLayout); //h_bttnLayout->addStretch(1); //forEnLayout->addStretch(1); forEnLayout->addWidget(bttnEn); //forEnLayout->addStretch(1); h_bttnLayout->addLayout(forEnLayout); //h_bttnLayout->addStretch(1); //forEnLayout->addStretch(1); forRuLayout->addWidget(bttnRu); //forEnLayout->addStretch(1); h_bttnLayout->addLayout(forRuLayout); //h_bttnLayout->addStretch(1); startLayout->addLayout(h_bttnLayout); // startLayout->addStretch(1); forllllLayout->addStretch(1); forllllLayout->addWidget(llll); forllllLayout->addStretch(1); startLayout->addLayout(forllllLayout); startLayout->addStretch(1); forbttnLayout->addStretch(1); forbttnLayout->addWidget(bttnStart); forbttnLayout->addStretch(1); startLayout->addLayout(forbttnLayout); startLayout->addStretch(1); fr1->setLayout(startLayout); //table->resize(20,30); // fr2 v_gameLayout->addStretch(1); h_blendLayout->addStretch(1); infr20Layout->addWidget(l_compa_m); forle3Layout->addStretch(1); forle3Layout->addWidget(l_try); forle3Layout->addStretch(1); infr20Layout->addLayout(forle3Layout); h_blendLayout->addLayout(fr20Layout); h_blendLayout->addStretch(1); //forTableLayout->addStretch(1); forTableLayout->addWidget(table); //forTableLayout->addStretch(1); h_blendLayout->addLayout(forTableLayout); h_blendLayout->addStretch(1); v_gameLayout->addLayout(h_blendLayout); v_gameLayout->addStretch(1); h_for1Layout->addStretch(1); infr21Layout->addWidget(l_compare); forle1Layout->addStretch(1); forle1Layout->addWidget(le1); forle1Layout->addStretch(1); infr21Layout->addLayout(forle1Layout); h_for1Layout->addLayout(fr21Layout); h_for1Layout->addWidget(l_comp1_5); //между первой (l_compare) и второй (l_compar2) промежуток небольшой infr22Layout->addWidget(l_compar2); forle2Layout->addStretch(1); forle2Layout->addWidget(le2); forle2Layout->addStretch(1); infr22Layout->addLayout(forle2Layout); h_for1Layout->addLayout(fr22Layout); h_for1Layout->addStretch(1); v_gameLayout->addLayout(h_for1Layout); //v_gameLayout->addStretch(1); forbttnnLayout->addStretch(1); forbttnnLayout->addWidget(bttnNext); forbttnnLayout->addStretch(1); v_gameLayout->addLayout(forbttnnLayout); //v_gameLayout->addStretch(1); forErrorLayout->addStretch(1); forErrorLayout->addWidget(l_error); forErrorLayout->addStretch(1); v_gameLayout->addLayout(forErrorLayout); // //v_gameLayout->addStretch(1); forMoreLayout->addStretch(1); forMoreLayout->addWidget(l_more); forMoreLayout->addStretch(1); v_gameLayout->addLayout(forMoreLayout); // v_gameLayout->addStretch(1); forbttnmLayout->addStretch(1); forbttnmLayout->addWidget(bttnMore); forbttnmLayout->addStretch(1); v_gameLayout->addLayout(forbttnmLayout); //v_gameLayout->addStretch(1); fr20->setLayout(infr20Layout); fr21->setLayout(infr21Layout); fr22->setLayout(infr22Layout); fr2->setLayout(v_gameLayout); fr2->hide(); l_error->hide(); l_more->hide(); bttnMore->hide(); bttnStart->setFocus(); //НЕ все одно фокус на кнопці, але активується пробілом //appl1.show(); connect(bttnUk, SIGNAL(clicked()), SLOT(slotUkClicked())); connect(bttnEn, SIGNAL(clicked()), SLOT(slotEnClicked())); connect(bttnRu, SIGNAL(clicked()), SLOT(slotRuClicked())); connect(bttnStart, SIGNAL(clicked()), SLOT(slotStartClicked())); connect(bttnNext, SIGNAL(clicked()), SLOT(slotNextClicked())); connect(bttnMore, SIGNAL(clicked()), SLOT(slotMoreClicked())); connect(le1, SIGNAL(selectionChanged()), SLOT(selectionChanged21())); connect(le2, SIGNAL(selectionChanged()), SLOT(selectionChanged22())); connect(le1, SIGNAL(textEdited(const QString&)), SLOT(textEdited21())); connect(le2, SIGNAL(textEdited(const QString&)), SLOT(textEdited22())); //connect(le1, SIGNAL(textChanged()), SLOT(textChanged21())); //connect(le2, SIGNAL(textChanged()), SLOT(textChanged22())); veryTransUk.load("appl_Uk.qm","."); veryTransEn.load("appl_En.qm","."); veryTransRu.load("appl_Ru.qm","."); }
void K3b::InteractionDialog::slotStartClickedInternal() { saveLastSettings(); slotStartClicked(); }