Another fixes

* update translator list
* drop russian changelog at all
* fix changelog building
* fix invalid graphical item UI behaviour
This commit is contained in:
2016-04-09 03:55:52 +03:00
parent 60cbc40e9f
commit 15abe54290
10 changed files with 98 additions and 595 deletions

View File

@ -48,20 +48,12 @@ GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
connect(ui->checkBox_custom, SIGNAL(stateChanged(int)), this,
SLOT(changeValue(int)));
connect(ui->checkBox_activeCheck, SIGNAL(stateChanged(int)), this,
SLOT(changeColorState(int)));
connect(ui->checkBox_inactiveCheck, SIGNAL(stateChanged(int)), this,
SLOT(changeColorState(int)));
connect(ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this,
SLOT(changeCountState(int)));
connect(ui->pushButton_activeColor, SIGNAL(clicked()), this,
SLOT(changeColor()));
connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this,
SLOT(changeColor()));
connect(ui->pushButton_activeImage, SIGNAL(clicked()), this,
SLOT(changeImage()));
connect(ui->pushButton_inactiveImage, SIGNAL(clicked()), this,
SLOT(changeImage()));
}
@ -457,7 +449,11 @@ int GraphicalItem::showConfiguration(const QVariant args)
ui->doubleSpinBox_max->setValue(m_maxValue);
ui->doubleSpinBox_min->setValue(m_minValue);
ui->spinBox_count->setValue(m_count);
ui->checkBox_activeCheck->setChecked(
m_activeColor.startsWith(QString("/")));
ui->pushButton_activeColor->setText(m_activeColor);
ui->checkBox_inactiveCheck->setChecked(
m_inactiveColor.startsWith(QString("/")));
ui->pushButton_inactiveColor->setText(m_inactiveColor);
ui->comboBox_type->setCurrentIndex(static_cast<int>(m_type));
ui->comboBox_direction->setCurrentIndex(static_cast<int>(m_direction));
@ -465,8 +461,9 @@ int GraphicalItem::showConfiguration(const QVariant args)
ui->spinBox_width->setValue(m_width);
// update UI
changeCountState(ui->comboBox_type->currentIndex());
changeValue(ui->checkBox_custom->checkState());
emit(ui->comboBox_type->currentIndexChanged(
ui->comboBox_type->currentIndex()));
emit(ui->checkBox_custom->stateChanged(ui->checkBox_custom->checkState()));
int ret = exec();
if (ret != 1)
@ -521,38 +518,38 @@ void GraphicalItem::writeConfiguration() const
void GraphicalItem::changeColor()
{
QColor color = m_helper->stringToColor(
(static_cast<QPushButton *>(sender()))->text());
QColor newColor = QColorDialog::getColor(color, this, tr("Select color"),
QColorDialog::ShowAlphaChannel);
if (!newColor.isValid())
return;
qCInfo(LOG_LIB) << "Selected color" << newColor;
QString outputColor;
bool imageRequired = sender() == ui->pushButton_activeColor
? ui->checkBox_activeCheck->isChecked()
: ui->checkBox_inactiveCheck->isChecked();
QStringList colorText;
colorText.append(QString("%1").arg(newColor.red()));
colorText.append(QString("%1").arg(newColor.green()));
colorText.append(QString("%1").arg(newColor.blue()));
colorText.append(QString("%1").arg(newColor.alpha()));
if (imageRequired) {
QString path = static_cast<QPushButton *>(sender())->text();
QString directory = QFileInfo(path).absolutePath();
outputColor = QFileDialog::getOpenFileName(
this, tr("Select path"), directory,
tr("Images (*.png *.bpm *.jpg);;All files (*.*)"));
return static_cast<QPushButton *>(sender())
->setText(colorText.join(QChar(',')));
}
qCInfo(LOG_LIB) << "Selected path" << outputColor;
} else {
QColor color = m_helper->stringToColor(
(static_cast<QPushButton *>(sender()))->text());
QColor newColor = QColorDialog::getColor(
color, this, tr("Select color"), QColorDialog::ShowAlphaChannel);
if (!newColor.isValid())
return;
qCInfo(LOG_LIB) << "Selected color" << newColor;
QStringList colorText;
colorText.append(QString("%1").arg(newColor.red()));
colorText.append(QString("%1").arg(newColor.green()));
colorText.append(QString("%1").arg(newColor.blue()));
colorText.append(QString("%1").arg(newColor.alpha()));
void GraphicalItem::changeColorState(const int state)
{
qCDebug(LOG_LIB) << "Current color state is" << state;
if (sender() == ui->checkBox_activeCheck) {
qCInfo(LOG_LIB) << "Change active color state";
ui->widget_activeColor->setHidden(state == Qt::Unchecked);
ui->widget_activeImage->setHidden(state != Qt::Unchecked);
} else if (sender() == ui->checkBox_inactiveCheck) {
qCInfo(LOG_LIB) << "Change inactive color state";
ui->widget_inactiveColor->setHidden(state == Qt::Unchecked);
ui->widget_inactiveImage->setHidden(state != Qt::Unchecked);
outputColor = colorText.join(QChar(','));
}
return static_cast<QPushButton *>(sender())->setText(outputColor);
}
@ -565,20 +562,6 @@ void GraphicalItem::changeCountState(const int state)
}
void GraphicalItem::changeImage()
{
QString path = static_cast<QPushButton *>(sender())->text();
QString directory = QFileInfo(path).absolutePath();
QString newPath = QFileDialog::getOpenFileName(
this, tr("Select path"), directory,
tr("Images (*.png *.bpm *.jpg);;All files (*.*)"));
qCInfo(LOG_LIB) << "Selected path" << newPath;
return static_cast<QPushButton *>(sender())->setText(newPath);
}
void GraphicalItem::changeValue(const int state)
{
qCDebug(LOG_LIB) << "Current state is" << state;
@ -621,10 +604,8 @@ void GraphicalItem::translate()
ui->label_min->setText(i18n("Min value"));
ui->checkBox_activeCheck->setText(i18n("Use image for active"));
ui->label_activeColor->setText(i18n("Active color"));
ui->label_activeImage->setText(i18n("Active image"));
ui->checkBox_inactiveCheck->setText(i18n("Use image for inactive"));
ui->label_inactiveColor->setText(i18n("Inactive color"));
ui->label_inactiveImage->setText(i18n("Inactive image"));
ui->label_type->setText(i18n("Type"));
ui->label_direction->setText(i18n("Direction"));
ui->label_height->setText(i18n("Height"));

View File

@ -98,9 +98,7 @@ public slots:
private slots:
void changeColor();
void changeColorState(const int state);
void changeCountState(const int state);
void changeImage();
void changeValue(const int state);
private:

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>416</width>
<height>606</height>
<height>537</height>
</rect>
</property>
<property name="windowTitle">
@ -25,7 +25,7 @@
</sizepolicy>
</property>
<property name="text">
<string>&amp;Name</string>
<string>Name</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -48,7 +48,7 @@
</sizepolicy>
</property>
<property name="text">
<string>&amp;Comment</string>
<string>Comment</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -115,7 +115,7 @@
<item>
<widget class="QLabel" name="label_value">
<property name="text">
<string>&amp;Value</string>
<string>Value</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -156,7 +156,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Va&amp;lue</string>
<string>Value</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -174,7 +174,7 @@
<item>
<widget class="QLabel" name="label_max">
<property name="text">
<string>&amp;Max value</string>
<string>Max value</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -195,7 +195,7 @@
<item>
<widget class="QLabel" name="label_min">
<property name="text">
<string>Min val&amp;ue</string>
<string>Min value</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -211,44 +211,6 @@
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="widget_count" native="true">
<layout class="QHBoxLayout" name="layout_count">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_count">
<property name="text">
<string>&amp;Points count</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_count">
<property name="maximum">
<number>2000</number>
</property>
<property name="singleStep">
<number>25</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
@ -304,7 +266,7 @@
<item>
<widget class="QLabel" name="label_activeColor">
<property name="text">
<string>Activ&amp;e color</string>
<string>Active color</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -321,41 +283,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_activeImage" native="true">
<layout class="QHBoxLayout" name="layout_activeImage">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_activeImage">
<property name="text">
<string>&amp;Active image</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_activeImage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_inactiveCheck">
<item>
@ -404,7 +331,7 @@
<item>
<widget class="QLabel" name="label_inactiveColor">
<property name="text">
<string>&amp;Inactive color</string>
<string>Inactive color</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -421,47 +348,12 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widget_inactiveImage" native="true">
<layout class="QHBoxLayout" name="layout_inactiveImage">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_inactiveImage">
<property name="text">
<string>Inactive image</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_inactiveImage">
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_type">
<item>
<widget class="QLabel" name="label_type">
<property name="text">
<string>&amp;Type</string>
<string>Type</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -499,7 +391,7 @@
<item>
<widget class="QLabel" name="label_direction">
<property name="text">
<string>&amp;Direction</string>
<string>Direction</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -522,12 +414,50 @@
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="widget_count" native="true">
<layout class="QHBoxLayout" name="layout_count">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_count">
<property name="text">
<string>Points count</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_count">
<property name="maximum">
<number>2000</number>
</property>
<property name="singleStep">
<number>25</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_height">
<item>
<widget class="QLabel" name="label_height">
<property name="text">
<string>&amp;Height</string>
<string>Height</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -551,7 +481,7 @@
<item>
<widget class="QLabel" name="label_width">
<property name="text">
<string>&amp;Width</string>
<string>Width</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>