1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Change default datetime formats (d/m m/d agnostic), style fixes, removed unnecessary signals

This commit is contained in:
Dubslow 2015-03-25 11:45:28 -05:00
parent 14a565bc3a
commit bab280a0ea
No known key found for this signature in database
GPG Key ID: 3DB8E05315C220AA
3 changed files with 26 additions and 34 deletions

View File

@ -240,8 +240,8 @@ void Settings::load()
emojiFontPointSize = s.value("emojiFontPointSize", 16).toInt(); emojiFontPointSize = s.value("emojiFontPointSize", 16).toInt();
firstColumnHandlePos = s.value("firstColumnHandlePos", 50).toInt(); firstColumnHandlePos = s.value("firstColumnHandlePos", 50).toInt();
secondColumnHandlePosFromRight = s.value("secondColumnHandlePosFromRight", 50).toInt(); secondColumnHandlePosFromRight = s.value("secondColumnHandlePosFromRight", 50).toInt();
timestampFormat = s.value("timestampFormat", "hh:mm").toString(); timestampFormat = s.value("timestampFormat", "hh:mm:ss").toString();
dateFormat = s.value("dateFormat", "dd-MM-yyyy").toString(); dateFormat = s.value("dateFormat", "dddd, MMMM d, yyyy").toString();
minimizeOnClose = s.value("minimizeOnClose", false).toBool(); minimizeOnClose = s.value("minimizeOnClose", false).toBool();
minimizeToTray = s.value("minimizeToTray", false).toBool(); minimizeToTray = s.value("minimizeToTray", false).toBool();
lightTrayIcon = s.value("lightTrayIcon", false).toBool(); lightTrayIcon = s.value("lightTrayIcon", false).toBool();
@ -608,7 +608,7 @@ QString Settings::getStyle() const
return style; return style;
} }
void Settings::setStyle(const QString& newStyle) void Settings::setStyle(const QString& newStyle)
{ {
style = newStyle; style = newStyle;
} }
@ -953,7 +953,7 @@ void Settings::setSecondColumnHandlePosFromRight(const int pos)
secondColumnHandlePosFromRight = pos; secondColumnHandlePosFromRight = pos;
} }
const QString &Settings::getTimestampFormat() const const QString& Settings::getTimestampFormat() const
{ {
return timestampFormat; return timestampFormat;
} }
@ -961,10 +961,9 @@ const QString &Settings::getTimestampFormat() const
void Settings::setTimestampFormat(const QString &format) void Settings::setTimestampFormat(const QString &format)
{ {
timestampFormat = format; timestampFormat = format;
emit timestampFormatChanged();
} }
const QString &Settings::getDateFormat() const const QString& Settings::getDateFormat() const
{ {
return dateFormat; return dateFormat;
} }
@ -972,7 +971,6 @@ const QString &Settings::getDateFormat() const
void Settings::setDateFormat(const QString &format) void Settings::setDateFormat(const QString &format)
{ {
dateFormat = format; dateFormat = format;
emit dateFormatChanged();
} }

View File

@ -63,22 +63,22 @@ public:
bool getAutostartInTray() const; bool getAutostartInTray() const;
void setAutostartInTray(bool newValue); void setAutostartInTray(bool newValue);
bool getCloseToTray() const; bool getCloseToTray() const;
void setCloseToTray(bool newValue); void setCloseToTray(bool newValue);
bool getMinimizeToTray() const; bool getMinimizeToTray() const;
void setMinimizeToTray(bool newValue); void setMinimizeToTray(bool newValue);
bool getLightTrayIcon() const; bool getLightTrayIcon() const;
void setLightTrayIcon(bool newValue); void setLightTrayIcon(bool newValue);
QString getStyle() const; QString getStyle() const;
void setStyle(const QString& newValue); void setStyle(const QString& newValue);
bool getShowSystemTray() const; bool getShowSystemTray() const;
void setShowSystemTray(const bool& newValue); void setShowSystemTray(const bool& newValue);
bool getUseEmoticons() const; bool getUseEmoticons() const;
void setUseEmoticons(bool newValue); void setUseEmoticons(bool newValue);
@ -88,7 +88,7 @@ public:
QString getTranslation() const; QString getTranslation() const;
void setTranslation(QString newValue); void setTranslation(QString newValue);
void setAutoSaveEnabled(bool newValue); void setAutoSaveEnabled(bool newValue);
bool getAutoSaveEnabled() const; bool getAutoSaveEnabled() const;
@ -205,11 +205,11 @@ public:
int getSecondColumnHandlePosFromRight() const; int getSecondColumnHandlePosFromRight() const;
void setSecondColumnHandlePosFromRight(const int pos); void setSecondColumnHandlePosFromRight(const int pos);
const QString &getTimestampFormat() const; const QString& getTimestampFormat() const;
void setTimestampFormat(const QString &format); void setTimestampFormat(const QString& format);
const QString &getDateFormat() const; const QString& getDateFormat() const;
void setDateFormat(const QString &format); void setDateFormat(const QString& format);
bool isMinimizeOnCloseEnabled() const; bool isMinimizeOnCloseEnabled() const;
void setMinimizeOnClose(bool newValue); void setMinimizeOnClose(bool newValue);
@ -310,7 +310,7 @@ private:
QHash<QString, QByteArray> widgetSettings; QHash<QString, QByteArray> widgetSettings;
QHash<QString, QString> autoAccept; QHash<QString, QString> autoAccept;
bool autoSaveEnabled; bool autoSaveEnabled;
QString globalAutoAcceptDir; QString globalAutoAcceptDir;
// GUI // GUI
@ -363,8 +363,6 @@ signals:
void logStorageOptsChanged(); void logStorageOptsChanged();
void smileyPackChanged(); void smileyPackChanged();
void emojiFontChanged(); void emojiFontChanged();
void timestampFormatChanged();
void dateFormatChanged();
void compactLayoutChanged(); void compactLayoutChanged();
}; };

View File

@ -104,11 +104,11 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize()); bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize());
QStringList timestamps; QStringList timestamps;
foreach (QString timestamp, timeFormats) { for (QString timestamp : timeFormats)
timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp)); timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp));
}
bodyUI->timestamp->addItems(timestamps); bodyUI->timestamp->addItems(timestamps);
QLocale ql; QLocale ql;
QStringList datestamps; QStringList datestamps;
dateFormats.append(ql.dateFormat()); dateFormats.append(ql.dateFormat());
@ -117,20 +117,16 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
timeFormats.append(ql.timeFormat()); timeFormats.append(ql.timeFormat());
timeFormats.append(ql.timeFormat(QLocale::LongFormat)); timeFormats.append(ql.timeFormat(QLocale::LongFormat));
timeFormats.removeDuplicates(); timeFormats.removeDuplicates();
foreach (QString datestamp, dateFormats) { for (QString datestamp : dateFormats)
datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp)); datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp));
}
bodyUI->dateFormats->addItems(datestamps); bodyUI->dateFormats->addItems(datestamps);
bodyUI->timestamp->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getTimestampFormat(), bodyUI->timestamp->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getTimestampFormat(), QTime::currentTime().toString(Settings::getInstance().getTimestampFormat())));
QTime::currentTime().toString(Settings::getInstance().getTimestampFormat()))
); bodyUI->dateFormats->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getDateFormat(), QDate::currentDate().toString(Settings::getInstance().getDateFormat())));
bodyUI->dateFormats->setCurrentText(QString("%1 - %2").arg(Settings::getInstance().getDateFormat(),
QDate::currentDate().toString(Settings::getInstance().getDateFormat()))
);
bodyUI->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime()); bodyUI->autoAwaySpinBox->setValue(Settings::getInstance().getAutoAwayTime());
bodyUI->cbEnableUDP->setChecked(!Settings::getInstance().getForceTCP()); bodyUI->cbEnableUDP->setChecked(!Settings::getInstance().getForceTCP());