source: src-qt4/EasyPBI/newModuleDialog.cpp @ ebba654

releng/10.0releng/10.0.1releng/10.0.2
Last change on this file since ebba654 was ebba654, checked in by Ken Moore <ken@…>, 8 months ago

Move over the EasyPBI-devel to src-qt4/EasyPBI

  • Property mode set to 100644
File size: 1.6 KB
Line 
1#include "newModuleDialog.h"
2#include "ui_newModuleDialog.h"
3#include <QDir>
4#include <QDebug>
5
6NewModuleDialog::NewModuleDialog(QWidget *parent) :
7    QDialog(parent),
8    ui(new Ui::NewModuleDialog)
9{
10       
11       //Setup Initial state of GUI objects and connect signal/slots
12       ui->setupUi(this);  //load the main UI from designer
13       isAccepted = FALSE;
14        //Setup the dialog icons
15        ui->push_port->setIcon(Backend::icon("load"));
16        ui->push_icon->setIcon(Backend::icon("file"));
17}
18
19NewModuleDialog::~NewModuleDialog(){
20}
21
22
23void NewModuleDialog::on_buttonBox_accepted(){
24  if(ui->line_port->text().isEmpty()){ return; }
25  isAccepted=TRUE;
26  //Now set the public variables
27  moduleData = ui->line_port->text();
28  moduleIcon = ui->line_icon->text().replace("~",QDir::homePath());
29  if(moduleIcon.isEmpty()){ moduleIcon = ui->line_icon->placeholderText().replace("~",QDir::homePath()); }
30  //Now close the UI
31  this->close();
32}
33
34void NewModuleDialog::on_buttonBox_rejected(){
35  isAccepted=FALSE;
36  moduleData.clear();
37  moduleIcon.clear();
38  this->close();
39}
40
41void NewModuleDialog::on_push_port_clicked(){
42  pkgSelect dlg(this);
43  dlg.exec();
44  if(dlg.selected){
45    ui->line_port->setText(dlg.portSelected);
46  }
47}
48
49void NewModuleDialog::on_push_icon_clicked(){
50//Prompt for a new selection
51  QString Sel = QFileDialog::getOpenFileName(this, tr("Select PNG Icon"), QDir::homePath(), tr("PNG icon (*.png)") );
52  if(Sel.isEmpty()){return;} //action cancelled or closed       
53  else{
54    ui->line_icon->setText(Sel);
55  }
56}
57
58void NewModuleDialog::setDefaultIconFile(QString icon){
59  ui->line_icon->setPlaceholderText(icon.replace(QDir::homePath(),"~"));
60}
Note: See TracBrowser for help on using the repository browser.