00001 /* 00002 This file is part of the Opie Project 00003 00004 Copyright (C)2004, 2005 Dan Williams <drw@handhelds.org> 00005 =. 00006 .=l. 00007 .>+-= 00008 _;:, .> :=|. This program is free software; you can 00009 .> <`_, > . <= redistribute it and/or modify it under 00010 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00011 .="- .-=="i, .._ License as published by the Free Software 00012 - . .-<_> .<> Foundation; either version 2 of the License, 00013 ._= =} : or (at your option) any later version. 00014 .%`+i> _;_. 00015 .i_,=:_. -<s. This program is distributed in the hope that 00016 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00017 : .. .:, . . . without even the implied warranty of 00018 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00019 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00020 ..}^=.= = ; Library General Public License for more 00021 ++= -. .` .: details. 00022 : = ...= . :.=- 00023 -. .:....=;==+<; You should have received a copy of the GNU 00024 -_. . . )=. = Library General Public License along with 00025 -- :-=` this library; see the file COPYING.LIB. 00026 If not, write to the Free Software Foundation, 00027 Inc., 59 Temple Place - Suite 330, 00028 Boston, MA 02111-1307, USA. 00029 */ 00030 00031 #ifndef MAINWINDOW_H 00032 #define MAINWINDOW_H 00033 00034 #include "opackagemanager.h" 00035 00036 #include <qpe/config.h> 00037 00038 #include <qlabel.h> 00039 #include <qlistview.h> 00040 #include <qmainwindow.h> 00041 #include <qpixmap.h> 00042 #include <qprogressbar.h> 00043 #include <qtoolbar.h> 00044 #include <qwidgetstack.h> 00045 00046 class QAction; 00047 class QLineEdit; 00048 00049 class MainWindow :public QMainWindow 00050 { 00051 Q_OBJECT 00052 00053 public: 00054 MainWindow( QWidget *parent = 0x0, const char *name = 0x0, WFlags fl = 0 ); 00055 static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); }; 00056 00057 protected: 00058 void closeEvent( QCloseEvent *event ); 00059 00060 private: 00061 Config m_config; // Configuration file 00062 00063 OPackageManager m_packman; // Package manager 00064 00065 // Toolbars 00066 QToolBar m_menuBar; // Main toolbar containing menu 00067 QToolBar m_toolBar; // Main toolbar 00068 QToolBar m_findBar; // Find toolbar 00069 00070 QWidgetStack m_widgetStack; // Main widget stack which contains m_packageList & m_statusWidget 00071 QListView m_packageList; // Main list view of all packages 00072 00073 QLineEdit *m_findEdit; // Line edit box used for find toolbar 00074 00075 // Status widget controls 00076 QWidget m_statusWidget; // Widget to display status during long operations 00077 QLabel m_statusText; // Text status message 00078 QProgressBar m_statusBar; // Progress bar showing % completed 00079 00080 // Icon pixmaps 00081 QPixmap m_iconUpdated; // Cached icon which shows when package can be updated 00082 QPixmap m_iconInstalled; // Cached icon which shows when package is installed 00083 QPixmap m_iconNull; // Cached icon which shows when package is not installed 00084 00085 // Menu/tool bar actions 00086 QAction *m_actionShowNotInstalled; // Action to show pakages not currently installed 00087 QAction *m_actionShowInstalled; // Action to show pakages currently installed 00088 QAction *m_actionShowUpdated; // Action to show pakages currently installed with update available 00089 QAction *m_actionFilter; // Action to filter packages 00090 QAction *m_actionFindNext; // Action to find next match 00091 00092 // Cached filter settings 00093 QString m_filterName; // Cached name filter value 00094 QString m_filterServer; // Cached server name filter value 00095 QString m_filterDest; // Cached destination name filter value 00096 OPackageManager::Status m_filterStatus; // Cached status filter value 00097 QString m_filterCategory; // Cached category filter value 00098 00099 void initPackageList(); 00100 void initStatusWidget(); 00101 void initUI(); 00102 00103 void loadPackageList( OPackageList *packages = 0x0, bool clearList = true ); 00104 void searchForPackage( const QString &text ); 00105 void installLocalPackage( const QString &ipkFile ); 00106 00107 private slots: 00108 void setDocument( const QString &ipkFile ); 00109 00110 void initPackageInfo(); 00111 void slotWidgetStackShow( QWidget *widget ); 00112 00113 // Status widget slots 00114 void slotInitStatusBar( int numSteps ); 00115 void slotStatusText( const QString &status ); 00116 void slotStatusBar( int currStep ); 00117 00118 // Actions menu action slots 00119 void slotUpdate(); 00120 void slotUpgrade(); 00121 void slotDownload(); 00122 void slotApply(); 00123 void slotInstallLocal(); 00124 void slotCloseDlg(); 00125 void slotConfigure(); 00126 00127 // View menu action slots 00128 void slotShowNotInstalled(); 00129 void slotShowInstalled(); 00130 void slotShowUpdated(); 00131 void slotFilterChange(); 00132 void slotFilter( bool isOn ); 00133 00134 // Find action slots 00135 void slotFindShowToolbar(); 00136 void slotFindHideToolbar(); 00137 void slotFindChanged( const QString &findText ); 00138 void slotFindNext(); 00139 00140 // Other slots 00141 void slotDisplayPackageInfo( QListViewItem * ); 00142 }; 00143 00144 #endif
1.4.2