[PC-BSD Commits] r2093 - pbibuild/pbi-source/PBCsource

svn at pcbsd.org svn at pcbsd.org
Thu Jun 12 08:23:04 PDT 2008


Author: kris
Date: 2008-06-12 08:23:03 -0700 (Thu, 12 Jun 2008)
New Revision: 2093

Added:
   pbibuild/pbi-source/PBCsource/PBC.qrc
   pbibuild/pbi-source/PBCsource/folder-blue.png
Removed:
   pbibuild/pbi-source/PBCsource/designer_d_fileopen.png
Modified:
   pbibuild/pbi-source/PBCsource/PBC.pro
   pbibuild/pbi-source/PBCsource/exedialog.cpp
   pbibuild/pbi-source/PBCsource/exedialog.h
   pbibuild/pbi-source/PBCsource/mimedialog.cpp
   pbibuild/pbi-source/PBCsource/mimedialog.h
   pbibuild/pbi-source/PBCsource/pbcwizard.cpp
   pbibuild/pbi-source/PBCsource/pbcwizard.h
   pbibuild/pbi-source/PBCsource/pbcwizard.ui
Log:

Finished up the porting of the PBI GUI creator (PBC) to KDE4 / QT4



Modified: pbibuild/pbi-source/PBCsource/PBC.pro
===================================================================
--- pbibuild/pbi-source/PBCsource/PBC.pro	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/PBC.pro	2008-06-12 15:23:03 UTC (rev 2093)
@@ -3,9 +3,10 @@
 ######################################################################
 
 TEMPLATE = app
-TARGET = 
+TARGET = PBC
 DEPENDPATH += .
 INCLUDEPATH += .
+RESOURCES += PBC.qrc
 LIBS	+= -lkdecore -lkio -lkdeui -Ikdelibs
 
 # Input

Added: pbibuild/pbi-source/PBCsource/PBC.qrc

Deleted: pbibuild/pbi-source/PBCsource/designer_d_fileopen.png

Modified: pbibuild/pbi-source/PBCsource/exedialog.cpp
===================================================================
--- pbibuild/pbi-source/PBCsource/exedialog.cpp	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/exedialog.cpp	2008-06-12 15:23:03 UTC (rev 2093)
@@ -11,12 +11,10 @@
 *****************************************************************************/
 #include "exedialog.h"
 #include <kfiledialog.h>
+#include <qstring.h>
+#include <qicon.h>
 
