tweaks for qt 4.7
authorHeikki Holstila <heikki.holstila@gmail.com>
Tue, 26 Oct 2010 19:03:31 +0000 (22:03 +0300)
committerHeikki Holstila <heikki.holstila@gmail.com>
Tue, 26 Oct 2010 19:03:31 +0000 (22:03 +0300)
22 files changed:
TODO.txt
aaptinterface.cpp
confirmdialog.h
dimmer.cpp
dimmer.h
fapman
filterselect.h
help.h
logview.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
packageselector.h
packageview.cpp
packageview.h
packageview.ui
repoedit.h
repoview.h
rotatingbackground.cpp
rotatingbackground.h
settings.h
sortselector.h

index 9f694b3..1713db3 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -6,15 +6,18 @@
 
 0.6.7:
 * scale package icons to proper size in the package details dialog
-* other minor UI tweaks
+* minor UI tweaks and fixes for Qt 4.7
 * fix: show free space and size correctly for large filesystems
-- system upgrade warning does not work
-- remove autorotation hacks (should work now with maemo pr1.3)
-- make sure network is online on startup (utilize Qt mobility features)
-- possible to save package selection or a list of installed (user category) packages anywhere ("backup & restore")
+- use QNetworkSession
+- fix: date fetching is very slow with qt4.7
+- test blacklist functionality with very large lists
 
 
 0.7:
+- app list backup & restore
+
+
+0.8:
 - support loading .install files
 - support installing local .debs
 - dbus interface for installing packages by name
@@ -45,7 +48,7 @@ later/any/uncertain:
 
 
 known bugs:
-- possible to get stuck in portrait mode (wait for Qt autorotation fix)
 - no window menu indicator in stacked windows (probably a Qt bug)
 - updating menu icons after installation does not work or works only sometimes (currently disabled)
+- does not warn about system upgrade?
 
index c53088f..b00f257 100644 (file)
@@ -1738,7 +1738,7 @@ void AAptInterface::startFetchDates()
                                                QApplication::processEvents(QEventLoop::WaitForMoreEvents);
                                        }
                                } else {
-                                       while( iDateRequestsWaiting>50 ) {
+                                       while( iDateRequestsWaiting>1 ) {
                                                QApplication::processEvents(QEventLoop::WaitForMoreEvents);
                                        }
                                }
index c2f50cf..d6460fc 100644 (file)
@@ -36,6 +36,7 @@ public:
 
        void setText(QString title, QString text);
        void disableButton();
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        int exec() {
                QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
@@ -46,6 +47,7 @@ public:
                return e;
        }
 #endif
+       */
 
 protected:
     void changeEvent(QEvent *e);
index fdff869..1e539b6 100644 (file)
@@ -24,12 +24,15 @@ dimmer::dimmer(QWidget *parent) :
     QWidget(parent)
 {
        iParent = parent;
-       iAlpha = 205;
+
        iLayout = new QVBoxLayout(this);
        iLabel = new QLabel(this);
        iLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
        iLabel->setAlignment(Qt::AlignCenter);
        iLayout->addWidget(iLabel);
+       iLayout->setSizeConstraint(QLayout::SetMaximumSize);
+
+       iAlpha = 205;
        iBusy = false;
        iAnim = 0;
        iAnimDir = 1;
@@ -38,6 +41,7 @@ dimmer::dimmer(QWidget *parent) :
        iUpdateAnim = false;
        iDownloadSpeed = -1;
 
+
        iTimer = new QTimer(this);
        connect(iTimer,SIGNAL(timeout()),this,SLOT(timerEvent()));
 
@@ -106,17 +110,15 @@ void dimmer::timerEvent()
        iUpdateAnim = false;
 }
 
-void dimmer::resizeEvent(QResizeEvent *)
+void dimmer::resizeEvent(QResizeEvent* event)
 {
-       this->resize(iParent->size());
-       iLayout->setGeometry(iParent->rect());
-       iLayout->setSizeConstraint(QLayout::SetMaximumSize);
-       iAnimY = this->rect().height()-this->rect().height()/4;
+       iAnimY = this->rect().height() - this->rect().height() / 4;
+       QWidget::resizeEvent(event);
 }
 
 void dimmer::orientationChanged()
 {
-       resizeEvent(0);
+       //resize( iParent->size() );
 }
 
 void dimmer::dim(QString title, QString message)
@@ -131,6 +133,9 @@ void dimmer::dim(QString title, QString message)
        iAnimDir = 1;
 
        show();
+
+       resize(iParent->size());
+
        iTimer->start(250);
 }
 
