feat: MacOS support
|
@ -149,8 +149,13 @@ set(ayugram_files
|
|||
ayu/libs/sqlite/sqlite3.c
|
||||
ayu/libs/sqlite/sqlite3.h
|
||||
ayu/libs/sqlite/sqlite_orm.h
|
||||
ayu/features/streamer_mode/streamer_mode_windows.cpp
|
||||
ayu/features/streamer_mode/streamer_mode_linux.cpp
|
||||
ayu/features/streamer_mode/platform/streamer_mode_win.cpp
|
||||
ayu/features/streamer_mode/platform/streamer_mode_win.h
|
||||
ayu/features/streamer_mode/platform/streamer_mode_linux.cpp
|
||||
ayu/features/streamer_mode/platform/streamer_mode_linux.h
|
||||
ayu/features/streamer_mode/platform/streamer_mode_mac.cpp
|
||||
ayu/features/streamer_mode/platform/streamer_mode_mac.h
|
||||
ayu/features/streamer_mode/streamer_mode.cpp
|
||||
ayu/features/streamer_mode/streamer_mode.h
|
||||
ayu/features/messageshot/message_shot.cpp
|
||||
ayu/features/messageshot/message_shot.h
|
||||
|
|
BIN
Telegram/Resources/art/ayu/alt/app_macos.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
Telegram/Resources/art/ayu/bard/app_macos.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
Telegram/Resources/art/ayu/chibi/app_macos.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
Telegram/Resources/art/ayu/chibi2/app_macos.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
Telegram/Resources/art/ayu/default/app_macos.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
Telegram/Resources/art/ayu/discord/app_macos.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
Telegram/Resources/art/ayu/extera/app_macos.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
Telegram/Resources/art/ayu/macos/app.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
Telegram/Resources/art/ayu/macos/app_icon.ico
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
Telegram/Resources/art/ayu/macos/app_macos.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
Telegram/Resources/art/ayu/macos/app_preview.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
Telegram/Resources/art/ayu/nothing/app_macos.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
Telegram/Resources/art/ayu/spotify/app_macos.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
Telegram/Resources/art/ayu/win95/app_macos.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
Telegram/Resources/art/ayu/yaplus/app_macos.png
Normal file
After Width: | Height: | Size: 19 KiB |
|
@ -2,36 +2,51 @@
|
|||
<qresource prefix="/gui">
|
||||
<file alias="art/ayu/alt/app.png">../../art/ayu/alt/app.png</file>
|
||||
<file alias="art/ayu/alt/app_preview.png">../../art/ayu/alt/app_preview.png</file>
|
||||
<file alias="art/ayu/alt/app_macos.png">../../art/ayu/alt/app_macos.png</file>
|
||||
<file alias="art/ayu/alt/app_icon.ico">../../art/ayu/alt/app_icon.ico</file>
|
||||
<file alias="art/ayu/bard/app.png">../../art/ayu/bard/app.png</file>
|
||||
<file alias="art/ayu/bard/app_preview.png">../../art/ayu/bard/app_preview.png</file>
|
||||
<file alias="art/ayu/bard/app_macos.png">../../art/ayu/bard/app_macos.png</file>
|
||||
<file alias="art/ayu/bard/app_icon.ico">../../art/ayu/bard/app_icon.ico</file>
|
||||
<file alias="art/ayu/chibi/app.png">../../art/ayu/chibi/app.png</file>
|
||||
<file alias="art/ayu/chibi/app_preview.png">../../art/ayu/chibi/app_preview.png</file>
|
||||
<file alias="art/ayu/chibi/app_macos.png">../../art/ayu/chibi/app_macos.png</file>
|
||||
<file alias="art/ayu/chibi/app_icon.ico">../../art/ayu/chibi/app_icon.ico</file>
|
||||
<file alias="art/ayu/chibi2/app.png">../../art/ayu/chibi2/app.png</file>
|
||||
<file alias="art/ayu/chibi2/app_preview.png">../../art/ayu/chibi2/app_preview.png</file>
|
||||
<file alias="art/ayu/chibi2/app_macos.png">../../art/ayu/chibi2/app_macos.png</file>
|
||||
<file alias="art/ayu/chibi2/app_icon.ico">../../art/ayu/chibi2/app_icon.ico</file>
|
||||
<file alias="art/ayu/default/app.png">../../art/ayu/default/app.png</file>
|
||||
<file alias="art/ayu/default/app_preview.png">../../art/ayu/default/app_preview.png</file>
|
||||
<file alias="art/ayu/default/app_macos.png">../../art/ayu/default/app_macos.png</file>
|
||||
<file alias="art/ayu/default/app_icon.ico">../../art/ayu/default/app_icon.ico</file>
|
||||
<file alias="art/ayu/discord/app.png">../../art/ayu/discord/app.png</file>
|
||||
<file alias="art/ayu/discord/app_preview.png">../../art/ayu/discord/app_preview.png</file>
|
||||
<file alias="art/ayu/discord/app_macos.png">../../art/ayu/discord/app_macos.png</file>
|
||||
<file alias="art/ayu/discord/app_icon.ico">../../art/ayu/discord/app_icon.ico</file>
|
||||
<file alias="art/ayu/extera/app.png">../../art/ayu/extera/app.png</file>
|
||||
<file alias="art/ayu/extera/app_preview.png">../../art/ayu/extera/app_preview.png</file>
|
||||
<file alias="art/ayu/extera/app_macos.png">../../art/ayu/extera/app_macos.png</file>
|
||||
<file alias="art/ayu/extera/app_icon.ico">../../art/ayu/extera/app_icon.ico</file>
|
||||
<file alias="art/ayu/macos/app.png">../../art/ayu/macos/app.png</file>
|
||||
<file alias="art/ayu/macos/app_preview.png">../../art/ayu/macos/app_preview.png</file>
|
||||
<file alias="art/ayu/macos/app_macos.png">../../art/ayu/macos/app_macos.png</file>
|
||||
<file alias="art/ayu/macos/app_icon.ico">../../art/ayu/macos/app_icon.ico</file>
|
||||
<file alias="art/ayu/nothing/app.png">../../art/ayu/nothing/app.png</file>
|
||||
<file alias="art/ayu/nothing/app_preview.png">../../art/ayu/nothing/app_preview.png</file>
|
||||
<file alias="art/ayu/nothing/app_macos.png">../../art/ayu/nothing/app_macos.png</file>
|
||||
<file alias="art/ayu/nothing/app_icon.ico">../../art/ayu/nothing/app_icon.ico</file>
|
||||
<file alias="art/ayu/spotify/app.png">../../art/ayu/spotify/app.png</file>
|
||||
<file alias="art/ayu/spotify/app_preview.png">../../art/ayu/spotify/app_preview.png</file>
|
||||
<file alias="art/ayu/spotify/app_macos.png">../../art/ayu/spotify/app_macos.png</file>
|
||||
<file alias="art/ayu/spotify/app_icon.ico">../../art/ayu/spotify/app_icon.ico</file>
|
||||
<file alias="art/ayu/win95/app.png">../../art/ayu/win95/app.png</file>
|
||||
<file alias="art/ayu/win95/app_preview.png">../../art/ayu/win95/app_preview.png</file>
|
||||
<file alias="art/ayu/win95/app_macos.png">../../art/ayu/win95/app_macos.png</file>
|
||||
<file alias="art/ayu/win95/app_icon.ico">../../art/ayu/win95/app_icon.ico</file>
|
||||
<file alias="art/ayu/yaplus/app.png">../../art/ayu/yaplus/app.png</file>
|
||||
<file alias="art/ayu/yaplus/app_preview.png">../../art/ayu/yaplus/app_preview.png</file>
|
||||
<file alias="art/ayu/yaplus/app_macos.png">../../art/ayu/yaplus/app_macos.png</file>
|
||||
<file alias="art/ayu/yaplus/app_icon.ico">../../art/ayu/yaplus/app_icon.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -226,7 +226,13 @@ AyuGramSettings::AyuGramSettings() {
|
|||
localPremium = false;
|
||||
|
||||
// ~ Customization
|
||||
appIcon = AyuAssets::DEFAULT_ICON;
|
||||
appIcon =
|
||||
#ifdef Q_OS_DARWIN
|
||||
AyuAssets::DEFAULT_MACOS_ICON
|
||||
#else
|
||||
AyuAssets::DEFAULT_ICON
|
||||
#endif
|
||||
;
|
||||
simpleQuotesAndReplies = true;
|
||||
deletedMark = "🧹";
|
||||
editedMark = Core::IsAppLaunched() ? tr::lng_edited(tr::now) : QString("edited");
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// but be respectful and credit the original author.
|
||||
//
|
||||
// Copyright @Radolyn, 2024
|
||||
#include "ayu_database.h"
|
||||
#include "ayu/data/ayu_database.h"
|
||||
|
||||
#include <ranges>
|
||||
|
||||
|
@ -137,18 +137,16 @@ namespace AyuDatabase {
|
|||
void moveCurrentDatabase() {
|
||||
auto time = base::unixtime::now();
|
||||
|
||||
if (std::filesystem::exists("./tdata/ayudata.db")) {
|
||||
std::filesystem::rename("./tdata/ayudata.db", QString("./tdata/ayudata_%1.db").arg(time).toStdString());
|
||||
if (QFile::exists("./tdata/ayudata.db")) {
|
||||
QFile::rename("./tdata/ayudata.db", QString("./tdata/ayudata_%1.db").arg(time));
|
||||
}
|
||||
|
||||
if (std::filesystem::exists("./tdata/ayudata.db-shm")) {
|
||||
std::filesystem::rename("./tdata/ayudata.db-shm",
|
||||
QString("./tdata/ayudata_%1.db-shm").arg(time).toStdString());
|
||||
if (QFile::exists("./tdata/ayudata.db-shm")) {
|
||||
QFile::rename("./tdata/ayudata.db-shm", QString("./tdata/ayudata_%1.db-shm").arg(time));
|
||||
}
|
||||
|
||||
if (std::filesystem::exists("./tdata/ayudata.db-wal")) {
|
||||
std::filesystem::rename("./tdata/ayudata.db-wal",
|
||||
QString("./tdata/ayudata_%1.db-wal").arg(time).toStdString());
|
||||
if (QFile::exists("./tdata/ayudata.db-wal")) {
|
||||
QFile::rename("./tdata/ayudata.db-wal", QString("./tdata/ayudata_%1.db-wal").arg(time));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// but be respectful and credit the original author.
|
||||
//
|
||||
// Copyright @Radolyn, 2024
|
||||
#include "messages_storage.h"
|
||||
#include "ayu/data/messages_storage.h"
|
||||
|
||||
#include "ayu/ayu_constants.h"
|
||||
#include "ayu/data/ayu_database.h"
|
||||
|
|
|
@ -5,31 +5,18 @@
|
|||
//
|
||||
// Copyright @Radolyn, 2024
|
||||
|
||||
#ifndef WIN32
|
||||
#include "ayu/features/streamer_mode/platform/streamer_mode_linux.h"
|
||||
|
||||
#include "streamer_mode.h"
|
||||
|
||||
#include "core/application.h"
|
||||
#include "window/window_controller.h"
|
||||
|
||||
namespace AyuFeatures::StreamerMode
|
||||
{
|
||||
namespace AyuFeatures::StreamerMode::Impl {
|
||||
|
||||
bool isEnabledVal;
|
||||
void enableHook() {
|
||||
|
||||
bool isEnabled()
|
||||
{
|
||||
return isEnabledVal;
|
||||
}
|
||||
|
||||
void enable()
|
||||
{
|
||||
isEnabledVal = true;
|
||||
}
|
||||
void disableHook() {
|
||||
|
||||
void disable()
|
||||
{
|
||||
isEnabledVal = false;
|
||||
}
|
||||
|
||||
void hideWidgetWindow(QWidget *widget)
|
||||
|
@ -43,5 +30,3 @@ void showWidgetWindow(QWidget *widget)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace AyuFeatures::StreamerMode::Impl {
|
||||
|
||||
void enableHook();
|
||||
void disableHook();
|
||||
void hideWidgetWindow(QWidget *widget);
|
||||
void showWidgetWindow(QWidget *widget);
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// This is the source code of AyuGram for Desktop.
|
||||
//
|
||||
// We do not and cannot prevent the use of our code,
|
||||
// but be respectful and credit the original author.
|
||||
//
|
||||
// Copyright @Radolyn, 2024
|
||||
|
||||
#include "ayu/features/streamer_mode/platform/streamer_mode_mac.h"
|
||||
|
||||
#include "window/window_controller.h"
|
||||
|
||||
namespace AyuFeatures::StreamerMode::Impl {
|
||||
|
||||
void enableHook() {
|
||||
|
||||
}
|
||||
|
||||
void disableHook() {
|
||||
|
||||
}
|
||||
|
||||
void hideWidgetWindow(QWidget *widget)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void showWidgetWindow(QWidget *widget)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace AyuFeatures::StreamerMode::Impl {
|
||||
|
||||
void enableHook();
|
||||
void disableHook();
|
||||
void hideWidgetWindow(QWidget *widget);
|
||||
void showWidgetWindow(QWidget *widget);
|
||||
|
||||
}
|
|
@ -5,41 +5,25 @@
|
|||
//
|
||||
// Copyright @Radolyn, 2024
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#include "streamer_mode.h"
|
||||
#include "ayu/features/streamer_mode/platform/streamer_mode_win.h"
|
||||
|
||||
#include "core/application.h"
|
||||
#include "window/window_controller.h"
|
||||
|
||||
namespace AyuFeatures::StreamerMode {
|
||||
namespace AyuFeatures::StreamerMode::Impl {
|
||||
|
||||
bool isEnabledVal;
|
||||
|
||||
bool isEnabled() {
|
||||
return isEnabledVal;
|
||||
}
|
||||
|
||||
void enable() {
|
||||
void enableHook() {
|
||||
auto handle = Core::App().activeWindow()->widget()->psHwnd();
|
||||
SetWindowDisplayAffinity(handle, WDA_EXCLUDEFROMCAPTURE);
|
||||
|
||||
Core::App().enumerateWindows([&](not_null<Window::Controller*> w) {
|
||||
SetWindowDisplayAffinity(w->widget()->psHwnd(), WDA_EXCLUDEFROMCAPTURE);
|
||||
});
|
||||
|
||||
isEnabledVal = true;
|
||||
}
|
||||
|
||||
void disable() {
|
||||
void disableHook() {
|
||||
auto handle = Core::App().activeWindow()->widget()->psHwnd();
|
||||
SetWindowDisplayAffinity(handle, WDA_NONE);
|
||||
|
||||
Core::App().enumerateWindows([&](not_null<Window::Controller*> w) {
|
||||
SetWindowDisplayAffinity(w->widget()->psHwnd(), WDA_NONE);
|
||||
});
|
||||
|
||||
isEnabledVal = false;
|
||||
}
|
||||
|
||||
void hideWidgetWindow(QWidget *widget) {
|
||||
|
@ -53,5 +37,3 @@ void showWidgetWindow(QWidget *widget) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace AyuFeatures::StreamerMode::Impl {
|
||||
|
||||
void enableHook();
|
||||
void disableHook();
|
||||
void hideWidgetWindow(QWidget *widget);
|
||||
void showWidgetWindow(QWidget *widget);
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// This is the source code of AyuGram for Desktop.
|
||||
//
|
||||
// We do not and cannot prevent the use of our code,
|
||||
// but be respectful and credit the original author.
|
||||
//
|
||||
// Copyright @Radolyn, 2024
|
||||
|
||||
#include "streamer_mode.h"
|
||||
|
||||
#include "window/window_controller.h"
|
||||
|
||||
#if defined Q_OS_WINRT || defined Q_OS_WIN
|
||||
#include "ayu/features/streamer_mode/platform/streamer_mode_win.h"
|
||||
#elif defined Q_OS_MAC // Q_OS_WINRT || Q_OS_WIN
|
||||
#include "ayu/features/streamer_mode/platform/streamer_mode_mac.h"
|
||||
#else // Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
|
||||
#include "ayu/features/streamer_mode/platform/streamer_mode_linux.h"
|
||||
#endif // else for Q_OS_WINRT || Q_OS_WIN || Q_OS_MAC
|
||||
|
||||
namespace AyuFeatures::StreamerMode
|
||||
{
|
||||
|
||||
bool isEnabledVal;
|
||||
|
||||
bool isEnabled()
|
||||
{
|
||||
return isEnabledVal;
|
||||
}
|
||||
|
||||
void enable()
|
||||
{
|
||||
isEnabledVal = true;
|
||||
Impl::enableHook();
|
||||
}
|
||||
|
||||
void disable()
|
||||
{
|
||||
isEnabledVal = false;
|
||||
Impl::disableHook();
|
||||
}
|
||||
|
||||
void hideWidgetWindow(QWidget *widget)
|
||||
{
|
||||
Impl::hideWidgetWindow(widget);
|
||||
}
|
||||
|
||||
void showWidgetWindow(QWidget *widget)
|
||||
{
|
||||
Impl::showWidgetWindow(widget);
|
||||
}
|
||||
|
||||
}
|
|
@ -34,7 +34,11 @@ void loadIcons() {
|
|||
if (LAST_LOADED_NAME != settings->appIcon) {
|
||||
LAST_LOADED_NAME = settings->appIcon;
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
LAST_LOADED = QImage(qsl(":/gui/art/ayu/%1/app_macos.png").arg(settings->appIcon));
|
||||
#else
|
||||
LAST_LOADED = QImage(qsl(":/gui/art/ayu/%1/app.png").arg(settings->appIcon));
|
||||
#endif
|
||||
LAST_LOADED_NO_MARGIN = QImage(qsl(":/gui/art/ayu/%1/app_preview.png").arg(settings->appIcon));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
namespace AyuAssets {
|
||||
|
||||
ICON(DEFAULT, "default");
|
||||
ICON(DEFAULT_MACOS, "macos");
|
||||
ICON(ALT, "alt");
|
||||
ICON(DISCORD, "discord");
|
||||
ICON(SPOTIFY, "spotify");
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
#endif
|
||||
|
||||
const QVector<QString> icons{
|
||||
#ifdef Q_OS_DARWIN
|
||||
AyuAssets::DEFAULT_MACOS_ICON,
|
||||
#endif
|
||||
AyuAssets::DEFAULT_ICON,
|
||||
AyuAssets::ALT_ICON,
|
||||
AyuAssets::DISCORD_ICON,
|
||||
|
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 381 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 381 KiB |
25
docs/building-mac.md
Normal file
|
@ -0,0 +1,25 @@
|
|||
## Build instructions for macOS
|
||||
|
||||
### Prepare folder
|
||||
|
||||
Choose a folder for the future build, for example **/Users/user/TBuild**. It will be named ***BuildPath*** in the rest of this document. All commands will be launched from Terminal.
|
||||
|
||||
### Clone source code and prepare libraries
|
||||
|
||||
Go to ***BuildPath*** and run
|
||||
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
brew install git automake cmake wget pkg-config gnu-tar ninja nasm meson
|
||||
|
||||
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
|
||||
|
||||
git clone --recursive https://github.com/AyuGram/AyuGramDesktop.git tdesktop
|
||||
./tdesktop/Telegram/build/prepare/mac.sh
|
||||
|
||||
### Building the project
|
||||
|
||||
Go to ***BuildPath*/tdesktop/Telegram** and run
|
||||
|
||||
./configure.sh -D TDESKTOP_API_ID=2040 -D TDESKTOP_API_HASH=b18441a1ff607e10a989891a5462e627
|
||||
|
||||
Then launch Xcode, open ***BuildPath*/tdesktop/out/Telegram.xcodeproj** and build for Debug / Release.
|