Permalink
Browse files

Create a new "Configuration" dialog for the package manager GUI.

Add the ability to switch between Production / Edge in this dialog

Remove the old production / edge dialog from System Manager
  • Loading branch information...
1 parent e9ebd59 commit e62a5d20acedf4da0e81ab17d020df68d44e3516 @kmoore134 kmoore134 committed Feb 3, 2014
@@ -0,0 +1,41 @@
+#include "dialogConfig.h"
+#include "ui_dialogConfig.h"
+#include <pcbsd-utils.h>
+
+void dialogConfig::programInit()
+{
+
+ // Load the default package set value
+ if ( pcbsd::Utils::getValFromPCBSDConf("PACKAGE_SET") == "EDGE" ) {
+ radioEdge->setChecked(true);
+ radioProduction->setChecked(false);
+ } else {
+ radioProduction->setChecked(true);
+ radioEdge->setChecked(false);
+ }
+
+
+ connect( pushOK, SIGNAL(clicked()), this, SLOT(slotOK()) );
+ connect( pushCancel, SIGNAL(clicked()), this, SLOT(slotCancel()) );
+}
+
+void dialogConfig::slotCancel()
+{
+ close();
+}
+
+void dialogConfig::slotOK()
+{
+
+ // Save package set
+ if ( radioProduction->isChecked() )
+ pcbsd::Utils::setValPCBSDConf("PACKAGE_SET", "PRODUCTION");
+ else
+ pcbsd::Utils::setValPCBSDConf("PACKAGE_SET", "EDGE");
+
+ // Extract the ports overlay to grab a new package set repo config
+ QProcess::execute(QString("pc-extractoverlay"), QStringList() << "ports");
+
+ emit ok();
+ close();
+}
@@ -0,0 +1,35 @@
+
+#ifndef DIALOGCONFIG_H
+#define DIALOGCONFIG_H
+
+#include "ui_dialogConfig.h"
+#include <QDebug>
+#include <qstring.h>
+
+class dialogConfig : public QDialog, private Ui::dialogConfig
+{
+ Q_OBJECT
+
+public:
+ dialogConfig() : QDialog()
+ {
+ setupUi(this);
+ }
+
+ void programInit();
+
+public slots:
+
+protected:
+
+private slots:
+ void slotCancel();
+ void slotOK();
+
+private:
+
+signals:
+ void ok();
+
+} ;
+#endif // DIALOGCONFIG_H
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>dialogConfig</class>
+ <widget class="QDialog" name="dialogConfig">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>499</width>
+ <height>142</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configuration</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Package Set</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_20">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="radioProduction">
+ <property name="text">
+ <string>Production (Packages updated quarterly - Recommended)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="radioEdge">
+ <property name="text">
+ <string>Edge (Packages updated frequently - For testing and development)</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushOK">
+ <property name="text">
+ <string>&amp;Ok</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushCancel">
+ <property name="text">
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
@@ -38,6 +38,7 @@ void mainWin::ProgramInit(QString ch)
connect(buttonRescanPkgs, SIGNAL(clicked()), this, SLOT(slotRescanPkgsClicked()));
connect(pushPkgApply, SIGNAL( clicked() ), this, SLOT( slotApplyClicked() ) );
connect(action_Quit, SIGNAL( triggered(bool) ), this, SLOT( slotCloseClicked() ) );
+ connect(action_Configuration, SIGNAL( triggered(bool) ), this, SLOT( slotConfigClicked() ) );
connect(tool_search, SIGNAL( clicked() ), this, SLOT( slotSearchPackages() ) );
connect(line_search, SIGNAL( returnPressed()), this, SLOT( slotSearchPackages()) );
@@ -1574,3 +1575,17 @@ void mainWin::slotReadEventPipe()
} // End of while canReadLine()
}
+
+void mainWin::slotConfigClicked()
+{
+ configD = new dialogConfig();
+ connect(configD, SIGNAL(ok()),this, SLOT(slotConfigFinished()) );
+ configD->programInit();
+ configD->show();
+}
+
+void mainWin::slotConfigFinished()
+{
+ // Changed view, lets refresh
+ initMetaWidget();
+}
@@ -16,6 +16,7 @@
#include <pcbsd-utils.h>
#include <pcbsd-ui.h>
#include "dialogConfirm.h"
+#include "dialogConfig.h"
#include "ui_mainWin.h"
#include "../config.h"
@@ -79,6 +80,10 @@ private slots:
void slotReadEventPipe();
+ // Configuration dialog
+ void slotConfigClicked();
+ void slotConfigFinished();
+
private:
// Generic pkg process handlers
void prepPkgProcess();
@@ -160,6 +165,9 @@ private slots:
// Event pipe process
QProcess *eP;
+ // Config dialog
+ dialogConfig *configD;
+
signals:
} ;
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>800</width>
+ <width>913</width>
<height>644</height>
</rect>
</property>
@@ -458,14 +458,16 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
- <width>800</width>
+ <width>913</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
<property name="title">
<string>&amp;File</string>
</property>
+ <addaction name="action_Configuration"/>
+ <addaction name="separator"/>
<addaction name="action_Quit"/>
</widget>
<widget class="QMenu" name="menu_View">
@@ -492,15 +494,25 @@ p, li { white-space: pre-wrap; }
<bool>true</bool>
</property>
<property name="text">
- <string>&amp;Basic</string>
+ <string>&amp;Basic (Meta-Packages)</string>
</property>
</action>
<action name="action_Advanced">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
- <string>&amp;Advanced</string>
+ <string>&amp;Advanced (All Packages)</string>
+ </property>
+ </action>
+ <action name="action_Preferences">
+ <property name="text">
+ <string>&amp;Configuration</string>
+ </property>
+ </action>
+ <action name="action_Configuration">
+ <property name="text">
+ <string>&amp;Configuration</string>
</property>
</action>
</widget>
@@ -6,11 +6,11 @@ LIBS += -L../libpcbsd -L/usr/local/lib -lpcbsd-ui -lpcbsd-utils -lQtSolutions_Si
INCLUDEPATH += ../libpcbsd/utils ../libpcbsd/ui /usr/local/include
-HEADERS += mainWin.h dialogConfirm.h
+HEADERS += mainWin.h dialogConfirm.h dialogConfig.h
-SOURCES += main.cpp mainWin.cpp dialogConfirm.cpp
+SOURCES += main.cpp mainWin.cpp dialogConfirm.cpp dialogConfig.cpp
-FORMS = mainWin.ui dialogConfirm.ui
+FORMS = mainWin.ui dialogConfirm.ui dialogConfig.ui
RESOURCES = pc-pkgmanager.qrc
@@ -180,14 +180,6 @@ void PBSystemTab::fetchPortsPressed()
void PBSystemTab::loadMiscData()
{
- // Load the default package set value
- if ( pcbsd::Utils::getValFromPCBSDConf("PACKAGE_SET") == "EDGE" ) {
- radioEdge->setChecked(true);
- radioProduction->setChecked(false);
- } else {
- radioProduction->setChecked(true);
- radioEdge->setChecked(false);
- }
//Check if IBUS input is forced
if ( pcbsd::Utils::getConfFileValue(QString(PREFIX + "/share/pcbsd/xstartup/enable-ibus.sh"), QString("FORCEIBUS=") ) == QString("YES")){
checkForceIbus->setChecked(TRUE);
@@ -203,15 +195,6 @@ void PBSystemTab::slotMiscSave() {
}else{
pcbsd::Utils::setConfFileValue(PREFIX + "/share/pcbsd/xstartup/enable-ibus.sh", "FORCEIBUS", "FORCEIBUS=\"NO\"", 1);
}
-
- // Save package set
- if ( radioProduction->isChecked() )
- pcbsd::Utils::setValPCBSDConf("PACKAGE_SET", "PRODUCTION");
- else
- pcbsd::Utils::setValPCBSDConf("PACKAGE_SET", "EDGE");
-
- // Extract the ports overlay to grab a new package set repo config
- QProcess::execute(QString("pc-extractoverlay"), QStringList() << "ports");
}
void PBSystemTab::slotClose() {
Oops, something went wrong.

0 comments on commit e62a5d2

Please sign in to comment.