Some optimizations in GUI resize code.

This commit is contained in:
LoRd_MuldeR 2012-09-20 22:52:52 +02:00
parent e03bd4c9ae
commit 057cb6fe4f
10 changed files with 661 additions and 646 deletions

File diff suppressed because it is too large Load Diff

View File

@ -169,7 +169,7 @@
</message> </message>
<message> <message>
<source>Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.</source> <source>Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.</source>
<translation>Hinweise: Diese Demo (Test) Version von LameXP läuft am %1 ab. Noch %2 Tage übrig.</translation> <translation>Hinweis: Diese Demo (Test) Version von LameXP läuft am %1 ab. Noch %2 Tage übrig.</translation>
</message> </message>
<message> <message>
<source>Aften - A/52 audio encoder</source> <source>Aften - A/52 audio encoder</source>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,7 @@
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
<number>24</number> <number>18</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>8</number> <number>8</number>
@ -71,7 +71,7 @@
<number>12</number> <number>12</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>12</number> <number>8</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>12</number> <number>12</number>
@ -154,13 +154,13 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>110</width> <width>676</width>
<height>37</height> <height>413</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing"> <property name="spacing">
<number>24</number> <number>18</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>8</number> <number>8</number>
@ -169,7 +169,7 @@
<number>12</number> <number>12</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>12</number> <number>8</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>12</number> <number>12</number>
@ -252,13 +252,13 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>110</width> <width>676</width>
<height>37</height> <height>413</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing"> <property name="spacing">
<number>24</number> <number>18</number>
</property> </property>
<property name="leftMargin"> <property name="leftMargin">
<number>8</number> <number>8</number>
@ -267,7 +267,7 @@
<number>12</number> <number>12</number>
</property> </property>
<property name="rightMargin"> <property name="rightMargin">
<number>12</number> <number>8</number>
</property> </property>
<property name="bottomMargin"> <property name="bottomMargin">
<number>12</number> <number>12</number>
@ -350,8 +350,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>100</width> <width>676</width>
<height>37</height> <height>413</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">

Binary file not shown.

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 6 #define VER_LAMEXP_MINOR_LO 6
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 1 #define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 1120 #define VER_LAMEXP_BUILD 1122
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -385,6 +385,20 @@ void AboutDialog::moveDisque(void)
} }
} }
} }
void AboutDialog::adjustSize(void)
{
int maximumHeight = QApplication::desktop()->availableGeometry().height();
int delta = infoScrollArea->widget()->height() - infoScrollArea->viewport()->height();
if(delta > 0)
{
this->resize(this->width(), qMin(this->height() + delta, maximumHeight));
this->move(this->x(), this->y() - (delta/2));
this->setMinimumHeight(qMax(this->minimumHeight(), this->height()));
}
}
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Protected Functions // Protected Functions
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
@ -403,6 +417,8 @@ void AboutDialog::showEvent(QShowEvent *e)
QTimer::singleShot(5000, this, SLOT(enableButtons())); QTimer::singleShot(5000, this, SLOT(enableButtons()));
setCursor(QCursor(Qt::WaitCursor)); setCursor(QCursor(Qt::WaitCursor));
} }
QTimer::singleShot(0, this, SLOT(adjustSize()));
} }
void AboutDialog::closeEvent(QCloseEvent *e) void AboutDialog::closeEvent(QCloseEvent *e)
@ -777,7 +793,7 @@ void AboutDialog::initLicenseTab(void)
if(!bIsBlank) licenseText += QString("<font size=\"+2\">%1</font><br>").arg(line.simplified()); if(!bIsBlank) licenseText += QString("<font size=\"+2\">%1</font><br>").arg(line.simplified());
break; break;
case 1: case 1:
if(!bIsBlank) licenseText += QString("<font size=\"+1\">%1</font><br>").arg(line.simplified()); if(!bIsBlank) licenseText += QString("<font size=\"+1\">%1 &minus; %2</font><br>").arg(line.simplified(), LINK("http://www.gnu.org/licenses/gpl-2.0.html"));
break; break;
default: default:
TRIM_RIGHT(line); TRIM_RIGHT(line);
@ -787,7 +803,7 @@ void AboutDialog::initLicenseTab(void)
if(!bIsBlank) counter++; if(!bIsBlank) counter++;
} }
licenseText += QString("<br><br>%1").arg(LINK("http://www.gnu.org/licenses/gpl-2.0.html")); licenseText += QString("<br>");
stream.device()->close(); stream.device()->close();
} }
else else

View File

@ -43,6 +43,7 @@ public slots:
void showAboutQt(void); void showAboutQt(void);
void moveDisque(void); void moveDisque(void);
void tabChanged(int index); void tabChanged(int index);
void adjustSize(void);
protected: protected:
virtual void showEvent(QShowEvent *e); virtual void showEvent(QShowEvent *e);

View File

@ -1537,31 +1537,28 @@ void MainWindow::tabPageChanged(int idx)
} }
int initialWidth = this->width(); int initialWidth = this->width();
int maximumWidth = QApplication::desktop()->width(); int maximumWidth = QApplication::desktop()->availableGeometry().width();
//Make sure all tab headers are fully visible
if(this->isVisible()) if(this->isVisible())
{ {
while(tabWidget->width() < tabWidget->sizeHint().width()) int delta = tabWidget->sizeHint().width() - tabWidget->width();
if(delta > 0)
{ {
int previousWidth = this->width(); this->resize(qMin(this->width() + delta, maximumWidth), this->height());
this->resize(this->width() + 1, this->height());
if(this->frameGeometry().width() >= maximumWidth) break;
if(this->width() <= previousWidth) break;
} }
} }
//Tab specific operations
if(idx == tabWidget->indexOf(tabOptions) && scrollArea->widget() && this->isVisible()) if(idx == tabWidget->indexOf(tabOptions) && scrollArea->widget() && this->isVisible())
{ {
for(int i = 0; i < 2; i++) scrollArea->widget()->updateGeometry();
scrollArea->viewport()->updateGeometry();
qApp->processEvents();
int delta = scrollArea->widget()->width() - scrollArea->viewport()->width();
if(delta > 0)
{ {
QApplication::processEvents(); this->resize(qMin(this->width() + delta, maximumWidth), this->height());
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)) else if(idx == tabWidget->indexOf(tabSourceFiles))
@ -1580,6 +1577,7 @@ void MainWindow::tabPageChanged(int idx)
} }
} }
//Center window around previous position
if(initialWidth < this->width()) if(initialWidth < this->width())
{ {
QPoint prevPos = this->pos(); QPoint prevPos = this->pos();