mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Alpha version 0.10.21: pinned chats, groups in common, new design.
This commit is contained in:
@@ -195,7 +195,7 @@ TaskQueue *TaskQueue::TaskQueueList::TakeFirst(int list_index_) {
|
||||
void TaskQueue::TaskThreadPool::AddQueueTask(TaskQueue *queue, Task &&task) {
|
||||
QMutexLocker lock(&queues_mutex_);
|
||||
|
||||
queue->tasks_.push_back(new Task(std::move(task)));
|
||||
queue->tasks_.push_back(new Task(std_::move(task)));
|
||||
auto list_was_empty = queue_list_.Empty(kAllQueuesList);
|
||||
auto threads_count = threads_.size();
|
||||
auto all_threads_processing = (threads_count == tasks_in_process_);
|
||||
@@ -332,7 +332,7 @@ TaskQueue::TaskQueue(Type type, Priority priority)
|
||||
|
||||
TaskQueue::~TaskQueue() {
|
||||
if (type_ != Type::Main && type_ != Type::Special) {
|
||||
if (auto thread_pool = weak_thread_pool_.lock()) {
|
||||
if (auto thread_pool = weak_thread_pool_.toStrongRef()) {
|
||||
thread_pool->RemoveQueue(this);
|
||||
}
|
||||
}
|
||||
@@ -344,12 +344,12 @@ TaskQueue::~TaskQueue() {
|
||||
void TaskQueue::Put(Task &&task) {
|
||||
if (type_ == Type::Main) {
|
||||
QMutexLocker lock(&tasks_mutex_);
|
||||
tasks_.push_back(new Task(std::move(task)));
|
||||
tasks_.push_back(new Task(std_::move(task)));
|
||||
|
||||
Sandbox::MainThreadTaskAdded();
|
||||
} else {
|
||||
t_assert(type_ != Type::Special);
|
||||
TaskThreadPool::Instance()->AddQueueTask(this, std::move(task));
|
||||
TaskThreadPool::Instance()->AddQueueTask(this, std_::move(task));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -938,41 +938,52 @@ QString rusKeyboardLayoutSwitch(const QString &from) {
|
||||
|
||||
QStringList MimeType::globPatterns() const {
|
||||
switch (_type) {
|
||||
case WebP: return QStringList(qsl("*.webp"));
|
||||
case Known::WebP: return QStringList(qsl("*.webp"));
|
||||
case Known::TDesktopTheme: return QStringList(qsl("*.tdesktop-theme"));
|
||||
default: break;
|
||||
}
|
||||
return _typeStruct.globPatterns();
|
||||
}
|
||||
QString MimeType::filterString() const {
|
||||
switch (_type) {
|
||||
case WebP: return qsl("WebP image (*.webp)");
|
||||
case Known::WebP: return qsl("WebP image (*.webp)");
|
||||
case Known::TDesktopTheme: return qsl("Theme files (*.tdesktop-theme)");
|
||||
default: break;
|
||||
}
|
||||
return _typeStruct.filterString();
|
||||
}
|
||||
QString MimeType::name() const {
|
||||
switch (_type) {
|
||||
case WebP: return qsl("image/webp");
|
||||
case Known::WebP: return qsl("image/webp");
|
||||
case Known::TDesktopTheme: return qsl("application/x-tdesktop-theme");
|
||||
default: break;
|
||||
}
|
||||
return _typeStruct.name();
|
||||
}
|
||||
|
||||
MimeType mimeTypeForName(const QString &mime) {
|
||||
if (mime == qsl("image/webp")) return MimeType(MimeType::WebP);
|
||||
if (mime == qsl("image/webp")) {
|
||||
return MimeType(MimeType::Known::WebP);
|
||||
} else if (mime == qsl("application/x-tdesktop-theme")) {
|
||||
return MimeType(MimeType::Known::TDesktopTheme);
|
||||
}
|
||||
return MimeType(QMimeDatabase().mimeTypeForName(mime));
|
||||
}
|
||||
|
||||
MimeType mimeTypeForFile(const QFileInfo &file) {
|
||||
QString path = file.absoluteFilePath();
|
||||
if (path.endsWith(qsl(".webp"), Qt::CaseInsensitive)) return MimeType(MimeType::WebP);
|
||||
if (path.endsWith(qsl(".webp"), Qt::CaseInsensitive)) {
|
||||
return MimeType(MimeType::Known::WebP);
|
||||
} else if (path.endsWith(qsl(".tdesktop-theme"), Qt::CaseInsensitive)) {
|
||||
return MimeType(MimeType::Known::TDesktopTheme);
|
||||
}
|
||||
{
|
||||
QFile f(path);
|
||||
if (f.open(QIODevice::ReadOnly)) {
|
||||
QByteArray magic = f.read(12);
|
||||
if (magic.size() >= 12) {
|
||||
if (!memcmp(magic.constData(), "RIFF", 4) && !memcmp(magic.constData() + 8, "WEBP", 4)) {
|
||||
return MimeType(MimeType::WebP);
|
||||
return MimeType(MimeType::Known::WebP);
|
||||
}
|
||||
}
|
||||
f.close();
|
||||
@@ -984,7 +995,7 @@ MimeType mimeTypeForFile(const QFileInfo &file) {
|
||||
MimeType mimeTypeForData(const QByteArray &data) {
|
||||
if (data.size() >= 12) {
|
||||
if (!memcmp(data.constData(), "RIFF", 4) && !memcmp(data.constData() + 8, "WEBP", 4)) {
|
||||
return MimeType(MimeType::WebP);
|
||||
return MimeType(MimeType::Known::WebP);
|
||||
}
|
||||
}
|
||||
return MimeType(QMimeDatabase().mimeTypeForData(data));
|
||||
|
@@ -429,24 +429,23 @@ inline QString strMakeFromLetters(const uint32 *letters, int32 len) {
|
||||
|
||||
class MimeType {
|
||||
public:
|
||||
|
||||
enum TypeEnum {
|
||||
enum class Known {
|
||||
Unknown,
|
||||
TDesktopTheme,
|
||||
WebP,
|
||||
};
|
||||
|
||||
MimeType(const QMimeType &type) : _typeStruct(type), _type(Unknown) {
|
||||
MimeType(const QMimeType &type) : _typeStruct(type) {
|
||||
}
|
||||
MimeType(TypeEnum type) : _type(type) {
|
||||
MimeType(Known type) : _type(type) {
|
||||
}
|
||||
QStringList globPatterns() const;
|
||||
QString filterString() const;
|
||||
QString name() const;
|
||||
|
||||
private:
|
||||
|
||||
QMimeType _typeStruct;
|
||||
TypeEnum _type;
|
||||
Known _type = Known::Unknown;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -22,9 +22,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include "core/utils.h"
|
||||
|
||||
#define BETA_VERSION_MACRO (10020007ULL)
|
||||
#define BETA_VERSION_MACRO (0ULL)
|
||||
|
||||
constexpr int AppVersion = 10020;
|
||||
constexpr str_const AppVersionStr = "0.10.20";
|
||||
constexpr bool AppAlphaVersion = false;
|
||||
constexpr int AppVersion = 10021;
|
||||
constexpr str_const AppVersionStr = "0.10.21";
|
||||
constexpr bool AppAlphaVersion = true;
|
||||
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;
|
||||
|
Reference in New Issue
Block a user