summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
authordrw <drw>2003-01-04 19:52:22 (UTC)
committer drw <drw>2003-01-04 19:52:22 (UTC)
commit8b0f280e69a6c5b4c1caf4070085feaf0951380d (patch) (unidiff)
treeee99aba03491199a28b862afd439a591d9a3de88 /noncore/settings/aqpkg
parentd7474edcc4efccbf5d5fd4b8926739a597463242 (diff)
downloadopie-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') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro2
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp20
-rw-r--r--noncore/settings/aqpkg/datamgr.h9
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp51
-rw-r--r--noncore/settings/aqpkg/mainwin.h7
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp84
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h18
-rw-r--r--noncore/settings/aqpkg/progresswidget.cpp66
-rw-r--r--noncore/settings/aqpkg/progresswidget.h54
9 files changed, 267 insertions, 44 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
@@ -8,6 +8,7 @@ HEADERS = global.h \
8 networkpkgmgr.h \ 8 networkpkgmgr.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 \
13 destination.h \ 14 destination.h \
@@ -26,6 +27,7 @@ SOURCES = mainwin.cpp \
26 main.cpp \ 27 main.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 \
31 destination.cpp \ 33 destination.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
@@ -20,6 +20,9 @@ using namespace std;
20 20
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
25#include <stdio.h> 28#include <stdio.h>
@@ -30,6 +33,7 @@ using namespace std;
30 33
31QString DataManager::availableCategories = ""; 34QString DataManager::availableCategories = "";
32DataManager::DataManager() 35DataManager::DataManager()
36 : QObject( 0x0, 0x0 )
33{ 37{
34 activeServer = ""; 38 activeServer = "";
35 availableCategories = "#"; 39 availableCategories = "#";
@@ -165,17 +169,27 @@ void DataManager :: loadServers()
165 169
166void DataManager :: reloadServerData( ) 170void DataManager :: reloadServerData( )
167{ 171{
168 vector<Server>::iterator it = serverList.begin(); 172 emit progressSetSteps( serverList.size() );
173 emit progressSetMessage( tr( "Reading configuration..." ) );
174
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
173 // status files the number of which depends on how many destinations 187 // status files the number of which depends on how many destinations
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
181 it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); 195 it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) );
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
@@ -21,6 +21,7 @@
21#include <map> 21#include <map>
22using namespace std; 22using namespace std;
23 23
24#include <qobject.h>
24#include <qstring.h> 25#include <qstring.h>
25 26
26#include "server.h" 27#include "server.h"
@@ -34,8 +35,9 @@ using namespace std;
34 */ 35 */
35 36
36 37
37class DataManager 38class DataManager : public QObject
38{ 39{
40 Q_OBJECT
39public: 41public:
40 DataManager(); 42 DataManager();
41 ~DataManager(); 43 ~DataManager();
@@ -86,6 +88,11 @@ private:
86 88
87 vector<Server> serverList; 89 vector<Server> serverList;
88 vector<Destination> destList; 90 vector<Destination> destList;
91
92signals:
93 void progressSetSteps( int );
94 void progressSetMessage( const QString & );
95 void progressUpdate( int );
89}; 96};
90 97
91#endif 98#endif
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 @@
19using namespace std; 19using 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"
@@ -66,21 +68,46 @@ MainWindow :: MainWindow( QWidget *p, char *name )
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
81MainWindow :: ~MainWindow() 94MainWindow :: ~MainWindow()
82{ 95{
83 delete networkPkgWindow; 96 delete mgr;
97}
98
99void 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
86void MainWindow :: setDocument( const QString &doc ) 113void MainWindow :: setDocument( const QString &doc )
@@ -208,3 +235,13 @@ void MainWindow :: filterCategory()
208 filter->setItemChecked( mnuFilterByCategory, true ); 235 filter->setItemChecked( mnuFilterByCategory, true );
209 } 236 }
210} 237}
238
239void MainWindow :: raiseMainWidget()
240{
241 stack->raiseWidget( networkPkgWindow );
242}
243
244void 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
@@ -21,7 +21,7 @@
21#include <qmainwindow.h> 21#include <qmainwindow.h>
22#include <qwidgetstack.h> 22#include <qwidgetstack.h>
23 23
24 24class ProgressWidget;
25class NetworkPackageManager; 25class NetworkPackageManager;
26class DataManager; 26class DataManager;
27 27
@@ -44,6 +44,7 @@ private:
44 QWidgetStack *stack; 44 QWidgetStack *stack;
45 45
46 NetworkPackageManager *networkPkgWindow; 46 NetworkPackageManager *networkPkgWindow;
47 ProgressWidget *progressWindow;
47 48
48 int mnuShowUninstalledPkgsId; 49 int mnuShowUninstalledPkgsId;
49 int mnuShowInstalledPkgsId; 50 int mnuShowInstalledPkgsId;
@@ -63,6 +64,10 @@ public slots:
63 void filterUpgradedPackages(); 64 void filterUpgradedPackages();
64 void filterCategory(); 65 void filterCategory();
65 void setFilterCategory(); 66 void setFilterCategory();
67 void raiseMainWidget();
68 void raiseProgressWidget();
66 69
70private 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
@@ -46,10 +46,9 @@ using namespace std;
46 46
47extern int compareVersions( const char *v1, const char *v2 ); 47extern int compareVersions( const char *v1, const char *v2 );
48 48
49NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name) 49NetworkPackageManager::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
55 // read download directory from config file 54 // read download directory from config file
@@ -68,48 +67,53 @@ NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget
68 initGui(); 67 initGui();
69 setupConnections(); 68 setupConnections();
70 69
71 updateData(); 70 //updateData();
72} 71}
73 72
74NetworkPackageManager::~NetworkPackageManager() 73NetworkPackageManager::~NetworkPackageManager()
75{ 74{
76} 75}
77 76
78void NetworkPackageManager :: timerEvent ( QTimerEvent * ) 77void 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
86void NetworkPackageManager :: updateData() 82void 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 }
108 112
109 // set selected server to be active server 113 // set selected server to be active server
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
115void NetworkPackageManager :: selectLocalPackage( const QString &pkg ) 119void NetworkPackageManager :: selectLocalPackage( const QString &pkg )
@@ -193,23 +197,36 @@ void NetworkPackageManager :: setupConnections()
193 connect( update, SIGNAL(released()), this, SLOT(updateServer()) ); 197 connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
194} 198}
195 199
196void NetworkPackageManager :: showProgressDialog( char *initialText ) 200void 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 205void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
205void 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
215 Config cfg( "aqpkg" ); 232 Config cfg( "aqpkg" );
@@ -217,13 +234,20 @@ void NetworkPackageManager :: serverSelected( int )
217 cfg.writeEntry( "selectedServer", currentlySelectedServer ); 234 cfg.writeEntry( "selectedServer", currentlySelectedServer );
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 {
226 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 }
250
227 QString text = ""; 251 QString text = "";
228 252
229 // Apply show only uninstalled packages filter 253 // Apply show only uninstalled packages filter
@@ -332,6 +356,12 @@ void NetworkPackageManager :: serverSelected( int )
332 download->setEnabled( true ); 356 download->setEnabled( true );
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
337void NetworkPackageManager :: updateServer() 367void NetworkPackageManager :: updateServer()
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
@@ -26,6 +26,7 @@
26 26
27#include "datamgr.h" 27#include "datamgr.h"
28#include "progressdlg.h" 28#include "progressdlg.h"
29
29class InstallData; 30class InstallData;
30 31
31/** NetworkPackageManager is the base class of the project */ 32/** NetworkPackageManager is the base class of the project */
@@ -34,10 +35,11 @@ class NetworkPackageManager : public QWidget
34 Q_OBJECT 35 Q_OBJECT
35public: 36public:
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();
43 void searchForPackage( bool findNext ); 45 void searchForPackage( bool findNext );
@@ -67,26 +69,32 @@ private:
67 bool showUninstalledPkgs; 69 bool showUninstalledPkgs;
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();
75 void setupConnections(); 74 void setupConnections();
76 void showProgressDialog( char *initialText ); 75 void showProgressDialog( char *initialText );
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
83signals:
84 void appRaiseMainWidget();
85 void appRaiseProgressWidget();
86 void progressSetSteps( int );
87 void progressSetMessage( const QString & );
88 void progressUpdate( int );
89
82public slots: 90public slots:
83 void serverSelected( int index );
84 void applyChanges(); 91 void applyChanges();
85 void upgradePackages(); 92 void upgradePackages();
86 void downloadPackage(); 93 void downloadPackage();
87 void updateServer(); 94 void updateServer();
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
92#endif 100#endif
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
35ProgressWidget::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
48ProgressWidget::~ProgressWidget()
49{
50}
51
52void ProgressWidget::setSteps( int numsteps )
53{
54 m_progress->setTotalSteps( numsteps );
55}
56
57void ProgressWidget::setMessage( const QString &msg )
58{
59 m_status->setText( msg );
60}
61
62void 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
34class QLabel;
35class QProgressBar;
36
37class ProgressWidget : public QWidget
38{
39 Q_OBJECT
40public:
41 ProgressWidget( QWidget * = 0, const char * = 0, WFlags = 0 );
42 ~ProgressWidget();
43
44private:
45 QLabel *m_status;
46 QProgressBar *m_progress;
47
48public slots:
49 void setSteps( int );
50 void setMessage( const QString & );
51 void update( int );
52};
53
54#endif