OSDN Git Service

Added code to automatically resize (enlarge) the main window if it is too small for...
authorlordmulder <mulder2@gmx.de>
Tue, 5 Apr 2011 12:57:21 +0000 (14:57 +0200)
committerlordmulder <mulder2@gmx.de>
Tue, 5 Apr 2011 12:57:21 +0000 (14:57 +0200)
gui/MainWindow.ui
src/Config.h
src/Dialog_MainWindow.cpp

index b80d166..c7e6080 100644 (file)
@@ -32,6 +32,9 @@
         <property name="currentIndex">
          <number>0</number>
         </property>
+        <property name="usesScrollButtons">
+         <bool>false</bool>
+        </property>
         <widget class="QWidget" name="tabSourceFiles">
          <property name="font">
           <font>
               <rect>
                <x>0</x>
                <y>0</y>
-               <width>604</width>
-               <height>1091</height>
+               <width>602</width>
+               <height>1088</height>
               </rect>
              </property>
              <layout class="QGridLayout" name="gridLayout_22">
   <include location="../res/Icons.qrc"/>
   <include location="../res/Icons.qrc"/>
   <include location="../res/Icons.qrc"/>
+  <include location="../res/Icons.qrc"/>
  </resources>
  <connections>
   <connection>
index 2ecec94..9340983 100644 (file)
@@ -24,9 +24,9 @@
  */
 #define VER_LAMEXP_MAJOR                               4
 #define VER_LAMEXP_MINOR_HI                            0
-#define VER_LAMEXP_MINOR_LO                            1
-#define VER_LAMEXP_BUILD                               418
-#define VER_LAMEXP_SUFFIX                              Final-1
+#define VER_LAMEXP_MINOR_LO                            2
+#define VER_LAMEXP_BUILD                               421
+#define VER_LAMEXP_SUFFIX                              Alpha-1
 
 /*
  * Tools versions
index 7673072..c09a28d 100644 (file)
@@ -680,6 +680,9 @@ void MainWindow::changeEvent(QEvent *e)
                {
                        ShellIntegration::install();
                }
+
+               //Force resize, if needed
+               tabPageChanged(tabWidget->currentIndex());
        }
 }
 
@@ -1230,11 +1233,43 @@ void MainWindow::tabPageChanged(int idx)
                        actions.at(i)->setChecked(true);
                }
        }
-       
-       if(idx == tabWidget->indexOf(tabSourceFiles))
+
+       int initialWidth = this->width();
+       int maximumWidth = QApplication::desktop()->width();
+
+       if(this->isVisible())
+       {
+               while(tabWidget->width() < tabWidget->sizeHint().width())
+               {
+                       int previousWidth = this->width();
+                       this->resize(this->width() + 1, this->height());
+                       if(this->frameGeometry().width() >= maximumWidth) break;
+                       if(this->width() <= previousWidth) break;
+               }
+       }
+
+       if(idx == tabWidget->indexOf(tabOptions) && scrollArea->widget() && this->isVisible())
+       {
+               QApplication::processEvents();
+               while(scrollArea->viewport()->width() < scrollArea->widget()->width())
+               {
+                       int previousWidth = this->width();
+                       this->resize(this->width() + 1, this->height());
+                       if(this->frameGeometry().width() >= maximumWidth) break;
+                       if(this->width() <= previousWidth) break;
+               }
+       }
+       else if(idx == tabWidget->indexOf(tabSourceFiles))
        {
                m_dropNoteLabel->setGeometry(0, 0, sourceFileView->width(), sourceFileView->height());
        }
+
+       if(initialWidth < this->width())
+       {
+               QPoint prevPos = this->pos();
+               int delta = (this->width() - initialWidth) >> 2;
+               move(prevPos.x() - delta, prevPos.y());
+       }
 }
 
 /*