summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/mainwin.h
blob: b8e1c985b1052b2216a6018fadd07c7755cc77ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/*
                             This file is part of the OPIE Project
                             
               =.            Copyright (c)  2002 Andy Qua <andy.qua@blueyonder.co.uk>
             .=l.                                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 MAINWIN_H
#define MAINWIN_H

#include <qmainwindow.h>
#include <qpixmap.h>

class DataManager;
class InstallData;
class InstallDlgImpl;

class QAction;
class QCheckListItem;
class QComboBox;
class QLabel;
class QLineEdit;
class QListView;
class QListViewItem;
class QToolBar;
class QProgressBar;
class QPushButton;
class QWidgetStack;

class MainWindow :public  QMainWindow
{
    Q_OBJECT
public:

	MainWindow( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
	~MainWindow();
	static QString appName() { return QString::fromLatin1( "aqpkg" ); };

protected:
    void closeEvent( QCloseEvent* e );

private:
    DataManager *mgr;

    QWidgetStack *stack;
    
    QToolBar *findBar;
    QToolBar *jumpBar;
    QLineEdit  *findEdit;
    QAction    *actionFindNext;
    QAction    *actionFilter;
    QAction    *actionUpgrade;
    QAction    *actionDownload;
    QAction    *actionUninstalled;
    QAction    *actionInstalled;
    QAction    *actionUpdated;
    
    QPixmap iconDownload;
    QPixmap iconRemove;
    
    int mnuShowUninstalledPkgsId;
    int mnuShowInstalledPkgsId;
    int mnuShowUpgradedPkgsId;
    int mnuFilterByCategory;
    int mnuSetFilterCategory;

    // Main package list widget
    QWidget   *networkPkgWindow;
    QComboBox *serversList;
    QListView *packagesList;
    QPixmap    installedIcon;
    QPixmap    updatedIcon;
    QString    currentlySelectedServer;
    QString    categoryFilter;
    QString    stickyOption;

    bool categoryFilterEnabled;
    bool showJumpTo;
    bool showUninstalledPkgs;
    bool showInstalledPkgs;
    bool showUpgradedPkgs;
    bool downloadEnabled;
	bool reloadDocuments;

    void initMainWidget();
    void updateData();
    void serverSelected( int index, bool showProgress );
    void searchForPackage( const QString & );
    bool filterByCategory( bool val );
    void downloadSelectedPackages();
    void downloadRemotePackage();
    InstallData *dealWithItem( QCheckListItem *item );
    
    // Progress widget
    QWidget      *progressWindow;
    QLabel       *m_status;
    QProgressBar *m_progress;
    
    void initProgressWidget();
    
public slots:
    void setDocument( const QString &doc );
    void displayFindBar();
    void displayJumpBar();
    void repeatFind();
    void findPackage( const QString & );
    void hideFindBar();
    void hideJumpBar();
    void displaySettings();
    void filterUninstalledPackages();
    void filterInstalledPackages();
    void filterUpgradedPackages();
    void filterCategory();
    bool setFilterCategory();
    void raiseMainWidget();
    void raiseProgressWidget();
    void enableUpgrade( bool );
    void enableDownload( bool );
    void reloadData( InstallDlgImpl * );

private slots:
    void init();
    void setProgressSteps( int );
    void setProgressMessage( const QString & );
    void updateProgress( int );
    void serverSelected( int index );
    void updateServer();
    void upgradePackages();
    void downloadPackage();
    void applyChanges();
    void letterPushed( QString t );
    void slotDisplayPackage( QListViewItem * );
};

class QuestionDlg : public QWidget
{
    Q_OBJECT
public:
    QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn );
    
    int exec();
    
private:
    QPushButton *btn1;
    QPushButton *btn2;
    
    bool executing;
    int  buttonpressed;
    
private slots:
    void slotButtonPressed();
};

#endif