author | drw <drw> | 2003-02-01 02:07:22 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-01 02:07:22 (UTC) |
commit | 766f09a89eef17808e77836f76371aab8ebc4c1c (patch) (side-by-side diff) | |
tree | 3a298c40d5b688dc409a0e6d251a514d88eada48 | |
parent | 266feac1ac442947651bf169dbf993c4d46d56ea (diff) | |
download | opie-766f09a89eef17808e77836f76371aab8ebc4c1c.zip opie-766f09a89eef17808e77836f76371aab8ebc4c1c.tar.gz opie-766f09a89eef17808e77836f76371aab8ebc4c1c.tar.bz2 |
Many updates to install dialog
-rw-r--r-- | noncore/settings/aqpkg/.cvsignore | 4 | ||||
-rw-r--r-- | noncore/settings/aqpkg/aqpkg.pro | 1 | ||||
-rw-r--r-- | noncore/settings/aqpkg/install.ui | 147 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.cpp | 132 | ||||
-rw-r--r-- | noncore/settings/aqpkg/installdlgimpl.h | 38 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 86 | ||||
-rw-r--r-- | noncore/settings/aqpkg/mainwin.h | 3 |
7 files changed, 164 insertions, 247 deletions
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore index ef0e27f..751040e 100644 --- a/noncore/settings/aqpkg/.cvsignore +++ b/noncore/settings/aqpkg/.cvsignore @@ -1,4 +1,2 @@ Makefile* -install.cpp -install.h instoptions.cpp @@ -9,2 +7,2 @@ settings.h categoryfilter.cpp -categoryfilter.h
\ No newline at end of file +categoryfilter.h diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro index d8eee6a..d3f898b 100644 --- a/noncore/settings/aqpkg/aqpkg.pro +++ b/noncore/settings/aqpkg/aqpkg.pro @@ -35,3 +35,2 @@ SOURCES = mainwin.cpp \ INTERFACES = settings.ui \ - install.ui \ instoptions.ui \ diff --git a/noncore/settings/aqpkg/install.ui b/noncore/settings/aqpkg/install.ui deleted file mode 100644 index 53622dd..0000000 --- a/noncore/settings/aqpkg/install.ui +++ b/dev/null @@ -1,147 +0,0 @@ -<!DOCTYPE UI><UI> -<class>InstallDlg</class> -<widget> - <class>QDialog</class> - <property stdset="1"> - <name>name</name> - <cstring>InstallDlg</cstring> - </property> - <property stdset="1"> - <name>geometry</name> - <rect> - <x>0</x> - <y>0</y> - <width>196</width> - <height>278</height> - </rect> - </property> - <property stdset="1"> - <name>caption</name> - <string>Install</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="1" > - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>destination</cstring> - </property> - </widget> - <widget row="3" column="0" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>btnInstall</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Start</string> - </property> - </widget> - <widget row="3" column="1" > - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>btnOptions</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Options</string> - </property> - </widget> - <widget row="2" column="0" rowspan="1" colspan="2" > - <class>QGroupBox</class> - <property stdset="1"> - <name>name</name> - <cstring>GroupBox2</cstring> - </property> - <property stdset="1"> - <name>title</name> - <string>Output</string> - </property> - <grid> - <property stdset="1"> - <name>margin</name> - <number>11</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget row="0" column="0" > - <class>QMultiLineEdit</class> - <property stdset="1"> - <name>name</name> - <cstring>output</cstring> - </property> - </widget> - </grid> - </widget> - <widget row="0" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel1</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Destination</string> - </property> - </widget> - <widget row="1" column="0" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>TextLabel3</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Space Avail</string> - </property> - </widget> - <widget row="1" column="1" > - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>txtAvailableSpace</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string></string> - </property> - </widget> - </grid> -</widget> -<connections> - <connection> - <sender>btnOptions</sender> - <signal>clicked()</signal> - <receiver>InstallDlg</receiver> - <slot>optionsSelected()</slot> - </connection> - <connection> - <sender>btnInstall</sender> - <signal>clicked()</signal> - <receiver>InstallDlg</receiver> - <slot>installSelected()</slot> - </connection> - <connection> - <sender>destination</sender> - <signal>highlighted(const QString&)</signal> - <receiver>InstallDlg</receiver> - <slot>displayAvailableSpace( const QString& )</slot> - </connection> - <slot access="public">displayAvailableSpace( const QString& )</slot> - <slot access="public">installSelected()</slot> - <slot access="public">displayText( const QString & )</slot> - <slot access="public">optionsSelected()</slot> -</connections> -</UI> diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp index 75ce1a1..65aaa32 100644 --- a/noncore/settings/aqpkg/installdlgimpl.cpp +++ b/noncore/settings/aqpkg/installdlgimpl.cpp @@ -17,2 +17,4 @@ +#include <stdio.h> + #ifdef QWS @@ -20,2 +22,3 @@ #include <qpe/qpeapplication.h> +#include <qpe/resource.h> #include <qpe/storage.h> @@ -23,14 +26,16 @@ -#include <qmultilineedit.h> -#include <qdialog.h> -#include <qcombobox.h> #include <qcheckbox.h> -#include <qpushbutton.h> +#include <qcombobox.h> +#include <qdialog.h> +#include <qgroupbox.h> +#include <qmultilineedit.h> #include <qlabel.h> - +#include <qlayout.h> +#include <qpushbutton.h> #include "datamgr.h" -#include "instoptionsimpl.h" #include "destination.h" +#include "instoptionsimpl.h" #include "installdlgimpl.h" +#include "ipkg.h" #include "utils.h" @@ -38,5 +43,8 @@ -InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) - : InstallDlg( parent, name, modal, fl ) +InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ) + : QWidget( 0, 0, 0 ) { + setCaption( title ); + init( TRUE ); + pIpkg = 0; @@ -60,5 +68,5 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d output->setReadOnly( true ); - QFont f( "helvetica" ); - f.setPointSize( 10 ); - output->setFont( f ); +// QFont f( "helvetica" ); +// f.setPointSize( 10 ); +// output->setFont( f ); @@ -79,5 +87,5 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d // setup package data - QString remove = "Remove\n"; - QString install = "\nInstall\n"; - QString upgrade = "\nUpgrade\n"; + QString remove = tr( "Remove\n" ); + QString install = tr( "Install\n" ); + QString upgrade = tr( "Upgrade\n" ); for ( it = packageList.begin() ; it != packageList.end() ; ++it ) @@ -88,3 +96,3 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d installList.push_back( item ); - install += " " + item.packageName + "\n"; + install.append( QString( " %1\n" ).arg( item.packageName ) ); } @@ -93,3 +101,3 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d removeList.push_back( item ); - remove += " " + item.packageName + "\n"; + remove.append( QString( " %1\n" ).arg( item.packageName ) ); } @@ -98,10 +106,12 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d updateList.push_back( item ); - QString type = " (Upgrade)"; + QString type; if ( item.option == "R" ) - type = " (ReInstall)"; - upgrade += " " + item.packageName + type + "\n"; - } + type = tr( "(ReInstall)" ); + else + type = tr( "(Upgrade)" ); + upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) ); + } } - output->setText( remove + install + upgrade ); + output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) ); @@ -110,5 +120,7 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d -InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) - : InstallDlg( parent, name, modal, fl ) +InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ) + : QWidget( 0, 0, 0 ) { + setCaption( title ); + init( FALSE ); pIpkg = ipkg; @@ -120,10 +132,48 @@ InstallDlgImpl::~InstallDlgImpl() { + if ( pIpkg ) + delete pIpkg; } -bool InstallDlgImpl :: showDlg() +void InstallDlgImpl :: init( bool displayextrainfo ) { - showMaximized(); - bool ret = exec(); + QGridLayout *layout = new QGridLayout( this ); + layout->setSpacing( 4 ); + layout->setMargin( 4 ); - return ret; + if ( displayextrainfo ) + { + QLabel *label = new QLabel( tr( "Destination" ), this ); + layout->addWidget( label, 0, 0 ); + destination = new QComboBox( FALSE, this ); + layout->addWidget( destination, 0, 1 ); + connect( destination, SIGNAL( highlighted( const QString & ) ), + this, SLOT( displayAvailableSpace( const QString & ) ) ); + + QLabel *label2 = new QLabel( tr( "Space Avail" ), this ); + layout->addWidget( label2, 1, 0 ); + txtAvailableSpace = new QLabel( "", this ); + layout->addWidget( txtAvailableSpace, 1, 1 ); + } + else + { + destination = 0x0; + txtAvailableSpace = 0x0; + } + + QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this ); + GroupBox2->layout()->setSpacing( 0 ); + GroupBox2->layout()->setMargin( 4 ); + + QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() ); + output = new QMultiLineEdit( GroupBox2 ); + GroupBox2Layout->addWidget( output ); + layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 ); + + btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this ); + layout->addWidget( btnInstall, 3, 0 ); + connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) ); + + btnOptions = new QPushButton( Resource::loadPixmap( "aqpkg/config" ), tr( "Options" ), this ); + layout->addWidget( btnOptions, 3, 1 ); + connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) ); } @@ -147,3 +197,3 @@ void InstallDlgImpl :: installSelected() { - if ( btnInstall->text() == "Abort" ) + if ( btnInstall->text() == tr( "Abort" ) ) { @@ -151,5 +201,5 @@ void InstallDlgImpl :: installSelected() { - displayText( "\n**** User Clicked ABORT ***" ); + displayText( tr( "\n**** User Clicked ABORT ***" ) ); pIpkg->abort(); - displayText( "**** Process Aborted ****" ); + displayText( tr( "**** Process Aborted ****" ) ); } @@ -157,2 +207,3 @@ void InstallDlgImpl :: installSelected() btnInstall->setText( tr( "Close" ) ); + btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); return; @@ -161,3 +212,3 @@ void InstallDlgImpl :: installSelected() { - done( 1 ); + emit reloadData( this ); return; @@ -169,4 +220,4 @@ void InstallDlgImpl :: installSelected() - btnInstall->setText( "Abort" ); - + btnInstall->setText( tr( "Abort" ) ); + btnInstall->setIconSet( Resource::loadPixmap( "close" ) ); if ( pIpkg ) @@ -174,3 +225,2 @@ void InstallDlgImpl :: installSelected() output->setText( "" ); - connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); @@ -244,2 +294,3 @@ void InstallDlgImpl :: installSelected() delete pIpkg; + pIpkg = 0; } @@ -249,4 +300,5 @@ void InstallDlgImpl :: installSelected() btnInstall->setText( tr( "Close" ) ); + btnInstall->setIconSet( Resource::loadPixmap( "enter" ) ); - if ( destination->currentText() != 0 && destination->currentText() != "" ) + if ( destination && destination->currentText() != 0 && destination->currentText() != "" ) displayAvailableSpace( destination->currentText() ); @@ -257,4 +309,5 @@ void InstallDlgImpl :: displayText(const QString &text ) { - QString t = output->text() + "\n" + text; - output->setText( t ); + //output->setText( QString( "%1\n%2" ).arg( output->text() ).arg( text ) ); + QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text ); + output->setText( newtext ); output->setCursorPosition( output->numLines(), 0 ); @@ -286,5 +339,6 @@ void InstallDlgImpl :: displayAvailableSpace( const QString &text ) else - space = "Unknown"; + space = tr( "Unknown" ); - txtAvailableSpace->setText( space ); + if ( txtAvailableSpace ) + txtAvailableSpace->setText( space ); } diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h index 2f80f08..4c9f087 100644 --- a/noncore/settings/aqpkg/installdlgimpl.h +++ b/noncore/settings/aqpkg/installdlgimpl.h @@ -22,6 +22,13 @@ using namespace std; +#include <qwidget.h> #include <qstring.h> -#include "ipkg.h" -#include "install.h" +class QComboBox; +class QLabel; +class QMultiLineEdit; +class QPushButton; + +class DataManager; +class Destination; +class Ipkg; @@ -36,13 +43,12 @@ public: -class InstallDlgImpl : public InstallDlg +class InstallDlgImpl : public QWidget { + Q_OBJECT public: - InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); - InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); + InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 ); + InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 ); ~InstallDlgImpl(); - bool showDlg(); bool upgradeServer( QString &server ); - protected: @@ -57,7 +63,19 @@ private: bool upgradePackages; + + QComboBox *destination; + QPushButton *btnInstall; + QPushButton *btnOptions; + QMultiLineEdit *output; + QLabel *txtAvailableSpace; - bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); + void init( bool ); + + bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); - void optionsSelected(); - void installSelected(); +signals: + void reloadData( InstallDlgImpl * ); + +public slots: + void optionsSelected(); + void installSelected(); void displayText(const QString &text ); diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index a25f5a7..947aace 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp @@ -47,2 +47,3 @@ #include "inputdlg.h" +#include "ipkg.h" #include "installdlgimpl.h" @@ -90,5 +91,2 @@ MainWindow :: MainWindow() QGridLayout *layout = new QGridLayout( w ); - //QVBoxLayout *vbox = new QVBoxLayout( w, 0, -1 ); - //QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 ); - //QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 ); @@ -102,8 +100,2 @@ MainWindow :: MainWindow() layout->addWidget( b, i / 13, i % 13); -/* - if ( i < 13 ) - hbox3->addWidget( b ); - else - hbox4->addWidget( b ); -*/ } @@ -800,9 +792,9 @@ void MainWindow :: updateServer() - Ipkg ipkg; - ipkg.setOption( "update" ); - - InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true ); - dlg.showDlg(); + Ipkg *ipkg = new Ipkg; + ipkg->setOption( "update" ); - reloadData(); + InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), + tr( "Update lists" ) ); + connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + dlg->showMaximized(); @@ -829,12 +821,13 @@ void MainWindow :: upgradePackages() // Now run upgrade - Ipkg ipkg; - ipkg.setOption( "upgrade" ); - - InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true ); - dlg.showDlg(); + Ipkg *ipkg = new Ipkg; + ipkg->setOption( "upgrade" ); - reloadData(); + InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), + tr ( "Upgrade" ) ); + connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + dlg->showMaximized(); } } - void MainWindow :: downloadPackage() + +void MainWindow :: downloadPackage() { @@ -900,3 +893,3 @@ void MainWindow :: upgradePackages() { - reloadData(); + reloadData( 0x0 ); } @@ -972,13 +965,5 @@ void MainWindow :: downloadRemotePackage() - InstallDlgImpl dlg2( workingPackages, mgr, this, "Install", true ); - dlg2.showDlg(); - - reloadData(); - -#ifdef QWS - // Finally let the main system update itself - QCopEnvelope e("QPE/System", "linkChanged(QString)"); - QString lf = QString::null; - e << lf; -#endif + InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); + connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + dlg->showMaximized(); } @@ -1018,13 +1003,5 @@ void MainWindow :: applyChanges() // do the stuff - InstallDlgImpl dlg( workingPackages, mgr, this, "Install", true ); - dlg.showDlg(); - - reloadData(); - -#ifdef QWS - // Finally let the main system update itself - QCopEnvelope e("QPE/System", "linkChanged(QString)"); - QString lf = QString::null; - e << lf; -#endif + InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); + connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); + dlg->showMaximized(); } @@ -1152,7 +1129,24 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item ) -void MainWindow :: reloadData() +void MainWindow :: reloadData( InstallDlgImpl *dlg ) { stack->raiseWidget( progressWindow ); + + if ( dlg ) + { + dlg->close(); + delete dlg; + } + mgr->reloadServerData(); serverSelected( -1, FALSE ); + +#ifdef QWS + m_status->setText( tr( "Updating Launcher..." ) ); + + // Finally let the main system update itself + QCopEnvelope e("QPE/System", "linkChanged(QString)"); + QString lf = QString::null; + e << lf; +#endif + stack->raiseWidget( networkPkgWindow ); diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h index b49c819..d0777fb 100644 --- a/noncore/settings/aqpkg/mainwin.h +++ b/noncore/settings/aqpkg/mainwin.h @@ -25,2 +25,3 @@ class DataManager; class InstallData; +class InstallDlgImpl; @@ -94,3 +95,2 @@ private: InstallData dealWithItem( QCheckListItem *item ); - void reloadData(); @@ -123,2 +123,3 @@ public slots: void enableDownload( bool ); + void reloadData( InstallDlgImpl * ); |