Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 0b5a5eb..3c72f2b 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,104 +1,111 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | mainwin.cpp - description | 2 | mainwin.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 13:32:30 BST 2002 | 4 | begin : Mon Aug 26 13:32:30 BST 2002 |
5 | copyright : (C) 2002 by Andy Qua | 5 | copyright : (C) 2002 by Andy Qua |
6 | email : andy.qua@blueyonder.co.uk | 6 | email : andy.qua@blueyonder.co.uk |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #include <qmenubar.h> | 18 | #include <qmenubar.h> |
19 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | 21 | ||
22 | #include "mainwin.h" | 22 | #include "mainwin.h" |
23 | #include "datamgr.h" | 23 | #include "datamgr.h" |
24 | #include "networkpkgmgr.h" | 24 | #include "networkpkgmgr.h" |
25 | #include "settingsimpl.h" | 25 | #include "settingsimpl.h" |
26 | #include "helpwindow.h" | 26 | #include "helpwindow.h" |
27 | #include "utils.h" | 27 | #include "utils.h" |
28 | #include "global.h" | 28 | #include "global.h" |
29 | 29 | ||
30 | MainWindow :: MainWindow( QWidget *p, char *name ) | 30 | MainWindow :: MainWindow( QWidget *p, char *name ) |
31 | :QMainWindow( p, name ) | 31 | :QMainWindow( p, name ) |
32 | { | 32 | { |
33 | #ifdef QWS | 33 | #ifdef QWS |
34 | showMaximized(); | 34 | showMaximized(); |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | setCaption( "AQPkg - Package Manager" ); | 37 | setCaption( "AQPkg - Package Manager" ); |
38 | 38 | ||
39 | // Create our menu | 39 | // Create our menu |
40 | QPopupMenu *help = new QPopupMenu( this ); | 40 | QPopupMenu *help = new QPopupMenu( this ); |
41 | |||
41 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); | 42 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); |
42 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); | 43 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); |
43 | 44 | ||
44 | QPopupMenu *settings = new QPopupMenu( this ); | 45 | QPopupMenu *settings = new QPopupMenu( this ); |
45 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); | 46 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); |
46 | 47 | ||
47 | QPopupMenu *edit = new QPopupMenu( this ); | 48 | QPopupMenu *edit = new QPopupMenu( this ); |
48 | edit->insertItem( "&Search", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F ); | 49 | edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F ); |
50 | edit->insertItem( "&Find Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_R ); | ||
49 | 51 | ||
50 | // Create the main menu | 52 | // Create the main menu |
51 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); | 53 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); |
52 | menu->insertItem( "&Settings", settings ); | 54 | menu->insertItem( "&Settings", settings ); |
53 | menu->insertItem( "&Edit", edit ); | 55 | menu->insertItem( "&Edit", edit ); |
54 | menu->insertItem( "&Help", help ); | 56 | menu->insertItem( "&Help", help ); |
55 | 57 | ||
56 | mgr = new DataManager(); | 58 | mgr = new DataManager(); |
57 | mgr->loadServers(); | 59 | mgr->loadServers(); |
58 | 60 | ||
59 | stack = new QWidgetStack( this ); | 61 | stack = new QWidgetStack( this ); |
60 | 62 | ||
61 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); | 63 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); |
62 | stack->addWidget( networkPkgWindow, 1 ); | 64 | stack->addWidget( networkPkgWindow, 1 ); |
63 | 65 | ||
64 | setCentralWidget( stack ); | 66 | setCentralWidget( stack ); |
65 | stack->raiseWidget( networkPkgWindow ); | 67 | stack->raiseWidget( networkPkgWindow ); |
66 | } | 68 | } |
67 | 69 | ||
68 | MainWindow :: ~MainWindow() | 70 | MainWindow :: ~MainWindow() |
69 | { | 71 | { |
70 | delete networkPkgWindow; | 72 | delete networkPkgWindow; |
71 | } | 73 | } |
72 | 74 | ||
73 | void MainWindow :: setDocument( const QString &doc ) | 75 | void MainWindow :: setDocument( const QString &doc ) |
74 | { | 76 | { |
75 | // Remove path from package | 77 | // Remove path from package |
76 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 78 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
77 | cout << "Selecting package " << package << endl; | 79 | cout << "Selecting package " << package << endl; |
78 | networkPkgWindow->selectLocalPackage( package ); | 80 | networkPkgWindow->selectLocalPackage( package ); |
79 | } | 81 | } |
80 | 82 | ||
81 | void MainWindow :: displaySettings() | 83 | void MainWindow :: displaySettings() |
82 | { | 84 | { |
83 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 85 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
84 | if ( dlg->showDlg( 0 ) ) | 86 | if ( dlg->showDlg( 0 ) ) |
85 | networkPkgWindow->updateData(); | 87 | networkPkgWindow->updateData(); |
86 | delete dlg; | 88 | delete dlg; |
87 | } | 89 | } |
88 | 90 | ||
89 | void MainWindow :: displayHelp() | 91 | void MainWindow :: displayHelp() |
90 | { | 92 | { |
91 | HelpWindow *dlg = new HelpWindow( this ); | 93 | HelpWindow *dlg = new HelpWindow( this ); |
92 | dlg->exec(); | 94 | dlg->exec(); |
93 | delete dlg; | 95 | delete dlg; |
94 | } | 96 | } |
95 | 97 | ||
96 | void MainWindow :: searchForPackage() | 98 | void MainWindow :: searchForPackage() |
97 | { | 99 | { |
98 | networkPkgWindow->searchForPackage(); | 100 | networkPkgWindow->searchForPackage( false ); |
101 | } | ||
102 | |||
103 | void MainWindow :: repeatSearchForPackage() | ||
104 | { | ||
105 | networkPkgWindow->searchForPackage( true ); | ||
99 | } | 106 | } |
100 | 107 | ||
101 | void MainWindow :: displayAbout() | 108 | void MainWindow :: displayAbout() |
102 | { | 109 | { |
103 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); | 110 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); |
104 | } | 111 | } |