[PC-BSD Commits] r9708 - pcbsd/current/src-qt4/pc-softwaremanager

svn at pcbsd.org svn at pcbsd.org
Thu Mar 17 13:18:32 PDT 2011


Author: kris
Date: 2011-03-17 13:18:31 -0700 (Thu, 17 Mar 2011)
New Revision: 9708

Modified:
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.ui
   pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp
Log:

Updated appcafe,

Removed combobox for repos, put that in the menu bar now, cleanup display
a bit while here



Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-03-17 17:22:55 UTC (rev 9707)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.cpp	2011-03-17 20:18:31 UTC (rev 9708)
@@ -53,6 +53,9 @@
 
    // Load the program preferences
    slotLoadSettings();
+
+   // Configure the menu
+   setupMenuBar();
     
    // Connect our buttons / slots
    connect(toolHomeButton, SIGNAL( clicked() ), this, SLOT(slotHomeButtonClicked() ) );
@@ -69,7 +72,6 @@
    connect( SoftwareListBox, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int) ), this, SLOT(slotViewPBIClicked() ) );
 
    // Connect our main UI Buttons
-   connect(pushRepoConfiguration, SIGNAL( clicked() ), this, SLOT(slotConfigButtonClicked() ) );
    connect(RemoveButton, SIGNAL( clicked() ), this, SLOT(RemoveButtonSlot() ) );
     
    // Begin to display the software browser
@@ -570,3 +572,9 @@
 		displayPBI(curPageName, false, curPageRepo);
 
 }
+
+// Setup the menu bar
+void PBM::setupMenuBar()
+{
+	repomenu = menuBar()->addMenu(tr("&Repositories"));
+}

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2011-03-17 17:22:55 UTC (rev 9707)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.h	2011-03-17 20:18:31 UTC (rev 9708)
@@ -89,7 +89,7 @@
 
     // Software Browser
     void startSoftwareBrowser();
-    void slotRepoChanged(int);
+    void slotRepoChanged(QAction *);
     void slotCatClicked(QString);
     void slotPBIClicked(QString);
     void slotDownloadClicked(QString);
@@ -110,6 +110,7 @@
     void loadStatePBI();
     void purgeAllDeletedPBI();  
     bool checkOkToClose();
+    void setupMenuBar();
 
     // PBI Browser 
     AvailPBI *pbiAvail;
@@ -133,6 +134,7 @@
     void loadAvailPBIs();
     void loadCategories();
     void loadRepos();
+    void setupRepoMenu();
     void updateHistory(QString type, QString name);
     QWidget* getLatestPBIWidget(int);
     // End PBI Browser
@@ -146,6 +148,7 @@
     QString RealUserName;
     QFileSystemWatcher *fileWatcher;
     QMenu *popup;
+    QMenu *repomenu;
 
     softwareConfigWidget *softConfig;
     int programstatus;

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.ui
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.ui	2011-03-17 17:22:55 UTC (rev 9707)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-main.ui	2011-03-17 20:18:31 UTC (rev 9708)
@@ -137,6 +137,9 @@
           <property name="styleSheet">
            <string notr="true">background-color: rgb(255, 255, 255);</string>
           </property>
+          <property name="frameShadow">
+           <enum>QFrame::Plain</enum>
+          </property>
           <property name="widgetResizable">
            <bool>true</bool>
           </property>
@@ -145,77 +148,13 @@
             <rect>
              <x>0</x>
              <y>0</y>
-             <width>531</width>
-             <height>310</height>
+             <width>545</width>
+             <height>388</height>
             </rect>
            </property>
           </widget>
          </widget>
         </item>
