author | drw <drw> | 2003-01-04 19:52:22 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-04 19:52:22 (UTC) |
commit | 8b0f280e69a6c5b4c1caf4070085feaf0951380d (patch) (unidiff) | |
tree | ee99aba03491199a28b862afd439a591d9a3de88 | |
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).
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 2 | ||||
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 18 | ||||
-rw-r--r-- | noncore/settings/aqpkg/datamgr.h | 9 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 51 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 7 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.cpp | 82 | ||||
-rw-r--r-- | noncore/settings/aqpkg/networkpkgmgr.h | 18 | ||||
-rw-r--r-- | noncore/settings/aqpkg/progresswidget.cpp | 66 | ||||
-rw-r--r-- | noncore/settings/aqpkg/progresswidget.h | 54 |
9 files changed, 265 insertions, 42 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index 3b27ac3..ad0dfc5 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro | |||
@@ -9,4 +9,5 @@ HEADERS = global.h \ | |||
9 | package.h \ | 9 | package.h \ |
10 | progressdlg.h \ | 10 | progressdlg.h \ |
11 | progresswidget.h \ | ||
11 | installdlgimpl.h \ | 12 | installdlgimpl.h \ |
12 | instoptionsimpl.h \ | 13 | instoptionsimpl.h \ |
@@ -27,4 +28,5 @@ SOURCES = mainwin.cpp \ | |||
27 | package.cpp \ | 28 | package.cpp \ |
28 | progressdlg.cpp \ | 29 | progressdlg.cpp \ |
30 | progresswidget.cpp \ | ||
29 | installdlgimpl.cpp \ | 31 | installdlgimpl.cpp \ |
30 | instoptionsimpl.cpp \ | 32 | instoptionsimpl.cpp \ |
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index 0159a79..2c83e28 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp | |||
@@ -21,4 +21,7 @@ using namespace std; | |||
21 | #ifdef QWS | 21 | #ifdef QWS |
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qpe/qpeapplication.h> | ||
24 | #else | ||
25 | #include <qapplication.h> | ||
23 | #endif | 26 | #endif |
24 | 27 | ||
@@ -31,4 +34,5 @@ using namespace std; | |||
31 | QString DataManager::availableCategories = ""; | 34 | QString DataManager::availableCategories = ""; |
32 | DataManager::DataManager() | 35 | DataManager::DataManager() |
36 | : QObject( 0x0, 0x0 ) | ||
33 | { | 37 | { |
34 | activeServer = ""; | 38 | activeServer = ""; |
@@ -166,7 +170,17 @@ void DataManager :: loadServers() | |||
166 | void DataManager :: reloadServerData( ) | 170 | void DataManager :: reloadServerData( ) |
167 | { | 171 | { |
172 | emit progressSetSteps( serverList.size() ); | ||
173 | emit progressSetMessage( tr( "Reading configuration..." ) ); | ||
174 | |||
168 | vector<Server>::iterator it = serverList.begin(); | 175 | vector<Server>::iterator it = serverList.begin(); |
176 | QString serverName; | ||
177 | int i = 0; | ||
169 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | 178 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) |
170 | { | 179 | { |
180 | serverName = it->getServerName(); | ||
181 | i++; | ||
182 | emit progressUpdate( i ); | ||
183 | qApp->processEvents(); | ||
184 | |||
171 | // Now we've read the config file in we need to read the servers | 185 | // Now we've read the config file in we need to read the servers |
172 | // The local server is a special case. This holds the contents of the | 186 | // The local server is a special case. This holds the contents of the |
@@ -174,7 +188,7 @@ void DataManager :: reloadServerData( ) | |||
174 | // we've set up | 188 | // we've set up |
175 | // The other servers files hold the contents of the server package list | 189 | // The other servers files hold the contents of the server package list |
176 | if ( it->getServerName() == LOCAL_SERVER ) | 190 | if ( serverName == LOCAL_SERVER ) |
177 | it->readStatusFile( destList ); | 191 | it->readStatusFile( destList ); |
178 | else if ( it->getServerName() == LOCAL_IPKGS ) | 192 | else if ( serverName == LOCAL_IPKGS ) |
179 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); | 193 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); |
180 | else | 194 | else |
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h index 0a7467f..90328ab 100644 --- a/noncore/settings/aqpkg/datamgr.h +++ b/noncore/settings/aqpkg/datamgr.h | |||
@@ -22,4 +22,5 @@ | |||
22 | using namespace std; | 22 | using namespace std; |
23 | 23 | ||
24 | #include <qobject.h> | ||
24 | #include <qstring.h> | 25 | #include <qstring.h> |
25 | 26 | ||
@@ -35,6 +36,7 @@ using namespace std; | |||
35 | 36 | ||
36 | 37 | ||
37 | class DataManager | 38 | class DataManager : public QObject |
38 | { | 39 | { |
40 | Q_OBJECT | ||
39 | public: | 41 | public: |
40 | DataManager(); | 42 | DataManager(); |
@@ -87,4 +89,9 @@ private: | |||
87 | vector<Server> serverList; | 89 | vector<Server> serverList; |
88 | vector<Destination> destList; | 90 | vector<Destination> destList; |
91 | |||
92 | signals: | ||
93 | void progressSetSteps( int ); | ||
94 | void progressSetMessage( const QString & ); | ||
95 | void progressUpdate( int ); | ||
89 | }; | 96 | }; |
90 | 97 | ||
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 | |||
@@ -20,8 +20,10 @@ 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" |
@@ -67,19 +69,44 @@ MainWindow :: MainWindow( QWidget *p, char *name ) | |||
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 | ||
@@ -209,2 +236,12 @@ void MainWindow :: filterCategory() | |||
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 | } | ||
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index 92aba4d..39799f9 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -22,5 +22,5 @@ | |||
22 | #include <qwidgetstack.h> | 22 | #include <qwidgetstack.h> |
23 | 23 | ||
24 | 24 | class ProgressWidget; | |
25 | class NetworkPackageManager; | 25 | class NetworkPackageManager; |
26 | class DataManager; | 26 | class DataManager; |
@@ -45,4 +45,5 @@ private: | |||
45 | 45 | ||
46 | NetworkPackageManager *networkPkgWindow; | 46 | NetworkPackageManager *networkPkgWindow; |
47 | ProgressWidget *progressWindow; | ||
47 | 48 | ||
48 | int mnuShowUninstalledPkgsId; | 49 | int mnuShowUninstalledPkgsId; |
@@ -64,5 +65,9 @@ public slots: | |||
64 | void filterCategory(); | 65 | void filterCategory(); |
65 | void setFilterCategory(); | 66 | void setFilterCategory(); |
67 | void raiseMainWidget(); | ||
68 | void raiseProgressWidget(); | ||
66 | 69 | ||
70 | private slots: | ||
71 | void init(); | ||
67 | }; | 72 | }; |
68 | #endif | 73 | #endif |
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp index 79a380e..cae0d8f 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.cpp +++ b/noncore/settings/aqpkg/networkpkgmgr.cpp | |||
@@ -47,8 +47,7 @@ using namespace std; | |||
47 | extern int compareVersions( const char *v1, const char *v2 ); | 47 | extern int compareVersions( const char *v1, const char *v2 ); |
48 | 48 | ||
49 | NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) | 49 | NetworkPackageManager::NetworkPackageManager( QWidget *parent, const char *name ) |
50 | : QWidget(parent, name) | 50 | : QWidget(parent, name) |
51 | { | 51 | { |
52 | dataMgr = dataManager; | ||
53 | 52 | ||
54 | #ifdef QWS | 53 | #ifdef QWS |
@@ -69,5 +68,5 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget | |||
69 | setupConnections(); | 68 | setupConnections(); |
70 | 69 | ||
71 | updateData(); | 70 | //updateData(); |
72 | } | 71 | } |
73 | 72 | ||
@@ -76,32 +75,37 @@ NetworkPackageManager::~NetworkPackageManager() | |||
76 | } | 75 | } |
77 | 76 | ||
78 | void NetworkPackageManager :: timerEvent ( QTimerEvent * ) | 77 | void NetworkPackageManager :: setDataManager( DataManager *dm ) |
79 | { | 78 | { |
80 | killTimer( timerId ); | 79 | dataMgr = dm; |
81 | |||
82 | // Add server names to listbox | ||
83 | updateData(); | ||
84 | } | 80 | } |
85 | 81 | ||
86 | void NetworkPackageManager :: updateData() | 82 | void NetworkPackageManager :: updateData() |
87 | { | 83 | { |
84 | emit progressSetSteps( dataMgr->getServerList().size() ); | ||
85 | |||
88 | serversList->clear(); | 86 | serversList->clear(); |
89 | packagesList->clear(); | 87 | packagesList->clear(); |
90 | 88 | ||
91 | |||
92 | vector<Server>::iterator it; | 89 | vector<Server>::iterator it; |
93 | int activeItem = -1; | 90 | int activeItem = -1; |
94 | int i; | 91 | int i; |
92 | QString serverName; | ||
95 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) | 93 | for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i ) |
96 | { | 94 | { |
95 | serverName = it->getServerName(); | ||
96 | emit progressSetMessage( tr( "Building server list:\n\t%1" ).arg( serverName ) ); | ||
97 | emit progressUpdate( i ); | ||
98 | qApp->processEvents(); | ||
99 | |||
97 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; | 100 | // cout << "Adding " << it->getServerName() << " to combobox" << endl; |
98 | if ( !it->isServerActive() ) | 101 | if ( !it->isServerActive() ) |
99 | { | 102 | { |
100 | cout << it->getServerName() << " is not active" << endl; | 103 | cout << serverName << " is not active" << endl; |
101 | i--; | 104 | i--; |
102 | continue; | 105 | continue; |
103 | } | 106 | } |
104 | serversList->insertItem( it->getServerName() ); | 107 | |
105 | if ( it->getServerName() == currentlySelectedServer ) | 108 | serversList->insertItem( serverName ); |
109 | if ( serverName == currentlySelectedServer ) | ||
106 | activeItem = i; | 110 | activeItem = i; |
107 | } | 111 | } |
@@ -110,5 +114,5 @@ void NetworkPackageManager :: updateData() | |||
110 | if ( activeItem != -1 ) | 114 | if ( activeItem != -1 ) |
111 | serversList->setCurrentItem( activeItem ); | 115 | serversList->setCurrentItem( activeItem ); |
112 | serverSelected( 0 ); | 116 | serverSelected( 0, FALSE ); |
113 | } | 117 | } |
114 | 118 | ||
@@ -194,21 +198,34 @@ void NetworkPackageManager :: setupConnections() | |||
194 | } | 198 | } |
195 | 199 | ||
196 | void NetworkPackageManager :: showProgressDialog( char *initialText ) | 200 | void NetworkPackageManager :: serverSelected( int index ) |
197 | { | 201 | { |
198 | if ( !progressDlg ) | 202 | serverSelected( index, TRUE ); |
199 | progressDlg = new ProgressDlg( this, "Progress", false ); | ||
200 | progressDlg->setText( initialText ); | ||
201 | progressDlg->show(); | ||
202 | } | 203 | } |
203 | 204 | ||
204 | 205 | void NetworkPackageManager :: serverSelected( int, bool raiseProgress ) | |
205 | void NetworkPackageManager :: serverSelected( int ) | ||
206 | { | 206 | { |
207 | packagesList->clear(); | ||
208 | |||
209 | // display packages | 207 | // display packages |
210 | QString serverName = serversList->currentText(); | 208 | QString serverName = serversList->currentText(); |
211 | currentlySelectedServer = serverName; | 209 | currentlySelectedServer = serverName; |
212 | 210 | ||
211 | vector<Server>::iterator s = dataMgr->getServer( serverName ); | ||
212 | |||
213 | vector<Package> &list = s->getPackageList(); | ||
214 | vector<Package>::iterator it; | ||
215 | |||
216 | // Display progress widget while loading list | ||
217 | bool doProgress = ( list.size() > 200 ); | ||
218 | if ( doProgress ) | ||
219 | { | ||
220 | if ( raiseProgress ) | ||
221 | { | ||
222 | emit appRaiseProgressWidget(); | ||
223 | } | ||
224 | emit progressSetSteps( list.size() ); | ||
225 | emit progressSetMessage( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); | ||
226 | } | ||
227 | |||
228 | packagesList->clear(); | ||
229 | |||
213 | #ifdef QWS | 230 | #ifdef QWS |
214 | // read download directory from config file | 231 | // read download directory from config file |
@@ -218,10 +235,17 @@ void NetworkPackageManager :: serverSelected( int ) | |||
218 | #endif | 235 | #endif |
219 | 236 | ||
220 | vector<Server>::iterator s = dataMgr->getServer( serverName ); | 237 | int i = 0; |
221 | |||
222 | vector<Package> &list = s->getPackageList(); | ||
223 | vector<Package>::iterator it; | ||
224 | for ( it = list.begin() ; it != list.end() ; ++it ) | 238 | for ( it = list.begin() ; it != list.end() ; ++it ) |
225 | { | 239 | { |
240 | // Update progress after every 100th package (arbitrary value, seems to give good balance) | ||
241 | i++; | ||
242 | if ( ( i % 100 ) == 0 ) | ||
243 | { | ||
244 | if ( doProgress ) | ||
245 | { | ||
246 | emit progressUpdate( i ); | ||
247 | } | ||
248 | qApp->processEvents(); | ||
249 | } | ||
226 | 250 | ||
227 | QString text = ""; | 251 | QString text = ""; |
@@ -333,4 +357,10 @@ void NetworkPackageManager :: serverSelected( int ) | |||
333 | download->setText( "Download" ); | 357 | download->setText( "Download" ); |
334 | } | 358 | } |
359 | |||
360 | // Display this widget once everything is done | ||
361 | if ( doProgress && raiseProgress ) | ||
362 | { | ||
363 | emit appRaiseMainWidget(); | ||
364 | } | ||
335 | } | 365 | } |
336 | 366 | ||
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h index 46919d7..2206c81 100644 --- a/noncore/settings/aqpkg/networkpkgmgr.h +++ b/noncore/settings/aqpkg/networkpkgmgr.h | |||
@@ -27,4 +27,5 @@ | |||
27 | #include "datamgr.h" | 27 | #include "datamgr.h" |
28 | #include "progressdlg.h" | 28 | #include "progressdlg.h" |
29 | |||
29 | class InstallData; | 30 | class InstallData; |
30 | 31 | ||
@@ -35,8 +36,9 @@ class NetworkPackageManager : public QWidget | |||
35 | public: | 36 | public: |
36 | /** construtor */ | 37 | /** construtor */ |
37 | NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0); | 38 | NetworkPackageManager( QWidget* parent=0, const char *name=0 ); |
38 | /** destructor */ | 39 | /** destructor */ |
39 | ~NetworkPackageManager(); | 40 | ~NetworkPackageManager(); |
40 | 41 | ||
42 | void setDataManager( DataManager *dm ); | ||
41 | void selectLocalPackage( const QString &pkg ); | 43 | void selectLocalPackage( const QString &pkg ); |
42 | void updateData(); | 44 | void updateData(); |
@@ -68,7 +70,4 @@ private: | |||
68 | bool showInstalledPkgs; | 70 | bool showInstalledPkgs; |
69 | bool showUpgradedPkgs; | 71 | bool showUpgradedPkgs; |
70 | int timerId; | ||
71 | |||
72 | void timerEvent ( QTimerEvent * ); | ||
73 | 72 | ||
74 | void initGui(); | 73 | void initGui(); |
@@ -77,9 +76,17 @@ private: | |||
77 | void downloadSelectedPackages(); | 76 | void downloadSelectedPackages(); |
78 | void downloadRemotePackage(); | 77 | void downloadRemotePackage(); |
78 | void serverSelected( int index, bool showProgress ); | ||
79 | |||
79 | InstallData dealWithItem( QCheckListItem *item ); | 80 | InstallData dealWithItem( QCheckListItem *item ); |
80 | QString stickyOption; | 81 | QString stickyOption; |
81 | 82 | ||
83 | signals: | ||
84 | void appRaiseMainWidget(); | ||
85 | void appRaiseProgressWidget(); | ||
86 | void progressSetSteps( int ); | ||
87 | void progressSetMessage( const QString & ); | ||
88 | void progressUpdate( int ); | ||
89 | |||
82 | public slots: | 90 | public slots: |
83 | void serverSelected( int index ); | ||
84 | void applyChanges(); | 91 | void applyChanges(); |
85 | void upgradePackages(); | 92 | void upgradePackages(); |
@@ -88,4 +95,5 @@ public slots: | |||
88 | void displayText( const QString &t ); | 95 | void displayText( const QString &t ); |
89 | void letterPushed( QString t ); | 96 | void letterPushed( QString t ); |
97 | void serverSelected( int index ); | ||
90 | }; | 98 | }; |
91 | 99 | ||
diff --git a/noncore/settings/aqpkg/progresswidget.cpp b/noncore/settings/aqpkg/progresswidget.cpp new file mode 100644 index 0000000..bbafcac --- a/dev/null +++ b/noncore/settings/aqpkg/progresswidget.cpp | |||
@@ -0,0 +1,66 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #include "progresswidget.h" | ||
30 | |||
31 | #include <qlabel.h> | ||
32 | #include <qlayout.h> | ||
33 | #include <qprogressbar.h> | ||
34 | |||
35 | ProgressWidget::ProgressWidget( QWidget *parent, const char *name, WFlags f ) | ||
36 | : QWidget( parent, name, f ) | ||
37 | { | ||
38 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 ); | ||
39 | |||
40 | m_status = new QLabel( this ); | ||
41 | m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); | ||
42 | layout->addWidget( m_status ); | ||
43 | |||
44 | m_progress = new QProgressBar( this ); | ||
45 | layout->addWidget( m_progress ); | ||
46 | } | ||
47 | |||
48 | ProgressWidget::~ProgressWidget() | ||
49 | { | ||
50 | } | ||
51 | |||
52 | void ProgressWidget::setSteps( int numsteps ) | ||
53 | { | ||
54 | m_progress->setTotalSteps( numsteps ); | ||
55 | } | ||
56 | |||
57 | void ProgressWidget::setMessage( const QString &msg ) | ||
58 | { | ||
59 | m_status->setText( msg ); | ||
60 | } | ||
61 | |||
62 | void ProgressWidget::update( int progress ) | ||
63 | { | ||
64 | m_progress->setProgress( progress ); | ||
65 | } | ||
66 | |||
diff --git a/noncore/settings/aqpkg/progresswidget.h b/noncore/settings/aqpkg/progresswidget.h new file mode 100644 index 0000000..7d99978 --- a/dev/null +++ b/noncore/settings/aqpkg/progresswidget.h | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. | ||
4 | .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | #ifndef PROGRESSWIDGET_H | ||
30 | #define PROGRESSWIDGET_H | ||
31 | |||
32 | #include <qwidget.h> | ||
33 | |||
34 | class QLabel; | ||
35 | class QProgressBar; | ||
36 | |||
37 | class ProgressWidget : public QWidget | ||
38 | { | ||
39 | Q_OBJECT | ||
40 | public: | ||
41 | ProgressWidget( QWidget * = 0, const char * = 0, WFlags = 0 ); | ||
42 | ~ProgressWidget(); | ||
43 | |||
44 | private: | ||
45 | QLabel *m_status; | ||
46 | QProgressBar *m_progress; | ||
47 | |||
48 | public slots: | ||
49 | void setSteps( int ); | ||
50 | void setMessage( const QString & ); | ||
51 | void update( int ); | ||
52 | }; | ||
53 | |||
54 | #endif | ||