[PC-BSD Commits] r4622 - pcbsd/trunk/SoftwareManager
svn at pcbsd.org
svn at pcbsd.org
Fri Oct 9 08:55:23 PDT 2009
Author: kris
Date: 2009-10-09 08:55:23 -0700 (Fri, 09 Oct 2009)
New Revision: 4622
Modified:
pcbsd/trunk/SoftwareManager/softmanager-main.cpp
pcbsd/trunk/SoftwareManager/softmanager-main.h
pcbsd/trunk/SoftwareManager/softmanager-main.ui
Log:
Cleanup Component tab in the new Software Manager for 8.0
Modified: pcbsd/trunk/SoftwareManager/softmanager-main.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.cpp 2009-10-09 15:47:18 UTC (rev 4621)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.cpp 2009-10-09 15:55:23 UTC (rev 4622)
@@ -105,17 +105,9 @@
// Get the username of the person running X
RealUserName = getlogin();
- // Load the Components
- loadComponents();
-
- // Connect our Component List Widget
- connect(componentListbox, SIGNAL( currentRowChanged(int) ), this, SLOT(componentSelectionChangedSlot(int) ) );
-
/**********************************************************************/
// Add our connections and calls for the System Updater Service
-
-
// Create the status dialog
UpdaterStatusDialog = new updaterStatus();
// If the dialog was closed, update the context menu
@@ -496,244 +488,6 @@
}
-void PBM::loadComponents()
-{
- componentListbox->clear();
-
-
- int found = 0;
-
- QDir d( "/PCBSD/Components");
-
- d.setFilter( QDir::Dirs );
- d.setSorting( QDir::Name );
-
- for ( uint i = 0; i < d.count(); i++ )
- {
- QFile file( "/PCBSD/Components/" + d[i] + "/component.cfg" );
- if ( file.open( QIODevice::ReadOnly ) ) {
-
-
- ComponentDir[found]=d[i];
-
- QTextStream stream( &file );
- QString line;
- while ( !stream.atEnd() ) {
- line = stream.readLine(); // line of text excluding '\n'
-
- if ( line.indexOf("name:") == 0)
- {
- ComponentName[found] = line.replace("name: ", "");
- }
-
- if ( line.indexOf("description:") == 0)
- {
- ComponentDescr[found] = line.replace("description: ", "");
- }
-
-
- }
- file.close();
-
-
- // Insert a new item here
- QPixmap PixmapIcon("/PCBSD/Components/" + ComponentDir[found] + "/component.png");
- if ( checkComponentSlot(found) ) {
- ComponentInstalled[found] = 0;
- new QListWidgetItem(PixmapIcon.scaled(40,40), ComponentName[found] + " (" + ComponentDescr[found] + ") - " + tr("INSTALLED"), componentListbox);
- } else {
- ComponentInstalled[found] = 1;
- new QListWidgetItem(PixmapIcon.scaled(40,40), ComponentName[found] + " (" + ComponentDescr[found] + ") - " + tr("NOT INSTALLED"), componentListbox);
- }
-
- found++;
- }
- }
-
- componentListbox->setCurrentItem(0);
-
-}
-
-
-void PBM::installComponentSlot(int item)
-{
- ComponentWorkingItem = item;
-
- switch( QMessageBox::warning( this, tr("Install Component?"), tr("Do you want to install ") + ComponentName[ComponentWorkingItem] + "? This can be removed later from this menu.", tr("OK"), tr("Cancel"), 0, 0, 1 ) ) {
- case 0: // The user clicked the OK again button or pressed Enter
- break;
- case 1: // The user clicked the cancel button
- return;
- break;
- }
-
- bool usingOptical = false;
-
- // Lets prompt the user if they want to install the component from
- // the Internet or from CD / DVD
- QMessageBox *mediaBox = new QMessageBox();
- mediaBox->setText(tr("Install from CD/DVD or from Internet?") );
- mediaBox->setWindowTitle(tr("Installation Source?") );
- QAbstractButton *opticalbutton = mediaBox->addButton(tr("CD/DVD"), QMessageBox::ActionRole);
- QAbstractButton *internetbutton = mediaBox->addButton(tr("Internet"), QMessageBox::ActionRole);
- mediaBox->exec();
- if ( mediaBox->clickedButton() == opticalbutton)
- {
- usingOptical = true;
- QMessageBox::information( this, tr("Insert Media"), tr("Please insert the PC-BSD CD/DVD media and click OK when ready to install.") );
- } else if (mediaBox->clickedButton() == internetbutton) {
- usingOptical = false;
- }
-
- QString prog = "kdialog";
- QStringList args;
- args << "--passivepopup" << "Please Wait.. Installing " + ComponentName[ComponentWorkingItem] << "300";
- InfoWindow = new QProcess( this );
- InfoWindow->start(prog, args);
-
-
- tabPBM->setEnabled(FALSE);
-
-
- // Remove the component
- prog = "/PCBSD/Scripts/Components/install-component.sh";
- args.clear();
- args << ComponentDir[ComponentWorkingItem];
- if ( usingOptical) {
- args << "Optical";
- } else {
- args << "Internet";
- }
-
-
- installComponentProc = new QProcess( this );
- connect( installComponentProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(installComponentFinishedSlot() ) );
- installComponentProc->start(prog, args);
-
-
-}
-
-
-void PBM::removeComponentSlot()
-{
-
- if (componentListbox->currentRow() != -1)
- {
- ComponentWorkingItem = componentListbox->currentRow();
-
- switch( QMessageBox::warning( this, tr("Remove Component?"), tr("Do you want to remove ") + ComponentName[ComponentWorkingItem] + "? This can be re-added later from this menu.", tr("OK"), tr("Cancel"), 0, 0, 1 ) ) {
- case 0: // The user clicked the OK again button or pressed Enter
- break;
- case 1: // The user clicked the cancel button
- return;
- break;
- }
-
- QString prog = "kdialog";
- QStringList args;
- args << "--passivepopup" << "Please Wait.. Removing " + ComponentName[ComponentWorkingItem] + ".." << "300";
-
- InfoWindow = new QProcess( this );
- InfoWindow->start(prog, args);
-
-
- tabPBM->setEnabled(FALSE);
-
-
- // Remove the component
- prog = "/PCBSD/Components/" + ComponentDir[ComponentWorkingItem] + "/remove.sh";
- args.clear();
-
- removeComponentProc = new QProcess( this );
- connect( removeComponentProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(removeComponentFinishedSlot() ) );
- removeComponentProc->start(prog, args);
-
-
- }
-
-}
-
-
-bool PBM::checkComponentSlot( int component )
-{
- int exit = system("/PCBSD/Components/" + ComponentDir[component].toLatin1() + "/install-check.sh");
- if ( exit == 0 )
- {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-
-void PBM::refreshComponentsSlot()
-{
- loadComponents();
-}
-
-
-void PBM::componentSelectionChangedSlot( int currentRow )
-{
-
- // Check if the current row is installed or not
- if (currentRow != -1)
- {
- componentInstallButton->setEnabled(TRUE);
- if ( ComponentInstalled[currentRow] == 0 ) {
- componentInstallButton->setText("Remove");
- } else {
- componentInstallButton->setText("Install");
- }
-
-
- } else {
- componentInstallButton->setEnabled(FALSE);
- }
-
-}
-
-
-void PBM::componentButtonClicked()
-{
- // If the user clicked to remove / install a component, check which one
- int selectedItem;
-
- if (componentListbox->currentRow() != -1)
- {
-
- selectedItem = componentListbox->currentRow();
- if ( ComponentInstalled[selectedItem] == 0 ) {
- removeComponentSlot();
- } else {
- installComponentSlot( selectedItem );
- }
-
-
- }
-
-}
-
-
-void PBM::removeComponentFinishedSlot()
-{
- // The removal process is done, now refresh and inform the user
- refreshComponentsSlot();
-
- tabPBM->setEnabled(TRUE);
- // QMessageBox::information( this, tr("Success!"), tr("The component was removed!") );
-}
-
-void PBM::installComponentFinishedSlot()
-{
-
- // The install process is done, now refresh and inform the user
- refreshComponentsSlot();
-
- tabPBM->setEnabled(TRUE);
- // QMessageBox::information( this, tr("Success!"), tr("The component was installed!") );
-}
-
-
QString PBM::bytesToHumanReadable( float bytes )
{
QStringList suffix;
Modified: pcbsd/trunk/SoftwareManager/softmanager-main.h
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.h 2009-10-09 15:47:18 UTC (rev 4621)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.h 2009-10-09 15:55:23 UTC (rev 4622)
@@ -65,14 +65,6 @@
private slots:
void RemoveButtonSlot();
void PopulateList();
- void installComponentSlot(int item);
- void removeComponentSlot();
- bool checkComponentSlot( int component );
- void refreshComponentsSlot();
- void componentSelectionChangedSlot( int currentRow );
- void componentButtonClicked();
- void removeComponentFinishedSlot();
- void installComponentFinishedSlot();
void checkRoot();
void slotStartUpdateCheck();
void slotSysUpdateCheckFinished();
@@ -149,7 +141,6 @@
private:
void RemovePBI( PBI * pbi );
- void loadComponents();
void generateCopyLabel();
bool checkPBILoaded(QString name);
PBI *getPBIFromName(QString name);
@@ -167,13 +158,6 @@
QString bytesToHumanReadable( float bytes );
int getDirSize( QString path );
QProcess *InfoWindow;
- QProcess *installComponentProc;
- QProcess *removeComponentProc;
- int ComponentWorkingItem;
- int ComponentInstalled[500];
- QString ComponentDir[500];
- QString ComponentDescr[500];
- QString ComponentName[500];
QProcess *RemoveScript;
QProcess *CheckRoot;
QString RealUserName;
Modified: pcbsd/trunk/SoftwareManager/softmanager-main.ui
===================================================================
--- pcbsd/trunk/SoftwareManager/softmanager-main.ui 2009-10-09 15:47:18 UTC (rev 4621)
+++ pcbsd/trunk/SoftwareManager/softmanager-main.ui 2009-10-09 15:55:23 UTC (rev 4622)
@@ -310,101 +310,6 @@
</item>
</layout>
</widget>
- <widget class="QWidget" name="tab">
- <attribute name="title">
- <string>System Components</string>
- </attribute>
- <layout class="QGridLayout">
- <item row="0" column="0">
- <layout class="QVBoxLayout">
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QLabel" name="pixmapLabel1">
- <property name="minimumSize">
- <size>
- <width>64</width>
- <height>64</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>64</width>
- <height>64</height>
- </size>
- </property>
- <property name="pixmap">
- <pixmap resource="SoftwareManager.qrc">:/demo.png</pixmap>
- </property>
- <property name="scaledContents">
- <bool>true</bool>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="textLabel1">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Available system components</string>
- </property>
- <property name="wordWrap">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
- <widget class="QListWidget" name="componentListbox"/>
- </item>
- <item>
- <layout class="QHBoxLayout">
- <item>
- <widget class="QPushButton" name="componentInstallButton">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&Install</string>
- </property>
- <property name="shortcut">
- <string>Alt+I</string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="spacer1_2">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>202</width>
- <height>31</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>System Updates</string>
@@ -618,38 +523,5 @@
<resources>
<include location="SoftwareManager.qrc"/>
</resources>
- <connections>
- <connection>
- <sender>componentListbox</sender>
- <signal>itemChanged(QListWidgetItem*)</signal>
- <receiver>PBM</receiver>
- <slot>componentSelectionChangedSlot(QListWidgetItem*)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>componentInstallButton</sender>
- <signal>clicked()</signal>
- <receiver>PBM</receiver>
- <slot>componentButtonClicked()</slot>
- <hints>
- <hint type="sourcelabel">
- <x>20</x>
- <y>20</y>
- </hint>
- <hint type="destinationlabel">
- <x>20</x>
- <y>20</y>
- </hint>
- </hints>
- </connection>
- </connections>
+ <connections/>
</ui>
More information about the Commits
mailing list