Skip to content

Commit

Permalink
qt 5.4 patch in .diff format added, time display in system settings done
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Feb 10, 2015
1 parent 43627a4 commit a220390
Show file tree
Hide file tree
Showing 10 changed files with 852 additions and 21 deletions.
10 changes: 5 additions & 5 deletions Telegram/SourceFiles/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ namespace App {
if (precise) {
QDateTime dOnline(date(online)), dNow(date(now));
if (dOnline.date() == dNow.date()) {
return lng_status_lastseen_today(lt_time, dOnline.time().toString(qsl("hh:mm")));
return lng_status_lastseen_today(lt_time, dOnline.time().toString(cTimeFormat()));
} else if (dOnline.date().addDays(1) == dNow.date()) {
return lng_status_lastseen_yesterday(lt_time, dOnline.time().toString(qsl("hh:mm")));
return lng_status_lastseen_yesterday(lt_time, dOnline.time().toString(cTimeFormat()));
}
return lng_status_lastseen_date_time(lt_date, dOnline.date().toString(qsl("dd.MM.yy")), lt_time, dOnline.time().toString(qsl("hh:mm")));
return lng_status_lastseen_date_time(lt_date, dOnline.date().toString(qsl("dd.MM.yy")), lt_time, dOnline.time().toString(cTimeFormat()));
}
int32 minutes = (now - online) / 60;
if (!minutes) {
Expand All @@ -264,9 +264,9 @@ namespace App {
}
QDateTime dOnline(date(online)), dNow(date(now));
if (dOnline.date() == dNow.date()) {
return lng_status_lastseen_today(lt_time, dOnline.time().toString(qsl("hh:mm")));
return lng_status_lastseen_today(lt_time, dOnline.time().toString(cTimeFormat()));
} else if (dOnline.date().addDays(1) == dNow.date()) {
return lng_status_lastseen_yesterday(lt_time, dOnline.time().toString(qsl("hh:mm")));
return lng_status_lastseen_yesterday(lt_time, dOnline.time().toString(cTimeFormat()));
}
return lng_status_lastseen_date(lt_date, dOnline.date().toString(qsl("dd.MM.yy")));
}
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
}

void Application::startApp() {
cChangeTimeFormat(QLocale::system().timeFormat(QLocale::ShortFormat));

DEBUG_LOG(("Application Info: starting app.."));

Local::ReadMapState state = Local::readMap(QByteArray());
Expand Down
6 changes: 3 additions & 3 deletions Telegram/SourceFiles/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ void DialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const {
QDate nowDate(now.date()), lastDate(lastTime.date());
QString dt;
if (lastDate == nowDate) {
dt = lastTime.toString(qsl("hh:mm"));
dt = lastTime.toString(cTimeFormat());
} else if (lastDate.year() == nowDate.year() && lastDate.weekNumber() == nowDate.weekNumber()) {
dt = langDayOfWeek(lastDate);
} else {
Expand Down Expand Up @@ -900,7 +900,7 @@ void FakeDialogRow::paint(QPainter &p, int32 w, bool act, bool sel) const {
QDate nowDate(now.date()), lastDate(lastTime.date());
QString dt;
if (lastDate == nowDate) {
dt = lastTime.toString(qsl("hh:mm"));
dt = lastTime.toString(cTimeFormat());
} else if (lastDate.year() == nowDate.year() && lastDate.weekNumber() == nowDate.weekNumber()) {
dt = langDayOfWeek(lastDate);
} else {
Expand Down Expand Up @@ -4029,7 +4029,7 @@ void HistoryMessage::initMediaFromDocument(DocumentData *doc) {
}

void HistoryMessage::initDimensions(const QString &text) {
_time = date.toString(qsl("hh:mm"));
_time = date.toString(cTimeFormat());
_timeWidth = st::msgDateFont->m.width(_time);
if (!_media) {
_timeWidth += st::msgDateSpace + (out() ? st::msgDateCheckSpace + st::msgCheckRect.pxWidth() : 0) - st::msgDateDelta.x();
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/mainwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2965,7 +2965,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
QDateTime datetime = date(d.vdate);

QString name = App::self()->firstName;
QString day = langDayOfWeekFull(datetime.date()), date = langDayOfMonth(datetime.date()), time = datetime.time().toString(qsl("hh:mm"));
QString day = langDayOfWeekFull(datetime.date()), date = langDayOfMonth(datetime.date()), time = datetime.time().toString(cTimeFormat());
QString device = qs(d.vdevice), location = qs(d.vlocation);
LangString text = lng_new_authorization(lt_name, App::self()->firstName, lt_day, day, lt_date, date, lt_time, time, lt_device, device, lt_location, location);
App::wnd()->serviceNotification(text);
Expand Down
6 changes: 3 additions & 3 deletions Telegram/SourceFiles/mediaview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ void MediaView::updateControls() {
}
QDateTime d(date(_photo ? _photo->date : _doc->date)), dNow(date(unixtime()));
if (d.date() == dNow.date()) {
_dateText = lng_mediaview_today(lt_time, d.time().toString(qsl("hh:mm")));
_dateText = lng_mediaview_today(lt_time, d.time().toString(cTimeFormat()));
} else if (d.date().addDays(1) == dNow.date()) {
_dateText = lng_mediaview_yesterday(lt_time, d.time().toString(qsl("hh:mm")));
_dateText = lng_mediaview_yesterday(lt_time, d.time().toString(cTimeFormat()));
} else {
_dateText = lng_mediaview_date_time(lt_date, d.date().toString(qsl("dd.MM.yy")), lt_time, d.time().toString(qsl("hh:mm")));
_dateText = lng_mediaview_date_time(lt_date, d.date().toString(qsl("dd.MM.yy")), lt_time, d.time().toString(cTimeFormat()));
}
if (_from) _fromName.setText(st::medviewNameFont, _from->name);
updateHeader();
Expand Down
2 changes: 2 additions & 0 deletions Telegram/SourceFiles/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ QByteArray gLocalSalt;
DBIScale gRealScale = dbisAuto, gScreenScale = dbisOne, gConfigScale = dbisAuto;
bool gCompressPastedImage = true;

QString gTimeFormat = qsl("hh:mm");

DBIEmojiTab gEmojiTab = dbietRecent;
RecentEmojiPack gRecentEmojis;
RecentEmojiPreload gRecentEmojisPreload;
Expand Down
5 changes: 5 additions & 0 deletions Telegram/SourceFiles/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ DeclareSetting(DBIScale, RealScale);
DeclareSetting(DBIScale, ScreenScale);
DeclareSetting(DBIScale, ConfigScale);
DeclareSetting(bool, CompressPastedImage);
DeclareSetting(QString, TimeFormat);

inline void cChangeTimeFormat(const QString &newFormat) {
if (!newFormat.isEmpty()) cSetTimeFormat(newFormat);
}

inline DBIScale cEvalScale(DBIScale scale) {
return (scale == dbisAuto) ? cScreenScale() : scale;
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void NotifyWindow::updateNotifyDisplay() {

QDateTime now(QDateTime::currentDateTime()), lastTime(item->date);
QDate nowDate(now.date()), lastDate(lastTime.date());
QString dt = lastTime.toString(qsl("hh:mm"));
QString dt = lastTime.toString(cTimeFormat());
int32 dtWidth = st::dlgHistFont->m.width(dt);
rectForName.setWidth(rectForName.width() - dtWidth - st::dlgDateSkip);
p.setFont(st::dlgDateFont->f);
Expand Down
Loading

0 comments on commit a220390

Please sign in to comment.