Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 54ee115..c803ca0 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -69,49 +69,49 @@ void MainWindow::makeMenu() | |||
69 | 69 | ||
70 | QPEToolBar *toolBar = new QPEToolBar( this ); | 70 | QPEToolBar *toolBar = new QPEToolBar( this ); |
71 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 71 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
72 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 72 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
73 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 73 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
74 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 74 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
75 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 75 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
76 | 76 | ||
77 | popupMenu = new QPopupMenu( this ); | 77 | popupMenu = new QPopupMenu( this ); |
78 | 78 | ||
79 | contextMenu = new QPopupMenu( this ); | 79 | contextMenu = new QPopupMenu( this ); |
80 | 80 | ||
81 | setToolBarsMovable( false ); | 81 | setToolBarsMovable( false ); |
82 | toolBar->setHorizontalStretchable( true ); | 82 | toolBar->setHorizontalStretchable( true ); |
83 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 83 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
84 | menuBar->insertItem( tr( "View" ), viewMenu ); | 84 | menuBar->insertItem( tr( "View" ), viewMenu ); |
85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
87 | 87 | ||
88 | QLabel *spacer = new QLabel( "", toolBar ); | 88 | QLabel *spacer = new QLabel( "", toolBar ); |
89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
90 | toolBar->setStretchableWidget( spacer ); | 90 | toolBar->setStretchableWidget( spacer ); |
91 | 91 | ||
92 | 92 | ||
93 | runAction = new QAction( tr( "Commit" ), | 93 | runAction = new QAction( tr( "Apply" ), |
94 | Resource::loadPixmap( "oipkg/install" ), | 94 | Resource::loadPixmap( "oipkg/install" ), |
95 | QString::null, 0, this, 0 ); | 95 | QString::null, 0, this, 0 ); |
96 | connect( runAction, SIGNAL( activated() ), | 96 | connect( runAction, SIGNAL( activated() ), |
97 | this, SLOT( runIpkg() ) ); | 97 | this, SLOT( runIpkg() ) ); |
98 | runAction->addTo( toolBar ); | 98 | runAction->addTo( toolBar ); |
99 | runAction->addTo( srvMenu ); | 99 | runAction->addTo( srvMenu ); |
100 | 100 | ||
101 | srvMenu->insertSeparator (); | 101 | srvMenu->insertSeparator (); |
102 | 102 | ||
103 | updateAction = new QAction( tr( "Update" ), | 103 | updateAction = new QAction( tr( "Update" ), |
104 | Resource::loadIconSet( "oipkg/update" ), | 104 | Resource::loadIconSet( "oipkg/update" ), |
105 | QString::null, 0, this, 0 ); | 105 | QString::null, 0, this, 0 ); |
106 | connect( updateAction, SIGNAL( activated() ), | 106 | connect( updateAction, SIGNAL( activated() ), |
107 | this , SLOT( updateList() ) ); | 107 | this , SLOT( updateList() ) ); |
108 | updateAction->addTo( toolBar ); | 108 | updateAction->addTo( toolBar ); |
109 | updateAction->addTo( srvMenu ); | 109 | updateAction->addTo( srvMenu ); |
110 | 110 | ||
111 | detailsAction = new QAction( tr( "Details" ), | 111 | detailsAction = new QAction( tr( "Details" ), |
112 | Resource::loadIconSet( "find" ), | 112 | Resource::loadIconSet( "find" ), |
113 | QString::null, 0, this, 0 ); | 113 | QString::null, 0, this, 0 ); |
114 | connect( detailsAction, SIGNAL( activated() ), | 114 | connect( detailsAction, SIGNAL( activated() ), |
115 | this , SLOT( showDetails() ) ); | 115 | this , SLOT( showDetails() ) ); |
116 | detailsAction->addTo( toolBar ); | 116 | detailsAction->addTo( toolBar ); |
117 | detailsAction->addTo( srvMenu ); | 117 | detailsAction->addTo( srvMenu ); |
@@ -150,78 +150,78 @@ void MainWindow::makeMenu() | |||
150 | // section->setBackgroundMode( PaletteBackground ); | 150 | // section->setBackgroundMode( PaletteBackground ); |
151 | label = new QLabel( " / ", sectionBar ); | 151 | label = new QLabel( " / ", sectionBar ); |
152 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 152 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
153 | subsection = new QComboBox( false, sectionBar ); | 153 | subsection = new QComboBox( false, sectionBar ); |
154 | 154 | ||
155 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 155 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
156 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 156 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
157 | a->addTo( sectionBar ); | 157 | a->addTo( sectionBar ); |
158 | 158 | ||
159 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 159 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
160 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 160 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
161 | sectionAction->setToggleAction( true ); | 161 | sectionAction->setToggleAction( true ); |
162 | sectionAction->setOn( true ); | 162 | sectionAction->setOn( true ); |
163 | sectionAction->addTo( viewMenu ); | 163 | sectionAction->addTo( viewMenu ); |
164 | 164 | ||
165 | findBar = new QPEToolBar(this); | 165 | findBar = new QPEToolBar(this); |
166 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 166 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); |
167 | label = new QLabel( tr("Filter: "), findBar ); | 167 | label = new QLabel( tr("Filter: "), findBar ); |
168 | label->setBackgroundColor( findBar->backgroundColor() ); | 168 | label->setBackgroundColor( findBar->backgroundColor() ); |
169 | findBar->setHorizontalStretchable( TRUE ); | 169 | findBar->setHorizontalStretchable( TRUE ); |
170 | findEdit = new QLineEdit( findBar, "findEdit" ); | 170 | findEdit = new QLineEdit( findBar, "findEdit" ); |
171 | findBar->setStretchableWidget( findEdit ); | 171 | findBar->setStretchableWidget( findEdit ); |
172 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 172 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
173 | this, SLOT( displayList() ) ); | 173 | this, SLOT( displayList() ) ); |
174 | //a = new QAction( tr( "Filter" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 ); | 174 | |
175 | // connect( a, SIGNAL( activated() ), this, SLOT( filterList() ) ); | ||
176 | // a->addTo( findBar ); | ||
177 | // a->addTo( edit ); | ||
178 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 175 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
179 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 176 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
180 | a->addTo( findBar ); | 177 | a->addTo( findBar ); |
181 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | 178 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); |
182 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 179 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
183 | findAction->setToggleAction( true ); | 180 | findAction->setToggleAction( true ); |
184 | findAction->setOn( true ); | 181 | findAction->setOn( true ); |
185 | findAction->addTo( viewMenu ); | 182 | findAction->addTo( viewMenu ); |
186 | |||
187 | } | 183 | } |
188 | 184 | ||
189 | MainWindow::~MainWindow() | 185 | MainWindow::~MainWindow() |
190 | { | 186 | { |
191 | } | 187 | } |
192 | 188 | ||
193 | void MainWindow::runIpkg() | 189 | void MainWindow::runIpkg() |
194 | { | 190 | { |
195 | ipkg->commit( packageList ); | 191 | ipkg->commit( packageList ); |
196 | updateList(); //to remove | 192 | // updateList(); //to remove |
197 | } | 193 | } |
198 | 194 | ||
199 | void MainWindow::updateList() | 195 | void MainWindow::updateList() |
200 | { | 196 | { |
197 | QTimer *t = new QTimer( this ); | ||
198 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | ||
199 | t->start( 0, false ); | ||
201 | packageList.clear(); | 200 | packageList.clear(); |
202 | ipkg->update(); | 201 | ipkg->update(); |
203 | getList(); | 202 | getList(); |
203 | t->stop(); | ||
204 | } | 204 | } |
205 | 205 | ||
206 | void MainWindow::getList() | 206 | void MainWindow::getList() |
207 | { | 207 | { |
208 | packageList.update(); | 208 | packageList.update(); |
209 | displayList(); | 209 | displayList(); |
210 | } | 210 | } |
211 | 211 | ||
212 | void MainWindow::filterList() | 212 | void MainWindow::filterList() |
213 | { | 213 | { |
214 | QString f = ""; | 214 | QString f = ""; |
215 | if ( findAction->isOn() ) f = findEdit->text(); | 215 | if ( findAction->isOn() ) f = findEdit->text(); |
216 | packageList.filterPackages( f ); | 216 | packageList.filterPackages( f ); |
217 | } | 217 | } |
218 | 218 | ||
219 | void MainWindow::displayList() | 219 | void MainWindow::displayList() |
220 | { | 220 | { |
221 | filterList(); | 221 | filterList(); |
222 | listViewPackages->clear(); | 222 | listViewPackages->clear(); |
223 | Package *pack = packageList.first(); | 223 | Package *pack = packageList.first(); |
224 | while( pack ) | 224 | while( pack ) |
225 | { | 225 | { |
226 | if ( pack && (pack->name() != "") ) | 226 | if ( pack && (pack->name() != "") ) |
227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); | 227 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) ); |
@@ -325,24 +325,33 @@ void MainWindow::setCurrent( QListViewItem* p ) | |||
325 | void MainWindow::sectionShow(bool b) | 325 | void MainWindow::sectionShow(bool b) |
326 | { | 326 | { |
327 | if (b) sectionBar->show(); | 327 | if (b) sectionBar->show(); |
328 | else sectionBar->hide(); | 328 | else sectionBar->hide(); |
329 | sectionAction->setOn( b ); | 329 | sectionAction->setOn( b ); |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::sectionClose() | 332 | void MainWindow::sectionClose() |
333 | { | 333 | { |
334 | sectionAction->setOn( false ); | 334 | sectionAction->setOn( false ); |
335 | } | 335 | } |
336 | 336 | ||
337 | void MainWindow::findShow(bool b) | 337 | void MainWindow::findShow(bool b) |
338 | { | 338 | { |
339 | if (b) findBar->show(); | 339 | if (b) findBar->show(); |
340 | else findBar->hide(); | 340 | else findBar->hide(); |
341 | findAction->setOn( b ); | 341 | findAction->setOn( b ); |
342 | } | 342 | } |
343 | 343 | ||
344 | void MainWindow::findClose() | 344 | void MainWindow::findClose() |
345 | { | 345 | { |
346 | findAction->setOn( false ); | 346 | findAction->setOn( false ); |
347 | } | 347 | } |
348 | 348 | ||
349 | void MainWindow::rotateUpdateIcon() | ||
350 | { | ||
351 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | ||
352 | if ( updateIcon ) | ||
353 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | ||
354 | else | ||
355 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | ||
356 | updateIcon = !updateIcon; | ||
357 | } | ||