-        <item row="2" column="0">
-         <widget class="QLabel" name="labelWebStatus">
-          <property name="text">
-           <string/>
-          </property>
-         </widget>
-        </item>
-        <item row="3" column="0">
-         <layout class="QHBoxLayout" name="horizontalLayout">
-          <item>
-           <spacer name="horizontalSpacer">
-            <property name="orientation">
-             <enum>Qt::Horizontal</enum>
-            </property>
-            <property name="sizeType">
-             <enum>QSizePolicy::Preferred</enum>
-            </property>
-            <property name="sizeHint" stdset="0">
-             <size>
-              <width>40</width>
-              <height>20</height>
-             </size>
-            </property>
-           </spacer>
-          </item>
-          <item>
-           <widget class="QLabel" name="label_2">
-            <property name="text">
-             <string>Viewing Software Repository:</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QComboBox" name="comboRepo">
-            <property name="sizePolicy">
-             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
-              <horstretch>0</horstretch>
-              <verstretch>0</verstretch>
-             </sizepolicy>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QPushButton" name="pushRepoConfiguration">
-            <property name="text">
-             <string/>
-            </property>
-            <property name="icon">
-             <iconset resource="SoftwareManager.qrc">
-              <normaloff>:/preferences-system.png</normaloff>:/preferences-system.png</iconset>
-            </property>
-            <property name="iconSize">
-             <size>
-              <width>22</width>
-              <height>22</height>
-             </size>
-            </property>
-            <property name="flat">
-             <bool>true</bool>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
        </layout>
       </widget>
       <widget class="QWidget" name="tab">
@@ -309,12 +248,6 @@
             <attribute name="headerStretchLastSection">
              <bool>true</bool>
             </attribute>
-            <attribute name="headerCascadingSectionResizes">
-             <bool>false</bool>
-            </attribute>
-            <attribute name="headerStretchLastSection">
-             <bool>true</bool>
-            </attribute>
             <column>
              <property name="text">
               <string>Program Name</string>
@@ -384,7 +317,7 @@
      <x>0</x>
      <y>0</y>
      <width>575</width>
-     <height>22</height>
+     <height>23</height>
     </rect>
    </property>
    <widget class="QMenu" name="menu_File">

Modified: pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp	2011-03-17 17:22:55 UTC (rev 9707)
+++ pcbsd/current/src-qt4/pc-softwaremanager/softmanager-pbibrowser.cpp	2011-03-17 20:18:31 UTC (rev 9708)
@@ -51,18 +51,10 @@
 
 void PBM::displayRepos()
 {
-	comboRepo->clear();
+	// Add all the repos to the menu
+	setupRepoMenu();
 
-	// Add all the repos
-	int rTot = pbiRepos->count();
-	for( int i = 0; i < rTot; i++)
-		comboRepo->addItem(pbiRepos->getDesc(i));
-	
-	// Set the current repo
-	if ( curRepo != -1 )
-		comboRepo->setCurrentIndex(curRepo);
-
-	tabPBM->setEnabled(true);
+	setEnabled(true);
 }
 
 // Show loading screen for software browser
@@ -426,39 +418,17 @@
 	QWidget *myWidget = new QWidget();
 	QVBoxLayout *layoutBrowser = new QVBoxLayout();
 
-	// Display header
+	// Display the recent apps list
 	/*************************************************/
-	clickedWidget *hWidget = new clickedWidget(0, pbiRepos->getID(curRepo));
-	QGridLayout *hGrid = new QGridLayout();
-        /*
-	QLabel *hLabel = new QLabel();
-	hLabel->setText("<b> - Latest Releases - </b>");
-	hLabel->setAlignment(Qt::AlignHCenter);
-	hGrid->addWidget(hLabel, 0, 0);
-        */
+	layoutBrowser->addWidget(getLatestPBIWidget(curRepo));
 
-	// Display the widget of latest PBI icons
-	hGrid->addWidget(getLatestPBIWidget(curRepo), 1, 0);
 
