[PC-BSD Commits] r2535 - pcbsd/trunk/kcmPBMsource
svn at pcbsd.org
svn at pcbsd.org
Wed Aug 6 07:41:19 PDT 2008
Author: kris
Date: 2008-08-06 07:41:19 -0700 (Wed, 06 Aug 2008)
New Revision: 2535
Modified:
pcbsd/trunk/kcmPBMsource/pbm.cpp
pcbsd/trunk/kcmPBMsource/pbm.h
Log:
Updated the Add / Remove program, fixed the component loading, and also
added a couple of dialogs to prompt for a CD or Internet install, will add
backend shortly
Modified: pcbsd/trunk/kcmPBMsource/pbm.cpp
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.cpp 2008-08-06 14:12:58 UTC (rev 2534)
+++ pcbsd/trunk/kcmPBMsource/pbm.cpp 2008-08-06 14:41:19 UTC (rev 2535)
@@ -65,6 +65,8 @@
// Load the Components
loadComponents();
+ // Connect our Component List Widget
+ connect(componentListbox, SIGNAL( currentRowChanged(int) ), this, SLOT(componentSelectionChangedSlot(int) ) );
}
@@ -418,6 +420,7 @@
QFile file( "/PCBSD/Components/" + d[i] + "/component.cfg" );
if ( file.open( QIODevice::ReadOnly ) ) {
+
ComponentDir[found]=d[i];
Q3TextStream stream( &file );
@@ -425,12 +428,12 @@
while ( !stream.atEnd() ) {
line = stream.readLine(); // line of text excluding '\n'
- if ( line.find("name:") == 0)
+ if ( line.indexOf("name:") == 0)
{
ComponentName[found] = line.replace("name: ", "");
}
- if ( line.find("description:") == 0)
+ if ( line.indexOf("description:") == 0)
{
ComponentDescr[found] = line.replace("description: ", "");
}
@@ -439,18 +442,17 @@
}
file.close();
+
// Insert a new item here, KPM!!!!!!
QImage *Icon = new QImage("/PCBSD/Components/" + ComponentDir[found] + "/component.png");
QPixmap PixmapIcon;
PixmapIcon.convertFromImage(Icon->smoothScale(40,40));
if ( checkComponentSlot(found) ) {
ComponentInstalled[found] = 0;
- QListWidgetItem item(QIcon(PixmapIcon), ComponentName[found] + " (" + ComponentDescr[found] + ") - INSTALLED");
- componentListbox->addItem(&item);
+ new QListWidgetItem(QIcon(PixmapIcon), ComponentName[found] + " (" + ComponentDescr[found] + ") - " + tr("INSTALLED"), componentListbox);
} else {
ComponentInstalled[found] = 1;
- QListWidgetItem item(QIcon(PixmapIcon), ComponentName[found] + " (" + ComponentDescr[found] + ") - NOT INSTALLED");
- componentListbox->addItem(&item);
+ new QListWidgetItem(QIcon(PixmapIcon), ComponentName[found] + " (" + ComponentDescr[found] + ") - " + tr("NOT INSTALLED"), componentListbox);
}
found++;
@@ -476,10 +478,28 @@
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;
+ }
+
InfoWindow = new Q3Process( this );
InfoWindow->addArgument( "kdialog");
InfoWindow->addArgument( "--passivepopup" );
- InfoWindow->addArgument( "Please Wait.. Installing " + ComponentName[ComponentWorkingItem] + ".." );
+ InfoWindow->addArgument( "Please Wait.. Installing " + ComponentName[ComponentWorkingItem] );
InfoWindow->addArgument( "300" );
if ( !InfoWindow->start() ) {
@@ -492,7 +512,13 @@
// Remove the component
installComponentProc = new Q3Process( this );
- installComponentProc->addArgument( "/PCBSD/Components/" + ComponentDir[ComponentWorkingItem] + "/install.sh");
+ installComponentProc->addArgument( "/PCBSD/Scripts/Components/install-component.sh");
+ installComponentProc->addArgument(ComponentDir[ComponentWorkingItem]);
+ if ( usingOptical) {
+ installComponentProc->addArgument("Optical");
+ } else {
+ installComponentProc->addArgument("Internet");
+ }
connect( installComponentProc, SIGNAL(processExited()), this, SLOT(installComponentFinishedSlot() ) );
@@ -568,17 +594,14 @@
}
-void PBM::componentSelectionChangedSlot( QListWidgetItem* )
+void PBM::componentSelectionChangedSlot( int currentRow )
{
- int selectedItem;
-
- if (componentListbox->currentRow() != -1)
+ // Check if the current row is installed or not
+ if (currentRow != -1)
{
-
- selectedItem = componentListbox->currentRow();
componentInstallButton->setEnabled(TRUE);
- if ( ComponentInstalled[selectedItem] == 0 ) {
+ if ( ComponentInstalled[currentRow] == 0 ) {
componentInstallButton->setText("Remove");
} else {
componentInstallButton->setText("Install");
Modified: pcbsd/trunk/kcmPBMsource/pbm.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.h 2008-08-06 14:12:58 UTC (rev 2534)
+++ pcbsd/trunk/kcmPBMsource/pbm.h 2008-08-06 14:41:19 UTC (rev 2535)
@@ -34,7 +34,7 @@
void removeComponentSlot();
bool checkComponentSlot( int component );
void refreshComponentsSlot();
- void componentSelectionChangedSlot( QListWidgetItem * );
+ void componentSelectionChangedSlot( int currentRow );
void componentButtonClicked();
void removeComponentFinishedSlot();
void installComponentFinishedSlot();
More information about the Commits
mailing list