Build Linux version with Qt 5.15.1 in CentOS 7 docker.

This commit is contained in:
John Preston 2020-11-04 18:50:17 +03:00
parent 80c4ecb9bf
commit 74d2313784
47 changed files with 131 additions and 168 deletions

View file

@ -42,6 +42,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/application.h"
#include "base/openssl_help.h"
#include "base/unixtime.h"
#include "base/qt_adapters.h"
#include "base/call_delayed.h"
#include "lang/lang_keys.h"
#include "mainwindow.h"
@ -3277,7 +3278,7 @@ void ApiWrap::requestMessageAfterDate(
// So we request a message with offset_date = desired_date - 1 and add_offset = -1.
// This should give us the first message with date >= desired_date.
auto offsetId = 0;
auto offsetDate = static_cast<int>(QDateTime(date).toTime_t()) - 1;
auto offsetDate = static_cast<int>(base::QDateToDateTime(date).toTime_t()) - 1;
auto addOffset = -1;
auto limit = 1;
auto maxId = 0;
@ -3365,7 +3366,7 @@ void ApiWrap::jumpToHistoryDate(not_null<PeerData*> peer, const QDate &date) {
// const QDate &date,
// Callback &&callback) {
// const auto offsetId = 0;
// const auto offsetDate = static_cast<TimeId>(QDateTime(date).toTime_t());
// const auto offsetDate = static_cast<TimeId>(base::QDateToDateTime(date).toTime_t());
// const auto addOffset = -2;
// const auto limit = 1;
// const auto hash = 0;

View file

@ -178,7 +178,7 @@ void PeerListBox::resizeEvent(QResizeEvent *e) {
void PeerListBox::paintEvent(QPaintEvent *e) {
Painter p(this);
for (auto rect : e->region().rects()) {
for (const auto rect : e->region()) {
p.fillRect(rect, st::contactsBg);
}
}

View file

@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_user.h"
#include "core/core_cloud_password.h"
#include "base/unixtime.h"
#include "base/qt_adapters.h"
#include "apiwrap.h"
#include "main/main_session.h"
#include "styles/style_layers.h"
@ -694,7 +695,7 @@ void EditRestrictedBox::showRestrictUntil() {
highlighted,
[this](const QDate &date) {
setRestrictUntil(
static_cast<int>(QDateTime(date).toTime_t()));
static_cast<int>(base::QDateToDateTime(date).toTime_t()));
}),
Ui::LayerOption::KeepOther);
_restrictUntilBox->setMaxDate(

View file

@ -981,7 +981,7 @@ void Panel::paint(QRect clip) {
if (!_incoming->isHidden()) {
region = region.subtracted(QRegion(_incoming->geometry()));
}
for (const auto rect : region.rects()) {
for (const auto rect : region) {
p.fillRect(rect, st::callBgOpaque);
}
if (_incoming && _incoming->isHidden()) {

View file

@ -171,10 +171,8 @@ bool SuggestionsWidget::eventHook(QEvent *e) {
}
void SuggestionsWidget::scrollByWheelEvent(not_null<QWheelEvent*> e) {
const auto horizontal = (e->angleDelta().x() != 0)
|| (e->orientation() == Qt::Horizontal);
const auto vertical = (e->angleDelta().y() != 0)
|| (e->orientation() == Qt::Vertical);
const auto horizontal = (e->angleDelta().x() != 0);
const auto vertical = (e->angleDelta().y() != 0);
const auto current = scrollCurrent();
const auto scroll = [&] {
if (horizontal) {

View file

@ -614,8 +614,8 @@ bool StickersListWidget::Footer::eventHook(QEvent *e) {
void StickersListWidget::Footer::scrollByWheelEvent(
not_null<QWheelEvent*> e) {
auto horizontal = (e->angleDelta().x() != 0 || e->orientation() == Qt::Horizontal);
auto vertical = (e->angleDelta().y() != 0 || e->orientation() == Qt::Vertical);
auto horizontal = (e->angleDelta().x() != 0);
auto vertical = (e->angleDelta().y() != 0);
if (horizontal) {
_horizontal = true;
}

View file

@ -79,6 +79,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtWidgets/QDesktopWidget>
#include <QtCore/QMimeDatabase>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
namespace Core {
namespace {
@ -941,7 +942,7 @@ QPoint Application::getPointForCallPanelCenter() const {
if (const auto window = activeWindow()) {
return window->getPointForCallPanelCenter();
}
return QApplication::desktop()->screenGeometry().center();
return QGuiApplication::primaryScreen()->geometry().center();
}
// macOS Qt bug workaround, sometimes no leaveEvent() gets to the nested widgets.

View file

@ -39,7 +39,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) {
setWindowTitle(title.isEmpty() ? qsl("Telegram") : title);
QPalette p(palette());
p.setColor(QPalette::Background, QColor(255, 255, 255));
p.setColor(QPalette::Window, QColor(255, 255, 255));
setPalette(p);
QLabel tmp(this);
@ -79,7 +79,7 @@ PreLaunchLabel::PreLaunchLabel(QWidget *parent) : QLabel(parent) {
setFont(labelFont);
QPalette p(palette());
p.setColor(QPalette::Foreground, QColor(0, 0, 0));
p.setColor(QPalette::WindowText, QColor(0, 0, 0));
setPalette(p);
show();
};
@ -97,7 +97,7 @@ PreLaunchInput::PreLaunchInput(QWidget *parent, bool password) : QLineEdit(paren
setFont(logFont);
QPalette p(palette());
p.setColor(QPalette::Foreground, QColor(0, 0, 0));
p.setColor(QPalette::WindowText, QColor(0, 0, 0));
setPalette(p);
QLineEdit::setTextMargins(0, 0, 0, 0);
@ -115,7 +115,7 @@ PreLaunchLog::PreLaunchLog(QWidget *parent) : QTextEdit(parent) {
setFont(logFont);
QPalette p(palette());
p.setColor(QPalette::Foreground, QColor(96, 96, 96));
p.setColor(QPalette::WindowText, QColor(96, 96, 96));
setPalette(p);
setReadOnly(true);
@ -783,7 +783,7 @@ void LastCrashedWindow::updateControls() {
}
QRect scr(QApplication::primaryScreen()->availableGeometry());
QSize s(2 * padding + QFontMetrics(_label.font()).width(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h);
QSize s(2 * padding + QFontMetrics(_label.font()).horizontalAdvance(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h);
if (s == size()) {
resizeEvent(0);
} else {

View file

@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/invoke_queued.h"
#include "base/qthelp_url.h"
#include "base/qthelp_regex.h"
#include "base/qt_adapters.h"
#include "ui/effects/animations.h"
#include "facades.h"
#include "app.h"
@ -35,9 +36,6 @@ namespace {
constexpr auto kEmptyPidForCommandResponse = 0ULL;
using ErrorSignal = void(QLocalSocket::*)(QLocalSocket::LocalSocketError);
const auto QLocalSocket_error = ErrorSignal(&QLocalSocket::error);
QChar _toHex(ushort v) {
v = v & 0x000F;
return QChar::fromLatin1((v >= 10) ? ('a' + (v - 10)) : ('0' + v));
@ -112,7 +110,7 @@ int Sandbox::start() {
[=] { socketDisconnected(); });
connect(
&_localSocket,
QLocalSocket_error,
base::QLocalSocket_error,
[=](QLocalSocket::LocalSocketError error) { socketError(error); });
connect(
&_localSocket,

View file

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/timer.h"
#include "base/bytes.h"
#include "base/unixtime.h"
#include "base/qt_adapters.h"
#include "storage/localstorage.h"
#include "core/application.h"
#include "core/changelogs.h"
@ -58,9 +59,6 @@ bool UpdaterIsDisabled = false;
std::weak_ptr<Updater> UpdaterInstance;
using ErrorSignal = void(QNetworkReply::*)(QNetworkReply::NetworkError);
const auto QNetworkReply_error = ErrorSignal(&QNetworkReply::error);
using Progress = UpdateChecker::Progress;
using State = UpdateChecker::State;
@ -626,7 +624,7 @@ void HttpChecker::start() {
_reply->connect(_reply, &QNetworkReply::finished, [=] {
gotResponse();
});
_reply->connect(_reply, QNetworkReply_error, [=](auto e) {
_reply->connect(_reply, base::QNetworkReply_error, [=](auto e) {
gotFailure(e);
});
}
@ -665,7 +663,7 @@ void HttpChecker::clearSentRequest() {
return;
}
reply->disconnect(reply, &QNetworkReply::finished, nullptr, nullptr);
reply->disconnect(reply, QNetworkReply_error, nullptr, nullptr);
reply->disconnect(reply, base::QNetworkReply_error, nullptr, nullptr);
reply->abort();
reply->deleteLater();
_manager = nullptr;
@ -819,7 +817,7 @@ void HttpLoaderActor::sendRequest() {
&HttpLoaderActor::partFinished);
connect(
_reply.get(),
QNetworkReply_error,
base::QNetworkReply_error,
this,
&HttpLoaderActor::partFailed);
connect(

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_chat.h"
#include "data/data_user.h"
#include "base/unixtime.h"
#include "base/qt_adapters.h"
namespace Data {
namespace {
@ -39,7 +40,7 @@ int OnlinePhraseChangeInSeconds(TimeId online, TimeId now) {
return (hours + 1) * 3600 - (now - online);
}
const auto nowFull = base::unixtime::parse(now);
const auto tomorrow = QDateTime(nowFull.date().addDays(1));
const auto tomorrow = base::QDateToDateTime(nowFull.date().addDays(1));
return std::max(static_cast<TimeId>(nowFull.secsTo(tomorrow)), 0);
}

View file

@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_photo.h"
#include "data/data_channel.h"
#include "data/data_document.h"
#include "base/qt_adapters.h"
#include "ui/image/image.h"
#include "ui/text/text_entity.h"
@ -26,7 +27,7 @@ QString SiteNameFromUrl(const QString &url) {
if (m.hasMatch()) pretty = pretty.mid(m.capturedLength());
int32 slash = pretty.indexOf('/');
if (slash > 0) pretty = pretty.mid(0, slash);
QStringList components = pretty.split('.', QString::SkipEmptyParts);
QStringList components = pretty.split('.', base::QStringSkipEmptyParts);
if (components.size() >= 2) {
components = components.mid(components.size() - 2);
return components.at(0).at(0).toUpper() + components.at(0).mid(1) + '.' + components.at(1);

View file

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/file_utilities.h"
#include "boxes/calendar_box.h"
#include "base/unixtime.h"
#include "base/qt_adapters.h"
#include "main/main_session.h"
#include "styles/style_widgets.h"
#include "styles/style_export.h"
@ -478,7 +479,7 @@ void SettingsWidget::editDateLimit(
}));
};
const auto callback = crl::guard(this, [=](const QDate &date) {
done(base::unixtime::serialize(QDateTime(date)));
done(base::unixtime::serialize(base::QDateToDateTime(date)));
if (const auto weak = shared->data()) {
weak->closeBox();
}

View file

@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "window/window_session_controller.h"
#include "facades.h"
#include "base/qt_adapters.h"
#include "styles/style_widgets.h"
#include "styles/style_chat.h"
@ -109,7 +110,7 @@ HiddenSenderInfo::HiddenSenderInfo(const QString &name)
, colorPeerId(Data::FakePeerIdForJustName(name))
, userpic(Data::PeerUserpicColor(colorPeerId), name) {
nameText.setText(st::msgNameStyle, name, Ui::NameTextOptions());
const auto parts = name.trimmed().split(' ', QString::SkipEmptyParts);
const auto parts = name.trimmed().split(' ', base::QStringSkipEmptyParts);
firstName = parts[0];
for (const auto &part : parts.mid(1)) {
if (!lastName.isEmpty()) {

View file

@ -226,7 +226,7 @@ public:
~Manager();
int loadLevel() const {
return _loadLevel.load();
return _loadLevel;
}
void append(Reader *reader, const Core::FileLocation &location, const QByteArray &data);
void start(Reader *reader);

View file

@ -2968,13 +2968,11 @@ void OverlayWidget::validatePhotoCurrentImage() {
void OverlayWidget::paintEvent(QPaintEvent *e) {
const auto r = e->rect();
const auto &region = e->region();
const auto rects = region.rects();
const auto region = e->region();
const auto contentShown = _photo || documentContentShown();
const auto bgRects = contentShown
? (region - contentRect()).rects()
: rects;
const auto bgRegion = contentShown
? (region - contentRect())
: region;
auto ms = crl::now();
@ -2988,7 +2986,7 @@ void OverlayWidget::paintEvent(QPaintEvent *e) {
const auto m = p.compositionMode();
p.setCompositionMode(QPainter::CompositionMode_Source);
const auto bgColor = _fullScreenVideo ? st::mediaviewVideoBg : st::mediaviewBg;
for (const auto &rect : bgRects) {
for (const auto rect : bgRegion) {
p.fillRect(rect, bgColor);
}
p.setCompositionMode(m);
@ -3084,7 +3082,7 @@ void OverlayWidget::paintEvent(QPaintEvent *e) {
auto o = overLevel(OverLeftNav);
if (o > 0) {
p.setOpacity(o * co);
for (const auto &rect : rects) {
for (const auto &rect : region) {
const auto fill = _leftNav.intersected(rect);
if (!fill.isEmpty()) p.fillRect(fill, st::mediaviewControlBg);
}
@ -3100,7 +3098,7 @@ void OverlayWidget::paintEvent(QPaintEvent *e) {
auto o = overLevel(OverRightNav);
if (o > 0) {
p.setOpacity(o * co);
for (const auto &rect : rects) {
for (const auto &rect : region) {
const auto fill = _rightNav.intersected(rect);
if (!fill.isEmpty()) p.fillRect(fill, st::mediaviewControlBg);
}
@ -3116,7 +3114,7 @@ void OverlayWidget::paintEvent(QPaintEvent *e) {
auto o = overLevel(OverClose);
if (o > 0) {
p.setOpacity(o * co);
for (const auto &rect : rects) {
for (const auto &rect : region) {
const auto fill = _closeNav.intersected(rect);
if (!fill.isEmpty()) p.fillRect(fill, st::mediaviewControlBg);
}
@ -4151,7 +4149,7 @@ bool OverlayWidget::eventHook(QEvent *e) {
} else {
_accumScroll += ev->angleDelta();
if (ev->phase() == Qt::ScrollEnd) {
if (ev->orientation() == Qt::Horizontal) {
if (ev->angleDelta().x() != 0) {
if (_accumScroll.x() * _accumScroll.x() > _accumScroll.y() * _accumScroll.y() && _accumScroll.x() != 0) {
moveToNext(_accumScroll.x() > 0 ? -1 : 1);
}

View file

@ -334,7 +334,7 @@ Qt::Edges RectPartToQtEdges(RectPart rectPart) {
return Qt::BottomEdge;
}
return 0;
return Qt::Edges();
}
} // namespace
@ -591,7 +591,7 @@ void PipPanel::paintEvent(QPaintEvent *e) {
QPainter p(this);
if (_useTransparency) {
Ui::Platform::StartTranslucentPaint(p, e->region().rects());
Ui::Platform::StartTranslucentPaint(p, e->region());
}
auto request = FrameRequest();

View file

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mtproto/details/mtproto_tcp_socket.h"
#include "base/invoke_queued.h"
#include "base/qt_adapters.h"
namespace MTP::details {
@ -33,12 +34,9 @@ TcpSocket::TcpSocket(not_null<QThread*> thread, const QNetworkProxy &proxy)
&_socket,
&QTcpSocket::readyRead,
wrap([=] { _readyRead.fire({}); }));
using ErrorSignal = void(QTcpSocket::*)(QAbstractSocket::SocketError);
const auto QTcpSocket_error = ErrorSignal(&QAbstractSocket::error);
connect(
&_socket,
QTcpSocket_error,
base::QTcpSocket_error,
wrap([=](Error e) { handleError(e); }));
}

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/bytes.h"
#include "base/invoke_queued.h"
#include "base/unixtime.h"
#include "base/qt_adapters.h"
#include <QtCore/QtEndian>
#include <range/v3/algorithm/reverse.hpp>
@ -470,12 +471,9 @@ TlsSocket::TlsSocket(
&_socket,
&QTcpSocket::readyRead,
wrap([=] { plainReadyRead(); }));
using ErrorSignal = void(QTcpSocket::*)(QAbstractSocket::SocketError);
const auto QTcpSocket_error = ErrorSignal(&QAbstractSocket::error);
connect(
&_socket,
QTcpSocket_error,
base::QTcpSocket_error,
wrap([=](Error e) { handleError(e); }));
}

View file

@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mtproto/facade.h"
#include "mtproto/connection_tcp.h"
#include "storage/serialize_common.h"
#include "base/qt_adapters.h"
#include <QtCore/QFile>
#include <QtCore/QRegularExpression>
@ -779,7 +780,7 @@ bool DcOptions::loadFromFile(const QString &path) {
stream.setCodec("UTF-8");
while (!stream.atEnd()) {
auto line = stream.readLine();
auto components = line.split(QRegularExpression(R"(\s)"), QString::SkipEmptyParts);
auto components = line.split(QRegularExpression(R"(\s)"), base::QStringSkipEmptyParts);
if (components.isEmpty() || components[0].startsWith('#')) {
continue;
}

View file

@ -79,9 +79,9 @@ bool CheckPhoneByPrefixesRules(const QString &phone, const QString &rules) {
}
QByteArray ConcatenateDnsTxtFields(const std::vector<DnsEntry> &response) {
auto entries = QMap<int, QString>();
auto entries = QMultiMap<int, QString>();
for (const auto &entry : response) {
entries.insertMulti(INT_MAX - entry.data.size(), entry.data);
entries.insert(INT_MAX - entry.data.size(), entry.data);
}
return QStringList(entries.values()).join(QString()).toLatin1();
}

View file

@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_item_components.h"
#include "history/view/history_view_cursor_state.h"
#include "base/unixtime.h"
#include "base/qt_adapters.h"
#include "ui/effects/round_checkbox.h"
#include "ui/image/image.h"
#include "ui/text/format_values.h"
@ -1518,7 +1519,7 @@ Link::Link(
domain = parts.at(2);
}
parts = domain.split('@').back().split('.', QString::SkipEmptyParts);
parts = domain.split('@').back().split('.', base::QStringSkipEmptyParts);
if (parts.size() > 1) {
_letter = parts.at(parts.size() - 2).at(0).toUpper();
if (_title.isEmpty()) {

View file

@ -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;

View file

@ -141,7 +141,7 @@ private:
void hideHelper();
// Options
QFileDialog::Options _options = { 0 };
QFileDialog::Options _options;
QString _windowTitle = "Choose file";
QString _initialDirectory;
QStringList _initialFiles;

View file

@ -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");

View file

@ -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;

View file

@ -9,10 +9,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/mac/base_utilities_mac.h"
#include "lang/lang_keys.h"
#include "base/qt_adapters.h"
#include "styles/style_window.h"
#include <QtWidgets/QApplication>
#include <QtWidgets/QDesktopWidget>
#include <QtGui/QScreen>
#include <Cocoa/Cocoa.h>
#include <CoreFoundation/CFURL.h>
@ -398,7 +399,11 @@ bool UnsafeShowOpenWithDropdown(const QString &filepath, QPoint menuPosition) {
NSString *file = Q2NSString(filepath);
@try {
OpenFileWithInterface *menu = [[[OpenFileWithInterface alloc] init:file] autorelease];
auto r = QApplication::desktop()->screenGeometry(menuPosition);
const auto screen = base::QScreenNearestTo(menuPosition);
if (!screen) {
return false;
}
const auto r = screen->availableGeometry();
auto x = menuPosition.x();
auto y = r.y() + r.height() - menuPosition.y();
return !![menu popupAtX:x andY:y];

View file

@ -358,11 +358,7 @@ bool Get(
dialog.setAcceptMode(QFileDialog::AcceptOpen);
} else if (type == Type::ReadFolder) { // save dir
dialog.setAcceptMode(QFileDialog::AcceptOpen);
// We use "obsolete" value ::DirectoryOnly instead of ::Directory + ::ShowDirsOnly
// because in Windows XP native dialog this one works, while the "preferred" one
// shows a native file choose dialog where you can't choose a directory, only open one.
dialog.setFileMode(QFileDialog::DirectoryOnly);
dialog.setFileMode(QFileDialog::Directory);
dialog.setOption(QFileDialog::ShowDirsOnly);
} else { // save file
dialog.setFileMode(QFileDialog::AnyFile);

View file

@ -199,7 +199,7 @@ void MainWindow::psRefreshTaskbarIcon() {
refresher->setWindowFlags(static_cast<Qt::WindowFlags>(Qt::Tool) | Qt::FramelessWindowHint);
refresher->setGeometry(x() + 1, y() + 1, 1, 1);
auto palette = refresher->palette();
palette.setColor(QPalette::Background, (isActiveWindow() ? st::titleBgActive : st::titleBg)->c);
palette.setColor(QPalette::Window, (isActiveWindow() ? st::titleBgActive : st::titleBg)->c);
refresher->setPalette(palette);
refresher->show();
refresher->activateWindow();

View file

@ -72,7 +72,7 @@ public:
}
template <typename Predicate>
void sortItems(Predicate predicate) {
qSort(_items.begin(), _items.end(), std::move(predicate));
std::sort(_items.begin(), _items.end(), std::move(predicate));
}
void setPreloadMoreCallback(Fn<void()> callback) {

View file

@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "storage/file_download_web.h"
#include "storage/cache/storage_cache_types.h"
#include "base/qt_adapters.h"
#include <QtNetwork/QAuthenticator>
@ -19,9 +20,6 @@ constexpr auto kResetDownloadPrioritiesTimeout = crl::time(200);
std::weak_ptr<WebLoadManager> GlobalLoadManager;
using ErrorSignal = void(QNetworkReply::*)(QNetworkReply::NetworkError);
const auto QNetworkReply_error = ErrorSignal(&QNetworkReply::error);
[[nodiscard]] std::shared_ptr<WebLoadManager> GetManager() {
auto result = GlobalLoadManager.lock();
if (!result) {
@ -270,7 +268,7 @@ not_null<QNetworkReply*> WebLoadManager::send(int id, const QString &url) {
failed(id, result, error);
};
connect(result, &QNetworkReply::downloadProgress, handleProgress);
connect(result, QNetworkReply_error, handleError);
connect(result, base::QNetworkReply_error, handleError);
return result;
}

View file

@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "base/unixtime.h"
#include "base/call_delayed.h"
#include "base/qt_adapters.h"
#include "main/main_session.h"
#include "main/main_session_settings.h"
#include "apiwrap.h"
@ -484,7 +485,7 @@ void Autocomplete::submitValue(const QString &value) {
const auto contact = value.mid(
prefix.size(),
(line > 0) ? (line - prefix.size()) : -1);
const auto parts = contact.split(' ', QString::SkipEmptyParts);
const auto parts = contact.split(' ', base::QStringSkipEmptyParts);
if (parts.size() > 1) {
const auto phone = parts[0];
const auto firstName = parts[1];

View file

@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/multi_select.h"
#include "ui/effects/ripple_animation.h"
#include "data/data_countries.h"
#include "base/qt_adapters.h"
#include "styles/style_layers.h"
#include "styles/style_boxes.h"
#include "styles/style_intro.h"
@ -248,7 +249,7 @@ CountrySelectBox::Inner::Inner(QWidget *parent, Type type)
: QString());
const auto namesList = std::move(full).toLower().split(
QRegularExpression("[\\s\\-]"),
QString::SkipEmptyParts);
base::QStringSkipEmptyParts);
auto &names = _namesList.emplace_back();
names.reserve(namesList.size());
for (const auto &name : namesList) {

View file

@ -358,7 +358,6 @@ void SeparatePanel::initGeometry(QSize size) {
st::lineWidth,
st::lineWidth);
setAttribute(Qt::WA_OpaquePaintEvent, !_useTransparency);
const auto screen = QApplication::desktop()->screenGeometry(center);
const auto rect = [&] {
const QRect initRect(QPoint(), size);
return initRect.translated(center - initRect.center()).marginsAdded(_padding);

View file

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/edit_color_box.h"
#include "lang/lang_keys.h"
#include "base/call_delayed.h"
#include "base/qt_adapters.h"
namespace Window {
namespace Theme {
@ -154,7 +155,7 @@ void EditorBlock::Row::fillSearchIndex() {
_searchWords.clear();
_searchStartChars.clear();
auto toIndex = _name + ' ' + _copyOf + ' ' + TextUtilities::RemoveAccents(_description.toString()) + ' ' + _valueString;
auto words = toIndex.toLower().split(SearchSplitter, QString::SkipEmptyParts);
auto words = toIndex.toLower().split(SearchSplitter, base::QStringSkipEmptyParts);
for_const (auto &word, words) {
_searchWords.insert(word);
_searchStartChars.insert(word[0]);

View file

@ -393,7 +393,7 @@ Qt::Edges TitleWidgetQt::edgesFromPos(const QPoint &pos) {
>= (window()->height() - getResizeArea(Qt::BottomEdge))) {
return Qt::BottomEdge;
} else {
return 0;
return Qt::Edges();
}
}

@ -1 +1 @@
Subproject commit 4abe66549e13b33fd4baa84858d932e0178ce8c0
Subproject commit f95f76d637990f66f056eb099d46e3b5e6e7366f

View file

@ -134,73 +134,13 @@ if [ "$BuildTarget" == "linux" ] || [ "$BuildTarget" == "linux32" ]; then
Error "Backup folder not found!"
fi
./configure.sh
./build/docker/centos_env/run.sh /usr/src/tdesktop/Telegram/build/docker/build.sh
cd $ProjectPath
cmake --build . --config Release --target Telegram -- -j8
cd $ReleasePath
echo "$BinaryName build complete!"
if [ ! -f "$ReleasePath/$BinaryName" ]; then
Error "$BinaryName not found!"
fi
# BadCount=`objdump -T $ReleasePath/$BinaryName | grep GLIBC_2\.1[6-9] | wc -l`
# if [ "$BadCount" != "0" ]; then
# Error "Bad GLIBC usages found: $BadCount"
# fi
# BadCount=`objdump -T $ReleasePath/$BinaryName | grep GLIBC_2\.2[0-9] | wc -l`
# if [ "$BadCount" != "0" ]; then
# Error "Bad GLIBC usages found: $BadCount"
# fi
BadCount=`objdump -T $ReleasePath/$BinaryName | grep GCC_4\.[3-9] | wc -l`
if [ "$BadCount" != "0" ]; then
Error "Bad GCC usages found: $BadCount"
fi
BadCount=`objdump -T $ReleasePath/$BinaryName | grep GCC_[5-9]\. | wc -l`
if [ "$BadCount" != "0" ]; then
Error "Bad GCC usages found: $BadCount"
fi
if [ ! -f "$ReleasePath/Updater" ]; then
Error "Updater not found!"
fi
BadCount=`objdump -T $ReleasePath/Updater | grep GLIBC_2\.1[6-9] | wc -l`
if [ "$BadCount" != "0" ]; then
Error "Bad GLIBC usages found: $BadCount"
fi
BadCount=`objdump -T $ReleasePath/Updater | grep GLIBC_2\.2[0-9] | wc -l`
if [ "$BadCount" != "0" ]; then
Error "Bad GLIBC usages found: $BadCount"
fi
BadCount=`objdump -T $ReleasePath/Updater | grep GCC_4\.[3-9] | wc -l`
if [ "$BadCount" != "0" ]; then
Error "Bad GCC usages found: $BadCount"
fi
BadCount=`objdump -T $ReleasePath/Updater | grep GCC_[5-9]\. | wc -l`
if [ "$BadCount" != "0" ]; then
Error "Bad GCC usages found: $BadCount"
fi
echo "Dumping debug symbols.."
"$HomePath/../../Libraries/breakpad/out/Default/dump_syms" "$ReleasePath/$BinaryName" > "$ReleasePath/$BinaryName.sym"
echo "Done!"
echo "Stripping the executable.."
strip -s "$ReleasePath/$BinaryName"
echo "Done!"
echo "Removing RPATH.."
chrpath -d "$ReleasePath/$BinaryName"
echo "Done!"
echo "Copying from docker result folder."
cp "$ReleasePath/root/$BinaryName" "$ReleasePath/$BinaryName"
cp "$ReleasePath/root/$BinaryName.sym" "$ReleasePath/$BinaryName.sym"
cp "$ReleasePath/root/Updater" "$ReleasePath/Updater"
cp "$ReleasePath/root/Packer" "$ReleasePath/Packer"
echo "Preparing version $AppVersionStrFull, executing Packer.."
cd "$ReleasePath"

View file

@ -1,10 +1,25 @@
#!/bin/bash
set -e
FullExecPath=$PWD
pushd `dirname $0` > /dev/null
FullScriptPath=`pwd`
popd > /dev/null
if [ ! -d "$FullScriptPath/../../../../DesktopPrivate" ]; then
echo ""
echo "This script is for building the production version of Telegram Desktop."
echo ""
echo "For building custom versions please visit the build instructions page at:"
echo "https://github.com/telegramdesktop/tdesktop/#build-instructions"
exit
fi
Run () {
scl enable devtoolset-8 -- "$@"
}
HomePath=/usr/src/tdesktop/Telegram
HomePath="$FullScriptPath/../.."
cd $HomePath
ProjectPath="$HomePath/../out"

@ -1 +1 @@
Subproject commit 8b4686f24d80f1f8d6a4ad0d6a55bf1bb701f35a
Subproject commit 127968de8129e8ccfa6ac50721c70415a5a087c3

@ -1 +1 @@
Subproject commit ffe7a4681ab4b11353c62c36d010db96f0f90fd8
Subproject commit 03b7b4cd6f26ff53dff311438bf9c3f84dec13aa

@ -1 +1 @@
Subproject commit b83eed16812f4de3c2537cd12722d3dece95021b
Subproject commit fb40f379d82ffa1fc7506e9a8dddcf48847715ae

@ -1 +1 @@
Subproject commit 9877397dbf97b7198d539a3994bf0e9619cf653c
Subproject commit 92ce41a690a463eb462089a4eb1e51e019308018

@ -1 +1 @@
Subproject commit 053e44a10107de4a0b7e9ad8826150c577db2a2b
Subproject commit 8aede3acc9d386484d2774316e9d1a3d0c265dd5

@ -1 +1 @@
Subproject commit 9c9a4bc4d85d7d771e6ff1084fe2ffe2cc883941
Subproject commit d4c99701b5210a2db83b1c0f13da1a62f48dfb80

@ -1 +1 @@
Subproject commit d7c4f1f0b902158f065ea9fb6b7ec80fa0ceac45
Subproject commit 52d52cad4e554dac1907224372d51fd40b9da92f

2
cmake

@ -1 +1 @@
Subproject commit 94025be392ab7e58115ac376cbf449cdca10de22
Subproject commit 3a2d8a252d7e84547b532605aaa557a8c70d6d0f