00001 /* 00002 This file is part of the OPIE Project 00003 00004 =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> 00005 .=l. Dan Williams <drw@handhelds.org> 00006 .>+-= 00007 _;:, .> :=|. This file is free software; you can 00008 .> <`_, > . <= redistribute it and/or modify it under 00009 :`=1 )Y*s>-.-- : the terms of the GNU General Public 00010 .="- .-=="i, .._ License as published by the Free Software 00011 - . .-<_> .<> Foundation; either version 2 of the License, 00012 ._= =} : or (at your option) any later version. 00013 .%`+i> _;_. 00014 .i_,=:_. -<s. This file is distributed in the hope that 00015 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00016 : .. .:, . . . without even the implied warranty of 00017 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00018 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General 00019 ..}^=.= = ; Public License for more details. 00020 ++= -. .` .: 00021 : = ...= . :.=- You should have received a copy of the GNU 00022 -. .:....=;==+<; General Public License along with this file; 00023 -_. . . )=. = see the file COPYING. If not, write to the 00024 -- :-=` Free Software Foundation, Inc., 00025 59 Temple Place - Suite 330, 00026 Boston, MA 02111-1307, USA. 00027 00028 */ 00029 00030 #ifndef MAINWIN_H 00031 #define MAINWIN_H 00032 00033 #include <qmainwindow.h> 00034 #include <qpixmap.h> 00035 00036 class DataManager; 00037 class InstallData; 00038 class InstallDlgImpl; 00039 00040 class QAction; 00041 class QCheckListItem; 00042 class QComboBox; 00043 class QLabel; 00044 class QLineEdit; 00045 class QListView; 00046 class QListViewItem; 00047 class QToolBar; 00048 class QProgressBar; 00049 class QPushButton; 00050 class QWidgetStack; 00051 00052 class MainWindow :public QMainWindow 00053 { 00054 Q_OBJECT 00055 public: 00056 00057 MainWindow( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 00058 ~MainWindow(); 00059 static QString appName() { return QString::fromLatin1( "aqpkg" ); }; 00060 00061 protected: 00062 void closeEvent( QCloseEvent* e ); 00063 00064 private: 00065 DataManager *mgr; 00066 00067 QWidgetStack *stack; 00068 00069 QToolBar *findBar; 00070 QToolBar *jumpBar; 00071 QLineEdit *findEdit; 00072 QAction *actionFindNext; 00073 QAction *actionFilter; 00074 QAction *actionUpgrade; 00075 QAction *actionDownload; 00076 QAction *actionUninstalled; 00077 QAction *actionInstalled; 00078 QAction *actionUpdated; 00079 00080 QPixmap iconDownload; 00081 QPixmap iconRemove; 00082 00083 int mnuShowUninstalledPkgsId; 00084 int mnuShowInstalledPkgsId; 00085 int mnuShowUpgradedPkgsId; 00086 int mnuFilterByCategory; 00087 int mnuSetFilterCategory; 00088 00089 // Main package list widget 00090 QWidget *networkPkgWindow; 00091 QComboBox *serversList; 00092 QListView *packagesList; 00093 QPixmap installedIcon; 00094 QPixmap updatedIcon; 00095 QString currentlySelectedServer; 00096 QString categoryFilter; 00097 QString stickyOption; 00098 00099 bool categoryFilterEnabled; 00100 bool showJumpTo; 00101 bool showUninstalledPkgs; 00102 bool showInstalledPkgs; 00103 bool showUpgradedPkgs; 00104 bool downloadEnabled; 00105 bool reloadDocuments; 00106 00107 void initMainWidget(); 00108 void updateData(); 00109 void serverSelected( int index, bool showProgress ); 00110 void searchForPackage( const QString & ); 00111 bool filterByCategory( bool val ); 00112 void downloadSelectedPackages(); 00113 void downloadRemotePackage(); 00114 InstallData *dealWithItem( QCheckListItem *item ); 00115 00116 // Progress widget 00117 QWidget *progressWindow; 00118 QLabel *m_status; 00119 QProgressBar *m_progress; 00120 00121 void initProgressWidget(); 00122 00123 public slots: 00124 void setDocument( const QString &doc ); 00125 void displayFindBar(); 00126 void displayJumpBar(); 00127 void repeatFind(); 00128 void findPackage( const QString & ); 00129 void hideFindBar(); 00130 void hideJumpBar(); 00131 void displaySettings(); 00132 void filterUninstalledPackages(); 00133 void filterInstalledPackages(); 00134 void filterUpgradedPackages(); 00135 void filterCategory(); 00136 bool setFilterCategory(); 00137 void raiseMainWidget(); 00138 void raiseProgressWidget(); 00139 void enableUpgrade( bool ); 00140 void enableDownload( bool ); 00141 void reloadData( InstallDlgImpl * ); 00142 00143 private slots: 00144 void init(); 00145 void setProgressSteps( int ); 00146 void setProgressMessage( const QString & ); 00147 void updateProgress( int ); 00148 void serverSelected( int index ); 00149 void updateServer(); 00150 void upgradePackages(); 00151 void downloadPackage(); 00152 void applyChanges(); 00153 void letterPushed( QString t ); 00154 void slotDisplayPackage( QListViewItem * ); 00155 }; 00156 00157 class QuestionDlg : public QWidget 00158 { 00159 Q_OBJECT 00160 public: 00161 QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ); 00162 00163 int exec(); 00164 00165 private: 00166 QPushButton *btn1; 00167 QPushButton *btn2; 00168 00169 bool executing; 00170 int buttonpressed; 00171 00172 private slots: 00173 void slotButtonPressed(); 00174 }; 00175 00176 #endif
1.4.2