source: src-qt4/EasyPBI/newModuleDialog.cpp @ 0c42827

releng/10.0.1releng/10.0.2releng/10.0.3releng/10.1
Last change on this file since 0c42827 was 0c42827, checked in by Ken Moore <ken@…>, 10 months ago

Update EasyPBI to 2.3:
Changes Include:
Add ability to build from ports directly again.
Add legacy port-build options to the GUI.
Add item to show current package compile-time options.
Add ability to create a new module from either ports/packages.
Fix a bug in the default wrapper script for 10.x PBI's (container path is /usr/local/ now when running)

  • Property mode set to 100644
File size: 2.1 KB
Line 
1#include "newModuleDialog.h"
2#include "ui_newModuleDialog.h"
3#include <QDir>
4#include <QDebug>
5
6NewModuleDialog::NewModuleDialog(QWidget *parent, QString portsdir) :
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       isPort=false;
15        portsDir=portsdir;
16        if(!portsDir.isEmpty() && !portsDir.endsWith("/")){ portsDir.append("/"); }
17        //Setup the dialog icons
18        ui->push_port->setIcon(Backend::icon("load"));
19        ui->push_icon->setIcon(Backend::icon("file"));
20        if(portsDir.isEmpty()){ ui->push_port->setEnabled(false); }
21}
22
23NewModuleDialog::~NewModuleDialog(){
24}
25
26
27void NewModuleDialog::on_buttonBox_accepted(){
28  if(ui->line_port->text().isEmpty()){ return; }
29  isAccepted=TRUE;
30  //Now set the public variables
31  moduleData = ui->line_port->text();
32  moduleIcon = ui->line_icon->text().replace("~",QDir::homePath());
33  if(moduleIcon.isEmpty()){ moduleIcon = ui->line_icon->placeholderText().replace("~",QDir::homePath()); }
34  //Now close the UI
35  this->close();
36}
37
38void NewModuleDialog::on_buttonBox_rejected(){
39  isAccepted=FALSE;
40  moduleData.clear();
41  moduleIcon.clear();
42  this->close();
43}
44
45void NewModuleDialog::on_push_port_clicked(){
46  QString portSel = QFileDialog::getExistingDirectory(this, tr("Select Port"), portsDir);
47  if(!portSel.isEmpty()){
48    ui->line_port->setText(portSel.remove(portsDir));
49    isPort=true;
50  }       
51}
52
53void NewModuleDialog::on_push_package_clicked(){
54  pkgSelect dlg(this);
55  dlg.exec();
56  if(dlg.selected){
57    ui->line_port->setText(dlg.portSelected);
58    isPort=false;
59  }     
60}
61
62void NewModuleDialog::on_push_icon_clicked(){
63//Prompt for a new selection
64  QString Sel = QFileDialog::getOpenFileName(this, tr("Select PNG Icon"), QDir::homePath(), tr("PNG icon (*.png)") );
65  if(Sel.isEmpty()){return;} //action cancelled or closed       
66  else{
67    ui->line_icon->setText(Sel);
68  }
69}
70
71void NewModuleDialog::setDefaultIconFile(QString icon){
72  ui->line_icon->setPlaceholderText(icon.replace(QDir::homePath(),"~"));
73}
Note: See TracBrowser for help on using the repository browser.