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 | |||
@@ -18,12 +18,14 @@ | |||
18 | #include <iostream> | 18 | #include <iostream> |
19 | using namespace std; | 19 | using namespace std; |
20 | 20 | ||
21 | #include <qmenubar.h> | 21 | #include <qmenubar.h> |
22 | #include <qpopupmenu.h> | ||
23 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qpopupmenu.h> | ||
24 | #include <qtimer.h> | ||
24 | 25 | ||
25 | #include "mainwin.h" | 26 | #include "mainwin.h" |
27 | #include "progresswidget.h" | ||
26 | #include "datamgr.h" | 28 | #include "datamgr.h" |
27 | #include "networkpkgmgr.h" | 29 | #include "networkpkgmgr.h" |
28 | #include "settingsimpl.h" | 30 | #include "settingsimpl.h" |
29 | #include "helpwindow.h" | 31 | #include "helpwindow.h" |
@@ -65,23 +67,48 @@ MainWindow :: MainWindow( QWidget *p, char *name ) | |||
65 | menu->insertItem( tr( "&Edit" ), edit ); | 67 | menu->insertItem( tr( "&Edit" ), edit ); |
66 | menu->insertItem( tr( "&Filter" ), filter ); | 68 | menu->insertItem( tr( "&Filter" ), filter ); |
67 | menu->insertItem( tr( "&Help" ), help ); | 69 | menu->insertItem( tr( "&Help" ), help ); |
68 | 70 | ||
69 | mgr = new DataManager(); | 71 | // Create UI widgets |
70 | mgr->loadServers(); | ||
71 | |||
72 | stack = new QWidgetStack( this ); | 72 | stack = new QWidgetStack( this ); |
73 | 73 | ||
74 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); | 74 | progressWindow = new ProgressWidget( stack ); |
75 | stack->addWidget( progressWindow, 2 ); | ||
76 | |||
77 | networkPkgWindow = new NetworkPackageManager( stack ); | ||
78 | connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) ); | ||
79 | connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) ); | ||
80 | connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | ||
81 | connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ), | ||
82 | progressWindow, SLOT( setMessage( const QString & ) ) ); | ||
83 | connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); | ||
75 | stack->addWidget( networkPkgWindow, 1 ); | 84 | stack->addWidget( networkPkgWindow, 1 ); |
76 | 85 | ||
77 | setCentralWidget( stack ); | 86 | setCentralWidget( stack ); |
78 | stack->raiseWidget( networkPkgWindow ); | 87 | stack->raiseWidget( progressWindow ); |
88 | |||
89 | // Delayed call to finish initialization | ||
90 | QTimer::singleShot( 100, this, SLOT( init() ) ); | ||
91 | |||
79 | } | 92 | } |
80 | 93 | ||
81 | MainWindow :: ~MainWindow() | 94 | MainWindow :: ~MainWindow() |
82 | { | 95 | { |
83 | delete networkPkgWindow; | 96 | delete mgr; |
97 | } | ||
98 | |||
99 | void MainWindow :: init() | ||
100 | { | ||
101 | stack->raiseWidget( progressWindow ); | ||
102 | mgr = new DataManager(); | ||
103 | connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) ); | ||
104 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | ||
105 | progressWindow, SLOT( setMessage( const QString & ) ) ); | ||
106 | connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) ); | ||
107 | mgr->loadServers(); | ||
108 | networkPkgWindow->setDataManager( mgr ); | ||
109 | networkPkgWindow->updateData(); | ||
110 | stack->raiseWidget( networkPkgWindow ); | ||
84 | } | 111 | } |
85 | 112 | ||
86 | void MainWindow :: setDocument( const QString &doc ) | 113 | void MainWindow :: setDocument( const QString &doc ) |
87 | { | 114 | { |
@@ -207,4 +234,14 @@ void MainWindow :: filterCategory() | |||
207 | if ( networkPkgWindow->filterByCategory( true ) ) | 234 | if ( networkPkgWindow->filterByCategory( true ) ) |
208 | filter->setItemChecked( mnuFilterByCategory, true ); | 235 | filter->setItemChecked( mnuFilterByCategory, true ); |
209 | } | 236 | } |
210 | } | 237 | } |
238 | |||
239 | void MainWindow :: raiseMainWidget() | ||
240 | { | ||
241 | stack->raiseWidget( networkPkgWindow ); | ||
242 | } | ||
243 | |||
244 | void MainWindow :: raiseProgressWidget() | ||
245 | { | ||
246 | stack->raiseWidget( progressWindow ); | ||
247 | } | ||