Changed: #1193 Polish code and layout dialogs.

This commit is contained in:
dnk-88 2011-03-05 14:58:06 +02:00
parent c91a062a7b
commit 7cd791496a
5 changed files with 124 additions and 166 deletions

View file

@ -6,31 +6,15 @@
<rect>
<x>0</x>
<y>0</y>
<width>239</width>
<height>264</height>
<width>200</width>
<height>252</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::East</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabWidgetPage1">
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Sound name</string>
@ -73,7 +57,7 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="spawnCheckBox">
@ -91,24 +75,38 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item>
<widget class="QCheckBox" name="keepPitchCheckBox">
<property name="text">
<string>Keep original pitch</string>
</property>
</widget>
</item>
<item row="3" column="0">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Emission percent:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item>
<widget class="NLQT::CEditRangeFloatWidget" name="emissionWidget" native="true"/>
</item>
<item row="5" column="0">
<item>
<widget class="NLQT::CAttribFloatWidget" name="gainWidget">
<property name="title">
<string>Sound volume</string>
</property>
</widget>
</item>
<item>
<widget class="NLQT::CAttribFloatWidget" name="pitchWidget">
<property name="title">
<string>Sound pitch</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -116,63 +114,13 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>51</height>
<height>22</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabWidgetPage2">
<attribute name="title">
<string>Sound volume</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="NLQT::CAttribFloatWidget" name="gainWidget"/>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>209</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabWidgetPage3">
<attribute name="title">
<string>Sound pitch</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="NLQT::CAttribFloatWidget" name="pitchWidget"/>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>208</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>NLQT::CEditRangeFloatWidget</class>

View file

@ -60,6 +60,9 @@
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

View file

@ -112,24 +112,31 @@ void CParticleTextureWidget::updateTexture()
_ui.nameLabel->setText(tr("Name:"));
_ui.sizeLabel->setText(tr("Size:"));
_ui.depthLabel->setText(tr("Depth:"));
if (!_Texture)
{
_ui.imageLabel->setText("");
_ui.imageLabel->setPixmap(QPixmap());
if (!_Texture)
return;
}
if (dynamic_cast<NL3D::CTextureFile *>(_Wrapper->get()))
{
std::string texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName().c_str();
_ui.nameLabel->setText(tr("Name: %1").arg(texName.c_str()));
if (!NLMISC::CFile::getFilename(texName).empty())
{
QPixmap pixmap(NLMISC::CPath::lookup(texName).c_str());
std::string path;
try
{
path = NLMISC::CPath::lookup(texName);
}
catch (NLMISC::Exception &e)
{
_ui.imageLabel->setText(e.what());
return;
}
QPixmap pixmap(path.c_str());
_ui.sizeLabel->setText(tr("Size: %1x%2").arg(pixmap.width()).arg(pixmap.height()));
_ui.depthLabel->setText(tr("Depth: %1").arg(pixmap.depth()));
_ui.imageLabel->setPixmap(pixmap);
}
else
_ui.imageLabel->setPixmap(QPixmap());
}
}

View file

@ -321,7 +321,7 @@ void CTextureGradientInterface::displayValue(uint index, QListWidgetItem *item)
std::string texName = (static_cast<NL3D::CTextureFile *>(tex.getPtr()))->getFileName().c_str();
if (!texName.empty())
{
pixmap.load(NLMISC::CPath::lookup(texName).c_str());
pixmap.load(NLMISC::CPath::lookup(texName, false).c_str());
item->setText(texName.c_str());
}
else