UICAddCategoryDialog::UICAddCategoryDialog(QWidget *parent) : QDialog(parent), ui(new Ui::UICAddCategoryDialog) { ui->setupUi(this); connect(ui->btn_cancel,SIGNAL(clicked()),this,SLOT(on_btn_cancel_clicked())); connect(ui->btn_accept,SIGNAL(clicked()),this,SLOT(on_btn_accept_clicked())); this->raise(); this->setFocus(); }
void radeon_profile::on_btn_ok_clicked() { if (ui->txt_profileName->text().isEmpty()) { QMessageBox::critical(this, tr("Error"), tr("Profile name can't be empty!"), QMessageBox::Ok); return; } if (ui->txt_binary->text().isEmpty()) { QMessageBox::critical(this, tr("Error"), tr("No binary is selected!"), QMessageBox::Ok); return; } // if only name given, assume it is in /usr/bin if (!ui->txt_binary->text().contains('/')) { QString tmpS = "/usr/bin/"+ui->txt_binary->text(); if (QFile::exists(tmpS)) ui->txt_binary->setText(tmpS); else { QMessageBox::critical(this, tr("Error"), tr("Binary not found in /usr/bin: ") + ui->txt_binary->text()); return; } } int modIndex = -1; if (ui->list_execProfiles->selectedItems().count() != 0) { if (ui->list_execProfiles->currentItem()->text(PROFILE_NAME) == ui->txt_profileName->text()) { modIndex = ui->list_execProfiles->indexOfTopLevelItem(ui->list_execProfiles->currentItem()); delete ui->list_execProfiles->currentItem(); } } QTreeWidgetItem *item = new QTreeWidgetItem(); item->setText(PROFILE_NAME, ui->txt_profileName->text()); item->setText(BINARY, ui->txt_binary->text()); item->setText(BINARY_PARAMS, ui->txt_binParams->text()); item->setText(ENV_SETTINGS,ui->txt_summary->text()); item->setText(LOG_FILE,ui->txt_logFile->text()); item->setText(LOG_FILE_DATE_APPEND,((ui->cb_appendDateTime->isChecked()) ? "1" : "0")); if (modIndex == -1) ui->list_execProfiles->addTopLevelItem(item); else ui->list_execProfiles->insertTopLevelItem(modIndex,item); ui->list_execProfiles->setCurrentItem(item); ui->execPages->setCurrentIndex(0); on_btn_cancel_clicked(); }
gboolean on_gtk_entry_password_key_press_event(GtkWidget * entry, GdkEventKey * event, gpointer user_data) { switch (event->keyval) { case GDK_Return: on_btn_ok_clicked(NULL, NULL); break; case GDK_Escape: on_btn_cancel_clicked(NULL, NULL); break; default: break; } return FALSE; }