tweaks for qt 4.7
[fapman] / mainwindow.cpp
index 71d9337..d63700f 100644 (file)
@@ -82,12 +82,12 @@ MainWindow::MainWindow(QWidget *parent) :
                                                                           iSettings->qsettings()->value("search_desclong",false).toBool() );
 
 #ifdef Q_WS_MAEMO_5
-       this->setAttribute(Qt::WA_Maemo5StackedWindow);
        if( !iSettings->qsettings()->value("disable_autorotation",false).toBool() ) {
                this->setAttribute(Qt::WA_Maemo5AutoOrientation);
        } else {
                this->setAttribute(Qt::WA_Maemo5LandscapeOrientation);
        }
+       this->setAttribute(Qt::WA_Maemo5StackedWindow);
 #endif
 
        iDimmer = new dimmer(this);
@@ -423,7 +423,7 @@ void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> last
                                        installing_blacklisted = true;
                                }
 #ifdef Q_WS_MAEMO_5
-                               if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {
+                               if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {       // unreliable?
                                        warn_system_package_install = true;
                                }
 #endif
@@ -658,12 +658,25 @@ void MainWindow::on_actionLoad_file_triggered()
        }
 }
 
+void MainWindow::resizeEvent(QResizeEvent* event)
+{
+       QRect sg = ui->listWidget->rect();
+
+       if( sg.width() > sg.height() ) {
+               ui->listWidget->setGridSize( QSize((sg.width()-12)/5, (sg.height()-12)/2) );
+       } else {
+               ui->listWidget->setGridSize( QSize((sg.width()-12)/3, (sg.height()-12)/3) );
+       }
+
+       if( iDimmer ) {
+               iDimmer->resize( this->size() );
+       }
+
+       QMainWindow::resizeEvent(event);
+}
+
 void MainWindow::orientationChanged()
 {
-       if( QApplication::desktop()->width() > QApplication::desktop()->height() )
-               ui->listWidget->setGridSize( QSize((ui->listWidget->width()-12)/5, (ui->listWidget->height()-12)/2) );
-       else
-               ui->listWidget->setGridSize( QSize((ui->listWidget->width()-12)/3, (ui->listWidget->height()-12)/3) );
 }