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> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>239</width> <width>200</width>
<height>264</height> <height>252</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="margin"> <item>
<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">
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>Sound name</string> <string>Sound name</string>
@ -73,7 +57,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QCheckBox" name="spawnCheckBox"> <widget class="QCheckBox" name="spawnCheckBox">
@ -91,24 +75,38 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0"> <item>
<widget class="QCheckBox" name="keepPitchCheckBox"> <widget class="QCheckBox" name="keepPitchCheckBox">
<property name="text"> <property name="text">
<string>Keep original pitch</string> <string>Keep original pitch</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>Emission percent:</string> <string>Emission percent:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item>
<widget class="NLQT::CEditRangeFloatWidget" name="emissionWidget" native="true"/> <widget class="NLQT::CEditRangeFloatWidget" name="emissionWidget" native="true"/>
</item> </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"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -116,63 +114,13 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>51</height> <height>22</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</widget> </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> <customwidgets>
<customwidget> <customwidget>
<class>NLQT::CEditRangeFloatWidget</class> <class>NLQT::CEditRangeFloatWidget</class>

View file

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

View file

@ -112,24 +112,31 @@ void CParticleTextureWidget::updateTexture()
_ui.nameLabel->setText(tr("Name:")); _ui.nameLabel->setText(tr("Name:"));
_ui.sizeLabel->setText(tr("Size:")); _ui.sizeLabel->setText(tr("Size:"));
_ui.depthLabel->setText(tr("Depth:")); _ui.depthLabel->setText(tr("Depth:"));
if (!_Texture) _ui.imageLabel->setText("");
{
_ui.imageLabel->setPixmap(QPixmap()); _ui.imageLabel->setPixmap(QPixmap());
if (!_Texture)
return; return;
}
if (dynamic_cast<NL3D::CTextureFile *>(_Wrapper->get())) if (dynamic_cast<NL3D::CTextureFile *>(_Wrapper->get()))
{ {
std::string texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName().c_str(); std::string texName = (static_cast<NL3D::CTextureFile *>(_Wrapper->get()))->getFileName().c_str();
_ui.nameLabel->setText(tr("Name: %1").arg(texName.c_str())); _ui.nameLabel->setText(tr("Name: %1").arg(texName.c_str()));
if (!NLMISC::CFile::getFilename(texName).empty()) 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.sizeLabel->setText(tr("Size: %1x%2").arg(pixmap.width()).arg(pixmap.height()));
_ui.depthLabel->setText(tr("Depth: %1").arg(pixmap.depth())); _ui.depthLabel->setText(tr("Depth: %1").arg(pixmap.depth()));
_ui.imageLabel->setPixmap(pixmap); _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(); std::string texName = (static_cast<NL3D::CTextureFile *>(tex.getPtr()))->getFileName().c_str();
if (!texName.empty()) 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()); item->setText(texName.c_str());
} }
else else