Changed: #1193 Polish code and layout dialogs.

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

View file

@ -6,171 +6,119 @@
<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> <widget class="QGroupBox" name="groupBox">
</property> <property name="title">
<item row="0" column="0"> <string>Sound name</string>
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::East</enum>
</property> </property>
<property name="currentIndex"> <layout class="QGridLayout" name="gridLayout_2">
<number>0</number> <item row="0" column="0" colspan="3">
</property> <widget class="QLineEdit" name="soundNameLineEdit">
<widget class="QWidget" name="tabWidgetPage1"> <property name="readOnly">
<attribute name="title"> <bool>true</bool>
<string>General</string> </property>
</attribute> </widget>
<layout class="QGridLayout" name="gridLayout_3"> </item>
<item row="0" column="0"> <item row="1" column="0">
<widget class="QGroupBox" name="groupBox"> <widget class="QPushButton" name="browsePushButton">
<property name="title"> <property name="text">
<string>Sound name</string> <string>Browse</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2"> </widget>
<item row="0" column="0" colspan="3"> </item>
<widget class="QLineEdit" name="soundNameLineEdit"> <item row="1" column="1">
<property name="readOnly"> <spacer name="horizontalSpacer">
<bool>true</bool> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
</widget> </property>
</item> <property name="sizeHint" stdset="0">
<item row="1" column="0"> <size>
<widget class="QPushButton" name="browsePushButton"> <width>93</width>
<property name="text"> <height>20</height>
<string>Browse</string> </size>
</property> </property>
</widget> </spacer>
</item> </item>
<item row="1" column="1"> <item row="1" column="2">
<spacer name="horizontalSpacer"> <widget class="QPushButton" name="playPushButton">
<property name="orientation"> <property name="text">
<enum>Qt::Horizontal</enum> <string>Play</string>
</property> </property>
<property name="sizeHint" stdset="0"> </widget>
<size> </item>
<width>93</width> </layout>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="playPushButton">
<property name="text">
<string>Play</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="spawnCheckBox">
<property name="text">
<string>Spawn</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="muteCheckBox">
<property name="text">
<string>Mute</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="keepPitchCheckBox">
<property name="text">
<string>Keep original pitch</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Emission percent:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="NLQT::CEditRangeFloatWidget" name="emissionWidget" native="true"/>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>51</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> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="spawnCheckBox">
<property name="text">
<string>Spawn</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="muteCheckBox">
<property name="text">
<string>Mute</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="keepPitchCheckBox">
<property name="text">
<string>Keep original pitch</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Emission percent:</string>
</property>
</widget>
</item>
<item>
<widget class="NLQT::CEditRangeFloatWidget" name="emissionWidget" native="true"/>
</item>
<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>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>

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:"));
_ui.imageLabel->setText("");
_ui.imageLabel->setPixmap(QPixmap());
if (!_Texture) if (!_Texture)
{
_ui.imageLabel->setPixmap(QPixmap());
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