-ExeDialog::ExeDialog(QWidget *parent)
-{
 
-}
-
 void ExeDialog::ProgramInit( QString Dir, const QPixmap *IconPixmap )
 {
     // Disable the Taskbar Icon checkbox, until we can use it properly with KDE support
@@ -25,6 +23,7 @@
     
     ProgDir = Dir;
     ExeIconButton->setIcon(*IconPixmap);
+    ExeIconButton->setIconSize(QSize(40,40));
     SaveButton->setEnabled(FALSE);
     connect( ProgLineEdit, SIGNAL(textChanged( const QString &)), this, SLOT(CheckFieldSlot()) );  
     connect( DescriptionLineEdit, SIGNAL(textChanged( const QString &)), this, SLOT(CheckFieldSlot()) ); 
@@ -51,11 +50,11 @@
    
     if(!TmpIcon.isNull() && TmpIcon.indexOf(ProgDir) == 0 )
     {
-	// We create a QImage, then convert it to QPixmap to set our button
-	QImage *Icon = new QImage(TmpIcon);
-	QPixmap PixmapIcon;
-	PixmapIcon.fromImage(Icon->scaled(80,80));
-	ExeIconButton->setIcon(PixmapIcon);
+	// Set our Icon Button to the new selected icon
+        QIcon Icon;
+        Icon.addPixmap(QPixmap(QString::fromUtf8(TmpIcon)), QIcon::Normal, QIcon::Off);
+        ExeIconButton->setIcon(Icon);
+        ExeIconButton->setIconSize(QSize(40,40));
 	// Save the path to this icon for later processing
 	IconDir = TmpIcon;
     }
@@ -258,12 +257,10 @@
     
     if (! Icon.isEmpty() )
     {
-      // We create a QImage, then convert it to QPixmap to set our button
-      QImage *IconImage = new QImage(Icon);
-      QPixmap PixmapIcon;
-      PixmapIcon.fromImage(IconImage->scaled(80,80));
-      ExeIconButton->setIcon(PixmapIcon);
-      // Save the path to this icon for later processing
+      QIcon ButtonIcon;
+      ButtonIcon.addPixmap(QPixmap(QString::fromUtf8(Icon)), QIcon::Normal, QIcon::Off);
+      ExeIconButton->setIcon(ButtonIcon);
+      ExeIconButton->setIconSize(QSize(40,40));
       IconDir = Icon;
     }
     

Modified: pbibuild/pbi-source/PBCsource/exedialog.h
===================================================================
--- pbibuild/pbi-source/PBCsource/exedialog.h	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/exedialog.h	2008-06-12 15:23:03 UTC (rev 2093)
@@ -3,12 +3,16 @@
 
 #include "ui_exedialog.h"
 
-class ExeDialog : public QWidget, private Ui::ExeDialog
+class ExeDialog : public QDialog, private Ui::ExeDialog
 {
 	Q_OBJECT
 
 public:
-     	ExeDialog(QWidget *parent=0);
+     	//ExeDialog(QWidget *parent=0);
+        ExeDialog() : QDialog()
+        {
+	  setupUi(this);
+        }
 	void ProgramInit(  QString Dir, const QPixmap *IconPixmap );
 	void SetEditValues( QString Prog, QString Icon, QString Desc, int noDesktop, int noMenu, int runRoot, int runShell, int notify, int link, int webLink, int taskbar, int owndir, QString kdeCat );
 
@@ -26,7 +30,7 @@
 	QString IconDir;
 
 signals:
-	void Saved(QString, QString&, QString, int&, int&, int&, int&, int&, int&, int&, int&, int&, QString);
+	void Saved(QString, QString, QString, int, int, int, int, int, int, int, int, int, QString);
 
 } ;
 #endif // EXEDIALOG_H

Added: pbibuild/pbi-source/PBCsource/folder-blue.png


Property changes on: pbibuild/pbi-source/PBCsource/folder-blue.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: pbibuild/pbi-source/PBCsource/mimedialog.cpp
===================================================================
--- pbibuild/pbi-source/PBCsource/mimedialog.cpp	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/mimedialog.cpp	2008-06-12 15:23:03 UTC (rev 2093)
@@ -13,19 +13,9 @@
 #include "mimedialog.h"
 #include <kfiledialog.h>
 
-MimeDialog::MimeDialog(QWidget *parent)
-{
 
-}
-
-
 void MimeDialog::CheckExtensionSlot( const QString &newLine )
 {
-
-    
-    
-    
-    
     if (newLine.isEmpty() )
     {
 	SaveButton->setEnabled(FALSE);
@@ -62,8 +52,10 @@
     if(!TmpIcon.isNull() && TmpIcon.indexOf(ProgDir) == 0 )
     {
 	// We create a QImage, then convert it to QPixmap to set our button
-	QPixmap PixmapIcon(TmpIcon);
-	MimeIconButton->setIcon(PixmapIcon.scaled(80,80));
+        QIcon Icon;
+        Icon.addPixmap(QPixmap(QString::fromUtf8(TmpIcon)), QIcon::Normal, QIcon::Off);
+	MimeIconButton->setIcon(Icon);
+	MimeIconButton->setIconSize(QSize(40,40));
 	// Save the path to this icon for later processing
 	IconDir = TmpIcon;
     }
@@ -77,6 +69,7 @@
     ProgDir = Directory;
     
     MimeIconButton->setIcon(*IconPixmap);
+    MimeIconButton->setIconSize(QSize(40,40));
     SaveButton->setEnabled(FALSE);
 
     IconDir=""; 
@@ -104,10 +97,10 @@
      
      if ( ! Icon.isEmpty() ) {
        // We create a QImage, then convert it to QPixmap to set our button
-      QImage *IconImg = new QImage(Icon);
-      QPixmap PixmapIcon;
-      PixmapIcon.fromImage(IconImg->scaled(80,80));
-      MimeIconButton->setIcon(PixmapIcon);
+      QIcon IconButton;
+      IconButton.addPixmap(QPixmap(QString::fromUtf8(Icon)), QIcon::Normal, QIcon::Off);
+      MimeIconButton->setIcon(IconButton);
+      MimeIconButton->setIconSize(QSize(40,40));
       // Save the path to this icon for later processing
       IconDir = Icon;
   } 

Modified: pbibuild/pbi-source/PBCsource/mimedialog.h
===================================================================
--- pbibuild/pbi-source/PBCsource/mimedialog.h	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/mimedialog.h	2008-06-12 15:23:03 UTC (rev 2093)
@@ -3,12 +3,15 @@
 
 #include "ui_mimedialog.h"
 
-class MimeDialog : public QWidget, private Ui::MimeDialog
+class MimeDialog : public QDialog, private Ui::MimeDialog
 {
 	Q_OBJECT
 
 public:
-     	MimeDialog(QWidget *parent=0);
+	MimeDialog() : QDialog()
+	{
+          setupUi(this);
+	}
 	void ProgramInit( QString *ExeDescr, const QPixmap *IconPixmap, QString Directory );
 
 public slots:
@@ -23,7 +26,7 @@
 	QString ProgDir;
 
 signals:
-	void Saved(QString, QString&, int);
+	void Saved(QString, QString, int);
 
 } ;
 

Modified: pbibuild/pbi-source/PBCsource/pbcwizard.cpp
===================================================================
--- pbibuild/pbi-source/PBCsource/pbcwizard.cpp	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/pbcwizard.cpp	2008-06-12 15:23:03 UTC (rev 2093)
@@ -70,13 +70,13 @@
      connect( AddExeButton, SIGNAL(clicked()), this, SLOT(AddExeButtonSlot()) );     
      connect( EditExeButton, SIGNAL(clicked()), this, SLOT(EditExeButtonSlot()) );
      connect( RemoveExeButton, SIGNAL(clicked()), this, SLOT(RemoveExeButtonSlot()) );
-     connect(ExeListBox, SIGNAL(doubleClicked( QListBoxItem *) ), this, SLOT(ExeBoxDoubleClick() ) );
+     connect(ExeListBox, SIGNAL(doubleClicked( Q3ListBoxItem *) ), this, SLOT(ExeBoxDoubleClick() ) );
      
      // Connects the Add / Edit / Remove Mime Buttons
      connect( AddMimeButton, SIGNAL(clicked()), this, SLOT(AddMimeButtonSlot()) );     
      connect( EditMimeButton, SIGNAL(clicked()), this, SLOT(EditMimeButtonSlot()) );
      connect( RemoveMimeButton, SIGNAL(clicked()), this, SLOT(RemoveMimeButtonSlot()) );
-      connect(MimeListBox, SIGNAL(doubleClicked( QListBoxItem *) ), this, SLOT(MimeBoxDoubleClick() ) );
+      connect(MimeListBox, SIGNAL(doubleClicked( Q3ListBoxItem *) ), this, SLOT(MimeBoxDoubleClick() ) );
      
      // Connect the Preset Buttons
      connect( LoadPresetButton, SIGNAL(clicked()), this, SLOT(selectPresetSlot()) ); 
@@ -138,7 +138,7 @@
 	QString program = "rm";
 	QStringList arguments;
  	arguments << "-rf" << HomeDir + "/.PBCtmp";	
-        connect( DelTmp, SIGNAL(processExited()), this, SLOT(StartPackageCreationSlot() ) );
+        connect( DelTmp, SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT(delTmpProcFinished(int, QProcess::ExitStatus ) ) );
 		   
 	 DelTmp->start(program, arguments);
 	
@@ -146,6 +146,12 @@
 
 }
 
+void PBCwizard::delTmpProcFinished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+  StartPackageCreationSlot();
+}
+
+
 // Checks for info about the package, enables the next button if all fields have data
 void PBCwizard::CheckInfoInput()
 {
@@ -252,10 +258,9 @@
     if(!TmpIcon.isNull() &&TmpIcon.indexOf(DirLineEdit->text()) == 0) 
     {
 	// We create a QImage, then convert it to QPixmap to set our button
-	QImage *Icon = new QImage(TmpIcon);
-	QPixmap PixmapIcon;
-	PixmapIcon.fromImage(Icon->scaled(80,80));
-	IconButton->setIcon(PixmapIcon);
+	QIcon Icon;
+        Icon.addPixmap(QPixmap(QString::fromUtf8(TmpIcon)), QIcon::Normal, QIcon::Off);
+	IconButton->setIcon(Icon);
 	// Save the path to this icon for later processing
 	DefaultIcon = TmpIcon;
     }
@@ -267,6 +272,7 @@
 void PBCwizard::AddExeButtonSlot()
 {
     AddDialog = new ExeDialog();
+    AddDialog->setModal(TRUE);
     connect( AddDialog, SIGNAL(Saved(QString, QString, QString, int, int, int, int, int, int, int, int, int, QString)), this, SLOT(AddExeDataSlot(QString, QString, QString, int, int, int, int, int, int, int, int, int, QString)) );
     QPixmap PixmapIcon;
     PixmapIcon = (IconButton->icon().pixmap(40,40));
@@ -283,10 +289,12 @@
     {
 	// Save the item number we are working on. 
 	CurrentExeItem = ExeListBox->currentItem();
+
 	QPixmap PixmapIcon;
         PixmapIcon = (IconButton->icon().pixmap(40,40));
 	
 	EditDialog = new ExeDialog();
+        EditDialog->setModal(TRUE);
 	connect( EditDialog, SIGNAL(Saved(QString, QString, QString, int, int, int, int, int, int, int, int, int, QString)), this, SLOT(EditExeDataSlot(QString, QString, QString, int, int, int, int, int, int, int, int, int, QString)) );
 	EditDialog->ProgramInit(DirLineEdit->text(), &PixmapIcon);
 	EditDialog->SetEditValues( ExeProgPath[CurrentExeItem], ExeIconPath[CurrentExeItem] , ExeDescr[CurrentExeItem], ExeNoDesktop[CurrentExeItem], ExeNoMenu[CurrentExeItem], ExeRunRoot[CurrentExeItem], ExeRunShell[CurrentExeItem], ExeNotify[CurrentExeItem], ExeLink[CurrentExeItem], ExeWebLink[CurrentExeItem], ExeTaskbar[CurrentExeItem], ExeOwndir[CurrentExeItem], ExeKdeCat[CurrentExeItem] );
@@ -372,15 +380,20 @@
     TarProg = new QProcess(this);
     QString program = PBCAppDir + "/createpbi.sh";
     QStringList arguments;
-    arguments << HomeDir + "/.pbi.pnc" << PBCAppDir + "/";
+    arguments << HomeDir + "/.pbi.pbc" << PBCAppDir + "/";
 
-    connect( TarProg, SIGNAL(processExited()), this, SLOT(InstallFileDoneSlot() ) );
+    connect( TarProg, SIGNAL( finished(int, QProcess::ExitStatus) ), this, SLOT(tarProcFinished(int, QProcess::ExitStatus ) ) );
      
     TarProg->start(program, arguments);
    
 }
 
+void PBCwizard::tarProcFinished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+   InstallFileDoneSlot();
+}
 
+
 void PBCwizard::StartPackageCreationSlot()
 {
     StartPackageCreation();
@@ -429,7 +442,8 @@
 void PBCwizard::AddMimeButtonSlot()
 {
     
-     AddMime = new MimeDialog();
+    AddMime = new MimeDialog();
+    AddMime->setModal(TRUE);
     QPixmap PixmapIcon;
     PixmapIcon = IconButton->icon().pixmap(40,40);
     connect( AddMime, SIGNAL(Saved(QString, QString, int)), this, SLOT(AddMimeDataSlot(QString, QString, int) ) );
@@ -449,6 +463,7 @@
         QPixmap PixmapIcon;
         PixmapIcon = IconButton->icon().pixmap(40,40);
 	EditMime = new MimeDialog();
+        EditMime->setModal(TRUE);
         connect(EditMime, SIGNAL(Saved(QString, QString, int)), this, SLOT(EditMimeDataSlot(QString, QString, int)));
 	EditMime->ProgramInit(ExeDescr, &PixmapIcon, DirLineEdit->text());
 	EditMime->SetEditValues( MimeExt[CurrentMimeItem], MimeIcon[CurrentMimeItem] , MimeProg[CurrentMimeItem] );
@@ -546,15 +561,12 @@
     // Insert a new item
     if (! ExeIconPath[i].isEmpty() )
     {
-       QImage *Icon = new QImage(ExeIconPath[i]);
-       QPixmap PixmapIcon;
-       PixmapIcon.fromImage(Icon->scaled(40,40));
-       ExeListBox->insertItem(PixmapIcon, ExeDescr[i]);
+       QIcon Icon;
+       Icon.addPixmap(QPixmap(QString::fromUtf8(ExeIconPath[i])), QIcon::Normal, QIcon::Off);
+       ExeListBox->insertItem(Icon.pixmap(40,40), ExeDescr[i]);
 	
     } else { 
-	QPixmap PixmapIcon;
-        PixmapIcon = (IconButton->icon().pixmap(40,40));
-	ExeListBox->insertItem(PixmapIcon, ExeDescr[i]);
+	ExeListBox->insertItem(IconButton->icon().pixmap(40,40), ExeDescr[i]);
     }
     
        i++;
@@ -579,15 +591,12 @@
         // Insert a new item
     if (! MimeIcon[i].isEmpty() )
     {
-       QImage *Icon = new QImage(MimeIcon[i]);
-       QPixmap PixmapIcon;
-       PixmapIcon.fromImage(Icon->scaled(40,40));
-       MimeListBox->insertItem(PixmapIcon, MimeExt[i]);
+       QIcon Icon;
+       Icon.addPixmap(QPixmap(QString::fromUtf8(MimeIcon[i])), QIcon::Normal, QIcon::Off);
+       MimeListBox->insertItem(Icon.pixmap(40,40), MimeExt[i]);
 	
     } else { 
-	QPixmap PixmapIcon;
-	PixmapIcon = (IconButton->icon().pixmap(40,40));
-	MimeListBox->insertItem(PixmapIcon, MimeExt[i]);
+	MimeListBox->insertItem(IconButton->icon().pixmap(40,40), MimeExt[i]);
     }
     
      i++; 
@@ -781,10 +790,9 @@
 		DefaultIcon = line.replace("DefaultIcon: ", "");
 		if ( ! DefaultIcon.isEmpty() ) {
 		// We create a QImage, then convert it to QPixmap to set our button
-		QImage *Icon = new QImage( DefaultIcon);
-		QPixmap PixmapIcon;
-		PixmapIcon.fromImage(Icon->scaled(80,80));
-		IconButton->setIcon(PixmapIcon);
+		QIcon Icon;
+                Icon.addPixmap(QPixmap(QString::fromUtf8(DefaultIcon)), QIcon::Normal, QIcon::Off);
+		IconButton->setIcon(Icon);
 		}
 	    } 
 	    if ( line.indexOf("ExePath:") == 0)

Modified: pbibuild/pbi-source/PBCsource/pbcwizard.h
===================================================================
--- pbibuild/pbi-source/PBCsource/pbcwizard.h	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/pbcwizard.h	2008-06-12 15:23:03 UTC (rev 2093)
@@ -57,6 +57,10 @@
 	void help();
 	void MakePresetFileSlot(QString filename);
 
+private slots:
+	void delTmpProcFinished(int exitCode, QProcess::ExitStatus exitStatus);
+	void tarProcFinished(int exitCode, QProcess::ExitStatus exitStatus);
+
 private:
 	QString ExeProgPath[500];
 	QString ExeIconPath[500];

Modified: pbibuild/pbi-source/PBCsource/pbcwizard.ui
===================================================================
--- pbibuild/pbi-source/PBCsource/pbcwizard.ui	2008-06-11 21:06:43 UTC (rev 2092)
+++ pbibuild/pbi-source/PBCsource/pbcwizard.ui	2008-06-12 15:23:03 UTC (rev 2093)
@@ -36,6 +36,10 @@
   <property name="windowTitle" >
    <string>PC-BSD Package Creator</string>
   </property>
+  <property name="windowIcon" >
+   <iconset resource="PBC.qrc" >
+    <normaloff>:/application.png</normaloff>:/application.png</iconset>
+  </property>
   <widget class="QWidget" name="StartPage" >
    <attribute name="title" >
     <string>Package Info</string>
@@ -346,6 +350,16 @@
       <property name="text" >
        <string/>
       </property>
+      <property name="icon" >
+       <iconset resource="PBC.qrc" >
+        <normaloff>:/folder-blue.png</normaloff>:/folder-blue.png</iconset>
+      </property>
+      <property name="iconSize" >
+       <size>
+        <width>22</width>
+        <height>22</height>
+       </size>
+      </property>
      </widget>
     </item>
     <item row="1" column="1" colspan="3" >
@@ -383,6 +397,16 @@
          <property name="text" >
           <string/>
          </property>
+         <property name="icon" >
+          <iconset resource="PBC.qrc" >
+           <normaloff>:/folder-blue.png</normaloff>:/folder-blue.png</iconset>
+         </property>
+         <property name="iconSize" >
+          <size>
+           <width>22</width>
+           <height>22</height>
+          </size>
+         </property>
         </widget>
        </item>
        <item row="0" column="0" colspan="2" >
@@ -515,10 +539,10 @@
   <widget class="QWidget" name="WizardPage" >
    <property name="geometry" >
     <rect>
-     <x>6</x>
-     <y>36</y>
-     <width>609</width>
-     <height>423</height>
+     <x>0</x>
+     <y>0</y>
+     <width>100</width>
+     <height>30</height>
     </rect>
    </property>
    <attribute name="title" >
@@ -618,6 +642,16 @@
       <property name="text" >
        <string/>
       </property>
+      <property name="icon" >
+       <iconset resource="PBC.qrc" >
+        <normaloff>:/application.png</normaloff>:/application.png</iconset>
+      </property>
+      <property name="iconSize" >
+       <size>
+        <width>48</width>
+        <height>48</height>
+       </size>
+      </property>
      </widget>
     </item>
     <item row="0" column="1" colspan="2" >
@@ -1046,6 +1080,8 @@
   <include location="local" >exedialog.h</include>
   <include location="local" >mimedialog.h</include>
  </includes>
- <resources/>
+ <resources>
+  <include location="PBC.qrc" />
+ </resources>
  <connections/>
 </ui>



More information about the Commits mailing list