mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Most of the new Settings are done.
Left: auto update, privacy and security, local storage box + some minor things, like design fixes, codes like loadlang and clearing of the local storage (box) and temp download folder.
This commit is contained in:
90
Telegram/SourceFiles/window/chat_background.cpp
Normal file
90
Telegram/SourceFiles/window/chat_background.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
#include "window/chat_background.h"
|
||||
|
||||
#include "mainwidget.h"
|
||||
#include "localstorage.h"
|
||||
|
||||
namespace Window {
|
||||
namespace {
|
||||
|
||||
NeverFreedPointer<ChatBackground> instance;
|
||||
|
||||
} // namespace
|
||||
|
||||
bool ChatBackground::empty() const {
|
||||
return _image.isNull();
|
||||
}
|
||||
|
||||
void ChatBackground::initIfEmpty() {
|
||||
if (empty()) {
|
||||
App::initBackground();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatBackground::init(int32 id, QPixmap &&image, QPixmap &&dog) {
|
||||
_id = id;
|
||||
_image = std_::move(image);
|
||||
_dog = std_::move(dog);
|
||||
|
||||
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::New, _tile));
|
||||
}
|
||||
|
||||
void ChatBackground::reset() {
|
||||
_id = 0;
|
||||
_image = QPixmap();
|
||||
_dog = QPixmap();
|
||||
_tile = false;
|
||||
|
||||
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::New, _tile));
|
||||
}
|
||||
|
||||
int32 ChatBackground::id() const {
|
||||
return _id;
|
||||
}
|
||||
|
||||
const QPixmap &ChatBackground::image() const {
|
||||
return _image;
|
||||
}
|
||||
|
||||
const QPixmap &ChatBackground::dog() const {
|
||||
return _dog;
|
||||
}
|
||||
|
||||
bool ChatBackground::tile() const {
|
||||
return _tile;
|
||||
}
|
||||
|
||||
void ChatBackground::setTile(bool tile) {
|
||||
if (_tile != tile) {
|
||||
_tile = tile;
|
||||
Local::writeUserSettings();
|
||||
notify(ChatBackgroundUpdate(ChatBackgroundUpdate::Type::Changed, _tile));
|
||||
}
|
||||
}
|
||||
|
||||
ChatBackground *chatBackground() {
|
||||
instance.makeIfNull();
|
||||
return instance.data();
|
||||
}
|
||||
|
||||
} // namespace Window
|
61
Telegram/SourceFiles/window/chat_background.h
Normal file
61
Telegram/SourceFiles/window/chat_background.h
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop version of Telegram messaging app, see https://telegram.org
|
||||
|
||||
Telegram Desktop is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
It is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
In addition, as a special exception, the copyright holders give permission
|
||||
to link the code of portions of this program with the OpenSSL library.
|
||||
|
||||
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
||||
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Window {
|
||||
|
||||
struct ChatBackgroundUpdate {
|
||||
enum class Type {
|
||||
New,
|
||||
Changed,
|
||||
Start,
|
||||
};
|
||||
|
||||
ChatBackgroundUpdate(Type type, bool tiled) : type(type), tiled(tiled) {
|
||||
}
|
||||
Type type;
|
||||
bool tiled;
|
||||
};
|
||||
|
||||
class ChatBackground : public base::Observable<ChatBackgroundUpdate> {
|
||||
public:
|
||||
bool empty() const;
|
||||
void initIfEmpty();
|
||||
void init(int32 id, QPixmap &&image, QPixmap &&dog);
|
||||
void reset();
|
||||
|
||||
int32 id() const;
|
||||
const QPixmap &image() const;
|
||||
const QPixmap &dog() const;
|
||||
bool tile() const;
|
||||
void setTile(bool tile);
|
||||
|
||||
private:
|
||||
int32 _id = 0;
|
||||
QPixmap _image;
|
||||
QPixmap _dog;
|
||||
bool _tile = false;
|
||||
|
||||
};
|
||||
|
||||
ChatBackground *chatBackground();
|
||||
|
||||
} // namespace Window
|
@@ -32,7 +32,7 @@ struct SectionSlideParams {
|
||||
bool withTopBarShadow = false;
|
||||
};
|
||||
|
||||
class SectionWidget : public TWidget {
|
||||
class SectionWidget : public TWidget, protected base::Subscriber {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@@ -71,9 +71,6 @@ public:
|
||||
setFocus();
|
||||
}
|
||||
|
||||
virtual void updateAdaptiveLayout() {
|
||||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
|
@@ -50,6 +50,8 @@ TopBarWidget::TopBarWidget(MainWidget *w) : TWidget(w)
|
||||
connect(_info, SIGNAL(clicked()), this, SLOT(onInfoClicked()));
|
||||
connect(_search, SIGNAL(clicked()), this, SLOT(onSearch()));
|
||||
|
||||
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||
|
||||
setCursor(style::cur_pointer);
|
||||
showAll();
|
||||
}
|
||||
|
@@ -30,7 +30,7 @@ class IconedButton;
|
||||
|
||||
namespace Window {
|
||||
|
||||
class TopBarWidget : public TWidget {
|
||||
class TopBarWidget : public TWidget, private base::Subscriber {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@@ -51,8 +51,6 @@ public:
|
||||
void showAll();
|
||||
void showSelected(uint32 selCount, bool canDelete = false);
|
||||
|
||||
void updateAdaptiveLayout();
|
||||
|
||||
void updateMembersShowArea();
|
||||
|
||||
Ui::RoundButton *mediaTypeButton();
|
||||
@@ -71,6 +69,8 @@ signals:
|
||||
void clicked();
|
||||
|
||||
private:
|
||||
void updateAdaptiveLayout();
|
||||
|
||||
MainWidget *main();
|
||||
anim::fvalue a_over = { 0. };
|
||||
Animation _a_appearance;
|
||||
|
Reference in New Issue
Block a user