mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(timeformat): Fixed list of available time formats
This commit is contained in:
parent
b3083250ff
commit
35e7da85d3
|
@ -118,13 +118,18 @@ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) :
|
|||
bodyUI->themeColorCBox->setCurrentIndex(s.getThemeColor());
|
||||
bodyUI->emoticonSize->setValue(s.getEmojiFontPointSize());
|
||||
|
||||
QStringList timestamps;
|
||||
for (QString timestamp : timeFormats)
|
||||
timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp));
|
||||
|
||||
bodyUI->timestamp->addItems(timestamps);
|
||||
|
||||
QLocale ql;
|
||||
timeFormats << ql.timeFormat(QLocale::ShortFormat)
|
||||
<< ql.timeFormat(QLocale::LongFormat);
|
||||
timeFormats.removeDuplicates();
|
||||
|
||||
for (QString format : timeFormats)
|
||||
{
|
||||
QString timeExample = QTime::currentTime().toString(format);
|
||||
QString element = QString("%1 - %2").arg(format, timeExample);
|
||||
bodyUI->timestamp->addItem(element, format);
|
||||
}
|
||||
|
||||
QStringList dateFormats;
|
||||
dateFormats << QStringLiteral("yyyy-MM-dd") // ISO 8601
|
||||
|
||||
|
@ -134,10 +139,6 @@ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) :
|
|||
<< ql.dateFormat(QLocale::NarrowFormat);
|
||||
dateFormats.removeDuplicates();
|
||||
|
||||
timeFormats.append(ql.timeFormat());
|
||||
timeFormats.append(ql.timeFormat(QLocale::LongFormat));
|
||||
timeFormats.removeDuplicates();
|
||||
|
||||
for (QString format : dateFormats)
|
||||
{
|
||||
QString dateExample = QDate::currentDate().toString(format);
|
||||
|
@ -176,7 +177,15 @@ void UserInterfaceForm::on_emoticonSize_editingFinished()
|
|||
|
||||
void UserInterfaceForm::on_timestamp_currentIndexChanged(int index)
|
||||
{
|
||||
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
||||
Q_UNUSED(index)
|
||||
QString format = bodyUI->timestamp->currentData().toString();
|
||||
Settings::getInstance().setTimestampFormat(format);
|
||||
Translator::translate();
|
||||
}
|
||||
|
||||
void UserInterfaceForm::on_timestamp_editTextChanged(const QString &format)
|
||||
{
|
||||
Settings::getInstance().setTimestampFormat(format);
|
||||
Translator::translate();
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ private slots:
|
|||
void on_emoticonSize_editingFinished();
|
||||
void on_styleBrowser_currentIndexChanged(QString style);
|
||||
void on_timestamp_currentIndexChanged(int index);
|
||||
void on_timestamp_editTextChanged(const QString& format);
|
||||
void on_dateFormats_currentIndexChanged();
|
||||
void on_dateFormats_editTextChanged();
|
||||
void on_textStyleComboBox_currentTextChanged();
|
||||
|
|
|
@ -480,6 +480,12 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
|
|
Loading…
Reference in New Issue
Block a user