/************ * *功能:重新启动操作 * * * **/ void mainview::rebootcomputer() { QDialog *tmp = new QDialog(); tmp->setWindowIcon(QIcon("./images/logo.png")); tmp->setWindowTitle("重启提示"); QVBoxLayout *vlay = new QVBoxLayout(); QHBoxLayout *hlay = new QHBoxLayout(); QLabel *afforminfo = new QLabel("重启?",tmp); QPushButton *button_ok = new QPushButton("OK",tmp); QPushButton *button_cancel = new QPushButton("Quit",tmp); hlay->addWidget(button_ok); hlay->addWidget(button_cancel); vlay->addWidget(afforminfo); vlay->addLayout(hlay); tmp->setLayout(vlay); connect(button_ok,SIGNAL(clicked()),tmp,SLOT(accept())); connect(button_cancel,SIGNAL(clicked()),tmp,SLOT(close())); if(tmp->exec() == QDialog::Accepted) { QProcess::execute("shutdown -r now"); } }
void MainWindow::WarningShow() { QDialog *warningDialog = new QDialog; QLabel *warningLabel = new QLabel; QString titleString = "Warning"; warningDialog->setWindowTitle(titleString); warningDialog->setWindowIcon(QIcon("://icon/infoIcon.png")); warningLabel = new QLabel(warningDialog); QPixmap contentPix("://icon/warningText.png"); warningLabel->setPixmap(contentPix); warningLabel->show(); warningDialog->exec(); }
void MainWindow::AboutShow() { QDialog *aboutDialog = new QDialog; QLabel *aboutLabel = new QLabel; QString titleString = "关于"; aboutDialog->setWindowTitle(titleString); aboutDialog->setWindowIcon(QIcon("://icon/infoIcon.png")); aboutLabel = new QLabel(aboutDialog); QPixmap contentPix("://icon/aboutText.png"); aboutLabel->setPixmap(contentPix); aboutLabel->show(); aboutDialog->exec(); }
void MainWindow::GuideShow() { QDialog *guideDialog = new QDialog; QLabel *guideLabel = new QLabel; QString titleString = "使用说明"; guideDialog->setWindowTitle(titleString); guideDialog->setWindowIcon(QIcon("://icon/helpIcon.png")); guideLabel = new QLabel(guideDialog); QPixmap contentPix("://icon/welcomeText.jpg"); guideLabel->setPixmap(contentPix); guideLabel->show(); guideDialog->exec(); }
void NSISUpdater::showDialog(const UpdateInfo &info) { // if the version tag is set, there is a newer version. QDialog *msgBox = new QDialog; msgBox->setAttribute(Qt::WA_DeleteOnClose); QIcon infoIcon = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0); int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0); msgBox->setWindowIcon(infoIcon); QVBoxLayout *layout = new QVBoxLayout(msgBox); QHBoxLayout *hlayout = new QHBoxLayout; layout->addLayout(hlayout); msgBox->setWindowTitle(tr("New Version Available")); QLabel *ico = new QLabel; ico->setFixedSize(iconSize, iconSize); ico->setPixmap(infoIcon.pixmap(iconSize)); QLabel *lbl = new QLabel; QString txt = tr("<p>A new version of the %1 Client is available.</p>" "<p><b>%2</b> is available for download. The installed version is %3.</p>") .arg(Utility::escape(Theme::instance()->appNameGUI()), Utility::escape(info.versionString()), Utility::escape(clientVersion())); lbl->setText(txt); lbl->setTextFormat(Qt::RichText); lbl->setWordWrap(true); hlayout->addWidget(ico); hlayout->addWidget(lbl); QDialogButtonBox *bb = new QDialogButtonBox; bb->setWindowFlags(bb->windowFlags() & ~Qt::WindowContextHelpButtonHint); QPushButton *skip = bb->addButton(tr("Skip this version"), QDialogButtonBox::ResetRole); QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole); QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole); connect(skip, &QAbstractButton::clicked, msgBox, &QDialog::reject); connect(reject, &QAbstractButton::clicked, msgBox, &QDialog::reject); connect(getupdate, &QAbstractButton::clicked, msgBox, &QDialog::accept); connect(skip, &QAbstractButton::clicked, this, &NSISUpdater::slotSetSeenVersion); connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl())); layout->addWidget(bb); msgBox->open(); }
void UpdateDetector::showDialog() { // if the version tag is set, there is a newer version. QString ver = QString::fromLatin1("%1.%2.%3") .arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR).arg(MIRALL_VERSION_MICRO); QDialog *msgBox = new QDialog; QIcon info = msgBox->style()->standardIcon(QStyle::SP_MessageBoxInformation, 0, 0); int iconSize = msgBox->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, 0); msgBox->setWindowIcon(info); QVBoxLayout *layout = new QVBoxLayout(msgBox); QHBoxLayout *hlayout = new QHBoxLayout; layout->addLayout(hlayout); msgBox->setWindowTitle(tr("New Version Available")); QLabel *ico = new QLabel; ico->setFixedSize(iconSize, iconSize); ico->setPixmap(info.pixmap(iconSize)); QLabel *lbl = new QLabel; QString txt = tr("<p>A new version of the %1 Client is available.</p>" "<p><b>%2</b> is available for download. The installed version is %3.<p>") .arg(Theme::instance()->appNameGUI()).arg(ocClient.versionstring()).arg(ver); lbl->setText(txt); lbl->setTextFormat(Qt::RichText); lbl->setWordWrap(true); hlayout->addWidget(ico); hlayout->addWidget(lbl); QDialogButtonBox *bb = new QDialogButtonBox; QPushButton *skip = bb->addButton(tr("Skip update"), QDialogButtonBox::ResetRole); QPushButton *reject = bb->addButton(tr("Skip this time"), QDialogButtonBox::AcceptRole); QPushButton *getupdate = bb->addButton(tr("Get update"), QDialogButtonBox::AcceptRole); connect(skip, SIGNAL(clicked()), msgBox, SLOT(reject())); connect(reject, SIGNAL(clicked()), msgBox, SLOT(reject())); connect(getupdate, SIGNAL(clicked()), msgBox, SLOT(accept())); connect(skip, SIGNAL(clicked()), SLOT(slotSetVersionSeen())); connect(getupdate, SIGNAL(clicked()), SLOT(slotOpenUpdateUrl())); layout->addWidget(bb); msgBox->open(); msgBox->resize(400, msgBox->sizeHint().height()); }
void ApplicationManager::start(){ //LOGO DISPLAY QDialog dialog; Ui::Dialog ui; ui.setupUi(&dialog); ui.hrIconLabel->setPixmap(QPixmap(":Sample/Resources/appIcon.png")); dialog.setWindowIcon(QIcon(":Sample/Resources/appIcon.ico")); dialog.show(); QApplication::processEvents(); //VARIABLE INITIALIZATION bool firstTime; std::string camera; float threshold; if (Utils::readPropertiesFile(firstTime, camera, threshold)){ FIRSTTIME = firstTime; CAMERA = camera; THRESHOLD = threshold; } else{ //error reading file or wrong parameters std::cout << "Exiting..." << std::endl; exit(0); } //SDK VARIABLE CREATION //In order to create use the Facial Recognition SDk you need to create the HrDLib variable. HrDLib hrd("./config", "./config/hrd_publicKey.txt", true); // Now that the sdk variable is created we need to tell him what camera are we going to use, \ and to do so, we do one of the following: int license = hrd.getLicenseType(); if (license != 2 && license != 3){ QMessageBox::critical(NULL, "Error!", "Invalid license.\n Please purchase a license to use this software.", QMessageBox::Close); return; } if (isdigit(camera[0])){ //To use a USB camera or a webcam, we need to select what device is going to be used. //We use the device read in the properties file,\ but for simplicity use 0, as it uses the first camera available in the computer. //It's also needed a pointer to the image so we can access it at any time (img). int device = atoi(&camera[0]); hrd.easySetImgFromDevice(device, img); } else{
void TestPlugin::showSettings(QWidget* parent) { // This function will be called from Preferences after clicking on Settings button. // Settings button will be enabled if PluginSpec.hasSettings == true QDialog* dialog = new QDialog(parent); QPushButton* b = new QPushButton("Example Plugin v0.0.1"); QPushButton* closeButton = new QPushButton(tr("Close")); QLabel* label = new QLabel(); label->setPixmap(QPixmap(":icons/other/about.png")); QVBoxLayout* l = new QVBoxLayout(dialog); l->addWidget(label); l->addWidget(b); l->addWidget(closeButton); dialog->setLayout(l); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setWindowTitle(tr("Example Plugin Settings")); dialog->setWindowIcon(QIcon(":qupzilla.png")); connect(closeButton, SIGNAL(clicked()), dialog, SLOT(close())); dialog->show(); }
void Config::ShowConfig() { // create dialog QDialog *window = new QDialog; // Config Logo header QPixmap *pixLogo = new QPixmap; // load logo image from file pixLogo->load(":/images/cst_config_logo.png"); // show logo file on label QLabel *labelConfigLogo = new QLabel; labelConfigLogo->setPixmap(*pixLogo); labelConfigLogo->setFrameStyle(QFrame::Panel | QFrame::Sunken); labelConfigLogo->setLineWidth(2); tabWidget = new QTabWidget; recordTab = new RecordingTab; userTab = new UserTab; generalTab = new GeneralTab; tabWidget->addTab(recordTab, tr("&Recording")); tabWidget->addTab(userTab, tr("&User")); tabWidget->addTab(generalTab, tr("&General")); // Buttons QHBoxLayout *hButtonBox = new QHBoxLayout; hButtonBox->addStretch(1); // create ok button QPushButton *okButton = new QPushButton(tr("&Ok")); // set ok button to default and accept connect(okButton, SIGNAL(clicked()), this, SLOT(SaveSettings())); connect(this, SIGNAL(SavedSettings()), window, SLOT(accept())); // create cancel button QPushButton *cancelButton = new QPushButton(tr("&Cancel")); connect(cancelButton, SIGNAL(clicked()), window, SLOT(reject())); cancelButton->setDefault(false); hButtonBox->addWidget(okButton); hButtonBox->addWidget(cancelButton); // everything QVBoxLayout *vBox = new QVBoxLayout(window); vBox->addWidget(labelConfigLogo); vBox->addWidget(tabWidget); // configuration tabs vBox->addLayout(hButtonBox); // ok and cancel buttons window->setLayout(vBox); okButton->setDefault(true); window->setGeometry(200,200,400,50); window->setWindowTitle("VoiceLog1 Configuration"); window->setWindowIcon(QIcon(QPixmap(":/images/icons/appIcon.png"))); // create our settings object QSettings voiceLogSettings; // get the recording settings recordTab->editRecPath->setText(voiceLogSettings.value("config/recording/Path").toString()); // the path of the recordings - usually app directory recordTab->editRecName->setText(voiceLogSettings.value("config/recording/Name").toString()); // record file name recordTab->spinThreshTimer->setValue(voiceLogSettings.value("config/recording/Timer").toInt()); // under threshold timer // get the user settings userTab->editCompany->setText(voiceLogSettings.value("config/user/Company").toString()); // company name userTab->editDept->setText(voiceLogSettings.value("config/user/Department").toString()); // department userTab->editUser->setText(voiceLogSettings.value("config/user/Username").toString()); // username // get general settings generalTab->checkStart->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AutoStart").toInt())); // auto start generalTab->checkConfig->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AllowConfig").toInt())); // allow access to configuration generalTab->checkDeactivate->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AllowDeactivate").toInt())); // allow access to deactivation generalTab->checkPlayback->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AllowPlayback").toInt())); // allow playback of recordings generalTab->checkHidden->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/GoStealth").toInt())); // go into stealth mode - set process id different and no gui generalTab->checkComments->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/Comments").toInt())); // go into stealth mode - set process id different and no gui window->exec(); }
void UserTab::ChangeUserPassword() { // create dialog QDialog *passwordDialog = new QDialog; // Old password QLabel *labelUserOldPass = new QLabel; labelUserOldPass->setText("&Old Password"); editUserOldPass = new QLineEdit(); editUserOldPass->setFixedWidth(180); editUserOldPass->setEchoMode(QLineEdit::Password); labelUserOldPass->setBuddy(editUserOldPass); // New password QLabel *labelUserNewPass = new QLabel; labelUserNewPass->setText("&New Password"); editUserNewPass = new QLineEdit(); editUserNewPass->setFixedWidth(180); editUserNewPass->setEchoMode(QLineEdit::Password); labelUserNewPass->setBuddy(editUserNewPass); // New password confirm QLabel *labelUserNewPassRep = new QLabel; labelUserNewPassRep->setText("&Confirm Password"); editUserNewPassRep = new QLineEdit(); editUserNewPassRep->setFixedWidth(180); editUserNewPassRep->setEchoMode(QLineEdit::Password); labelUserNewPassRep->setBuddy(editUserNewPassRep); // Buttons QHBoxLayout *hButtonBox = new QHBoxLayout; hButtonBox->addStretch(1); // create ok button QPushButton *okButton = new QPushButton(tr("&Ok")); okButton->setDefault(true); // set ok button to default and check if passwords match connect(okButton, SIGNAL(clicked()), this, SLOT(CheckPassMatches())); connect(this, SIGNAL(userPassMatches()), passwordDialog, SLOT(accept())); // create cancel button QPushButton *cancelButton = new QPushButton(tr("&Cancel")); connect(cancelButton, SIGNAL(clicked()), passwordDialog, SLOT(reject())); cancelButton->setDefault(false); hButtonBox->addWidget(okButton); hButtonBox->addWidget(cancelButton); // layout for options QGridLayout *gBoxPass = new QGridLayout; gBoxPass->addWidget(labelUserOldPass, 0, 0); gBoxPass->addWidget(editUserOldPass, 0, 1); gBoxPass->addWidget(labelUserNewPass, 1, 0); gBoxPass->addWidget(editUserNewPass, 1, 1); gBoxPass->addWidget(labelUserNewPassRep, 2, 0); gBoxPass->addWidget(editUserNewPassRep, 2, 1); QVBoxLayout *vBox = new QVBoxLayout(passwordDialog); vBox->addLayout(gBoxPass); // password stuff vBox->addLayout(hButtonBox); // ok and cancel buttons passwordDialog->setLayout(vBox); passwordDialog->setGeometry(200,200,200,40); passwordDialog->setWindowTitle("Change User Password"); passwordDialog->setWindowIcon(QIcon(QPixmap(":/images/icons/appIcon.png"))); passwordDialog->exec(); }
void MainWindow::ManipShow() { QDialog *settings; QLabel *heightLabel, *widthLabel, *rotateLabel, *modeLabel, *methodLabel; QPushButton *confirmButton; QGridLayout *layout; settings = new QDialog; settings->setWindowTitle(tr("设置")); settings->setWindowIcon(QIcon("://icon/settingsIcon.png")); heightLabel = new QLabel(settings); QPixmap heightPix("://icon/heightIcon.png"); heightLabel->setPixmap(heightPix); widthLabel = new QLabel(settings); QPixmap widthPix("://icon/widthIcon.png"); widthLabel->setPixmap(widthPix); rotateLabel = new QLabel(settings); QPixmap rotatePix("://icon/rotateIcon.png"); rotateLabel->setPixmap(rotatePix); modeLabel = new QLabel(settings); QPixmap modelPix("://icon/cropIcon.png"); modeLabel->setPixmap(modelPix); methodLabel = new QLabel(settings); QPixmap methodPix("://icon/interIcon.png"); methodLabel->setPixmap(methodPix); heightEdit = new QLineEdit(settings); heightEdit->setText("1"); widthEdit = new QLineEdit(settings); widthEdit->setText("1"); rotateEdit = new QLineEdit(settings); rotateEdit->setText("0"); modeSelect = new QComboBox(settings); modeSelect->insertItem(0, tr("Crop")); modeSelect->insertItem(1, tr("Loose")); methodSelect = new QComboBox(settings); methodSelect->insertItem(0, tr("NearestNeighbor")); methodSelect->insertItem(1, tr("Bilinear")); methodSelect->insertItem(2, tr("Bicubic")); confirmButton = new QPushButton(settings); confirmButton->setText(tr("确定")); QObject::connect(confirmButton, SIGNAL(clicked()), this, SLOT(StartManipulate())); layout = new QGridLayout; layout->addWidget(heightLabel, 0, 0); layout->addWidget(widthLabel, 1, 0); layout->addWidget(rotateLabel, 2, 0); layout->addWidget(modeLabel, 3, 0); layout->addWidget(methodLabel, 4, 0); layout->addWidget(heightEdit, 0, 1); layout->addWidget(widthEdit, 1, 1); layout->addWidget(rotateEdit, 2, 1); layout->addWidget(modeSelect, 3, 1); layout->addWidget(methodSelect, 4, 1); layout->addWidget(confirmButton, 5, 0, 1, 2); settings->setLayout(layout); settings->exec(); }