author | kergoth <kergoth> | 2002-11-11 17:24:58 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-11-11 17:24:58 (UTC) |
commit | 94cc15c14d0a15dd21258730d058f72dae730cf4 (patch) (unidiff) | |
tree | 9de88e05e769ac0f150693411b038c50e23662fb | |
parent | 84cafc64d515c80aebd50e70b47e3da93d742c8a (diff) | |
download | opie-94cc15c14d0a15dd21258730d058f72dae730cf4.zip opie-94cc15c14d0a15dd21258730d058f72dae730cf4.tar.gz opie-94cc15c14d0a15dd21258730d058f72dae730cf4.tar.bz2 |
add #include <iostream>, and std:: when not 'using namespace std'
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mem.cpp | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 4e9cc12..5ccd3c3 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,148 +1,150 @@ | |||
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 <iostream> | ||
19 | |||
18 | #include <qmenubar.h> | 20 | #include <qmenubar.h> |
19 | #include <qpopupmenu.h> | 21 | #include <qpopupmenu.h> |
20 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
21 | 23 | ||
22 | #include "mainwin.h" | 24 | #include "mainwin.h" |
23 | #include "datamgr.h" | 25 | #include "datamgr.h" |
24 | #include "networkpkgmgr.h" | 26 | #include "networkpkgmgr.h" |
25 | #include "settingsimpl.h" | 27 | #include "settingsimpl.h" |
26 | #include "helpwindow.h" | 28 | #include "helpwindow.h" |
27 | #include "utils.h" | 29 | #include "utils.h" |
28 | #include "global.h" | 30 | #include "global.h" |
29 | 31 | ||
30 | MainWindow :: MainWindow( QWidget *p, char *name ) | 32 | MainWindow :: MainWindow( QWidget *p, char *name ) |
31 | :QMainWindow( p, name ) | 33 | :QMainWindow( p, name ) |
32 | { | 34 | { |
33 | #ifdef QWS | 35 | #ifdef QWS |
34 | showMaximized(); | 36 | showMaximized(); |
35 | #endif | 37 | #endif |
36 | 38 | ||
37 | setCaption( "AQPkg - Package Manager" ); | 39 | setCaption( "AQPkg - Package Manager" ); |
38 | 40 | ||
39 | // Create our menu | 41 | // Create our menu |
40 | help = new QPopupMenu( this ); | 42 | help = new QPopupMenu( this ); |
41 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G ); | 43 | help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G ); |
42 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); | 44 | help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A ); |
43 | 45 | ||
44 | settings = new QPopupMenu( this ); | 46 | settings = new QPopupMenu( this ); |
45 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); | 47 | settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S ); |
46 | 48 | ||
47 | edit = new QPopupMenu( this ); | 49 | edit = new QPopupMenu( this ); |
48 | edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I ); | 50 | edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I ); |
49 | edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N ); | 51 | edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N ); |
50 | 52 | ||
51 | filter = new QPopupMenu( this ); | 53 | filter = new QPopupMenu( this ); |
52 | mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U ); | 54 | mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U ); |
53 | mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S ); | 55 | mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S ); |
54 | mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P ); | 56 | mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P ); |
55 | 57 | ||
56 | // Create the main menu | 58 | // Create the main menu |
57 | menu = menuBar(); //new QMenuBar( this ); | 59 | menu = menuBar(); //new QMenuBar( this ); |
58 | menu->insertItem( "&Settings", settings ); | 60 | menu->insertItem( "&Settings", settings ); |
59 | menu->insertItem( "&Edit", edit ); | 61 | menu->insertItem( "&Edit", edit ); |
60 | menu->insertItem( "&Filter", filter ); | 62 | menu->insertItem( "&Filter", filter ); |
61 | menu->insertItem( "&Help", help ); | 63 | menu->insertItem( "&Help", help ); |
62 | 64 | ||
63 | mgr = new DataManager(); | 65 | mgr = new DataManager(); |
64 | mgr->loadServers(); | 66 | mgr->loadServers(); |
65 | 67 | ||
66 | stack = new QWidgetStack( this ); | 68 | stack = new QWidgetStack( this ); |
67 | 69 | ||
68 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); | 70 | networkPkgWindow = new NetworkPackageManager( mgr, stack ); |
69 | stack->addWidget( networkPkgWindow, 1 ); | 71 | stack->addWidget( networkPkgWindow, 1 ); |
70 | 72 | ||
71 | setCentralWidget( stack ); | 73 | setCentralWidget( stack ); |
72 | stack->raiseWidget( networkPkgWindow ); | 74 | stack->raiseWidget( networkPkgWindow ); |
73 | } | 75 | } |
74 | 76 | ||
75 | MainWindow :: ~MainWindow() | 77 | MainWindow :: ~MainWindow() |
76 | { | 78 | { |
77 | delete networkPkgWindow; | 79 | delete networkPkgWindow; |
78 | } | 80 | } |
79 | 81 | ||
80 | void MainWindow :: setDocument( const QString &doc ) | 82 | void MainWindow :: setDocument( const QString &doc ) |
81 | { | 83 | { |
82 | // Remove path from package | 84 | // Remove path from package |
83 | QString package = Utils::getPackageNameFromIpkFilename( doc ); | 85 | QString package = Utils::getPackageNameFromIpkFilename( doc ); |
84 | cout << "Selecting package " << package << endl; | 86 | std::cout << "Selecting package " << package << std::endl; |
85 | networkPkgWindow->selectLocalPackage( package ); | 87 | networkPkgWindow->selectLocalPackage( package ); |
86 | } | 88 | } |
87 | 89 | ||
88 | void MainWindow :: displaySettings() | 90 | void MainWindow :: displaySettings() |
89 | { | 91 | { |
90 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); | 92 | SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); |
91 | if ( dlg->showDlg( 0 ) ) | 93 | if ( dlg->showDlg( 0 ) ) |
92 | networkPkgWindow->updateData(); | 94 | networkPkgWindow->updateData(); |
93 | delete dlg; | 95 | delete dlg; |
94 | } | 96 | } |
95 | 97 | ||
96 | void MainWindow :: displayHelp() | 98 | void MainWindow :: displayHelp() |
97 | { | 99 | { |
98 | HelpWindow *dlg = new HelpWindow( this ); | 100 | HelpWindow *dlg = new HelpWindow( this ); |
99 | dlg->exec(); | 101 | dlg->exec(); |
100 | delete dlg; | 102 | delete dlg; |
101 | } | 103 | } |
102 | 104 | ||
103 | void MainWindow :: searchForPackage() | 105 | void MainWindow :: searchForPackage() |
104 | { | 106 | { |
105 | networkPkgWindow->searchForPackage( false ); | 107 | networkPkgWindow->searchForPackage( false ); |
106 | } | 108 | } |
107 | 109 | ||
108 | void MainWindow :: repeatSearchForPackage() | 110 | void MainWindow :: repeatSearchForPackage() |
109 | { | 111 | { |
110 | networkPkgWindow->searchForPackage( true ); | 112 | networkPkgWindow->searchForPackage( true ); |
111 | } | 113 | } |
112 | 114 | ||
113 | void MainWindow :: displayAbout() | 115 | void MainWindow :: displayAbout() |
114 | { | 116 | { |
115 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); | 117 | QMessageBox::about( this, "About AQPkg", VERSION_TEXT ); |
116 | } | 118 | } |
117 | 119 | ||
118 | 120 | ||
119 | void MainWindow :: filterUninstalledPackages() | 121 | void MainWindow :: filterUninstalledPackages() |
120 | { | 122 | { |
121 | bool val; | 123 | bool val; |
122 | if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) ) | 124 | if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) ) |
123 | { | 125 | { |
124 | val = false; | 126 | val = false; |
125 | filter->setItemChecked( mnuShowUninstalledPkgsId, false ); | 127 | filter->setItemChecked( mnuShowUninstalledPkgsId, false ); |
126 | } | 128 | } |
127 | else | 129 | else |
128 | { | 130 | { |
129 | val = true; | 131 | val = true; |
130 | filter->setItemChecked( mnuShowUninstalledPkgsId, true ); | 132 | filter->setItemChecked( mnuShowUninstalledPkgsId, true ); |
131 | } | 133 | } |
132 | 134 | ||
133 | filter->setItemChecked( mnuShowInstalledPkgsId, false ); | 135 | filter->setItemChecked( mnuShowInstalledPkgsId, false ); |
134 | networkPkgWindow->showOnlyInstalledPackages( false ); | 136 | networkPkgWindow->showOnlyInstalledPackages( false ); |
135 | filter->setItemChecked( mnuShowUpgradedPkgsId, false ); | 137 | filter->setItemChecked( mnuShowUpgradedPkgsId, false ); |
136 | networkPkgWindow->showUpgradedPackages( false ); | 138 | networkPkgWindow->showUpgradedPackages( false ); |
137 | 139 | ||
138 | networkPkgWindow->showOnlyUninstalledPackages( val ); | 140 | networkPkgWindow->showOnlyUninstalledPackages( val ); |
139 | 141 | ||
140 | } | 142 | } |
141 | 143 | ||
142 | void MainWindow :: filterInstalledPackages() | 144 | void MainWindow :: filterInstalledPackages() |
143 | { | 145 | { |
144 | bool val; | 146 | bool val; |
145 | if ( filter->isItemChecked( mnuShowInstalledPkgsId ) ) | 147 | if ( filter->isItemChecked( mnuShowInstalledPkgsId ) ) |
146 | { | 148 | { |
147 | val = false; | 149 | val = false; |
148 | filter->setItemChecked( mnuShowInstalledPkgsId, false ); | 150 | filter->setItemChecked( mnuShowInstalledPkgsId, false ); |
diff --git a/noncore/settings/aqpkg/mem.cpp b/noncore/settings/aqpkg/mem.cpp index 76ce35c..405aada 100644 --- a/noncore/settings/aqpkg/mem.cpp +++ b/noncore/settings/aqpkg/mem.cpp | |||
@@ -1,82 +1,83 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | mem.h - description | 2 | mem.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Mon Aug 26 2002 | 4 | begin : Mon Aug 26 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 | #include <stdio.h> | 17 | #include <stdio.h> |
18 | #include <fstream> | 18 | #include <fstream> |
19 | #include <iostream> | ||
19 | #include <list> | 20 | #include <list> |
20 | using namespace std; | 21 | using namespace std; |
21 | 22 | ||
22 | #define __MEMFILE_C | 23 | #define __MEMFILE_C |
23 | #include "global.h" | 24 | #include "global.h" |
24 | 25 | ||
25 | #ifdef _DEBUG | 26 | #ifdef _DEBUG |
26 | 27 | ||
27 | void __cdecl *operator new( unsigned int size, const char *file, int line ) | 28 | void __cdecl *operator new( unsigned int size, const char *file, int line ) |
28 | { | 29 | { |
29 | void *ptr = (void *)malloc(size); | 30 | void *ptr = (void *)malloc(size); |
30 | AddTrack((long)ptr, size, file, line); | 31 | AddTrack((long)ptr, size, file, line); |
31 | return(ptr); | 32 | return(ptr); |
32 | } | 33 | } |
33 | 34 | ||
34 | void operator delete(void *p) | 35 | void operator delete(void *p) |
35 | { | 36 | { |
36 | RemoveTrack((long)p); | 37 | RemoveTrack((long)p); |
37 | free(p); | 38 | free(p); |
38 | } | 39 | } |
39 | 40 | ||
40 | #endif | 41 | #endif |
41 | 42 | ||
42 | 43 | ||
43 | typedef struct { | 44 | typedef struct { |
44 | longaddress; | 45 | longaddress; |
45 | longsize; | 46 | longsize; |
46 | charfile[64]; | 47 | charfile[64]; |
47 | longline; | 48 | longline; |
48 | } ALLOC_INFO; | 49 | } ALLOC_INFO; |
49 | 50 | ||
50 | typedef list<ALLOC_INFO*> AllocList; | 51 | typedef list<ALLOC_INFO*> AllocList; |
51 | 52 | ||
52 | AllocList allocList; | 53 | AllocList allocList; |
53 | 54 | ||
54 | 55 | ||
55 | 56 | ||
56 | void AddTrack(long addr, long asize, const char *fname, long lnum) | 57 | void AddTrack(long addr, long asize, const char *fname, long lnum) |
57 | { | 58 | { |
58 | ALLOC_INFO *info; | 59 | ALLOC_INFO *info; |
59 | 60 | ||
60 | 61 | ||
61 | info = (ALLOC_INFO *)malloc(sizeof( ALLOC_INFO )); | 62 | info = (ALLOC_INFO *)malloc(sizeof( ALLOC_INFO )); |
62 | info->address = addr; | 63 | info->address = addr; |
63 | strncpy(info->file, fname, 63); | 64 | strncpy(info->file, fname, 63); |
64 | info->line = lnum; | 65 | info->line = lnum; |
65 | info->size = asize; | 66 | info->size = asize; |
66 | allocList.insert(allocList.begin(), info); | 67 | allocList.insert(allocList.begin(), info); |
67 | }; | 68 | }; |
68 | 69 | ||
69 | void RemoveTrack(long addr) | 70 | void RemoveTrack(long addr) |
70 | { | 71 | { |
71 | AllocList::iterator i; | 72 | AllocList::iterator i; |
72 | 73 | ||
73 | bool found = false; | 74 | bool found = false; |
74 | for(i = allocList.begin(); i != allocList.end(); i++) | 75 | for(i = allocList.begin(); i != allocList.end(); i++) |
75 | { | 76 | { |
76 | if((*i)->address == addr) | 77 | if((*i)->address == addr) |
77 | { | 78 | { |
78 | allocList.remove((*i)); | 79 | allocList.remove((*i)); |
79 | found = true; | 80 | found = true; |
80 | break; | 81 | break; |
81 | } | 82 | } |
82 | } | 83 | } |