mirror of
https://github.com/vale981/tdesktop
synced 2025-03-08 19:21:39 -05:00
Merge branch 'dev' of https://github.com/telegramdesktop/tdesktop into dev
This commit is contained in:
commit
f1de06424e
2 changed files with 19 additions and 13 deletions
|
@ -68,7 +68,7 @@ namespace {
|
||||||
|
|
||||||
bool frameless = true;
|
bool frameless = true;
|
||||||
bool finished = true;
|
bool finished = true;
|
||||||
bool noQtTrayIcon = false;
|
bool noQtTrayIcon = false, noTryUnity = false;
|
||||||
bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false;
|
bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false;
|
||||||
|
|
||||||
AppIndicator *_trayIndicator = 0;
|
AppIndicator *_trayIndicator = 0;
|
||||||
|
@ -351,10 +351,16 @@ namespace {
|
||||||
class _PsInitializer {
|
class _PsInitializer {
|
||||||
public:
|
public:
|
||||||
_PsInitializer() {
|
_PsInitializer() {
|
||||||
|
static bool inited = false;
|
||||||
|
if (inited) return;
|
||||||
|
inited = true;
|
||||||
|
|
||||||
QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower();
|
QString cdesktop = QString(getenv("XDG_CURRENT_DESKTOP")).toLower();
|
||||||
noQtTrayIcon = (cdesktop == qstr("unity")) || (cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome"));
|
noQtTrayIcon = false;//(cdesktop == qstr("pantheon")) || (cdesktop == qstr("gnome"));
|
||||||
|
noTryUnity = (cdesktop != qstr("unity"));
|
||||||
|
|
||||||
if (noQtTrayIcon) cSetSupportTray(false);
|
if (noQtTrayIcon) cSetSupportTray(false);
|
||||||
|
|
||||||
std::cout << "libs init..\n";
|
std::cout << "libs init..\n";
|
||||||
setupGtk();
|
setupGtk();
|
||||||
setupUnity();
|
setupUnity();
|
||||||
|
@ -458,9 +464,9 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupUnity() {
|
void setupUnity() {
|
||||||
if (!useGtkBase || !noQtTrayIcon) return;
|
if (noTryUnity) return;
|
||||||
|
|
||||||
QLibrary lib_unity(qstr("unity"), 9, 0);
|
QLibrary lib_unity(qstr("unity"), 9, 0);
|
||||||
if (!loadLibrary(lib_unity, "unity", 9)) return;
|
if (!loadLibrary(lib_unity, "unity", 9)) return;
|
||||||
|
|
||||||
if (!loadFunction(lib_unity, "unity_launcher_entry_get_for_desktop_id", ps_unity_launcher_entry_get_for_desktop_id)) return;
|
if (!loadFunction(lib_unity, "unity_launcher_entry_get_for_desktop_id", ps_unity_launcher_entry_get_for_desktop_id)) return;
|
||||||
|
@ -470,7 +476,6 @@ namespace {
|
||||||
std::cout << "unity count api loaded\n";
|
std::cout << "unity count api loaded\n";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_PsInitializer _psInitializer;
|
|
||||||
|
|
||||||
class _PsEventFilter : public QAbstractNativeEventFilter {
|
class _PsEventFilter : public QAbstractNativeEventFilter {
|
||||||
public:
|
public:
|
||||||
|
@ -933,6 +938,8 @@ void PsMainWindow::psPlatformNotify(HistoryItem *item, int32 fwdCount) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PsApplication::PsApplication(int &argc, char **argv) : QApplication(argc, argv) {
|
PsApplication::PsApplication(int &argc, char **argv) : QApplication(argc, argv) {
|
||||||
|
_PsInitializer _psInitializer;
|
||||||
|
Q_UNUSED(_psInitializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PsApplication::psInstallEventFilter() {
|
void PsApplication::psInstallEventFilter() {
|
||||||
|
|
|
@ -429,16 +429,11 @@ void Window::init() {
|
||||||
|
|
||||||
title = new TitleWidget(this);
|
title = new TitleWidget(this);
|
||||||
|
|
||||||
psInitSize();
|
|
||||||
psUpdateWorkmode();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::firstShow() {
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
trayIconMenu = new ContextMenu(this);
|
trayIconMenu = new ContextMenu(this);
|
||||||
#else
|
#else
|
||||||
trayIconMenu = new QMenu(this);
|
trayIconMenu = new QMenu(this);
|
||||||
trayIconMenu->setFont(QFont("Tahoma"));
|
trayIconMenu->setFont(QFont("Tahoma"));
|
||||||
#endif
|
#endif
|
||||||
if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
|
if (cPlatform() == dbipWindows || cPlatform() == dbipMac) {
|
||||||
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
|
trayIconMenu->addAction(lang(lng_minimize_to_tray), this, SLOT(minimizeToTray()))->setEnabled(true);
|
||||||
|
@ -449,8 +444,12 @@ void Window::firstShow() {
|
||||||
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
|
trayIconMenu->addAction(lang(lng_quit_from_tray), this, SLOT(quitFromTray()))->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
psFirstShow();
|
psInitSize();
|
||||||
|
psUpdateWorkmode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Window::firstShow() {
|
||||||
|
psFirstShow();
|
||||||
updateTrayMenu();
|
updateTrayMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue