mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added build date info to version label as tooltip.
This commit is contained in:
parent
7681f14a3c
commit
77b2076e0f
1 changed files with 38 additions and 2 deletions
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "ui/widgets/shadow.h"
|
#include "ui/widgets/shadow.h"
|
||||||
|
#include "ui/widgets/tooltip.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
|
@ -40,6 +41,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "info/profile/info_profile_emoji_status_panel.h"
|
#include "info/profile/info_profile_emoji_status_panel.h"
|
||||||
#include "info/stories/info_stories_widget.h"
|
#include "info/stories/info_stories_widget.h"
|
||||||
#include "info/info_memento.h"
|
#include "info/info_memento.h"
|
||||||
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "base/qt_signal_producer.h"
|
#include "base/qt_signal_producer.h"
|
||||||
#include "boxes/about_box.h"
|
#include "boxes/about_box.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
|
@ -81,6 +83,37 @@ namespace {
|
||||||
|
|
||||||
constexpr auto kPlayStatusLimit = 2;
|
constexpr auto kPlayStatusLimit = 2;
|
||||||
|
|
||||||
|
class VersionLabel final
|
||||||
|
: public Ui::FlatLabel
|
||||||
|
, public Ui::AbstractTooltipShower {
|
||||||
|
public:
|
||||||
|
using Ui::FlatLabel::FlatLabel;
|
||||||
|
|
||||||
|
void clickHandlerActiveChanged(
|
||||||
|
const ClickHandlerPtr &action,
|
||||||
|
bool active) override {
|
||||||
|
update();
|
||||||
|
if (active && action && !action->dragText().isEmpty()) {
|
||||||
|
Ui::Tooltip::Show(1000, this);
|
||||||
|
} else {
|
||||||
|
Ui::Tooltip::Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString tooltipText() const override {
|
||||||
|
return u"Build date: %1."_q.arg(__DATE__);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPoint tooltipPos() const override {
|
||||||
|
return QCursor::pos();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tooltipWindowActive() const override {
|
||||||
|
return Ui::AppInFocus() && Ui::InFocusChain(window());
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
[[nodiscard]] bool CanCheckSpecialEvent() {
|
[[nodiscard]] bool CanCheckSpecialEvent() {
|
||||||
static const auto result = [] {
|
static const auto result = [] {
|
||||||
const auto now = QDate::currentDate();
|
const auto now = QDate::currentDate();
|
||||||
|
@ -520,8 +553,11 @@ MainMenu::MainMenu(
|
||||||
, _footer(_inner->add(object_ptr<Ui::RpWidget>(_inner.get())))
|
, _footer(_inner->add(object_ptr<Ui::RpWidget>(_inner.get())))
|
||||||
, _telegram(
|
, _telegram(
|
||||||
Ui::CreateChild<Ui::FlatLabel>(_footer.get(), st::mainMenuTelegramLabel))
|
Ui::CreateChild<Ui::FlatLabel>(_footer.get(), st::mainMenuTelegramLabel))
|
||||||
, _version(
|
, _version((Platform::IsMacStoreBuild() || Platform::IsWindowsStoreBuild())
|
||||||
Ui::CreateChild<Ui::FlatLabel>(
|
? Ui::CreateChild<Ui::FlatLabel>(
|
||||||
|
_footer.get(),
|
||||||
|
st::mainMenuVersionLabel)
|
||||||
|
: Ui::CreateChild<VersionLabel>(
|
||||||
_footer.get(),
|
_footer.get(),
|
||||||
st::mainMenuVersionLabel)) {
|
st::mainMenuVersionLabel)) {
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
|
|
Loading…
Add table
Reference in a new issue