summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro2
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp18
-rw-r--r--noncore/settings/aqpkg/datamgr.h9
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp51
-rw-r--r--noncore/settings/aqpkg/mainwin.h7
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp82
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.h18
-rw-r--r--noncore/settings/aqpkg/progresswidget.cpp66
-rw-r--r--noncore/settings/aqpkg/progresswidget.h54
9 files changed, 265 insertions, 42 deletions
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index 3b27ac3..ad0dfc5 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,47 +1,49 @@
TEMPLATE = app
CONFIG = qt warn_on debug
HEADERS = global.h \
mainwin.h \
datamgr.h \
settingsimpl.h \
ipkg.h \
networkpkgmgr.h \
package.h \
progressdlg.h \
+ progresswidget.h \
installdlgimpl.h \
instoptionsimpl.h \
destination.h \
utils.h \
server.h \
helpwindow.h \
letterpushbutton.h \
inputdlg.h \
categoryfilterimpl.h
SOURCES = mainwin.cpp \
datamgr.cpp \
mem.cpp \
settingsimpl.cpp \
ipkg.cpp \
networkpkgmgr.cpp \
main.cpp \
package.cpp \
progressdlg.cpp \
+ progresswidget.cpp \
installdlgimpl.cpp \
instoptionsimpl.cpp \
destination.cpp \
utils.cpp \
server.cpp \
helpwindow.cpp \
letterpushbutton.cpp \
inputdlg.cpp \
version.cpp \
categoryfilterimpl.cpp
INTERFACES = settings.ui \
install.ui \
instoptions.ui \
categoryfilter.ui
TARGET = aqpkg
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie -lstdc++
DESTDIR = $(OPIEDIR)/bin
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index 0159a79..2c83e28 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -1,56 +1,60 @@
/***************************************************************************
datamgr.cpp - description
-------------------
begin : Thu Aug 29 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 <fstream>
#include <iostream>
using namespace std;
#ifdef QWS
#include <qpe/config.h>
+#include <qpe/qpeapplication.h>
+#else
+#include <qapplication.h>
#endif
#include <stdio.h>
#include "datamgr.h"
#include "global.h"
QString DataManager::availableCategories = "";
DataManager::DataManager()
+ : QObject( 0x0, 0x0 )
{
activeServer = "";
availableCategories = "#";
}
DataManager::~DataManager()
{
}
vector<Server>::iterator DataManager :: getServer( const char *name )
{
vector<Server>::iterator it = serverList.begin();
while ( it != serverList.end() )
{
if ( it->getServerName() == name )
return it;
++it;
}
return serverList.end();
}
vector<Destination>::iterator DataManager :: getDestination( const char *name )
@@ -144,59 +148,69 @@ void DataManager :: loadServers()
httpProxyEnabled = true;
}
if ( stricmp( type, "ftp_proxy" ) == 0 )
{
ftpProxy = val;
if ( lineStr.startsWith( "#" ) )
ftpProxyEnabled = false;
else
ftpProxyEnabled = true;
}
if ( stricmp( type, "proxy_username" ) == 0 )
proxyUsername = val;
if ( stricmp( type, "proxy_password" ) == 0 )
proxyPassword = val;
}
}
}
fclose( fp );
reloadServerData( );
}
void DataManager :: reloadServerData( )
{
+ emit progressSetSteps( serverList.size() );
+ emit progressSetMessage( tr( "Reading configuration..." ) );
+
vector<Server>::iterator it = serverList.begin();
+ QString serverName;
+ int i = 0;
for ( it = serverList.begin() ; it != serverList.end() ; ++it )
{
+ serverName = it->getServerName();
+ i++;
+ emit progressUpdate( i );
+ qApp->processEvents();
+
// Now we've read the config file in we need to read the servers
// The local server is a special case. This holds the contents of the
// status files the number of which depends on how many destinations
// we've set up
// The other servers files hold the contents of the server package list
- if ( it->getServerName() == LOCAL_SERVER )
+ if ( serverName == LOCAL_SERVER )
it->readStatusFile( destList );
- else if ( it->getServerName() == LOCAL_IPKGS )
+ else if ( serverName == LOCAL_IPKGS )
it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) );
else
it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) );
}
}
void DataManager :: writeOutIpkgConf()
{
QString ipkg_conf = IPKG_CONF;
ofstream out( ipkg_conf );
out << "# Written by AQPkg" << endl;
out << "# Must have one or more source entries of the form:" << endl;
out << "#" << endl;
out << "# src <src-name> <source-url>" << endl;
out << "#" << endl;
out << "# and one or more destination entries of the form:" << endl;
out << "#" << endl;
out << "# dest <dest-name> <target-path>" << endl;
out << "#" << endl;
out << "# where <src-name> and <dest-names> are identifiers that" << endl;
out << "# should match [a-zA-Z0-9._-]+, <source-url> should be a" << endl;
out << "# URL that points to a directory containing a Familiar" << endl;
out << "# Packages file, and <target-path> should be a directory" << endl;
diff --git a/noncore/settings/aqpkg/datamgr.h b/noncore/settings/aqpkg/datamgr.h
index 0a7467f..90328ab 100644
--- a/noncore/settings/aqpkg/datamgr.h
+++ b/noncore/settings/aqpkg/datamgr.h
@@ -1,62 +1,64 @@
/***************************************************************************
datamgr.h - description
-------------------
begin : Thu Aug 29 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. *
* *
***************************************************************************/
#ifndef DATAMGR_H
#define DATAMGR_H
#include <map>
using namespace std;
+#include <qobject.h>
#include <qstring.h>
#include "server.h"
#include "destination.h"
#define LOCAL_SERVER "Installed Pkgs"
#define LOCAL_IPKGS "local IPKG"
/**
*@author Andy Qua
*/
-class DataManager
+class DataManager : public QObject
{
+ Q_OBJECT
public:
DataManager();
~DataManager();
void setActiveServer( const QString &act ) { activeServer = act; }
QString &getActiveServer( ) { return activeServer; }
Server *getLocalServer() { return &( *getServer( LOCAL_SERVER ) ); }
vector<Server> &getServerList() { return serverList; }
vector<Server>::iterator getServer( const char *name );
vector<Destination> &getDestinationList() { return destList; }
vector<Destination>::iterator getDestination( const char *name );
void loadServers();
void reloadServerData( );
void writeOutIpkgConf();
static QString getAvailableCategories() { return availableCategories; }
static void setAvailableCategories( QString section );
QString getHttpProxy() { return httpProxy; }
QString getFtpProxy() { return ftpProxy; }
@@ -65,27 +67,32 @@ public:
bool getHttpProxyEnabled() { return httpProxyEnabled; }
bool getFtpProxyEnabled() { return ftpProxyEnabled; }
void setHttpProxy( QString proxy ) { httpProxy = proxy; }
void setFtpProxy( QString proxy ) { ftpProxy = proxy; }
void setProxyUsername( QString name ) { proxyUsername = name; }
void setProxyPassword( QString pword ) { proxyPassword = pword; }
void setHttpProxyEnabled( bool val ) { httpProxyEnabled = val; }
void setFtpProxyEnabled( bool val ) { ftpProxyEnabled = val; }
private:
static QString availableCategories;
QString activeServer;
QString httpProxy;
QString ftpProxy;
QString proxyUsername;
QString proxyPassword;
bool httpProxyEnabled;
bool ftpProxyEnabled;
vector<Server> serverList;
vector<Destination> destList;
+
+signals:
+ void progressSetSteps( int );
+ void progressSetMessage( const QString & );
+ void progressUpdate( int );
};
#endif
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index b00931e..5e03f11 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1,107 +1,134 @@
/***************************************************************************
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>
using namespace std;
#include <qmenubar.h>
-#include <qpopupmenu.h>
#include <qmessagebox.h>
+#include <qpopupmenu.h>
+#include <qtimer.h>
#include "mainwin.h"
+#include "progresswidget.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( tr( "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 &Non-Installed 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 );
filter->insertSeparator();
mnuFilterByCategory = filter->insertItem( "Filter By &Category", this, SLOT(filterCategory()), Qt::CTRL+Qt::Key_C );
mnuSetFilterCategory = filter->insertItem( "Set Filter C&ategory", this, SLOT(setFilterCategory()), Qt::CTRL+Qt::Key_A );
// Create the main menu
menu = menuBar(); //new QMenuBar( this );
menu->insertItem( tr( "&Settings" ), settings );
menu->insertItem( tr( "&Edit" ), edit );
menu->insertItem( tr( "&Filter" ), filter );
menu->insertItem( tr( "&Help" ), help );
- mgr = new DataManager();
- mgr->loadServers();
-
+ // Create UI widgets
stack = new QWidgetStack( this );
- networkPkgWindow = new NetworkPackageManager( mgr, stack );
+ progressWindow = new ProgressWidget( stack );
+ stack->addWidget( progressWindow, 2 );
+
+ networkPkgWindow = new NetworkPackageManager( stack );
+ connect( networkPkgWindow, SIGNAL( appRaiseMainWidget() ), this, SLOT( raiseMainWidget() ) );
+ connect( networkPkgWindow, SIGNAL( appRaiseProgressWidget() ), this, SLOT( raiseProgressWidget() ) );
+ connect( networkPkgWindow, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) );
+ connect( networkPkgWindow, SIGNAL( progressSetMessage( const QString & ) ),
+ progressWindow, SLOT( setMessage( const QString & ) ) );
+ connect( networkPkgWindow, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) );
stack->addWidget( networkPkgWindow, 1 );
setCentralWidget( stack );
- stack->raiseWidget( networkPkgWindow );
+ stack->raiseWidget( progressWindow );
+
+ // Delayed call to finish initialization
+ QTimer::singleShot( 100, this, SLOT( init() ) );
+
}
MainWindow :: ~MainWindow()
{
- delete networkPkgWindow;
+ delete mgr;
+}
+
+void MainWindow :: init()
+{
+ stack->raiseWidget( progressWindow );
+ mgr = new DataManager();
+ connect( mgr, SIGNAL( progressSetSteps( int ) ), progressWindow, SLOT( setSteps( int ) ) );
+ connect( mgr, SIGNAL( progressSetMessage( const QString & ) ),
+ progressWindow, SLOT( setMessage( const QString & ) ) );
+ connect( mgr, SIGNAL( progressUpdate( int ) ), progressWindow, SLOT( update( int ) ) );
+ mgr->loadServers();
+ networkPkgWindow->setDataManager( mgr );
+ networkPkgWindow->updateData();
+ stack->raiseWidget( networkPkgWindow );
}
void MainWindow :: setDocument( const QString &doc )
{
// Remove path from package
QString package = Utils::getPackageNameFromIpkFilename( doc );
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;
}
@@ -187,24 +214,34 @@ void MainWindow :: filterUpgradedPackages()
networkPkgWindow->showOnlyInstalledPackages( false );
networkPkgWindow->showUpgradedPackages( val );
}
void MainWindow :: setFilterCategory()
{
if ( networkPkgWindow->setFilterCategory( ) )
filter->setItemChecked( mnuFilterByCategory, true );
}
void MainWindow :: filterCategory()
{
if ( filter->isItemChecked( mnuFilterByCategory ) )
{
networkPkgWindow->filterByCategory( false );
filter->setItemChecked( mnuFilterByCategory, false );
}
else
{
if ( networkPkgWindow->filterByCategory( true ) )
filter->setItemChecked( mnuFilterByCategory, true );
}
}
+
+void MainWindow :: raiseMainWidget()
+{
+ stack->raiseWidget( networkPkgWindow );
+}
+
+void MainWindow :: raiseProgressWidget()
+{
+ stack->raiseWidget( progressWindow );
+}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 92aba4d..39799f9 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -1,68 +1,73 @@
/***************************************************************************
mainwin.h - 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. *
* *
***************************************************************************/
#ifndef MAINWIN_H
#define MAINWIN_H
#include <qmainwindow.h>
#include <qwidgetstack.h>
-
+class ProgressWidget;
class NetworkPackageManager;
class DataManager;
class MainWindow :public QMainWindow
{
Q_OBJECT
public:
MainWindow( QWidget *p = 0, char *name = 0 );
~MainWindow();
private:
DataManager *mgr;
QMenuBar *menu;
QPopupMenu *help;
QPopupMenu *settings;
QPopupMenu *edit;
QPopupMenu *filter;
QWidgetStack *stack;
NetworkPackageManager *networkPkgWindow;
+ ProgressWidget *progressWindow;
int mnuShowUninstalledPkgsId;
int mnuShowInstalledPkgsId;
int mnuShowUpgradedPkgsId;
int mnuFilterByCategory;
int mnuSetFilterCategory;
public slots:
void setDocument( const QString &doc );
void displayHelp();
void searchForPackage();
void repeatSearchForPackage();
void displayAbout();
void displaySettings();
void filterUninstalledPackages();
void filterInstalledPackages();
void filterUpgradedPackages();
void filterCategory();
void setFilterCategory();
+ void raiseMainWidget();
+ void raiseProgressWidget();
+private slots:
+ void init();
};
#endif
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index 79a380e..cae0d8f 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -25,112 +25,116 @@ using namespace std;
#ifdef QWS
#include <qpe/qpeapplication.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/config.h>
#else
#include <qapplication.h>
#endif
#include <qlabel.h>
#include <qfile.h>
#include <qmessagebox.h>
#include "datamgr.h"
#include "networkpkgmgr.h"
#include "installdlgimpl.h"
#include "ipkg.h"
#include "inputdlg.h"
#include "letterpushbutton.h"
#include "categoryfilterimpl.h"
#include "global.h"
extern int compareVersions( const char *v1, const char *v2 );
-NetworkPackageManager::NetworkPackageManager( DataManager *dataManager, QWidget *parent, const char *name)
+NetworkPackageManager::NetworkPackageManager( QWidget *parent, const char *name )
: QWidget(parent, name)
{
- dataMgr = dataManager;
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
#endif
showUninstalledPkgs = false;
showInstalledPkgs = false;
showUpgradedPkgs = false;
categoryFilterEnabled = false;
initGui();
setupConnections();
- updateData();
+ //updateData();
}
NetworkPackageManager::~NetworkPackageManager()
{
}
-void NetworkPackageManager :: timerEvent ( QTimerEvent * )
+void NetworkPackageManager :: setDataManager( DataManager *dm )
{
- killTimer( timerId );
-
- // Add server names to listbox
- updateData();
+ dataMgr = dm;
}
void NetworkPackageManager :: updateData()
{
+ emit progressSetSteps( dataMgr->getServerList().size() );
+
serversList->clear();
packagesList->clear();
-
vector<Server>::iterator it;
int activeItem = -1;
int i;
+ QString serverName;
for ( i = 0, it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it, ++i )
{
+ serverName = it->getServerName();
+ emit progressSetMessage( tr( "Building server list:\n\t%1" ).arg( serverName ) );
+ emit progressUpdate( i );
+ qApp->processEvents();
+
// cout << "Adding " << it->getServerName() << " to combobox" << endl;
if ( !it->isServerActive() )
{
- cout << it->getServerName() << " is not active" << endl;
+ cout << serverName << " is not active" << endl;
i--;
continue;
}
- serversList->insertItem( it->getServerName() );
- if ( it->getServerName() == currentlySelectedServer )
+
+ serversList->insertItem( serverName );
+ if ( serverName == currentlySelectedServer )
activeItem = i;
}
// set selected server to be active server
if ( activeItem != -1 )
serversList->setCurrentItem( activeItem );
- serverSelected( 0 );
+ serverSelected( 0, FALSE );
}
void NetworkPackageManager :: selectLocalPackage( const QString &pkg )
{
// First select local server
for ( int i = 0 ; i < serversList->count() ; ++i )
{
if ( serversList->text( i ) == LOCAL_IPKGS )
{
serversList->setCurrentItem( i );
break;
}
}
serverSelected( 0 );
// Now set the check box of the selected package
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
item != 0 ;
item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().startsWith( pkg ) )
{
item->setOn( true );
break;
@@ -172,78 +176,98 @@ void NetworkPackageManager :: initGui()
else
hbox4->addWidget( b );
}
}
vbox->addWidget( packagesList );
packagesList->addColumn( "Packages" );
QHBoxLayout *hbox2 = new QHBoxLayout( vbox, -1, "HBox2" );
hbox2->addWidget( update );
hbox2->addWidget( download );
hbox2->addWidget( upgrade );
hbox2->addWidget( apply );
}
void NetworkPackageManager :: setupConnections()
{
connect( serversList, SIGNAL(activated( int )), this, SLOT(serverSelected( int )));
connect( apply, SIGNAL(released()), this, SLOT(applyChanges()) );
connect( download, SIGNAL(released()), this, SLOT(downloadPackage()) );
connect( upgrade, SIGNAL( released()), this, SLOT(upgradePackages()) );
connect( update, SIGNAL(released()), this, SLOT(updateServer()) );
}
-void NetworkPackageManager :: showProgressDialog( char *initialText )
+void NetworkPackageManager :: serverSelected( int index )
{
- if ( !progressDlg )
- progressDlg = new ProgressDlg( this, "Progress", false );
- progressDlg->setText( initialText );
- progressDlg->show();
+ serverSelected( index, TRUE );
}
-
-void NetworkPackageManager :: serverSelected( int )
+void NetworkPackageManager :: serverSelected( int, bool raiseProgress )
{
- packagesList->clear();
-
// display packages
QString serverName = serversList->currentText();
currentlySelectedServer = serverName;
+ vector<Server>::iterator s = dataMgr->getServer( serverName );
+
+ vector<Package> &list = s->getPackageList();
+ vector<Package>::iterator it;
+
+ // Display progress widget while loading list
+ bool doProgress = ( list.size() > 200 );
+ if ( doProgress )
+ {
+ if ( raiseProgress )
+ {
+ emit appRaiseProgressWidget();
+ }
+ emit progressSetSteps( list.size() );
+ emit progressSetMessage( tr( "Building package list for:\n\t%1" ).arg( serverName ) );
+ }
+
+ packagesList->clear();
+
#ifdef QWS
// read download directory from config file
Config cfg( "aqpkg" );
cfg.setGroup( "settings" );
cfg.writeEntry( "selectedServer", currentlySelectedServer );
#endif
- vector<Server>::iterator s = dataMgr->getServer( serverName );
-
- vector<Package> &list = s->getPackageList();
- vector<Package>::iterator it;
+ int i = 0;
for ( it = list.begin() ; it != list.end() ; ++it )
{
+ // Update progress after every 100th package (arbitrary value, seems to give good balance)
+ i++;
+ if ( ( i % 100 ) == 0 )
+ {
+ if ( doProgress )
+ {
+ emit progressUpdate( i );
+ }
+ qApp->processEvents();
+ }
QString text = "";
// Apply show only uninstalled packages filter
if ( showUninstalledPkgs && it->isInstalled() )
continue;
// Apply show only installed packages filter
if ( showInstalledPkgs && !it->isInstalled() )
continue;
// Apply show only new installed packages filter
if ( showUpgradedPkgs )
{
if ( !it->isInstalled() ||
compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
continue;
}
// Apply the section filter
if ( categoryFilterEnabled && categoryFilter != "" )
{
if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 )
continue;
@@ -311,48 +335,54 @@ void NetworkPackageManager :: serverSelected( int )
}
packagesList->insertItem( item );
}
// If the local server or the local ipkgs server disable the download button
if ( serverName == LOCAL_SERVER )
{
upgrade->setEnabled( false );
download->setText( "Download" );
download->setEnabled( true );
}
else if ( serverName == LOCAL_IPKGS )
{
upgrade->setEnabled( false );
download->setEnabled( true );
download->setText( "Remove" );
}
else
{
upgrade->setEnabled( true );
download->setEnabled( true );
download->setText( "Download" );
}
+
+ // Display this widget once everything is done
+ if ( doProgress && raiseProgress )
+ {
+ emit appRaiseMainWidget();
+ }
}
void NetworkPackageManager :: updateServer()
{
QString serverName = serversList->currentText();
// Update the current server
// Display dialog
// Disable buttons to stop silly people clicking lots on them :)
// First, write out ipkg_conf file so that ipkg can use it
dataMgr->writeOutIpkgConf();
Ipkg ipkg;
ipkg.setOption( "update" );
InstallDlgImpl dlg( &ipkg, "Refreshing server package lists", this, "Upgrade", true );
dlg.showDlg();
// Reload data
dataMgr->reloadServerData();
serverSelected(-1);
// delete progDlg;
diff --git a/noncore/settings/aqpkg/networkpkgmgr.h b/noncore/settings/aqpkg/networkpkgmgr.h
index 46919d7..2206c81 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.h
+++ b/noncore/settings/aqpkg/networkpkgmgr.h
@@ -5,88 +5,96 @@
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. *
* *
***************************************************************************/
#ifndef NETWORKPKGMGR_H
#define NETWORKPKGMGR_H
#include <qlayout.h>
#include <qpushbutton.h>
#include <qwidget.h>
#include <qcombobox.h>
#include <qlistview.h>
#include "datamgr.h"
#include "progressdlg.h"
+
class InstallData;
/** NetworkPackageManager is the base class of the project */
class NetworkPackageManager : public QWidget
{
Q_OBJECT
public:
/** construtor */
- NetworkPackageManager( DataManager *dataManager, QWidget* parent=0, const char *name=0);
+ NetworkPackageManager( QWidget* parent=0, const char *name=0 );
/** destructor */
~NetworkPackageManager();
+ void setDataManager( DataManager *dm );
void selectLocalPackage( const QString &pkg );
void updateData();
void searchForPackage( bool findNext );
void showOnlyUninstalledPackages( bool val );
void showOnlyInstalledPackages( bool val );
void showUpgradedPackages( bool val );
bool filterByCategory( bool val );
bool setFilterCategory();
private:
DataManager *dataMgr;
QComboBox *serversList;
QListView *packagesList;
QPushButton *update;
QPushButton *upgrade;
QPushButton *download;
QPushButton *apply;
ProgressDlg *progressDlg;
QString currentlySelectedServer;
QString lastSearchText;
QString categoryFilter;
bool categoryFilterEnabled;
bool showJumpTo;
bool showUninstalledPkgs;
bool showInstalledPkgs;
bool showUpgradedPkgs;
- int timerId;
-
- void timerEvent ( QTimerEvent * );
void initGui();
void setupConnections();
void showProgressDialog( char *initialText );
void downloadSelectedPackages();
void downloadRemotePackage();
+ void serverSelected( int index, bool showProgress );
+
InstallData dealWithItem( QCheckListItem *item );
QString stickyOption;
+signals:
+ void appRaiseMainWidget();
+ void appRaiseProgressWidget();
+ void progressSetSteps( int );
+ void progressSetMessage( const QString & );
+ void progressUpdate( int );
+
public slots:
- void serverSelected( int index );
void applyChanges();
void upgradePackages();
void downloadPackage();
void updateServer();
void displayText( const QString &t );
void letterPushed( QString t );
+ void serverSelected( int index );
};
#endif
diff --git a/noncore/settings/aqpkg/progresswidget.cpp b/noncore/settings/aqpkg/progresswidget.cpp
new file mode 100644
index 0000000..bbafcac
--- a/dev/null
+++ b/noncore/settings/aqpkg/progresswidget.cpp
@@ -0,0 +1,66 @@
+/*
+                This file is part of the OPIE Project
+ =.
+             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include "progresswidget.h"
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qprogressbar.h>
+
+ProgressWidget::ProgressWidget( QWidget *parent, const char *name, WFlags f )
+ : QWidget( parent, name, f )
+{
+ QVBoxLayout *layout = new QVBoxLayout( this, 4, 4 );
+
+ m_status = new QLabel( this );
+ m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ layout->addWidget( m_status );
+
+ m_progress = new QProgressBar( this );
+ layout->addWidget( m_progress );
+}
+
+ProgressWidget::~ProgressWidget()
+{
+}
+
+void ProgressWidget::setSteps( int numsteps )
+{
+ m_progress->setTotalSteps( numsteps );
+}
+
+void ProgressWidget::setMessage( const QString &msg )
+{
+ m_status->setText( msg );
+}
+
+void ProgressWidget::update( int progress )
+{
+ m_progress->setProgress( progress );
+}
+
diff --git a/noncore/settings/aqpkg/progresswidget.h b/noncore/settings/aqpkg/progresswidget.h
new file mode 100644
index 0000000..7d99978
--- a/dev/null
+++ b/noncore/settings/aqpkg/progresswidget.h
@@ -0,0 +1,54 @@
+/*
+                This file is part of the OPIE Project
+ =.
+             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef PROGRESSWIDGET_H
+#define PROGRESSWIDGET_H
+
+#include <qwidget.h>
+
+class QLabel;
+class QProgressBar;
+
+class ProgressWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ ProgressWidget( QWidget * = 0, const char * = 0, WFlags = 0 );
+ ~ProgressWidget();
+
+private:
+ QLabel *m_status;
+ QProgressBar *m_progress;
+
+public slots:
+ void setSteps( int );
+ void setMessage( const QString & );
+ void update( int );
+};
+
+#endif