summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp92
-rw-r--r--noncore/settings/aqpkg/mainwin.h3
2 files changed, 65 insertions, 30 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index ae073ef..a25f5a7 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -49,59 +49,84 @@
#include "letterpushbutton.h"
#include "mainwin.h"
#include "settingsimpl.h"
#include "utils.h"
extern int compareVersions( const char *v1, const char *v2 );
MainWindow :: MainWindow()
: QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
{
setCaption( tr( "AQPkg - Package Manager" ) );
-#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
-
// Create UI widgets
initMainWidget();
initProgressWidget();
// Build menu and tool bars
setToolBarsMovable( FALSE );
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
QPEMenuBar *mb = new QPEMenuBar( bar );
mb->setMargin( 0 );
bar = new QPEToolBar( this );
// Find toolbar
findBar = new QPEToolBar( this );
addToolBar( findBar, QMainWindow::Top, true );
findBar->setHorizontalStretchable( true );
findEdit = new QLineEdit( findBar );
QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
findBar->setStretchableWidget( findEdit );
connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) );
+ // Quick jump toolbar
+ jumpBar = new QPEToolBar( this );
+ addToolBar( jumpBar, QMainWindow::Top, true );
+ jumpBar->setHorizontalStretchable( true );
+ QWidget *w = new QWidget( jumpBar );
+ jumpBar->setStretchableWidget( w );
+
+ QGridLayout *layout = new QGridLayout( w );
+ //QVBoxLayout *vbox = new QVBoxLayout( w, 0, -1 );
+ //QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 );
+ //QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 );
+
+ char text[2];
+ text[1] = '\0';
+ for ( int i = 0 ; i < 26 ; ++i )
+ {
+ text[0] = 'A' + i;
+ LetterPushButton *b = new LetterPushButton( text, w );
+ connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
+ layout->addWidget( b, i / 13, i % 13);
+/*
+ if ( i < 13 )
+ hbox3->addWidget( b );
+ else
+ hbox4->addWidget( b );
+*/
+ }
+
+ QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 );
+ a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
+ connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
+ a->addTo( jumpBar );
+ jumpBar->hide();
+
// Packages menu
QPopupMenu *popup = new QPopupMenu( this );
- QAction *a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 );
+ a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
a->addTo( popup );
a->addTo( bar );
actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 );
actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) );
actionUpgrade->addTo( popup );
actionUpgrade->addTo( bar );
iconDownload = Resource::loadPixmap( "aqpkg/download" );
@@ -159,24 +184,32 @@ MainWindow :: MainWindow()
a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to search for text in package names." ) );
connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
a->addTo( popup );
actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
actionFindNext->setEnabled( FALSE );
actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
actionFindNext->addTo( popup );
actionFindNext->addTo( findBar );
+
+ popup->insertSeparator();
+
+ a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 );
+ a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) );
+ connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) );
+ a->addTo( popup );
+
mb->insertItem( tr( "View" ), popup );
// Options menu
popup = new QPopupMenu( this );
a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 );
a->setWhatsThis( tr( "Click here to configure this application." ) );
connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) );
a->addTo( popup );
popup->insertSeparator();
@@ -229,65 +262,54 @@ void MainWindow :: initMainWidget()
installedIcon = Resource::loadPixmap( "aqpkg/installed" );
updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
packagesList = new QListView( networkPkgWindow );
packagesList->addColumn( tr( "Packages" ), 225 );
QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
hbox1->addWidget( l );
hbox1->addWidget( serversList );
-
- QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 );
- QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 );
-
- if ( showJumpTo )
- {
- char text[2];
- text[1] = '\0';
- for ( int i = 0 ; i < 26 ; ++i )
- {
- text[0] = 'A' + i;
- LetterPushButton *b = new LetterPushButton( text, networkPkgWindow );
- connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
- if ( i < 13 )
- hbox3->addWidget( b );
- else
- hbox4->addWidget( b );
- }
- }
-
vbox->addWidget( packagesList );
downloadEnabled = TRUE;
}
void MainWindow :: initProgressWidget()
{
progressWindow = new QWidget( this );
QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
m_status = new QLabel( progressWindow );
m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
layout->addWidget( m_status );
m_progress = new QProgressBar( progressWindow );
layout->addWidget( m_progress );
}
void MainWindow :: init()
{
+#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
+
stack->raiseWidget( progressWindow );
mgr = new DataManager();
connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) );
connect( mgr, SIGNAL( progressSetMessage( const QString & ) ),
this, SLOT( setProgressMessage( const QString & ) ) );
connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) );
mgr->loadServers();
showUninstalledPkgs = false;
showInstalledPkgs = false;
showUpgradedPkgs = false;
@@ -344,40 +366,50 @@ void MainWindow :: displayHelp()
{
HelpWindow *dlg = new HelpWindow( this );
dlg->exec();
delete dlg;
}
void MainWindow :: displayFindBar()
{
findBar->show();
findEdit->setFocus();
}
+void MainWindow :: displayJumpBar()
+{
+ jumpBar->show();
+}
+
void MainWindow :: repeatFind()
{
searchForPackage( findEdit->text() );
}
void MainWindow :: findPackage( const QString &text )
{
actionFindNext->setEnabled( !text.isEmpty() );
searchForPackage( text );
}
void MainWindow :: hideFindBar()
{
findBar->hide();
}
+void MainWindow :: hideJumpBar()
+{
+ jumpBar->hide();
+}
+
void MainWindow :: displayAbout()
{
QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) );
}
void MainWindow :: filterUninstalledPackages()
{
showUninstalledPkgs = actionUninstalled->isOn();
if ( showUninstalledPkgs )
{
showInstalledPkgs = FALSE;
showUpgradedPkgs = FALSE;
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index be30668..b49c819 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -39,24 +39,25 @@ class MainWindow :public QMainWindow
Q_OBJECT
public:
MainWindow();
~MainWindow();
private:
DataManager *mgr;
QWidgetStack *stack;
QPEToolBar *findBar;
+ QPEToolBar *jumpBar;
QLineEdit *findEdit;
QAction *actionFindNext;
QAction *actionFilter;
QAction *actionUpgrade;
QAction *actionDownload;
QAction *actionUninstalled;
QAction *actionInstalled;
QAction *actionUpdated;
QPixmap iconDownload;
QPixmap iconRemove;
@@ -95,27 +96,29 @@ private:
// Progress widget
QWidget *progressWindow;
QLabel *m_status;
QProgressBar *m_progress;
void initProgressWidget();
public slots:
// void setDocument( const QString &doc );
void displayHelp();
void displayFindBar();
+ void displayJumpBar();
void repeatFind();
void findPackage( const QString & );
void hideFindBar();
+ void hideJumpBar();
void displayAbout();
void displaySettings();
void filterUninstalledPackages();
void filterInstalledPackages();
void filterUpgradedPackages();
void filterCategory();
bool setFilterCategory();
void raiseMainWidget();
void raiseProgressWidget();
void enableUpgrade( bool );
void enableDownload( bool );