-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,184 +1,186 @@ /***************************************************************************
mainwin.cpp - description
-------------------
begin : Mon Aug 26 13:32:30 BST 2002
copyright : (C) 2002 by Andy Qua
email : andy.qua@blueyonder.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
+#include <iostream>
+
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qmessagebox.h>
#include "mainwin.h"
#include "datamgr.h"
#include "networkpkgmgr.h"
#include "settingsimpl.h"
#include "helpwindow.h"
#include "utils.h"
#include "global.h"
MainWindow :: MainWindow( QWidget *p, char *name )
: QMainWindow( p, name )
{
#ifdef QWS
showMaximized();
#endif
setCaption( "AQPkg - Package Manager" );
// Create our menu
help = new QPopupMenu( this );
help->insertItem( "&General", this, SLOT(displayHelp()), Qt::CTRL+Qt::Key_G );
help->insertItem( "&About", this, SLOT(displayAbout()), Qt::CTRL+Qt::Key_A );
settings = new QPopupMenu( this );
settings->insertItem( "&Settings", this, SLOT(displaySettings()), Qt::CTRL+Qt::Key_S );
edit = new QPopupMenu( this );
edit->insertItem( "&Find", this, SLOT(searchForPackage()), Qt::CTRL+Qt::Key_I );
edit->insertItem( "Find &Next", this, SLOT(repeatSearchForPackage()), Qt::CTRL+Qt::Key_N );
filter = new QPopupMenu( this );
mnuShowUninstalledPkgsId = filter->insertItem( "Show &Uninstalled Packages", this, SLOT(filterUninstalledPackages()), Qt::CTRL+Qt::Key_U );
mnuShowInstalledPkgsId = filter->insertItem( "Show In&stalled Packages", this, SLOT(filterInstalledPackages()), Qt::CTRL+Qt::Key_S );
mnuShowUpgradedPkgsId = filter->insertItem( "Show U&pdated Packages", this, SLOT(filterUpgradedPackages()), Qt::CTRL+Qt::Key_P );
// Create the main menu
menu = menuBar(); //new QMenuBar( this );
menu->insertItem( "&Settings", settings );
menu->insertItem( "&Edit", edit );
menu->insertItem( "&Filter", filter );
menu->insertItem( "&Help", help );
mgr = new DataManager();
mgr->loadServers();
stack = new QWidgetStack( this );
networkPkgWindow = new NetworkPackageManager( mgr, stack );
stack->addWidget( networkPkgWindow, 1 );
setCentralWidget( stack );
stack->raiseWidget( networkPkgWindow );
}
MainWindow :: ~MainWindow()
{
delete networkPkgWindow;
}
void MainWindow :: setDocument( const QString &doc )
{
// Remove path from package
QString package = Utils::getPackageNameFromIpkFilename( doc );
- cout << "Selecting package " << package << endl;
+ std::cout << "Selecting package " << package << std::endl;
networkPkgWindow->selectLocalPackage( package );
}
void MainWindow :: displaySettings()
{
SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
if ( dlg->showDlg( 0 ) )
networkPkgWindow->updateData();
delete dlg;
}
void MainWindow :: displayHelp()
{
HelpWindow *dlg = new HelpWindow( this );
dlg->exec();
delete dlg;
}
void MainWindow :: searchForPackage()
{
networkPkgWindow->searchForPackage( false );
}
void MainWindow :: repeatSearchForPackage()
{
networkPkgWindow->searchForPackage( true );
}
void MainWindow :: displayAbout()
{
QMessageBox::about( this, "About AQPkg", VERSION_TEXT );
}
void MainWindow :: filterUninstalledPackages()
{
bool val;
if ( filter->isItemChecked( mnuShowUninstalledPkgsId ) )
{
val = false;
filter->setItemChecked( mnuShowUninstalledPkgsId, false );
}
else
{
val = true;
filter->setItemChecked( mnuShowUninstalledPkgsId, true );
}
filter->setItemChecked( mnuShowInstalledPkgsId, false );
networkPkgWindow->showOnlyInstalledPackages( false );
filter->setItemChecked( mnuShowUpgradedPkgsId, false );
networkPkgWindow->showUpgradedPackages( false );
networkPkgWindow->showOnlyUninstalledPackages( val );
}
void MainWindow :: filterInstalledPackages()
{
bool val;
if ( filter->isItemChecked( mnuShowInstalledPkgsId ) )
{
val = false;
filter->setItemChecked( mnuShowInstalledPkgsId, false );
}
else
{
val = true;
filter->setItemChecked( mnuShowInstalledPkgsId, true );
}
filter->setItemChecked( mnuShowUninstalledPkgsId, false );
networkPkgWindow->showOnlyUninstalledPackages( false );
filter->setItemChecked( mnuShowUpgradedPkgsId, false );
networkPkgWindow->showUpgradedPackages( false );
networkPkgWindow->showOnlyInstalledPackages( val );
}
void MainWindow :: filterUpgradedPackages()
{
bool val;
if ( filter->isItemChecked( mnuShowUpgradedPkgsId ) )
{
val = false;
filter->setItemChecked( mnuShowUpgradedPkgsId, false );
}
else
{
val = true;
filter->setItemChecked( mnuShowUpgradedPkgsId, true );
}
filter->setItemChecked( mnuShowUninstalledPkgsId, false );
networkPkgWindow->showOnlyUninstalledPackages( false );
filter->setItemChecked( mnuShowInstalledPkgsId, false );
networkPkgWindow->showOnlyInstalledPackages( false );
networkPkgWindow->showUpgradedPackages( val );
}
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,105 +1,106 @@ /***************************************************************************
mem.h - description
-------------------
begin : Mon Aug 26 2002
copyright : (C) 2002 by Andy Qua
email : andy.qua@blueyonder.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <stdio.h>
#include <fstream>
+#include <iostream>
#include <list>
using namespace std;
#define __MEMFILE_C
#include "global.h"
#ifdef _DEBUG
void __cdecl *operator new( unsigned int size, const char *file, int line )
{
void *ptr = (void *)malloc(size);
AddTrack((long)ptr, size, file, line);
return(ptr);
}
void operator delete(void *p)
{
RemoveTrack((long)p);
free(p);
}
#endif
typedef struct {
long address;
long size;
char file[64];
long line;
} ALLOC_INFO;
typedef list<ALLOC_INFO*> AllocList;
AllocList allocList;
void AddTrack(long addr, long asize, const char *fname, long lnum)
{
ALLOC_INFO *info;
info = (ALLOC_INFO *)malloc(sizeof( ALLOC_INFO ));
info->address = addr;
strncpy(info->file, fname, 63);
info->line = lnum;
info->size = asize;
allocList.insert(allocList.begin(), info);
};
void RemoveTrack(long addr)
{
AllocList::iterator i;
bool found = false;
for(i = allocList.begin(); i != allocList.end(); i++)
{
if((*i)->address == addr)
{
allocList.remove((*i));
found = true;
break;
}
}
}
void DumpUnfreed()
{
AllocList::iterator i;
long totalSize = 0;
char buf[1024];
// if(!allocList)
// return;
for(i = allocList.begin(); i != allocList.end(); i++) {
sprintf(buf, "%-15s: LINE %ld, ADDRESS %ld %ld unfreed",
(*i)->file, (*i)->line, (*i)->address, (*i)->size);
cout <<buf << endl;
totalSize += (*i)->size;
}
sprintf(buf, "-----------------------------------------------------------\n");
cout <<buf << endl;
sprintf(buf, "Total Unfreed: %ld bytes\n", totalSize);
cout <<buf << endl;
};
|