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>
<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>
<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>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>24</number>
<number>18</number>
</property>
<property name="leftMargin">
<number>8</number>
@ -71,7 +71,7 @@
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>12</number>
@ -154,13 +154,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>110</width>
<height>37</height>
<width>676</width>
<height>413</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>24</number>
<number>18</number>
</property>
<property name="leftMargin">
<number>8</number>
@ -169,7 +169,7 @@
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>12</number>
@ -252,13 +252,13 @@
<rect>
<x>0</x>
<y>0</y>
<width>110</width>
<height>37</height>
<width>676</width>
<height>413</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>24</number>
<number>18</number>
</property>
<property name="leftMargin">
<number>8</number>
@ -267,7 +267,7 @@
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
<number>8</number>
</property>
<property name="bottomMargin">
<number>12</number>
@ -350,8 +350,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>37</height>
<width>676</width>
<height>413</height>
</rect>
</property>
<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_TYPE Alpha
#define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 1120
#define VER_LAMEXP_BUILD 1122
///////////////////////////////////////////////////////////////////////////////
// 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
////////////////////////////////////////////////////////////
@ -403,6 +417,8 @@ void AboutDialog::showEvent(QShowEvent *e)
QTimer::singleShot(5000, this, SLOT(enableButtons()));
setCursor(QCursor(Qt::WaitCursor));
}
QTimer::singleShot(0, this, SLOT(adjustSize()));
}
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());
break;
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;
default:
TRIM_RIGHT(line);
@ -787,7 +803,7 @@ void AboutDialog::initLicenseTab(void)
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();
}
else

View File

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

View File

@ -1537,31 +1537,28 @@ void MainWindow::tabPageChanged(int idx)
}
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())
{
while(tabWidget->width() < tabWidget->sizeHint().width())
int delta = tabWidget->sizeHint().width() - tabWidget->width();
if(delta > 0)
{
int previousWidth = this->width();
this->resize(this->width() + 1, this->height());
if(this->frameGeometry().width() >= maximumWidth) break;
if(this->width() <= previousWidth) break;
this->resize(qMin(this->width() + delta, maximumWidth), this->height());
}
}
//Tab specific operations
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();
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;
}
this->resize(qMin(this->width() + delta, maximumWidth), this->height());
}
}
else if(idx == tabWidget->indexOf(tabSourceFiles))
@ -1580,6 +1577,7 @@ void MainWindow::tabPageChanged(int idx)
}
}
//Center window around previous position
if(initialWidth < this->width())
{
QPoint prevPos = this->pos();