2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2014-12-01 10:47:38 +00:00
|
|
|
Copyright (c) 2014 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "lang.h"
|
|
|
|
|
|
|
|
#include "aboutbox.h"
|
|
|
|
#include "mainwidget.h"
|
|
|
|
#include "window.h"
|
|
|
|
|
2014-06-16 09:31:10 +00:00
|
|
|
AboutBox::AboutBox() :
|
2014-05-30 08:53:19 +00:00
|
|
|
_done(this, lang(lng_about_done), st::aboutCloseButton),
|
2015-07-28 13:47:21 +00:00
|
|
|
_version(this, qsl("[a href=\"https://desktop.telegram.org/#changelog\"]") + textClean(lng_about_version(lt_version, QString::fromWCharArray(AppVersionStr) + (cDevVersion() ? " dev" : ""))) + qsl("[/a]"), st::aboutVersion, st::defaultTextStyle),
|
2015-04-02 10:33:19 +00:00
|
|
|
_text(this, lang(lng_about_text), st::aboutLabel, st::aboutTextStyle) {
|
2014-07-18 10:37:34 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
resizeMaxHeight(st::aboutWidth, st::aboutHeight);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
_version.move(0, st::aboutVersionTop);
|
2014-05-30 08:53:19 +00:00
|
|
|
_text.move(0, st::aboutTextTop);
|
|
|
|
|
|
|
|
_headerWidth = st::aboutHeaderFont->m.width(qsl("Telegram "));
|
|
|
|
_subheaderWidth = st::aboutSubheaderFont->m.width(qsl("Desktop"));
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
_done.move(0, height() - _done.height());
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
connect(&_done, SIGNAL(clicked()), this, SLOT(onClose()));
|
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
prepare();
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AboutBox::hideAll() {
|
|
|
|
_done.hide();
|
2014-07-18 10:37:34 +00:00
|
|
|
_version.hide();
|
2014-05-30 08:53:19 +00:00
|
|
|
_text.hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AboutBox::showAll() {
|
|
|
|
_done.show();
|
2014-07-18 10:37:34 +00:00
|
|
|
_version.show();
|
2014-05-30 08:53:19 +00:00
|
|
|
_text.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AboutBox::keyPressEvent(QKeyEvent *e) {
|
|
|
|
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
|
|
|
onClose();
|
2015-04-02 10:33:19 +00:00
|
|
|
} else {
|
|
|
|
AbstractBox::keyPressEvent(e);
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AboutBox::paintEvent(QPaintEvent *e) {
|
|
|
|
QPainter p(this);
|
2015-04-02 10:33:19 +00:00
|
|
|
if (paint(p)) return;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
p.drawPixmap(QPoint((width() - st::aboutIcon.pxWidth()) / 2, st::aboutIconTop), App::sprite(), st::aboutIcon);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
p.setPen(st::black->p);
|
|
|
|
p.setFont(st::aboutHeaderFont->f);
|
|
|
|
p.drawText((width() - (_headerWidth + _subheaderWidth)) / 2, st::aboutHeaderTop + st::aboutHeaderFont->ascent, qsl("Telegram"));
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-04-02 10:33:19 +00:00
|
|
|
p.setFont(st::aboutSubheaderFont->f);
|
|
|
|
p.drawText((width() - (_headerWidth + _subheaderWidth)) / 2 + _headerWidth, st::aboutHeaderTop + st::aboutSubheaderFont->ascent, qsl("Desktop"));
|
2014-05-30 08:53:19 +00:00
|
|
|
}
|