index 22dfa90..ae84854 100644 (file)
--- a/dimmer.h
+++ b/dimmer.h
@@ -26,11 +26,11 @@ class dimmer : public QWidget
 {
     Q_OBJECT
 public:
-    explicit dimmer(QWidget *parent = 0);
+       explicit dimmer(QWidget *parent);
        virtual ~dimmer();
 
        void paintEvent(QPaintEvent *);
-       void resizeEvent(QResizeEvent *);
+       void resizeEvent(QResizeEvent* event);
 
        void dim(QString title, QString message);
        void undim();
diff --git a/fapman b/fapman
index 6dd305e..8a9a351 100755 (executable)
Binary files a/fapman and b/fapman differ
index c346863..401cd1a 100644 (file)
@@ -36,6 +36,7 @@ public:
 
        void setList(QStringList labels, int selected);
        int selection();
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        int exec() {
                QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
@@ -46,6 +47,7 @@ public:
                return e;
        }
 #endif
+       */
 
 protected:
     void changeEvent(QEvent *e);
diff --git a/help.h b/help.h
index 6b9ca4a..f062384 100644 (file)
--- a/help.h
+++ b/help.h
@@ -34,6 +34,7 @@ public:
     explicit Help(QWidget *parent = 0);
        virtual ~Help();
 
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        int exec() {
                QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
@@ -44,6 +45,7 @@ public:
                return e;
        }
 #endif
+       */
 
 protected:
     void changeEvent(QEvent *e);
index 3a548cc..58afbde 100644 (file)
@@ -59,11 +59,14 @@ LogView::~LogView()
 
 int LogView::exec()
 {
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
        if(r.width() < r.height())
                this->setAttribute(Qt::WA_Maemo5PortraitOrientation);
 #endif
+       */
+
        show();
 
        //ui->plainTextEdit->setMinimumHeight( ui->plainTextEdit->contentsRect().height() );
@@ -83,9 +86,12 @@ int LogView::exec()
 
        int e = QDialog::exec();
 
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        this->setAttribute(Qt::WA_Maemo5AutoOrientation);
 #endif
+       */
+
        return e;
 }
 
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) );
 }
 
 
index c2267e6..4b6266a 100644 (file)
@@ -59,6 +59,7 @@ public:
        void setNextOperation(nextOperation op_) { iNextOperation=op_; }
 
        void on_btnUpdate_clicked();
+       void resizeEvent(QResizeEvent* event);
 
 public slots:
        void orientationChanged();
index bd31c5e..3c8ed0a 100644 (file)
@@ -24,6 +24,9 @@
     <property name="spacing">
      <number>0</number>
     </property>
+    <property name="sizeConstraint">
+     <enum>QLayout::SetNoConstraint</enum>
+    </property>
     <property name="leftMargin">
      <number>20</number>
     </property>
     </property>
     <item>
      <widget class="QListWidget" name="listWidget">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
       <property name="editTriggers">
        <set>QAbstractItemView::NoEditTriggers</set>
       </property>
        <enum>QListView::LeftToRight</enum>
       </property>
       <property name="resizeMode">
-       <enum>QListView::Fixed</enum>
+       <enum>QListView::Adjust</enum>
+      </property>
+      <property name="gridSize">
+       <size>
+        <width>140</width>
+        <height>160</height>
+       </size>
       </property>
       <property name="viewMode">
        <enum>QListView::IconMode</enum>
     </item>
     <item>
      <widget class="QLabel" name="label">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
       <property name="text">
        <string/>
       </property>
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>23</height>
+     <height>24</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuMenu">
index 93b909c..ea66de8 100644 (file)
@@ -39,6 +39,7 @@ public:
        explicit PackageSelector(Package* pkg, AAptInterface* apt, Settings* set, QWidget *parent);
        virtual ~PackageSelector();
 
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        int exec() {
                QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
@@ -49,6 +50,7 @@ public:
                return e;
        }
 #endif
+       */
 
        Package::operation selectedOperation();
 
index 326a92e..f50f115 100644 (file)
@@ -290,6 +290,10 @@ void PackageView::orientationChanged()
 
 void PackageView::resizeEvent(QResizeEvent* event)
 {
+       if( iDimmer ) {
+               iDimmer->resize( this->size() );
+       }
+
        iListCoverLabel->setGeometry( ui->listWidget->rect() );
        QWidget::resizeEvent(event);
 }
