author | drw <drw> | 2003-01-04 19:52:22 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-04 19:52:22 (UTC) |
commit | 8b0f280e69a6c5b4c1caf4070085feaf0951380d (patch) (side-by-side diff) | |
tree | ee99aba03491199a28b862afd439a591d9a3de88 /noncore/settings/aqpkg/mainwin.cpp | |
parent | d7474edcc4efccbf5d5fd4b8926739a597463242 (diff) | |
download | opie-8b0f280e69a6c5b4c1caf4070085feaf0951380d.zip opie-8b0f280e69a6c5b4c1caf4070085feaf0951380d.tar.gz opie-8b0f280e69a6c5b4c1caf4070085feaf0951380d.tar.bz2 |
Delay initial load of ipkg info so app displays quicker, and add progress display for longer operations (such as loading packages for large feeds).
Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index b00931e..5e03f11 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -19,10 +19,12 @@ using namespace std; #include <qmenubar.h> -#include <qpopupmenu.h> #include <qmessagebox.h> +#include <qpopupmenu.h> +#include <qtimer.h> #include "mainwin.h" +#include "progresswidget.h" #include "datamgr.h" #include "networkpkgmgr.h" #include "settingsimpl.h" @@ -66,21 +68,46 @@ MainWindow :: MainWindow( QWidget *p, char *name ) menu->insertItem( tr( "&Filter" ), filter ); menu->insertItem( tr( "&Help" ), help ); - mgr = new DataManager(); - mgr->loadServers(); - + // Create UI widgets stack = new QWidgetStack( this ); - networkPkgWindow = new NetworkPackageManager( mgr, stack ); + progressWindow = new ProgressWidget( stack ); + stack->addWidget( progressWindow, 2 ); + + networkPkgWindow = new NetworkPackageManager( stack ); + connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) ); + connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) ); + connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); + connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), + progressWindow, SLOT( setMessage( const QString & ) ) ); + connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); stack->addWidget( networkPkgWindow, 1 ); setCentralWidget( stack ); - stack->raiseWidget( networkPkgWindow ); + stack->raiseWidget( progressWindow ); + + // Delayed call to finish initialization + QTimer::singleShot( 100, this, SLOT( init() ) ); + } MainWindow :: ~MainWindow() { - delete networkPkgWindow; + delete mgr; +} + +void MainWindow :: init() +{ + stack->raiseWidget( progressWindow ); + mgr = new DataManager(); + connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); + connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), + progressWindow, SLOT( setMessage( const QString & ) ) ); + connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); + mgr->loadServers(); + networkPkgWindow->setDataManager( mgr ); + networkPkgWindow->updateData(); + stack->raiseWidget( networkPkgWindow ); } void MainWindow :: setDocument( const QString &doc ) @@ -208,3 +235,13 @@ void MainWindow :: filterCategory() filter->setItemChecked( mnuFilterByCategory, true ); } } + +void MainWindow :: raiseMainWidget() +{ + stack->raiseWidget( networkPkgWindow ); +} + +void MainWindow :: raiseProgressWidget() +{ + stack->raiseWidget( progressWindow ); +} |