Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 9f19dfa..0b5a5eb 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,95 +1,104 @@ | |||
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 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); | 41 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); |
42 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); | 42 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); |
43 | 43 | ||
44 | QPopupMenu *settings = new QPopupMenu( this ); | 44 | QPopupMenu *settings = new QPopupMenu( this ); |
45 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); | 45 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); |
46 | 46 | ||
47 | QPopupMenu *edit = new QPopupMenu( this ); | ||
48 | edit->insertItem( "&Search", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_F ); | ||
49 | |||
47 | // Create the main menu | 50 | // Create the main menu |
48 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); | 51 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); |
49 | menu->insertItem( "&Settings", settings ); | 52 | menu->insertItem( "&Settings", settings ); |
53 | menu->insertItem( "&Edit", edit ); | ||
50 | menu->insertItem( "&Help", help ); | 54 | menu->insertItem( "&Help", help ); |
51 | 55 | ||
52 | mgr = new DataManager(); | 56 | mgr = new DataManager(); |
53 | mgr->loadServers(); | 57 | mgr->loadServers(); |
54 | 58 | ||
55 | stack = new QWidgetStack( this ); | 59 | stack = new QWidgetStack( this ); |
56 | 60 | ||
57 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); | 61 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); |
58 | stack->addWidget( networkPkgWindow, 1 ); | 62 | stack->addWidget( networkPkgWindow, 1 ); |
59 | 63 | ||
60 | setCentralWidget( stack ); | 64 | setCentralWidget( stack ); |
61 | stack->raiseWidget( networkPkgWindow ); | 65 | stack->raiseWidget( networkPkgWindow ); |
62 | } | 66 | } |
63 | 67 | ||
64 | MainWindow :: ~MainWindow() | 68 | MainWindow :: ~MainWindow() |
65 | { | 69 | { |
66 | delete networkPkgWindow; | 70 | delete networkPkgWindow; |
67 | } | 71 | } |
68 | 72 | ||
69 | void MainWindow :: setDocument( const QString &doc ) | 73 | void MainWindow :: setDocument( const QString &doc ) |
70 | { | 74 | { |
71 | // Remove path from package | 75 | // Remove path from package |
72 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 76 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
73 | cout << "Selecting package " << package << endl; | 77 | cout << "Selecting package " << package << endl; |
74 | networkPkgWindow->selectLocalPackage( package ); | 78 | networkPkgWindow->selectLocalPackage( package ); |
75 | } | 79 | } |
76 | 80 | ||
77 | void MainWindow :: displaySettings() | 81 | void MainWindow :: displaySettings() |
78 | { | 82 | { |
79 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 83 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
80 | if ( dlg->showDlg( 0 ) ) | 84 | if ( dlg->showDlg( 0 ) ) |
81 | networkPkgWindow->updateData(); | 85 | networkPkgWindow->updateData(); |
82 | delete dlg; | 86 | delete dlg; |
83 | } | 87 | } |
84 | 88 | ||
85 | void MainWindow :: displayHelp() | 89 | void MainWindow :: displayHelp() |
86 | { | 90 | { |
87 | HelpWindow *dlg = new HelpWindow( this ); | 91 | HelpWindow *dlg = new HelpWindow( this ); |
88 | dlg->exec(); | 92 | dlg->exec(); |
89 | delete dlg; | 93 | delete dlg; |
90 | } | 94 | } |
91 | 95 | ||
96 | void MainWindow :: searchForPackage() | ||
97 | { | ||
98 | networkPkgWindow->searchForPackage(); | ||
99 | } | ||
100 | |||
92 | void MainWindow :: displayAbout() | 101 | void MainWindow :: displayAbout() |
93 | { | 102 | { |
94 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); | 103 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); |
95 | } | 104 | } |