2016-06-16 12:59:54 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-06-16 12:59:54 +00:00
|
|
|
*/
|
|
|
|
#include "platform/linux/main_window_linux.h"
|
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
#include "styles/style_window.h"
|
2016-06-16 17:20:58 +00:00
|
|
|
#include "platform/linux/linux_libs.h"
|
2020-01-30 18:41:24 +00:00
|
|
|
#include "platform/linux/specific_linux.h"
|
2017-02-26 17:19:35 +00:00
|
|
|
#include "platform/linux/linux_desktop_environment.h"
|
2016-10-03 15:07:50 +00:00
|
|
|
#include "platform/platform_notifications_manager.h"
|
2018-01-25 14:19:14 +00:00
|
|
|
#include "history/history.h"
|
2016-06-16 12:59:54 +00:00
|
|
|
#include "mainwindow.h"
|
2019-01-21 13:42:21 +00:00
|
|
|
#include "core/application.h"
|
2017-04-13 08:27:10 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2017-03-04 10:23:56 +00:00
|
|
|
#include "storage/localstorage.h"
|
2019-09-13 06:06:02 +00:00
|
|
|
#include "facades.h"
|
|
|
|
#include "app.h"
|
2019-09-08 20:15:42 +00:00
|
|
|
|
2020-01-21 12:51:39 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
2018-12-07 17:59:14 +00:00
|
|
|
#include <QtDBus>
|
2020-01-21 12:51:39 +00:00
|
|
|
#endif
|
|
|
|
|
2019-09-08 20:15:42 +00:00
|
|
|
#include <QtWidgets/QMenu>
|
|
|
|
#include <QtWidgets/QAction>
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
namespace Platform {
|
|
|
|
namespace {
|
|
|
|
|
2016-06-16 17:20:58 +00:00
|
|
|
bool noQtTrayIcon = false, tryAppIndicator = false;
|
|
|
|
bool useGtkBase = false, useAppIndicator = false, useStatusIcon = false, trayIconChecked = false, useUnityCount = false;
|
|
|
|
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
AppIndicator *_trayIndicator = 0;
|
|
|
|
GtkStatusIcon *_trayIcon = 0;
|
|
|
|
GtkWidget *_trayMenu = 0;
|
|
|
|
GdkPixbuf *_trayPixbuf = 0;
|
|
|
|
QByteArray _trayPixbufData;
|
|
|
|
QList<QPair<GtkWidget*, QObject*> > _trayItems;
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2020-01-24 01:39:46 +00:00
|
|
|
int32 _trayIconSize = 48;
|
2016-06-16 17:20:58 +00:00
|
|
|
bool _trayIconMuted = true;
|
|
|
|
int32 _trayIconCount = 0;
|
|
|
|
QImage _trayIconImageBack, _trayIconImage;
|
2020-01-24 01:39:46 +00:00
|
|
|
QString _trayIconThemeName, _trayIconName;
|
2018-12-07 17:59:14 +00:00
|
|
|
QString _desktopFile;
|
2020-01-21 12:51:39 +00:00
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
2018-12-07 17:59:14 +00:00
|
|
|
QString _dbusPath = "/";
|
2020-01-21 12:51:39 +00:00
|
|
|
#endif
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
void _trayIconPopup(GtkStatusIcon *status_icon, guint button, guint32 activate_time, gpointer popup_menu) {
|
2016-10-19 12:24:39 +00:00
|
|
|
Libs::gtk_menu_popup(Libs::gtk_menu_cast(popup_menu), NULL, NULL, Libs::gtk_status_icon_position_menu, status_icon, button, activate_time);
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void _trayIconActivate(GtkStatusIcon *status_icon, gpointer popup_menu) {
|
2016-10-19 12:24:39 +00:00
|
|
|
if (App::wnd()->isActiveWindow() && App::wnd()->isVisible()) {
|
|
|
|
Libs::gtk_menu_popup(Libs::gtk_menu_cast(popup_menu), NULL, NULL, Libs::gtk_status_icon_position_menu, status_icon, 0, Libs::gtk_get_current_event_time());
|
|
|
|
} else {
|
|
|
|
App::wnd()->showFromTray();
|
|
|
|
}
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean _trayIconResized(GtkStatusIcon *status_icon, gint size, gpointer popup_menu) {
|
2016-10-19 12:24:39 +00:00
|
|
|
_trayIconSize = size;
|
2016-11-11 07:51:53 +00:00
|
|
|
if (Global::started()) Notify::unreadCounterUpdated();
|
2016-10-19 12:24:39 +00:00
|
|
|
return FALSE;
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
|
|
|
|
#define QT_RED 0
|
|
|
|
#define QT_GREEN 1
|
|
|
|
#define QT_BLUE 2
|
|
|
|
#define QT_ALPHA 3
|
|
|
|
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
#define GTK_RED 2
|
|
|
|
#define GTK_GREEN 1
|
|
|
|
#define GTK_BLUE 0
|
|
|
|
#define GTK_ALPHA 3
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2020-01-24 01:39:46 +00:00
|
|
|
QImage _trayIconImageGen(bool useSystemIcon) {
|
2019-01-21 13:42:21 +00:00
|
|
|
const auto counter = Core::App().unreadBadge();
|
|
|
|
const auto muted = Core::App().unreadBadgeMuted();
|
2018-12-04 10:32:06 +00:00
|
|
|
const auto counterSlice = (counter >= 1000)
|
|
|
|
? (1000 + (counter % 100))
|
|
|
|
: counter;
|
2020-01-24 01:39:46 +00:00
|
|
|
|
|
|
|
QString iconThemeName = QIcon::themeName();
|
|
|
|
QString iconName = (counter > 0)
|
|
|
|
? (muted ? "telegram-mute-panel" : "telegram-attention-panel")
|
|
|
|
: "telegram-panel";
|
|
|
|
|
|
|
|
if (_trayIconImage.isNull() || _trayIconImage.width() != _trayIconSize
|
|
|
|
|| (useSystemIcon && (iconThemeName != _trayIconThemeName
|
|
|
|
|| iconName != _trayIconName))
|
|
|
|
|| muted != _trayIconMuted || counterSlice != _trayIconCount) {
|
|
|
|
if (_trayIconImageBack.isNull()
|
|
|
|
|| _trayIconImageBack.width() != _trayIconSize
|
|
|
|
|| iconThemeName != _trayIconThemeName
|
|
|
|
|| iconName != _trayIconName) {
|
|
|
|
_trayIconImageBack = Core::App().logo();
|
|
|
|
|
|
|
|
if (useSystemIcon) {
|
|
|
|
_trayIconImageBack = QIcon::fromTheme(
|
|
|
|
iconName,
|
|
|
|
QIcon::fromTheme(
|
|
|
|
"telegram",
|
|
|
|
QIcon(QPixmap::fromImage(_trayIconImageBack)))
|
|
|
|
).pixmap(_trayIconSize, _trayIconSize).toImage();
|
|
|
|
}
|
|
|
|
|
|
|
|
int w = _trayIconImageBack.width(),
|
|
|
|
h = _trayIconImageBack.height();
|
|
|
|
|
|
|
|
if (w != _trayIconSize || h != _trayIconSize) {
|
|
|
|
_trayIconImageBack = _trayIconImageBack.scaled(
|
|
|
|
_trayIconSize,
|
|
|
|
_trayIconSize,
|
|
|
|
Qt::IgnoreAspectRatio,
|
|
|
|
Qt::SmoothTransformation);
|
|
|
|
}
|
|
|
|
|
|
|
|
_trayIconImageBack = _trayIconImageBack.convertToFormat(
|
|
|
|
QImage::Format_ARGB32);
|
|
|
|
|
|
|
|
w = _trayIconImageBack.width();
|
|
|
|
h = _trayIconImageBack.height();
|
|
|
|
int perline = _trayIconImageBack.bytesPerLine();
|
2016-10-19 12:24:39 +00:00
|
|
|
uchar *bytes = _trayIconImageBack.bits();
|
2020-01-24 01:39:46 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
for (int32 y = 0; y < h; ++y) {
|
|
|
|
for (int32 x = 0; x < w; ++x) {
|
|
|
|
int32 srcoff = y * perline + x * 4;
|
2020-01-24 01:39:46 +00:00
|
|
|
bytes[srcoff + QT_RED ] = qMax(
|
|
|
|
bytes[srcoff + QT_RED ],
|
|
|
|
uchar(224));
|
|
|
|
bytes[srcoff + QT_GREEN] = qMax(
|
|
|
|
bytes[srcoff + QT_GREEN],
|
|
|
|
uchar(165));
|
|
|
|
bytes[srcoff + QT_BLUE ] = qMax(
|
|
|
|
bytes[srcoff + QT_BLUE ],
|
|
|
|
uchar(44));
|
2016-10-19 12:24:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-24 01:39:46 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
_trayIconImage = _trayIconImageBack;
|
2019-01-10 13:55:56 +00:00
|
|
|
_trayIconMuted = muted;
|
|
|
|
_trayIconCount = counterSlice;
|
2020-01-24 01:39:46 +00:00
|
|
|
_trayIconThemeName = iconThemeName;
|
|
|
|
_trayIconName = iconName;
|
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
if (counter > 0) {
|
|
|
|
QPainter p(&_trayIconImage);
|
|
|
|
int32 layerSize = -16;
|
2020-01-24 01:39:46 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
if (_trayIconSize >= 48) {
|
|
|
|
layerSize = -32;
|
|
|
|
} else if (_trayIconSize >= 36) {
|
|
|
|
layerSize = -24;
|
|
|
|
} else if (_trayIconSize >= 32) {
|
|
|
|
layerSize = -20;
|
|
|
|
}
|
2020-01-24 01:39:46 +00:00
|
|
|
|
2016-10-31 12:29:26 +00:00
|
|
|
auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
|
|
|
|
auto &fg = st::trayCounterFg;
|
2020-01-24 01:39:46 +00:00
|
|
|
|
|
|
|
auto layer = App::wnd()->iconWithCounter(
|
|
|
|
layerSize,
|
|
|
|
counter,
|
|
|
|
bg,
|
|
|
|
fg,
|
|
|
|
false);
|
|
|
|
|
|
|
|
p.drawImage(
|
|
|
|
_trayIconImage.width() - layer.width() - 1,
|
|
|
|
_trayIconImage.height() - layer.height() - 1,
|
|
|
|
layer);
|
2016-10-19 12:24:39 +00:00
|
|
|
}
|
|
|
|
}
|
2020-01-24 01:39:46 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
return _trayIconImage;
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString _trayIconImageFile() {
|
2019-01-21 13:42:21 +00:00
|
|
|
const auto counter = Core::App().unreadBadge();
|
|
|
|
const auto muted = Core::App().unreadBadgeMuted();
|
2020-01-24 01:39:46 +00:00
|
|
|
const auto counterSlice = (counter >= 1000)
|
|
|
|
? (1000 + (counter % 100))
|
|
|
|
: counter;
|
|
|
|
|
|
|
|
QString iconThemeName = QIcon::themeName();
|
|
|
|
|
|
|
|
QString name = cWorkingDir() + qsl("tdata/ticons/icon%1_%2_%3_%4.png")
|
|
|
|
.arg(muted ? "mute" : "")
|
|
|
|
.arg(iconThemeName)
|
|
|
|
.arg(_trayIconSize)
|
|
|
|
.arg(counterSlice);
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
QFileInfo info(name);
|
|
|
|
if (info.exists()) return name;
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2020-01-24 01:39:46 +00:00
|
|
|
QImage img = _trayIconImageGen(false);
|
2016-10-19 12:24:39 +00:00
|
|
|
if (img.save(name, "PNG")) return name;
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
QDir dir(info.absoluteDir());
|
|
|
|
if (!dir.exists()) {
|
|
|
|
dir.mkpath(dir.absolutePath());
|
|
|
|
if (img.save(name, "PNG")) return name;
|
|
|
|
}
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
return QString();
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
|
|
|
|
void loadPixbuf(QImage image) {
|
2016-10-19 12:24:39 +00:00
|
|
|
int w = image.width(), h = image.height(), perline = image.bytesPerLine(), s = image.byteCount();
|
|
|
|
_trayPixbufData.resize(w * h * 4);
|
|
|
|
uchar *result = (uchar*)_trayPixbufData.data(), *bytes = image.bits();
|
|
|
|
for (int32 y = 0; y < h; ++y) {
|
|
|
|
for (int32 x = 0; x < w; ++x) {
|
|
|
|
int32 offset = (y * w + x) * 4, srcoff = y * perline + x * 4;
|
|
|
|
result[offset + GTK_RED ] = bytes[srcoff + QT_RED ];
|
|
|
|
result[offset + GTK_GREEN] = bytes[srcoff + QT_GREEN];
|
|
|
|
result[offset + GTK_BLUE ] = bytes[srcoff + QT_BLUE ];
|
|
|
|
result[offset + GTK_ALPHA] = bytes[srcoff + QT_ALPHA];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_trayPixbuf) Libs::g_object_unref(_trayPixbuf);
|
|
|
|
_trayPixbuf = Libs::gdk_pixbuf_new_from_data(result, GDK_COLORSPACE_RGB, true, 8, w, h, w * 4, 0, 0);
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void _trayMenuCallback(GtkMenu *menu, gpointer data) {
|
2016-10-19 12:24:39 +00:00
|
|
|
for (int32 i = 0, l = _trayItems.size(); i < l; ++i) {
|
|
|
|
if ((void*)_trayItems.at(i).first == (void*)menu) {
|
|
|
|
QMetaObject::invokeMethod(_trayItems.at(i).second, "triggered");
|
|
|
|
}
|
|
|
|
}
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean _trayIconCheck(gpointer/* pIn*/) {
|
2016-10-19 12:24:39 +00:00
|
|
|
if (useStatusIcon && !trayIconChecked) {
|
|
|
|
if (Libs::gtk_status_icon_is_embedded(_trayIcon)) {
|
|
|
|
trayIconChecked = true;
|
|
|
|
cSetSupportTray(true);
|
2017-03-04 19:36:59 +00:00
|
|
|
if (Global::started()) {
|
|
|
|
Global::RefWorkMode().setForced(Global::WorkMode().value(), true);
|
|
|
|
}
|
2016-10-19 12:24:39 +00:00
|
|
|
if (App::wnd()) {
|
2016-11-11 07:51:53 +00:00
|
|
|
Notify::unreadCounterUpdated();
|
2016-10-19 12:24:39 +00:00
|
|
|
App::wnd()->updateTrayMenu();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
|
|
|
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2018-12-07 17:59:14 +00:00
|
|
|
quint32 djbStringHash(QString string) {
|
2020-01-02 11:25:52 +00:00
|
|
|
quint32 hash = 5381;
|
|
|
|
QByteArray chars = string.toLatin1();
|
|
|
|
for(int i = 0; i < chars.length(); i++){
|
|
|
|
hash = (hash << 5) + hash + chars[i];
|
|
|
|
}
|
|
|
|
return hash;
|
2018-12-07 17:59:14 +00:00
|
|
|
}
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
} // namespace
|
|
|
|
|
2019-06-06 11:20:21 +00:00
|
|
|
MainWindow::MainWindow(not_null<Window::Controller*> controller)
|
|
|
|
: Window::MainWindow(controller) {
|
2016-06-16 12:59:54 +00:00
|
|
|
connect(&_psCheckStatusIconTimer, SIGNAL(timeout()), this, SLOT(psStatusIconCheck()));
|
|
|
|
_psCheckStatusIconTimer.setSingleShot(false);
|
|
|
|
|
|
|
|
connect(&_psUpdateIndicatorTimer, SIGNAL(timeout()), this, SLOT(psUpdateIndicator()));
|
|
|
|
_psUpdateIndicatorTimer.setSingleShot(true);
|
|
|
|
}
|
|
|
|
|
2017-01-01 16:45:20 +00:00
|
|
|
bool MainWindow::hasTrayIcon() const {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2017-03-04 19:36:59 +00:00
|
|
|
return trayIcon || ((useAppIndicator || (useStatusIcon && trayIconChecked)) && (Global::WorkMode().value() != dbiwmWindowOnly));
|
2017-08-07 11:57:34 +00:00
|
|
|
#else
|
|
|
|
return trayIcon;
|
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::psStatusIconCheck() {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
_trayIconCheck(0);
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
if (cSupportTray() || !--_psCheckStatusIconLeft) {
|
|
|
|
_psCheckStatusIconTimer.stop();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::psShowTrayMenu() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::psTrayMenuUpdated() {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
if (noQtTrayIcon && (useAppIndicator || useStatusIcon)) {
|
|
|
|
const QList<QAction*> &actions = trayIconMenu->actions();
|
|
|
|
if (_trayItems.isEmpty()) {
|
|
|
|
DEBUG_LOG(("Creating tray menu!"));
|
|
|
|
for (int32 i = 0, l = actions.size(); i != l; ++i) {
|
2016-06-16 17:20:58 +00:00
|
|
|
GtkWidget *item = Libs::gtk_menu_item_new_with_label(actions.at(i)->text().toUtf8());
|
|
|
|
Libs::gtk_menu_shell_append(Libs::gtk_menu_shell_cast(_trayMenu), item);
|
|
|
|
Libs::g_signal_connect_helper(item, "activate", G_CALLBACK(_trayMenuCallback), this);
|
|
|
|
Libs::gtk_widget_show(item);
|
|
|
|
Libs::gtk_widget_set_sensitive(item, actions.at(i)->isEnabled());
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
_trayItems.push_back(qMakePair(item, actions.at(i)));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
DEBUG_LOG(("Updating tray menu!"));
|
|
|
|
for (int32 i = 0, l = actions.size(); i != l; ++i) {
|
|
|
|
if (i < _trayItems.size()) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::gtk_menu_item_set_label(reinterpret_cast<GtkMenuItem*>(_trayItems.at(i).first), actions.at(i)->text().toUtf8());
|
|
|
|
Libs::gtk_widget_set_sensitive(_trayItems.at(i).first, actions.at(i)->isEnabled());
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::psSetupTrayIcon() {
|
|
|
|
if (noQtTrayIcon) {
|
|
|
|
if (!cSupportTray()) return;
|
2016-11-11 07:51:53 +00:00
|
|
|
updateIconCounters();
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
2016-10-19 12:24:39 +00:00
|
|
|
LOG(("Using Qt tray icon."));
|
2016-06-16 12:59:54 +00:00
|
|
|
if (!trayIcon) {
|
|
|
|
trayIcon = new QSystemTrayIcon(this);
|
2020-01-24 01:39:46 +00:00
|
|
|
trayIcon->setIcon(QIcon(QPixmap::fromImage(_trayIconImageGen(true))));
|
2016-06-21 14:19:24 +00:00
|
|
|
|
2019-04-12 13:21:01 +00:00
|
|
|
attachToTrayIcon(trayIcon);
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2016-11-11 07:51:53 +00:00
|
|
|
updateIconCounters();
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
trayIcon->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
void MainWindow::workmodeUpdated(DBIWorkMode mode) {
|
2016-06-16 12:59:54 +00:00
|
|
|
if (!cSupportTray()) return;
|
|
|
|
|
2017-03-04 19:36:59 +00:00
|
|
|
if (mode == dbiwmWindowOnly) {
|
2016-06-16 12:59:54 +00:00
|
|
|
if (noQtTrayIcon) {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
if (useAppIndicator) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_PASSIVE);
|
2016-06-16 12:59:54 +00:00
|
|
|
} else if (useStatusIcon) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::gtk_status_icon_set_visible(_trayIcon, false);
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
|
|
|
if (trayIcon) {
|
|
|
|
trayIcon->setContextMenu(0);
|
|
|
|
trayIcon->deleteLater();
|
|
|
|
}
|
|
|
|
trayIcon = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (noQtTrayIcon) {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
if (useAppIndicator) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
|
2016-06-16 12:59:54 +00:00
|
|
|
} else if (useStatusIcon) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::gtk_status_icon_set_visible(_trayIcon, true);
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
|
|
|
psSetupTrayIcon();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::psUpdateIndicator() {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
_psUpdateIndicatorTimer.stop();
|
2019-02-19 06:57:53 +00:00
|
|
|
_psLastIndicatorUpdate = crl::now();
|
2016-06-22 19:50:44 +00:00
|
|
|
QFileInfo iconFile(_trayIconImageFile());
|
|
|
|
if (iconFile.exists()) {
|
|
|
|
QByteArray path = QFile::encodeName(iconFile.absoluteFilePath()), name = QFile::encodeName(iconFile.fileName());
|
2016-06-16 12:59:54 +00:00
|
|
|
name = name.mid(0, name.size() - 4);
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::app_indicator_set_icon_full(_trayIndicator, path.constData(), name);
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
|
|
|
useAppIndicator = false;
|
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
2016-11-11 07:51:53 +00:00
|
|
|
void MainWindow::unreadCounterChangedHook() {
|
|
|
|
setWindowTitle(titleText());
|
|
|
|
updateIconCounters();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::updateIconCounters() {
|
2017-05-12 15:27:19 +00:00
|
|
|
updateWindowIcon();
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2020-01-21 12:51:39 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
2018-12-07 17:59:14 +00:00
|
|
|
if (useUnityCount) {
|
2020-01-24 01:39:46 +00:00
|
|
|
const auto counter = Core::App().unreadBadge();
|
2018-12-07 17:59:14 +00:00
|
|
|
QVariantMap dbusUnityProperties;
|
2016-06-16 12:59:54 +00:00
|
|
|
if (counter > 0) {
|
2018-12-07 17:59:14 +00:00
|
|
|
// Gnome requires that count is a 64bit integer
|
|
|
|
dbusUnityProperties.insert("count", (qint64) ((counter > 9999) ? 9999 : (counter)));
|
|
|
|
dbusUnityProperties.insert("count-visible", true);
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
2018-12-07 17:59:14 +00:00
|
|
|
dbusUnityProperties.insert("count-visible", false);
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2018-12-07 17:59:14 +00:00
|
|
|
QDBusMessage signal = QDBusMessage::createSignal(_dbusPath, "com.canonical.Unity.LauncherEntry", "Update");
|
|
|
|
signal << "application://" + _desktopFile;
|
|
|
|
signal << dbusUnityProperties;
|
|
|
|
QDBusConnection::sessionBus().send(signal);
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2020-01-21 12:51:39 +00:00
|
|
|
#endif
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
if (noQtTrayIcon) {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
if (useAppIndicator) {
|
2019-02-19 06:57:53 +00:00
|
|
|
if (crl::now() > _psLastIndicatorUpdate + 1000) {
|
2016-06-16 12:59:54 +00:00
|
|
|
psUpdateIndicator();
|
|
|
|
} else if (!_psUpdateIndicatorTimer.isActive()) {
|
|
|
|
_psUpdateIndicatorTimer.start(100);
|
|
|
|
}
|
|
|
|
} else if (useStatusIcon && trayIconChecked) {
|
2020-01-24 01:39:46 +00:00
|
|
|
loadPixbuf(_trayIconImageGen(true));
|
|
|
|
Libs::gtk_status_icon_set_from_pixbuf(_trayIcon, _trayPixbuf);
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
} else if (trayIcon) {
|
2020-01-24 01:39:46 +00:00
|
|
|
trayIcon->setIcon(QIcon(QPixmap::fromImage(_trayIconImageGen(true))));
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-16 17:20:58 +00:00
|
|
|
void MainWindow::LibsLoaded() {
|
2017-02-26 17:19:35 +00:00
|
|
|
noQtTrayIcon = !DesktopEnvironment::TryQtTrayIcon();
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2017-04-04 09:58:44 +00:00
|
|
|
tryAppIndicator = DesktopEnvironment::PreferAppIndicatorTrayIcon();
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
|
2017-04-03 16:56:20 +00:00
|
|
|
LOG(("Tray Icon: Try Qt = %1, Prefer appindicator = %2").arg(Logs::b(!noQtTrayIcon)).arg(Logs::b(tryAppIndicator)));
|
|
|
|
|
2016-06-16 17:20:58 +00:00
|
|
|
if (noQtTrayIcon) cSetSupportTray(false);
|
|
|
|
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
useGtkBase = (Libs::gtk_init_check != nullptr)
|
|
|
|
&& (Libs::gtk_menu_new != nullptr)
|
|
|
|
&& (Libs::gtk_menu_get_type != nullptr)
|
|
|
|
&& (Libs::gtk_menu_item_new_with_label != nullptr)
|
|
|
|
&& (Libs::gtk_menu_item_set_label != nullptr)
|
|
|
|
&& (Libs::gtk_menu_shell_append != nullptr)
|
|
|
|
&& (Libs::gtk_menu_shell_get_type != nullptr)
|
|
|
|
&& (Libs::gtk_widget_show != nullptr)
|
|
|
|
&& (Libs::gtk_widget_get_toplevel != nullptr)
|
|
|
|
&& (Libs::gtk_widget_get_visible != nullptr)
|
|
|
|
&& (Libs::gtk_widget_set_sensitive != nullptr)
|
|
|
|
&& (Libs::g_type_check_instance_cast != nullptr)
|
|
|
|
&& (Libs::g_signal_connect_data != nullptr)
|
|
|
|
&& (Libs::g_object_ref_sink != nullptr)
|
|
|
|
&& (Libs::g_object_unref != nullptr);
|
|
|
|
|
|
|
|
useAppIndicator = useGtkBase
|
|
|
|
&& (Libs::app_indicator_new != nullptr)
|
|
|
|
&& (Libs::app_indicator_set_status != nullptr)
|
|
|
|
&& (Libs::app_indicator_set_menu != nullptr)
|
|
|
|
&& (Libs::app_indicator_set_icon_full != nullptr);
|
|
|
|
|
|
|
|
if (tryAppIndicator && useGtkBase && useAppIndicator) {
|
|
|
|
noQtTrayIcon = true;
|
|
|
|
cSetSupportTray(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
useStatusIcon = (Libs::gdk_init_check != nullptr)
|
|
|
|
&& (Libs::gdk_pixbuf_new_from_data != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_new_from_pixbuf != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_set_from_pixbuf != nullptr)
|
2016-06-21 14:19:24 +00:00
|
|
|
&& (Libs::gtk_status_icon_new_from_file != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_set_from_file != nullptr)
|
2016-06-16 17:20:58 +00:00
|
|
|
&& (Libs::gtk_status_icon_set_title != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_set_tooltip_text != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_set_visible != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_is_embedded != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_get_geometry != nullptr)
|
|
|
|
&& (Libs::gtk_status_icon_position_menu != nullptr)
|
|
|
|
&& (Libs::gtk_menu_popup != nullptr)
|
|
|
|
&& (Libs::gtk_get_current_event_time != nullptr)
|
|
|
|
&& (Libs::g_idle_add != nullptr);
|
|
|
|
if (useStatusIcon) {
|
|
|
|
DEBUG_LOG(("Status icon api loaded!"));
|
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 17:20:58 +00:00
|
|
|
}
|
|
|
|
|
2016-06-16 12:59:54 +00:00
|
|
|
void MainWindow::psCreateTrayIcon() {
|
|
|
|
if (!noQtTrayIcon) {
|
2017-04-03 16:56:20 +00:00
|
|
|
LOG(("Tray Icon: Using Qt tray icon, available: %1").arg(Logs::b(QSystemTrayIcon::isSystemTrayAvailable())));
|
2016-06-16 12:59:54 +00:00
|
|
|
cSetSupportTray(QSystemTrayIcon::isSystemTrayAvailable());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
if (useAppIndicator) {
|
|
|
|
DEBUG_LOG(("Trying to create AppIndicator"));
|
2016-06-16 17:20:58 +00:00
|
|
|
_trayMenu = Libs::gtk_menu_new();
|
2016-06-16 12:59:54 +00:00
|
|
|
if (_trayMenu) {
|
|
|
|
DEBUG_LOG(("Created gtk menu for appindicator!"));
|
2016-06-22 19:50:44 +00:00
|
|
|
QFileInfo iconFile(_trayIconImageFile());
|
|
|
|
if (iconFile.exists()) {
|
|
|
|
QByteArray path = QFile::encodeName(iconFile.absoluteFilePath());
|
2016-06-16 17:20:58 +00:00
|
|
|
_trayIndicator = Libs::app_indicator_new("Telegram Desktop", path.constData(), APP_INDICATOR_CATEGORY_APPLICATION_STATUS);
|
2016-06-16 12:59:54 +00:00
|
|
|
if (_trayIndicator) {
|
2017-04-03 16:56:20 +00:00
|
|
|
LOG(("Tray Icon: Using appindicator tray icon."));
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
|
|
|
DEBUG_LOG(("Failed to app_indicator_new()!"));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
useAppIndicator = false;
|
|
|
|
DEBUG_LOG(("Failed to create image file!"));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
DEBUG_LOG(("Failed to gtk_menu_new()!"));
|
|
|
|
}
|
|
|
|
if (_trayMenu && _trayIndicator) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::app_indicator_set_status(_trayIndicator, APP_INDICATOR_STATUS_ACTIVE);
|
|
|
|
Libs::app_indicator_set_menu(_trayIndicator, Libs::gtk_menu_cast(_trayMenu));
|
2016-06-16 12:59:54 +00:00
|
|
|
useStatusIcon = false;
|
|
|
|
} else {
|
|
|
|
DEBUG_LOG(("AppIndicator failed!"));
|
|
|
|
useAppIndicator = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (useStatusIcon) {
|
2016-06-16 17:20:58 +00:00
|
|
|
if (Libs::gdk_init_check(0, 0)) {
|
|
|
|
if (!_trayMenu) _trayMenu = Libs::gtk_menu_new();
|
2016-06-16 12:59:54 +00:00
|
|
|
if (_trayMenu) {
|
2020-01-24 01:39:46 +00:00
|
|
|
loadPixbuf(_trayIconImageGen(true));
|
|
|
|
_trayIcon = Libs::gtk_status_icon_new_from_pixbuf(_trayPixbuf);
|
2016-06-16 12:59:54 +00:00
|
|
|
if (_trayIcon) {
|
2017-04-03 16:56:20 +00:00
|
|
|
LOG(("Tray Icon: Using GTK status tray icon."));
|
2016-10-19 12:24:39 +00:00
|
|
|
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::g_signal_connect_helper(_trayIcon, "popup-menu", GCallback(_trayIconPopup), _trayMenu);
|
|
|
|
Libs::g_signal_connect_helper(_trayIcon, "activate", GCallback(_trayIconActivate), _trayMenu);
|
|
|
|
Libs::g_signal_connect_helper(_trayIcon, "size-changed", GCallback(_trayIconResized), _trayMenu);
|
2016-06-16 12:59:54 +00:00
|
|
|
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::gtk_status_icon_set_title(_trayIcon, "Telegram Desktop");
|
|
|
|
Libs::gtk_status_icon_set_tooltip_text(_trayIcon, "Telegram Desktop");
|
|
|
|
Libs::gtk_status_icon_set_visible(_trayIcon, true);
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
|
|
|
useStatusIcon = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
useStatusIcon = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
useStatusIcon = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!useStatusIcon && !useAppIndicator) {
|
2017-04-03 16:56:20 +00:00
|
|
|
LOG(("Tray Icon: Not able to use any tray icon :("));
|
2016-06-16 12:59:54 +00:00
|
|
|
if (_trayMenu) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::g_object_ref_sink(_trayMenu);
|
|
|
|
Libs::g_object_unref(_trayMenu);
|
2017-04-03 16:56:20 +00:00
|
|
|
_trayMenu = nullptr;
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
cSetSupportTray(useAppIndicator);
|
|
|
|
if (useStatusIcon) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::g_idle_add((GSourceFunc)_trayIconCheck, 0);
|
2016-06-16 12:59:54 +00:00
|
|
|
_psCheckStatusIconTimer.start(100);
|
|
|
|
} else {
|
2017-03-04 19:36:59 +00:00
|
|
|
workmodeUpdated(Global::WorkMode().value());
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::psFirstShow() {
|
|
|
|
psCreateTrayIcon();
|
|
|
|
|
2020-01-21 12:51:39 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_DBUS_INTEGRATION
|
2018-12-07 17:59:14 +00:00
|
|
|
if (QDBusInterface("com.canonical.Unity", "/").isValid()) {
|
2020-01-30 18:41:24 +00:00
|
|
|
std::vector<QString> possibleDesktopFiles = {
|
|
|
|
GetLauncherFilename(),
|
|
|
|
"Telegram.desktop"
|
|
|
|
};
|
|
|
|
|
|
|
|
for (auto it = possibleDesktopFiles.begin(); it != possibleDesktopFiles.end(); it++) {
|
|
|
|
if (!QStandardPaths::locate(QStandardPaths::ApplicationsLocation, *it).isEmpty()) {
|
|
|
|
_desktopFile = *it;
|
|
|
|
LOG(("Found Unity Launcher entry %1!").arg(_desktopFile));
|
|
|
|
useUnityCount = true;
|
|
|
|
break;
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2020-01-30 18:41:24 +00:00
|
|
|
}
|
|
|
|
if (!useUnityCount) {
|
|
|
|
LOG(("Could not get Unity Launcher entry!"));
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2018-12-07 17:59:14 +00:00
|
|
|
_dbusPath = "/com/canonical/unity/launcherentry/" + QString::number(djbStringHash("application://" + _desktopFile));
|
2016-06-16 12:59:54 +00:00
|
|
|
} else {
|
|
|
|
LOG(("Not using Unity Launcher count."));
|
|
|
|
}
|
2020-01-21 12:51:39 +00:00
|
|
|
#endif
|
2016-06-16 12:59:54 +00:00
|
|
|
|
|
|
|
show();
|
|
|
|
if (cWindowPos().maximized) {
|
2017-07-03 12:23:41 +00:00
|
|
|
DEBUG_LOG(("Window Pos: First show, setting maximized."));
|
2016-06-16 12:59:54 +00:00
|
|
|
setWindowState(Qt::WindowMaximized);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((cLaunchMode() == LaunchModeAutoStart && cStartMinimized()) || cStartInTray()) {
|
2020-01-28 08:40:27 +00:00
|
|
|
// If I call hide() synchronously here after show() then on Ubuntu 14.04
|
|
|
|
// it will show a window frame with transparent window body, without content.
|
|
|
|
// And to be able to "Show from tray" one more hide() will be required.
|
|
|
|
crl::on_main(this, [=] {
|
|
|
|
setWindowState(Qt::WindowMinimized);
|
|
|
|
if (Global::WorkMode().value() == dbiwmTrayOnly || Global::WorkMode().value() == dbiwmWindowAndTray) {
|
|
|
|
hide();
|
|
|
|
} else {
|
|
|
|
show();
|
|
|
|
}
|
|
|
|
});
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
2016-11-04 11:14:47 +00:00
|
|
|
setPositionInited();
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow() {
|
2017-08-07 11:57:34 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
if (_trayIcon) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::g_object_unref(_trayIcon);
|
|
|
|
_trayIcon = nullptr;
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
if (_trayPixbuf) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::g_object_unref(_trayPixbuf);
|
|
|
|
_trayPixbuf = nullptr;
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
if (_trayMenu) {
|
2016-06-16 17:20:58 +00:00
|
|
|
Libs::g_object_ref_sink(_trayMenu);
|
|
|
|
Libs::g_object_unref(_trayMenu);
|
|
|
|
_trayMenu = nullptr;
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
2017-01-24 10:45:10 +00:00
|
|
|
if (_trayIndicator) {
|
|
|
|
Libs::g_object_unref(_trayIndicator);
|
|
|
|
_trayIndicator = nullptr;
|
|
|
|
}
|
2017-08-07 11:57:34 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
|
2016-06-16 12:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Platform
|