index 6ffb5e8..9111ca8 100644 (file)
@@ -85,7 +85,7 @@ public:
 
        enum sortOrder { SortAlpha, SortDateDesc, SortSizeDesc };
 
-    explicit PackageView(QWidget *parent = 0);
+       explicit PackageView(QWidget *parent);
        virtual ~PackageView();
 
        void openWin();
@@ -104,6 +104,7 @@ public:
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        void show() {
                if( !isVisible() ) {
+                       /*
                        QRect r = dynamic_cast<QMainWindow*>(this->parent())->rect();
                        if(r.width() < r.height()) {
                                this->setAttribute(Qt::WA_Maemo5PortraitOrientation);
@@ -115,8 +116,11 @@ public:
                                        this->setAttribute( Qt::WA_Maemo5LandscapeOrientation );
                                }
                                this->setAttribute(Qt::WA_Maemo5StackedWindow);
-                               this->setWindowFlags(Qt::Window);
+                               this->setWindowFlags( Qt::Window );
                        }
+                       */
+                       this->setAttribute(Qt::WA_Maemo5StackedWindow);
+                       this->setWindowFlags( Qt::Window );
                }
                QMainWindow::show();
        }
index 5b650f9..b856b67 100644 (file)
      <x>0</x>
      <y>0</y>
      <width>800</width>
-     <height>23</height>
+     <height>24</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuMenu">
index 6591093..8d92cb2 100644 (file)
@@ -37,6 +37,7 @@ public:
        explicit RepoEdit(AAptInterface* apt, Repository* repo, int pos, QWidget *parent = 0);
        virtual ~RepoEdit();
 
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        int exec() {
                QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
@@ -47,7 +48,7 @@ public:
                return e;
        }
 #endif
-
+       */
 
 protected:
     void changeEvent(QEvent *e);
index c8d8dd0..ae14183 100644 (file)
@@ -44,6 +44,7 @@ public:
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        void show() {
                if( !isVisible() ) {
+                       /*
                        QRect r = dynamic_cast<QMainWindow*>(this->parent())->rect();
                        if(r.width() < r.height())
                                this->setAttribute(Qt::WA_Maemo5PortraitOrientation);
@@ -53,8 +54,9 @@ public:
                                else
                                        this->setAttribute( Qt::WA_Maemo5LandscapeOrientation );
                        }
+                       */
                        this->setAttribute(Qt::WA_Maemo5StackedWindow);
-                       this->setWindowFlags(Qt::Window);
+                       this->setWindowFlags( Qt::Window );
                }
                QMainWindow::show();
        }
index 43d9db7..10dd5cd 100644 (file)
@@ -86,12 +86,11 @@ void RotatingBackground::paintEvent(QPaintEvent *)
        }
 }
 
-void RotatingBackground::resizeEvent(QResizeEvent *)
+void RotatingBackground::resizeEvent(QResizeEvent* event)
 {
-       this->resize( dynamic_cast<QWidget*>(parent())->size() );
+       QWidget::resizeEvent(event);
 }
 
 void RotatingBackground::orientationChanged()
 {
-       resizeEvent(0);
 }
index 61ccf7b..5cb70eb 100644 (file)
@@ -30,8 +30,8 @@ public:
        virtual ~RotatingBackground();
 
        void loadWallpaper();
-       void paintEvent(QPaintEvent *);
-       void resizeEvent(QResizeEvent *);
+       void paintEvent(QPaintEvent*);
+       void resizeEvent(QResizeEvent* event);
 
 public slots:
        void orientationChanged();
index 35656a7..4936a21 100644 (file)
@@ -41,6 +41,7 @@ public:
        void setAptInterface(AAptInterface* apt) { iAptInterface=apt; }
        void setPackageView(PackageView* v_) { iPackageView=v_; }
 
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        void open() {
                QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
@@ -55,6 +56,7 @@ public:
                QDialog::open();
        }
 #endif
+       */
 
        QSettings* qsettings() { return iQSettings; }
 
index af86ff9..9b209cf 100644 (file)
@@ -35,6 +35,7 @@ public:
        explicit SortSelector(PackageView::sortOrder currOrder, QWidget *parent = 0);
        virtual ~SortSelector();
 
+       /*
 #ifdef Q_WS_MAEMO_5            // workaround for buggy Qt autorotation
        int exec() {
                QRect r = dynamic_cast<QWidget*>(this->parent())->rect();
@@ -45,6 +46,7 @@ public:
                return e;
        }
 #endif
+       */
        PackageView::sortOrder selectedOperation();
 
 protected: