mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge branch 'pr1393'
This commit is contained in:
commit
14a565bc3a
|
@ -104,11 +104,11 @@ HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// for old tables:
|
// for old tables:
|
||||||
QSqlQuery ans = db->exec("select seq from sqlite_sequence where name=\"history\";");
|
QSqlQuery ans = db->exec("SELECT seq FROM sqlite_sequence WHERE name=\"history\";");
|
||||||
if (ans.first())
|
if (ans.first())
|
||||||
{
|
{
|
||||||
int idMax = ans.value(0).toInt();
|
int idMax = ans.value(0).toInt();
|
||||||
QSqlQuery ret = db->exec("select seq from sqlite_sequence where name=\"sent_status\";");
|
QSqlQuery ret = db->exec("SELECT seq FROM sqlite_sequence WHERE name=\"sent_status\";");
|
||||||
int idCur = 0;
|
int idCur = 0;
|
||||||
if (ret.first())
|
if (ret.first())
|
||||||
{
|
{
|
||||||
|
@ -128,7 +128,7 @@ HistoryKeeper::HistoryKeeper(GenericDdInterface *db_) :
|
||||||
setSyncType(Settings::getInstance().getDbSyncType());
|
setSyncType(Settings::getInstance().getDbSyncType());
|
||||||
|
|
||||||
messageID = 0;
|
messageID = 0;
|
||||||
QSqlQuery sqlAnswer = db->exec("select seq from sqlite_sequence where name=\"history\";");
|
QSqlQuery sqlAnswer = db->exec("SELECT seq FROM sqlite_sequence WHERE name=\"history\";");
|
||||||
if (sqlAnswer.first())
|
if (sqlAnswer.first())
|
||||||
messageID = sqlAnswer.value(0).toLongLong();
|
messageID = sqlAnswer.value(0).toLongLong();
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,6 +241,7 @@ void Settings::load()
|
||||||
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").toString();
|
||||||
|
dateFormat = s.value("dateFormat", "dd-MM-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();
|
||||||
|
@ -411,6 +412,7 @@ void Settings::saveGlobal(QString path)
|
||||||
s.setValue("firstColumnHandlePos", firstColumnHandlePos);
|
s.setValue("firstColumnHandlePos", firstColumnHandlePos);
|
||||||
s.setValue("secondColumnHandlePosFromRight", secondColumnHandlePosFromRight);
|
s.setValue("secondColumnHandlePosFromRight", secondColumnHandlePosFromRight);
|
||||||
s.setValue("timestampFormat", timestampFormat);
|
s.setValue("timestampFormat", timestampFormat);
|
||||||
|
s.setValue("dateFormat", dateFormat);
|
||||||
s.setValue("minimizeOnClose", minimizeOnClose);
|
s.setValue("minimizeOnClose", minimizeOnClose);
|
||||||
s.setValue("minimizeToTray", minimizeToTray);
|
s.setValue("minimizeToTray", minimizeToTray);
|
||||||
s.setValue("lightTrayIcon", lightTrayIcon);
|
s.setValue("lightTrayIcon", lightTrayIcon);
|
||||||
|
@ -962,6 +964,18 @@ void Settings::setTimestampFormat(const QString &format)
|
||||||
emit timestampFormatChanged();
|
emit timestampFormatChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &Settings::getDateFormat() const
|
||||||
|
{
|
||||||
|
return dateFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setDateFormat(const QString &format)
|
||||||
|
{
|
||||||
|
dateFormat = format;
|
||||||
|
emit dateFormatChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Settings::getEmojiFontFamily() const
|
QString Settings::getEmojiFontFamily() const
|
||||||
{
|
{
|
||||||
return emojiFontFamily;
|
return emojiFontFamily;
|
||||||
|
|
|
@ -208,6 +208,9 @@ public:
|
||||||
const QString &getTimestampFormat() const;
|
const QString &getTimestampFormat() const;
|
||||||
void setTimestampFormat(const QString &format);
|
void setTimestampFormat(const QString &format);
|
||||||
|
|
||||||
|
const QString &getDateFormat() const;
|
||||||
|
void setDateFormat(const QString &format);
|
||||||
|
|
||||||
bool isMinimizeOnCloseEnabled() const;
|
bool isMinimizeOnCloseEnabled() const;
|
||||||
void setMinimizeOnClose(bool newValue);
|
void setMinimizeOnClose(bool newValue);
|
||||||
|
|
||||||
|
@ -328,6 +331,7 @@ private:
|
||||||
int firstColumnHandlePos;
|
int firstColumnHandlePos;
|
||||||
int secondColumnHandlePosFromRight;
|
int secondColumnHandlePosFromRight;
|
||||||
QString timestampFormat;
|
QString timestampFormat;
|
||||||
|
QString dateFormat;
|
||||||
bool statusChangeNotificationEnabled;
|
bool statusChangeNotificationEnabled;
|
||||||
|
|
||||||
// Privacy
|
// Privacy
|
||||||
|
@ -360,6 +364,7 @@ signals:
|
||||||
void smileyPackChanged();
|
void smileyPackChanged();
|
||||||
void emojiFontChanged();
|
void emojiFontChanged();
|
||||||
void timestampFormatChanged();
|
void timestampFormatChanged();
|
||||||
|
void dateFormatChanged();
|
||||||
void compactLayoutChanged();
|
void compactLayoutChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -826,10 +826,11 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
|
||||||
// Show the date every new day
|
// Show the date every new day
|
||||||
QDateTime msgDateTime = it.timestamp.toLocalTime();
|
QDateTime msgDateTime = it.timestamp.toLocalTime();
|
||||||
QDate msgDate = msgDateTime.date();
|
QDate msgDate = msgDateTime.date();
|
||||||
|
|
||||||
if (msgDate > lastDate)
|
if (msgDate > lastDate)
|
||||||
{
|
{
|
||||||
lastDate = msgDate;
|
lastDate = msgDate;
|
||||||
historyMessages.append(ChatMessage::createChatInfoMessage(msgDate.toString(), ChatMessage::INFO, QDateTime()));
|
historyMessages.append(ChatMessage::createChatInfoMessage(msgDate.toString(Settings::getInstance().getDateFormat()), ChatMessage::INFO, QDateTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show each messages
|
// Show each messages
|
||||||
|
|
|
@ -187,7 +187,7 @@ void ProfileForm::setToxId(const QString& id)
|
||||||
|
|
||||||
void ProfileForm::onAvatarClicked()
|
void ProfileForm::onAvatarClicked()
|
||||||
{
|
{
|
||||||
QString filename = QFileDialog::getOpenFileName(this,
|
QString filename = QFileDialog::getOpenFileName(0,
|
||||||
tr("Choose a profile picture"),
|
tr("Choose a profile picture"),
|
||||||
QDir::homePath(),
|
QDir::homePath(),
|
||||||
Nexus::getSupportedImageFilter());
|
Nexus::getSupportedImageFilter());
|
||||||
|
|
|
@ -35,6 +35,9 @@ static QStringList locales = {"bg", "de", "en", "es", "fr", "hr", "hu", "it", "l
|
||||||
static QStringList langs = {"Български", "Deutsch", "English", "Español", "Français", "Hrvatski", "Magyar", "Italiano", "Lietuvių", "mannol", "Nederlands", "Pirate", "Polski", "Português", "Русский", "Slovenščina", "Suomi", "Svenska", "Українська", "简体中文"};
|
static QStringList langs = {"Български", "Deutsch", "English", "Español", "Français", "Hrvatski", "Magyar", "Italiano", "Lietuvių", "mannol", "Nederlands", "Pirate", "Polski", "Português", "Русский", "Slovenščina", "Suomi", "Svenska", "Українська", "简体中文"};
|
||||||
|
|
||||||
static QStringList timeFormats = {"hh:mm AP", "hh:mm", "hh:mm:ss AP", "hh:mm:ss"};
|
static QStringList timeFormats = {"hh:mm AP", "hh:mm", "hh:mm:ss AP", "hh:mm:ss"};
|
||||||
|
// http://doc.qt.io/qt-4.8/qdate.html#fromString
|
||||||
|
static QStringList dateFormats = {"yyyy-MM-dd", "dd-MM-yyyy", "d-MM-yyyy", "dddd d-MM-yyyy", "dddd d-MM", "dddd dd MMMM"};
|
||||||
|
|
||||||
GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
GenericForm(tr("General"), QPixmap(":/img/settings/general.png"))
|
GenericForm(tr("General"), QPixmap(":/img/settings/general.png"))
|
||||||
{
|
{
|
||||||
|
@ -101,15 +104,33 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize());
|
bodyUI->emoticonSize->setValue(Settings::getInstance().getEmojiFontPointSize());
|
||||||
|
|
||||||
QStringList timestamps;
|
QStringList timestamps;
|
||||||
timestamps << QString("%1 - %2").arg(timeFormats[0],QTime::currentTime().toString(timeFormats[0]))
|
foreach (QString timestamp, timeFormats) {
|
||||||
<< QString("%1 - %2").arg(timeFormats[1],QTime::currentTime().toString(timeFormats[1]))
|
timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp));
|
||||||
<< QString("%1 - %2").arg(timeFormats[2],QTime::currentTime().toString(timeFormats[2]))
|
}
|
||||||
<< QString("%1 - %2").arg(timeFormats[3],QTime::currentTime().toString(timeFormats[3]));
|
|
||||||
bodyUI->timestamp->addItems(timestamps);
|
bodyUI->timestamp->addItems(timestamps);
|
||||||
|
|
||||||
|
QLocale ql;
|
||||||
|
QStringList datestamps;
|
||||||
|
dateFormats.append(ql.dateFormat());
|
||||||
|
dateFormats.append(ql.dateFormat(QLocale::LongFormat));
|
||||||
|
dateFormats.removeDuplicates();
|
||||||
|
timeFormats.append(ql.timeFormat());
|
||||||
|
timeFormats.append(ql.timeFormat(QLocale::LongFormat));
|
||||||
|
timeFormats.removeDuplicates();
|
||||||
|
|
||||||
|
foreach (QString datestamp, dateFormats) {
|
||||||
|
datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp));
|
||||||
|
}
|
||||||
|
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()))
|
||||||
); //idiot proof enough?
|
);
|
||||||
|
|
||||||
|
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());
|
||||||
|
@ -146,6 +167,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
|
||||||
connect(bodyUI->themeColorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onThemeColorChanged(int)));
|
connect(bodyUI->themeColorCBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onThemeColorChanged(int)));
|
||||||
connect(bodyUI->emoticonSize, SIGNAL(editingFinished()), this, SLOT(onEmoticonSizeChanged()));
|
connect(bodyUI->emoticonSize, SIGNAL(editingFinished()), this, SLOT(onEmoticonSizeChanged()));
|
||||||
connect(bodyUI->timestamp, SIGNAL(currentIndexChanged(int)), this, SLOT(onTimestampSelected(int)));
|
connect(bodyUI->timestamp, SIGNAL(currentIndexChanged(int)), this, SLOT(onTimestampSelected(int)));
|
||||||
|
connect(bodyUI->dateFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(onDateFormatSelected(int)));
|
||||||
//connection
|
//connection
|
||||||
connect(bodyUI->cbEnableIPv6, &QCheckBox::stateChanged, this, &GeneralForm::onEnableIPv6Updated);
|
connect(bodyUI->cbEnableIPv6, &QCheckBox::stateChanged, this, &GeneralForm::onEnableIPv6Updated);
|
||||||
connect(bodyUI->cbEnableUDP, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated);
|
connect(bodyUI->cbEnableUDP, &QCheckBox::stateChanged, this, &GeneralForm::onUDPUpdated);
|
||||||
|
@ -249,6 +271,11 @@ void GeneralForm::onTimestampSelected(int index)
|
||||||
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
Settings::getInstance().setTimestampFormat(timeFormats.at(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeneralForm::onDateFormatSelected(int index)
|
||||||
|
{
|
||||||
|
Settings::getInstance().setDateFormat(dateFormats.at(index));
|
||||||
|
}
|
||||||
|
|
||||||
void GeneralForm::onAutoAwayChanged()
|
void GeneralForm::onAutoAwayChanged()
|
||||||
{
|
{
|
||||||
int minutes = bodyUI->autoAwaySpinBox->value();
|
int minutes = bodyUI->autoAwaySpinBox->value();
|
||||||
|
|
|
@ -46,6 +46,7 @@ private slots:
|
||||||
void onEmoticonSizeChanged();
|
void onEmoticonSizeChanged();
|
||||||
void onStyleSelected(QString style);
|
void onStyleSelected(QString style);
|
||||||
void onTimestampSelected(int index);
|
void onTimestampSelected(int index);
|
||||||
|
void onDateFormatSelected(int index);
|
||||||
void onSetStatusChange();
|
void onSetStatusChange();
|
||||||
void onAutoAwayChanged();
|
void onAutoAwayChanged();
|
||||||
void onUseEmoticonsChange();
|
void onUseEmoticonsChange();
|
||||||
|
|
|
@ -591,6 +591,16 @@ will be sent to them when they appear online to you.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="dateformatLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Date format:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QComboBox" name="dateFormats"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user