Changed: #1193 Polish code and layout dialogs.

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

View file

@ -6,171 +6,119 @@
<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>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Sound name</string>
</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">
<property name="title">
<string>Sound name</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<widget class="QLineEdit" name="soundNameLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="browsePushButton">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>93</width>
<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>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="3">
<widget class="QLineEdit" name="soundNameLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="browsePushButton">
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>93</width>
<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>
<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>
</widget>
<customwidgets>

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