Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp new file mode 100644 index 0000000..5de4dc9 --- a/dev/null +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | /*************************************************************************** | ||
2 | mainwin.cpp - description | ||
3 | ------------------- | ||
4 | begin : Mon Aug 26 13:32:30 BST 2002 | ||
5 | copyright : (C) 2002 by Andy Qua | ||
6 | email : andy.qua@blueyonder.co.uk | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
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 * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | |||
18 | #include <qmenubar.h> | ||
19 | #include <qpopupmenu.h> | ||
20 | |||
21 | #include "mainwin.h" | ||
22 | #include "datamgr.h" | ||
23 | #include "networkpkgmgr.h" | ||
24 | #include "settingsimpl.h" | ||
25 | #include "helpwindow.h" | ||
26 | #include "global.h" | ||
27 | |||
28 | MainWindow :: MainWindow( QWidget *p, char *name ) | ||
29 | :QMainWindow( p, name ) | ||
30 | { | ||
31 | #ifdef QWS | ||
32 | showMaximized(); | ||
33 | #endif | ||
34 | |||
35 | setCaption( "AQPkg - Package Manager" ); | ||
36 | |||
37 | // Create our menu | ||
38 | QPopupMenu *help = new QPopupMenu( this ); | ||
39 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_H ); | ||
40 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); | ||
41 | |||
42 | QPopupMenu *settings = new QPopupMenu( this ); | ||
43 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); | ||
44 | |||
45 | // Create the main menu | ||
46 | QMenuBar *menu = menuBar(); //new QMenuBar( this ); | ||
47 | menu->insertItem( "&Settings", settings ); | ||
48 | menu->insertItem( "&Help", help ); | ||
49 | |||
50 | mgr = new DataManager(); | ||
51 | mgr->loadServers(); | ||
52 | |||
53 | stack = new QWidgetStack( this ); | ||
54 | |||
55 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); | ||
56 | stack->addWidget( networkPkgWindow, 1 ); | ||
57 | |||
58 | setCentralWidget( stack ); | ||
59 | stack->raiseWidget( networkPkgWindow ); | ||
60 | } | ||
61 | |||
62 | MainWindow :: ~MainWindow() | ||
63 | { | ||
64 | delete networkPkgWindow; | ||
65 | } | ||
66 | |||
67 | void MainWindow :: displaySettings() | ||
68 | { | ||
69 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | ||
70 | if ( dlg->showDlg( 0 ) ) | ||
71 | networkPkgWindow->updateData(); | ||
72 | delete dlg; | ||
73 | } | ||
74 | |||
75 | void MainWindow :: displayHelp() | ||
76 | { | ||
77 | HelpWindow *dlg = new HelpWindow( this ); | ||
78 | dlg->exec(); | ||
79 | delete dlg; | ||
80 | } | ||
81 | |||
82 | void MainWindow :: displayAbout() | ||
83 | { | ||
84 | |||
85 | } | ||