void PropertiesAndStyleWidget::createConnect() { connect(mToolBar,SIGNAL(sigAddParamter()),mPropTableWidget,SLOT(slotAdd())); connect(mToolBar,SIGNAL(sigRemoveParamter()),mPropTableWidget,SLOT(slotRemove())); connect(mToolBar,SIGNAL(sigClearParameter()),mPropTableWidget,SLOT(slotClear())); connect(mToolBar,SIGNAL(sigSubumit()),mPropTableWidget,SLOT(slotSubmit())); connect(mPropTableWidget,SIGNAL(sigAddDeleteEnable(bool,bool)),mToolBar,SLOT(slotSetBtnsEnable(bool,bool))); }
bool GeneralSetupWizard::Create() { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("config-ui.xml", "generalwizard", this); if (!foundtheme) return false; m_submitButton = dynamic_cast<MythUIButton *> (GetChild("submit")); m_viewButton = dynamic_cast<MythUIButton *> (GetChild("view")); m_deleteButton = dynamic_cast<MythUIButton *> (GetChild("delete")); m_nextButton = dynamic_cast<MythUIButton *> (GetChild("next")); m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel")); m_profileLocation = dynamic_cast<MythUIText *> (GetChild("profiletext")); m_adminPassword = dynamic_cast<MythUIText *> (GetChild("profilepassword")); if (!m_submitButton || !m_viewButton || !m_deleteButton || !m_nextButton || !m_cancelButton) { LOG(VB_GENERAL, LOG_ERR, "Theme is missing critical theme elements."); return false; } m_submitButton->SetHelpText( tr("Anonymously submit a profile of your hardware. " "This helps the developers to determine where " "to focus their efforts.") ); m_viewButton->SetHelpText( tr("Visit your online hardware profile. (This requires " "that you have the MythBrowser plugin installed)") ); m_deleteButton->SetHelpText( tr("Delete your online hardware profile.") ); m_nextButton->SetHelpText( tr("Save these changes and move on to the " "next configuration step.") ); m_cancelButton->SetHelpText( tr("Exit this wizard, save no changes.") ); connect(m_submitButton, SIGNAL(Clicked()), this, SLOT(slotSubmit())); connect(m_viewButton, SIGNAL(Clicked()), this, SLOT(slotView())); connect(m_deleteButton, SIGNAL(Clicked()), this, SLOT(slotDelete())); connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(slotNext())); connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); BuildFocusList(); loadData(); #ifndef __linux__ #ifndef CONFIG_BINDINGS_PYTHON // The hardware profiler only works on linux. // Make the widgets invisible on other platforms. m_submitButton->Hide(); m_viewButton->Hide(); m_deleteButton->Hide(); if (m_profileLocation) m_profileLocation->Hide(); if (m_adminPassword) m_adminPassword->Hide(); #endif #endif return true; }
UIInput::UIInput(QString title, QString showMsg, QString regExp, int length, QDialog *parent, Qt::WindowFlags f): QDialog(parent,f) { QPixmap bg; bg.load(":/images/commonbg.png"); QPalette palette; palette.setBrush(backgroundRole(),QBrush(bg)); this->setPalette(palette); this->setAutoFillBackground(true); this->setAttribute(Qt::WA_DeleteOnClose); this->setGeometry(20,FRAME420_THVALUE+50,FRAME420_WIDTH,FRAME420_HEIGHT-50); this->setFixedSize(FRAME420_WIDTH-40,FRAME420_HEIGHT-80); this->setStyleSheet("QDialog{border: 6px solid silver;}"); //--------------define--------------------// lbHead=new QLabel(); QFont fontH("Helvetica",18,QFont::Bold); lbHead->setFont(fontH); lbHead->setAlignment(Qt::AlignCenter); lbHead->setMinimumHeight(40); lbHead->setMaximumHeight(40); lbHead->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); lbHead->setText(title); lbHead->setStyleSheet("background-color: rgb(0, 153, 255);"); lbMsg=new QLabel(); QFont fontL("Helvetica",14,QFont::Bold); lbMsg->setAlignment(Qt::AlignCenter); lbMsg->setFont(fontL); lbMsg->setText(showMsg); leInput=new QLineEdit(); leInput->setFont(fontL); leInput->setAlignment(Qt::AlignCenter); leInput->setMinimumHeight(35); leInput->setStyleSheet("border: 3px solid silver;border-radius: 6px;"); leInput->setMaxLength(length); if(regExp!="0") { const QString REGEX_AMOUNT = regExp; QRegExp regx(REGEX_AMOUNT); QValidator *validator = new QRegExpValidator(regx, leInput); leInput->setValidator(validator); } btnSubmit=new QPushButton; btnSubmit->setText(tr("Apply")); btnSubmit->setFont(fontL); btnSubmit->setMinimumHeight(30); btnSubmit->setStyleSheet(BTN_GREEN_STYLE); btnCancel=new QPushButton; btnCancel->setText(tr("Cancel")); btnCancel->setFont(fontL); btnCancel->setMinimumHeight(30); btnCancel->setStyleSheet(BTN_BLUE_STYLE); // -----------layout------------// QSpacerItem *sp1=new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Expanding); QSpacerItem *sp2=new QSpacerItem(1,1,QSizePolicy::Expanding,QSizePolicy::Expanding); QHBoxLayout *h1Lay=new QHBoxLayout(); h1Lay->addSpacing(6); h1Lay->addWidget(lbHead); h1Lay->addSpacing(6); QVBoxLayout *v1Lay=new QVBoxLayout(); v1Lay->addItem(sp1); v1Lay->addWidget(lbMsg); v1Lay->addWidget(leInput); v1Lay->addItem(sp2); QHBoxLayout *hLay=new QHBoxLayout(); hLay->addSpacing(10); hLay->addLayout(v1Lay); hLay->addSpacing(10); QHBoxLayout *h2Lay=new QHBoxLayout(); h2Lay->addSpacing(10); h2Lay->addWidget(btnCancel); h2Lay->addWidget(btnSubmit); h2Lay->addSpacing(10); QVBoxLayout *layout=new QVBoxLayout(this); layout->addSpacing(6); layout->addLayout(h1Lay); layout->addLayout(hLay); layout->addLayout(h2Lay); layout->setContentsMargins(0,0,0,10); // connect connect(btnCancel,SIGNAL(clicked()),this,SLOT(slotCancel())); connect(btnSubmit,SIGNAL(clicked()),this,SLOT(slotSubmit())); connect(leInput,SIGNAL(textChanged(QString)),this,SLOT(restartTimer())); this->setAutoClose(g_constantParam.TIMEOUT_UI); }