mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Build Linux version with Qt 5.15.1 in CentOS 7 docker.
This commit is contained in:
@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/linux/linux_desktop_environment.h"
|
||||
#include "platform/linux/specific_linux.h"
|
||||
#include "storage/localstorage.h"
|
||||
#include "base/qt_adapters.h"
|
||||
|
||||
#include <QtGui/QDesktopServices>
|
||||
|
||||
@@ -387,7 +388,7 @@ QStringList cleanFilterList(const QString &filter) {
|
||||
int i = regexp.indexIn(f);
|
||||
if (i >= 0)
|
||||
f = regexp.cap(2);
|
||||
return f.split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
return f.split(QLatin1Char(' '), base::QStringSkipEmptyParts);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -585,7 +586,6 @@ GtkFileChooserAction gtkFileChooserAction(QFileDialog::FileMode fileMode, QFileD
|
||||
else
|
||||
return GTK_FILE_CHOOSER_ACTION_SAVE;
|
||||
case QFileDialog::Directory:
|
||||
case QFileDialog::DirectoryOnly:
|
||||
default:
|
||||
if (acceptMode == QFileDialog::AcceptOpen)
|
||||
return GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
|
||||
|
@@ -141,7 +141,7 @@ private:
|
||||
void hideHelper();
|
||||
|
||||
// Options
|
||||
QFileDialog::Options _options = { 0 };
|
||||
QFileDialog::Options _options;
|
||||
QString _windowTitle = "Choose file";
|
||||
QString _initialDirectory;
|
||||
QStringList _initialFiles;
|
||||
|
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/linux/linux_desktop_environment.h"
|
||||
|
||||
#include "platform/linux/specific_linux.h"
|
||||
#include "base/qt_adapters.h"
|
||||
|
||||
namespace Platform {
|
||||
namespace DesktopEnvironment {
|
||||
@@ -22,7 +23,7 @@ QString GetEnv(const char *name) {
|
||||
|
||||
Type Compute() {
|
||||
auto xdgCurrentDesktop = GetEnv("XDG_CURRENT_DESKTOP").toLower();
|
||||
auto list = xdgCurrentDesktop.split(':', QString::SkipEmptyParts);
|
||||
auto list = xdgCurrentDesktop.split(':', base::QStringSkipEmptyParts);
|
||||
auto desktopSession = GetEnv("DESKTOP_SESSION").toLower();
|
||||
auto slash = desktopSession.lastIndexOf('/');
|
||||
auto kdeSession = GetEnv("KDE_SESSION_VERSION");
|
||||
|
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "platform/linux/linux_libs.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/platform/linux/base_xcb_utilities_linux.h"
|
||||
#include "base/qt_adapters.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
@@ -248,14 +249,14 @@ bool GenerateDesktopFile(
|
||||
QRegularExpression::MultilineOption),
|
||||
qsl("TryExec=")
|
||||
+ QFile::encodeName(cExeDir() + cExeName())
|
||||
.replace('\\', qsl("\\\\")));
|
||||
.replace('\\', "\\\\"));
|
||||
fileText = fileText.replace(
|
||||
QRegularExpression(
|
||||
qsl("^Exec=.*$"),
|
||||
QRegularExpression::MultilineOption),
|
||||
qsl("Exec=")
|
||||
+ EscapeShell(QFile::encodeName(cExeDir() + cExeName()))
|
||||
.replace('\\', qsl("\\\\"))
|
||||
.replace('\\', "\\\\")
|
||||
+ (args.isEmpty() ? QString() : ' ' + args));
|
||||
} else {
|
||||
fileText = fileText.replace(
|
||||
@@ -1025,7 +1026,7 @@ namespace Platform {
|
||||
|
||||
void start() {
|
||||
PlatformThemes = QString::fromUtf8(qgetenv("QT_QPA_PLATFORMTHEME"))
|
||||
.split(':', QString::SkipEmptyParts);
|
||||
.split(':', base::QStringSkipEmptyParts);
|
||||
|
||||
LOG(("Launcher filename: %1").arg(GetLauncherFilename()));
|
||||
|
||||
@@ -1249,27 +1250,35 @@ void OpenSystemSettingsForPermission(PermissionType type) {
|
||||
|
||||
bool OpenSystemSettings(SystemSettingsType type) {
|
||||
if (type == SystemSettingsType::Audio) {
|
||||
auto options = std::vector<QString>();
|
||||
const auto add = [&](const char *option) {
|
||||
options.emplace_back(option);
|
||||
struct Command {
|
||||
QString command;
|
||||
QStringList arguments;
|
||||
};
|
||||
auto options = std::vector<Command>();
|
||||
const auto add = [&](const char *option, const char *arg = nullptr) {
|
||||
auto command = Command{ .command = option };
|
||||
if (arg) {
|
||||
command.arguments.push_back(arg);
|
||||
}
|
||||
options.push_back(std::move(command));
|
||||
};
|
||||
if (DesktopEnvironment::IsUnity()) {
|
||||
add("unity-control-center sound");
|
||||
add("unity-control-center", "sound");
|
||||
} else if (DesktopEnvironment::IsKDE()) {
|
||||
add("kcmshell5 kcm_pulseaudio");
|
||||
add("kcmshell4 phonon");
|
||||
add("kcmshell5", "kcm_pulseaudio");
|
||||
add("kcmshell4", "phonon");
|
||||
} else if (DesktopEnvironment::IsGnome()) {
|
||||
add("gnome-control-center sound");
|
||||
add("gnome-control-center", "sound");
|
||||
} else if (DesktopEnvironment::IsCinnamon()) {
|
||||
add("cinnamon-settings sound");
|
||||
add("cinnamon-settings", "sound");
|
||||
} else if (DesktopEnvironment::IsMATE()) {
|
||||
add("mate-volume-control");
|
||||
}
|
||||
add("pavucontrol-qt");
|
||||
add("pavucontrol");
|
||||
add("alsamixergui");
|
||||
return ranges::any_of(options, [](const QString &command) {
|
||||
return QProcess::startDetached(command);
|
||||
return ranges::any_of(options, [](const Command &command) {
|
||||
return QProcess::startDetached(command.command, command.arguments);
|
||||
});
|
||||
}
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user