-	// TODO, stylize this header a bit more
-	hGrid->setRowMinimumHeight(2, 20);
-
-        /*
-	QLabel *catHeader = new QLabel();
-	catHeader->setText("<b> - " + tr("Categories") + " - </b>");
-	catHeader->setAlignment(Qt::AlignHCenter);
-	hGrid->addWidget(catHeader, 3, 0);
-        */
-
-	hWidget->setLayout(hGrid);
-	layoutBrowser->addWidget(hWidget);
-
+	// Build the display of categories
+	/*************************************************/
 	QGroupBox *catGroup = new QGroupBox();
         catGroup->setTitle(tr("Application Categories"));
 	QVBoxLayout *catLayout = new QVBoxLayout();
 
-	// Build the display of categories
-	/*************************************************/
 	int cTot = pbiCats->count();
 	for( int i = 0; i < cTot; i++) {
 
@@ -468,6 +438,7 @@
 		// Create the first horizontal box with icon / name
 		clickedWidget *catWidget = new clickedWidget(0, pbiCats->getName(i));
 		QGridLayout *grid1 = new QGridLayout();
+		grid1->setAlignment(Qt::AlignTop);
 		
 		// Create the category icon
 		QPixmap cIcon(pbiCats->getIcon(i));
@@ -514,9 +485,11 @@
 
 	// Add the category groupbox to our main layout
  	catGroup->setLayout(catLayout);	
-	layoutBrowser->addWidget(catGroup);
 
 	layoutBrowser->setAlignment(Qt::AlignTop);
+	layoutBrowser->insertSpacing(-1, 10);
+	layoutBrowser->addWidget(catGroup);
+
 	myWidget->setLayout(layoutBrowser);
 	scrollAreaPBI->setWidget(myWidget);
 }
@@ -528,7 +501,7 @@
 	pbiCats = new Category();
    	pbiAvail = new AvailPBI();
 
-	tabPBM->setEnabled(false);
+	setEnabled(false);
 
 	loadRepos();
 	loadCategories();
@@ -752,21 +725,6 @@
 
 }
 
-void PBM::slotRepoChanged(int nRepo)
-{
-	if ( nRepo == -1 )
-		return;
-
-	// Save the current repo
-	curRepo=nRepo;
-
-	// Clear the history
-	histType.clear();
-
-	// Display the landing page for this repo
-	displayCategories(true);
-}
-
 void PBM::slotSearchAsTyped()
 {
 	slotSearchForKeyword(false);
@@ -860,8 +818,6 @@
 	}
 		
 	if ( found ) {
-		QSpacerItem *space = new QSpacerItem(50,50, QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
-		layoutBrowser->insertSpacerItem(-1, space);
 		myWidget->setLayout(layoutBrowser);
 		scrollAreaPBI->setWidget(myWidget);
 	} else {
@@ -970,6 +926,48 @@
 	}
 
 	latestWidget->setLayout(latestLayout);
-
+	latestWidget->setAlignment(Qt::AlignTop);
 	return latestWidget;
 }
+
+void PBM::setupRepoMenu()
+{
+	repomenu->clear();
+	repomenu->addAction(tr("Configure Repository"), this, SLOT(slotConfigButtonClicked()));
+	repomenu->addSeparator();
+
+        QActionGroup *actGroup = new QActionGroup(this);
+
+	int rTot = pbiRepos->count();
+	for( int i = 0; i < rTot; i++) {
+		QAction *act = repomenu->addAction(pbiRepos->getDesc(i));
+		act->setData(i);
+		act->setCheckable(true);
+
+		if ( curRepo != -1 && curRepo == i )
+			act->setChecked(true);
+		else
+			act->setChecked(false);
+
+		actGroup->addAction(act);		
+	}
+
+	connect(actGroup, SIGNAL( triggered(QAction*) ), this, SLOT(slotRepoChanged(QAction *) ) );
+	
+}
+
+void PBM::slotRepoChanged(QAction *curAction)
+{
+	// Save the current repo
+        bool ok;
+	curAction->data().toInt(&ok);
+	if ( ok )
+		curRepo=curAction->data().toInt(&ok);
+
+	// Clear the history
+	histType.clear();
+
+	// Display the landing page for this repo
+	displayCategories(true);
+}
+



More information about the Commits mailing list