author | drw <drw> | 2003-01-24 02:28:59 (UTC) |
---|---|---|
committer | drw <drw> | 2003-01-24 02:28:59 (UTC) |
commit | 342c113c3b7b3a319f49498b82def9f761c1264f (patch) (unidiff) | |
tree | 596c76aded38645435ecc9c1a1a90d603e681465 /noncore | |
parent | a6ad63972673fdb2ed9fba33c7c2e5e9cb3968b1 (diff) | |
download | opie-342c113c3b7b3a319f49498b82def9f761c1264f.zip opie-342c113c3b7b3a319f49498b82def9f761c1264f.tar.gz opie-342c113c3b7b3a319f49498b82def9f761c1264f.tar.bz2 |
Make the quick jump to keypad a toolbar like the find bar (option in config dialog will be removed).
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 92 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 3 |
2 files changed, 65 insertions, 30 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index ae073ef..a25f5a7 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -53,25 +53,16 @@ | |||
53 | 53 | ||
54 | extern int compareVersions( const char *v1, const char *v2 ); | 54 | extern int compareVersions( const char *v1, const char *v2 ); |
55 | 55 | ||
56 | MainWindow :: MainWindow() | 56 | MainWindow :: MainWindow() |
57 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 57 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) |
58 | { | 58 | { |
59 | setCaption( tr( "AQPkg - Package Manager" ) ); | 59 | setCaption( tr( "AQPkg - Package Manager" ) ); |
60 | 60 | ||
61 | #ifdef QWS | ||
62 | // read download directory from config file | ||
63 | Config cfg( "aqpkg" ); | ||
64 | cfg.setGroup( "settings" ); | ||
65 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | ||
66 | showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | ||
67 | |||
68 | #endif | ||
69 | |||
70 | // Create UI widgets | 61 | // Create UI widgets |
71 | initMainWidget(); | 62 | initMainWidget(); |
72 | initProgressWidget(); | 63 | initProgressWidget(); |
73 | 64 | ||
74 | // Build menu and tool bars | 65 | // Build menu and tool bars |
75 | setToolBarsMovable( FALSE ); | 66 | setToolBarsMovable( FALSE ); |
76 | 67 | ||
77 | QPEToolBar *bar = new QPEToolBar( this ); | 68 | QPEToolBar *bar = new QPEToolBar( this ); |
@@ -83,21 +74,55 @@ MainWindow :: MainWindow() | |||
83 | // Find toolbar | 74 | // Find toolbar |
84 | findBar = new QPEToolBar( this ); | 75 | findBar = new QPEToolBar( this ); |
85 | addToolBar( findBar, QMainWindow::Top, true ); | 76 | addToolBar( findBar, QMainWindow::Top, true ); |
86 | findBar->setHorizontalStretchable( true ); | 77 | findBar->setHorizontalStretchable( true ); |
87 | findEdit = new QLineEdit( findBar ); | 78 | findEdit = new QLineEdit( findBar ); |
88 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); | 79 | QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); |
89 | findBar->setStretchableWidget( findEdit ); | 80 | findBar->setStretchableWidget( findEdit ); |
90 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); | 81 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); |
82 | |||
83 | // Quick jump toolbar | ||
84 | jumpBar = new QPEToolBar( this ); | ||
85 | addToolBar( jumpBar, QMainWindow::Top, true ); | ||
86 | jumpBar->setHorizontalStretchable( true ); | ||
87 | QWidget *w = new QWidget( jumpBar ); | ||
88 | jumpBar->setStretchableWidget( w ); | ||
91 | 89 | ||
90 | QGridLayout *layout = new QGridLayout( w ); | ||
91 | //QVBoxLayout *vbox = new QVBoxLayout( w, 0, -1 ); | ||
92 | //QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); | ||
93 | //QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); | ||
94 | |||
95 | char text[2]; | ||
96 | text[1] = '\0'; | ||
97 | for ( int i = 0 ; i < 26 ; ++i ) | ||
98 | { | ||
99 | text[0] = 'A' + i; | ||
100 | LetterPushButton *b = new LetterPushButton( text, w ); | ||
101 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | ||
102 | layout->addWidget( b, i / 13, i % 13); | ||
103 | /* | ||
104 | if ( i < 13 ) | ||
105 | hbox3->addWidget( b ); | ||
106 | else | ||
107 | hbox4->addWidget( b ); | ||
108 | */ | ||
109 | } | ||
110 | |||
111 | QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); | ||
112 | a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); | ||
113 | connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); | ||
114 | a->addTo( jumpBar ); | ||
115 | jumpBar->hide(); | ||
116 | |||
92 | // Packages menu | 117 | // Packages menu |
93 | QPopupMenu *popup = new QPopupMenu( this ); | 118 | QPopupMenu *popup = new QPopupMenu( this ); |
94 | 119 | ||
95 | QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); | 120 | a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); |
96 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); | 121 | a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); |
97 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); | 122 | connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); |
98 | a->addTo( popup ); | 123 | a->addTo( popup ); |
99 | a->addTo( bar ); | 124 | a->addTo( bar ); |
100 | 125 | ||
101 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); | 126 | actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); |
102 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); | 127 | actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); |
103 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); | 128 | connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); |
@@ -163,16 +188,24 @@ MainWindow :: MainWindow() | |||
163 | 188 | ||
164 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); | 189 | actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); |
165 | actionFindNext->setEnabled( FALSE ); | 190 | actionFindNext->setEnabled( FALSE ); |
166 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); | 191 | actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); |
167 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); | 192 | connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); |
168 | actionFindNext->addTo( popup ); | 193 | actionFindNext->addTo( popup ); |
169 | actionFindNext->addTo( findBar ); | 194 | actionFindNext->addTo( findBar ); |
170 | 195 | ||
196 | |||
197 | popup->insertSeparator(); | ||
198 | |||
199 | a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); | ||
200 | a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); | ||
201 | connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); | ||
202 | a->addTo( popup ); | ||
203 | |||
171 | mb->insertItem( tr( "View" ), popup ); | 204 | mb->insertItem( tr( "View" ), popup ); |
172 | 205 | ||
173 | 206 | ||
174 | // Options menu | 207 | // Options menu |
175 | popup = new QPopupMenu( this ); | 208 | popup = new QPopupMenu( this ); |
176 | 209 | ||
177 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); | 210 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); |
178 | a->setWhatsThis( tr( "Click here to configure this application." ) ); | 211 | a->setWhatsThis( tr( "Click here to configure this application." ) ); |
@@ -232,36 +265,16 @@ void MainWindow :: initMainWidget() | |||
232 | packagesList = new QListView( networkPkgWindow ); | 265 | packagesList = new QListView( networkPkgWindow ); |
233 | packagesList->addColumn( tr( "Packages" ), 225 ); | 266 | packagesList->addColumn( tr( "Packages" ), 225 ); |
234 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); | 267 | QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); |
235 | 268 | ||
236 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); | 269 | QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); |
237 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); | 270 | QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); |
238 | hbox1->addWidget( l ); | 271 | hbox1->addWidget( l ); |
239 | hbox1->addWidget( serversList ); | 272 | hbox1->addWidget( serversList ); |
240 | |||
241 | |||
242 | QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); | ||
243 | QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); | ||
244 | |||
245 | if ( showJumpTo ) | ||
246 | { | ||
247 | char text[2]; | ||
248 | text[1] = '\0'; | ||
249 | for ( int i = 0 ; i < 26 ; ++i ) | ||
250 | { | ||
251 | text[0] = 'A' + i; | ||
252 | LetterPushButton *b = new LetterPushButton( text, networkPkgWindow ); | ||
253 | connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); | ||
254 | if ( i < 13 ) | ||
255 | hbox3->addWidget( b ); | ||
256 | else | ||
257 | hbox4->addWidget( b ); | ||
258 | } | ||
259 | } | ||
260 | 273 | ||
261 | vbox->addWidget( packagesList ); | 274 | vbox->addWidget( packagesList ); |
262 | 275 | ||
263 | downloadEnabled = TRUE; | 276 | downloadEnabled = TRUE; |
264 | } | 277 | } |
265 | 278 | ||
266 | void MainWindow :: initProgressWidget() | 279 | void MainWindow :: initProgressWidget() |
267 | { | 280 | { |
@@ -274,16 +287,25 @@ void MainWindow :: initProgressWidget() | |||
274 | layout->addWidget( m_status ); | 287 | layout->addWidget( m_status ); |
275 | 288 | ||
276 | m_progress = new QProgressBar( progressWindow ); | 289 | m_progress = new QProgressBar( progressWindow ); |
277 | layout->addWidget( m_progress ); | 290 | layout->addWidget( m_progress ); |
278 | } | 291 | } |
279 | 292 | ||
280 | void MainWindow :: init() | 293 | void MainWindow :: init() |
281 | { | 294 | { |
295 | #ifdef QWS | ||
296 | // read download directory from config file | ||
297 | Config cfg( "aqpkg" ); | ||
298 | cfg.setGroup( "settings" ); | ||
299 | currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); | ||
300 | // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); | ||
301 | |||
302 | #endif | ||
303 | |||
282 | stack->raiseWidget( progressWindow ); | 304 | stack->raiseWidget( progressWindow ); |
283 | 305 | ||
284 | mgr = new DataManager(); | 306 | mgr = new DataManager(); |
285 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); | 307 | connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); |
286 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), | 308 | connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), |
287 | this, SLOT( setProgressMessage( const QString & ) ) ); | 309 | this, SLOT( setProgressMessage( const QString & ) ) ); |
288 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); | 310 | connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); |
289 | mgr->loadServers(); | 311 | mgr->loadServers(); |
@@ -348,32 +370,42 @@ void MainWindow :: displayHelp() | |||
348 | } | 370 | } |
349 | 371 | ||
350 | void MainWindow :: displayFindBar() | 372 | void MainWindow :: displayFindBar() |
351 | { | 373 | { |
352 | findBar->show(); | 374 | findBar->show(); |
353 | findEdit->setFocus(); | 375 | findEdit->setFocus(); |
354 | } | 376 | } |
355 | 377 | ||
378 | void MainWindow :: displayJumpBar() | ||
379 | { | ||
380 | jumpBar->show(); | ||
381 | } | ||
382 | |||
356 | void MainWindow :: repeatFind() | 383 | void MainWindow :: repeatFind() |
357 | { | 384 | { |
358 | searchForPackage( findEdit->text() ); | 385 | searchForPackage( findEdit->text() ); |
359 | } | 386 | } |
360 | 387 | ||
361 | void MainWindow :: findPackage( const QString &text ) | 388 | void MainWindow :: findPackage( const QString &text ) |
362 | { | 389 | { |
363 | actionFindNext->setEnabled( !text.isEmpty() ); | 390 | actionFindNext->setEnabled( !text.isEmpty() ); |
364 | searchForPackage( text ); | 391 | searchForPackage( text ); |
365 | } | 392 | } |
366 | 393 | ||
367 | void MainWindow :: hideFindBar() | 394 | void MainWindow :: hideFindBar() |
368 | { | 395 | { |
369 | findBar->hide(); | 396 | findBar->hide(); |
370 | } | 397 | } |
371 | 398 | ||
399 | void MainWindow :: hideJumpBar() | ||
400 | { | ||
401 | jumpBar->hide(); | ||
402 | } | ||
403 | |||
372 | void MainWindow :: displayAbout() | 404 | void MainWindow :: displayAbout() |
373 | { | 405 | { |
374 | QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); | 406 | QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); |
375 | } | 407 | } |
376 | 408 | ||
377 | void MainWindow :: filterUninstalledPackages() | 409 | void MainWindow :: filterUninstalledPackages() |
378 | { | 410 | { |
379 | showUninstalledPkgs = actionUninstalled->isOn(); | 411 | showUninstalledPkgs = actionUninstalled->isOn(); |
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index be30668..b49c819 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h | |||
@@ -43,16 +43,17 @@ public: | |||
43 | ~MainWindow(); | 43 | ~MainWindow(); |
44 | 44 | ||
45 | private: | 45 | private: |
46 | DataManager *mgr; | 46 | DataManager *mgr; |
47 | 47 | ||
48 | QWidgetStack *stack; | 48 | QWidgetStack *stack; |
49 | 49 | ||
50 | QPEToolBar *findBar; | 50 | QPEToolBar *findBar; |
51 | QPEToolBar *jumpBar; | ||
51 | QLineEdit *findEdit; | 52 | QLineEdit *findEdit; |
52 | QAction *actionFindNext; | 53 | QAction *actionFindNext; |
53 | QAction *actionFilter; | 54 | QAction *actionFilter; |
54 | QAction *actionUpgrade; | 55 | QAction *actionUpgrade; |
55 | QAction *actionDownload; | 56 | QAction *actionDownload; |
56 | QAction *actionUninstalled; | 57 | QAction *actionUninstalled; |
57 | QAction *actionInstalled; | 58 | QAction *actionInstalled; |
58 | QAction *actionUpdated; | 59 | QAction *actionUpdated; |
@@ -99,19 +100,21 @@ private: | |||
99 | QProgressBar *m_progress; | 100 | QProgressBar *m_progress; |
100 | 101 | ||
101 | void initProgressWidget(); | 102 | void initProgressWidget(); |
102 | 103 | ||
103 | public slots: | 104 | public slots: |
104 | // void setDocument( const QString &doc ); | 105 | // void setDocument( const QString &doc ); |
105 | void displayHelp(); | 106 | void displayHelp(); |
106 | void displayFindBar(); | 107 | void displayFindBar(); |
108 | void displayJumpBar(); | ||
107 | void repeatFind(); | 109 | void repeatFind(); |
108 | void findPackage( const QString & ); | 110 | void findPackage( const QString & ); |
109 | void hideFindBar(); | 111 | void hideFindBar(); |
112 | void hideJumpBar(); | ||
110 | void displayAbout(); | 113 | void displayAbout(); |
111 | void displaySettings(); | 114 | void displaySettings(); |
112 | void filterUninstalledPackages(); | 115 | void filterUninstalledPackages(); |
113 | void filterInstalledPackages(); | 116 | void filterInstalledPackages(); |
114 | void filterUpgradedPackages(); | 117 | void filterUpgradedPackages(); |
115 | void filterCategory(); | 118 | void filterCategory(); |
116 | bool setFilterCategory(); | 119 | bool setFilterCategory(); |
117 | void raiseMainWidget(); | 120 | void raiseMainWidget(); |