Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (ignore 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 @@ -21,6 +21,8 @@ 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" @@ -68,8 +70,15 @@ MainWindow :: MainWindow( QWidget *p, char *name ) - 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 ); @@ -77,3 +86,7 @@ MainWindow :: MainWindow( QWidget *p, char *name ) setCentralWidget( stack ); - stack->raiseWidget( networkPkgWindow ); + stack->raiseWidget( progressWindow ); + + // Delayed call to finish initialization + QTimer::singleShot( 100, this, SLOT( init() ) ); + } @@ -82,3 +95,17 @@ 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 ); } @@ -210 +237,11 @@ void MainWindow :: filterCategory() } + +void MainWindow :: raiseMainWidget() +{ + stack->raiseWidget( networkPkgWindow ); +} + +void MainWindow :: raiseProgressWidget() +{ + stack->raiseWidget( progressWindow ); +} |