Changeset 84406a4


Ignore:
Timestamp:
04/24/13 16:21:11 (16 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.1-release, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
b4350b9
Parents:
d5d5aa1
Message:

Enable the basic / advanced view functionality

Save the last view mode, so we startup with it again

Fix a bug changing meta-pkgs, make sure we always refresh to be
positive whats on disk

Location:
src-qt4/pc-pkgmanager
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-pkgmanager/mainWin.cpp

    r98b904e r84406a4  
    2121#include <pcbsd-utils.h> 
    2222#include <pcbsd-ui.h> 
     23#include <QSettings> 
    2324#include "mainWin.h" 
    2425#include "../config.h" 
     
    3637  connect(buttonRescanPkgs, SIGNAL(clicked()), this, SLOT(slotRescanPkgsClicked())); 
    3738  connect(pushPkgApply, SIGNAL( clicked() ), this, SLOT( slotApplyClicked() ) ); 
     39  connect(action_Quit, SIGNAL( triggered(bool) ), this, SLOT( slotCloseClicked() ) ); 
     40  connect(action_Basic, SIGNAL( triggered(bool) ), this, SLOT( slotViewChanged() ) ); 
     41  connect(action_Advanced, SIGNAL( triggered(bool) ), this, SLOT( slotViewChanged() ) ); 
     42 
     43  // Setup the action group 
     44  viewGroup = new QActionGroup(this); 
     45  viewGroup->addAction(action_Basic); 
     46  viewGroup->addAction(action_Advanced); 
     47 
     48  treeMetaPkgs->setContextMenuPolicy(Qt::CustomContextMenu); 
     49  connect(treeMetaPkgs, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotMetaRightClick()) ); 
    3850 
    3951  QTimer::singleShot(200, this, SLOT(slotRescanPkgsClicked() ) ); 
     52 
     53  QSettings settings("PC-BSD", "PackageManager"); 
     54  QString curMode = settings.value("view/mode").toString(); 
     55  if ( curMode == "Advanced" ) 
     56  { 
     57    stackedPkgView->setCurrentIndex(1); 
     58    action_Basic->setChecked(false); 
     59    action_Advanced->setChecked(true); 
     60  } 
     61 
     62  initMetaWidget(); 
     63} 
     64 
     65void mainWin::slotViewChanged() 
     66{ 
     67  QString mode; 
     68  if ( action_Basic->isChecked() ) { 
     69    stackedPkgView->setCurrentIndex(0); 
     70    mode="Basic"; 
     71  } else { 
     72    mode="Advanced"; 
     73    stackedPkgView->setCurrentIndex(1); 
     74  } 
     75 
     76  // Save the mode as the default at next open 
     77  QSettings settings("PC-BSD", "PackageManager"); 
     78  settings.setValue("view/mode", mode); 
     79 
     80  // Changed view, lets refresh 
    4081  initMetaWidget(); 
    4182} 
     
    4889 
    4990void mainWin::slotApplyClicked() { 
     91  // Running in basic mode 
     92  if ( stackedPkgView->currentIndex() == 0 ) 
     93  { 
     94      saveMetaPkgs();    
     95  } else { 
     96  // Running in advanced mode 
     97 
     98  } 
    5099 
    51100} 
     
    339388    QMessageBox::warning(this, tr("Finished!"), tr("Package changes complete!" )); 
    340389 
     390  // Clear out the old commands 
     391  pkgCmdList.clear(); 
     392 
     393  // Switch back to our main display 
    341394  stackedTop->setCurrentIndex(0); 
     395 
     396  // Re-init the meta-widget 
     397  initMetaWidget(); 
    342398 
    343399} 
     
    351407  qDebug() << "Starting metaWidget..."; 
    352408 
    353   populateMetaPkgs(); 
    354  
    355   // Connect our slots 
    356   treeMetaPkgs->setContextMenuPolicy(Qt::CustomContextMenu); 
    357   connect(treeMetaPkgs, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotMetaRightClick()) ); 
     409  // Running in basic mode 
     410  if ( stackedPkgView->currentIndex() == 0 ) 
     411  { 
     412    populateMetaPkgs(); 
     413    // Connect our slots 
     414  } else { 
     415  // Running in advanced mode 
     416 
     417  } 
     418 
    358419 
    359420 
  • src-qt4/pc-pkgmanager/mainWin.h

    r98b904e r84406a4  
    3939 
    4040private slots: 
    41     void slotCloseClicked(); 
    4241     
    4342    // Generic pkgng handlers 
     
    5756    void slotMetaRightClick(); 
    5857    void slotMetaViewPkgs(); 
     58 
     59    // UI Stuff 
     60    void slotViewChanged(); 
     61    void slotCloseClicked(); 
    5962 
    6063private: 
     
    113116    QMenu *popup; 
    114117    dialogInfo *dIB; 
     118    QActionGroup *viewGroup; 
    115119 
    116120signals: 
  • src-qt4/pc-pkgmanager/mainWin.ui

    r98b904e r84406a4  
    6767               </item> 
    6868               <item row="0" column="0"> 
    69                 <widget class="QStackedWidget" name="stackedPkgMode"> 
     69                <widget class="QStackedWidget" name="stackedPkgView"> 
    7070                 <property name="currentIndex"> 
    7171                  <number>0</number> 
Note: See TracChangeset for help on using the changeset viewer.