mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Save IV window geometry.
This commit is contained in:
@@ -44,6 +44,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_updates.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "countries/countries_manager.h"
|
||||
#include "iv/iv_delegate_impl.h"
|
||||
#include "iv/iv_instance.h"
|
||||
#include "lang/lang_file_parser.h"
|
||||
#include "lang/lang_translator.h"
|
||||
@@ -163,7 +164,8 @@ Application::Application()
|
||||
, _domain(std::make_unique<Main::Domain>(cDataFile()))
|
||||
, _exportManager(std::make_unique<Export::Manager>())
|
||||
, _calls(std::make_unique<Calls::Instance>())
|
||||
, _iv(std::make_unique<Iv::Instance>())
|
||||
, _iv(std::make_unique<Iv::Instance>(
|
||||
Ui::CreateChild<Iv::DelegateImpl>(this)))
|
||||
, _langpack(std::make_unique<Lang::Instance>())
|
||||
, _langCloudManager(std::make_unique<Lang::CloudManager>(langpack()))
|
||||
, _emojiKeywords(std::make_unique<ChatHelpers::EmojiKeywords>())
|
||||
@@ -1368,6 +1370,25 @@ Window::Controller *Application::windowFor(
|
||||
return activePrimaryWindow();
|
||||
}
|
||||
|
||||
Window::Controller *Application::findWindow(
|
||||
not_null<QWidget*> widget) const {
|
||||
const auto window = widget->window();
|
||||
if (_lastActiveWindow && _lastActiveWindow->widget() == window) {
|
||||
return _lastActiveWindow;
|
||||
}
|
||||
for (const auto &[account, primary] : _primaryWindows) {
|
||||
if (primary->widget() == window) {
|
||||
return primary.get();
|
||||
}
|
||||
}
|
||||
for (const auto &[history, secondary] : _secondaryWindows) {
|
||||
if (secondary->widget() == window) {
|
||||
return secondary.get();
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Window::Controller *Application::activeWindow() const {
|
||||
return _lastActiveWindow;
|
||||
}
|
||||
|
@@ -47,6 +47,7 @@ class Session;
|
||||
|
||||
namespace Iv {
|
||||
class Instance;
|
||||
class DelegateImpl;
|
||||
} // namespace Iv
|
||||
|
||||
namespace Ui {
|
||||
@@ -165,6 +166,8 @@ public:
|
||||
bool hasActiveWindow(not_null<Main::Session*> session) const;
|
||||
[[nodiscard]] bool savingPositionFor(
|
||||
not_null<Window::Controller*> window) const;
|
||||
[[nodiscard]] Window::Controller *findWindow(
|
||||
not_null<QWidget*> widget) const;
|
||||
[[nodiscard]] Window::Controller *activeWindow() const;
|
||||
[[nodiscard]] Window::Controller *activePrimaryWindow() const;
|
||||
[[nodiscard]] Window::Controller *separateWindowForAccount(
|
||||
|
@@ -134,6 +134,8 @@ QByteArray Settings::serialize() const {
|
||||
LogPosition(_windowPosition, u"Window"_q);
|
||||
const auto mediaViewPosition = Serialize(_mediaViewPosition);
|
||||
LogPosition(_mediaViewPosition, u"Viewer"_q);
|
||||
const auto ivPosition = Serialize(_ivPosition);
|
||||
LogPosition(_ivPosition, u"IV"_q);
|
||||
const auto proxy = _proxy.serialize();
|
||||
const auto skipLanguages = _skipTranslationLanguages.current();
|
||||
|
||||
@@ -209,7 +211,8 @@ QByteArray Settings::serialize() const {
|
||||
+ Serialize::stringSize(_playbackDeviceId.current())
|
||||
+ Serialize::stringSize(_captureDeviceId.current())
|
||||
+ Serialize::stringSize(_callPlaybackDeviceId.current())
|
||||
+ Serialize::stringSize(_callCaptureDeviceId.current());
|
||||
+ Serialize::stringSize(_callCaptureDeviceId.current())
|
||||
+ Serialize::bytearraySize(ivPosition);
|
||||
|
||||
auto result = QByteArray();
|
||||
result.reserve(size);
|
||||
@@ -353,7 +356,8 @@ QByteArray Settings::serialize() const {
|
||||
<< _playbackDeviceId.current()
|
||||
<< _captureDeviceId.current()
|
||||
<< _callPlaybackDeviceId.current()
|
||||
<< _callCaptureDeviceId.current();
|
||||
<< _callCaptureDeviceId.current()
|
||||
<< ivPosition;
|
||||
}
|
||||
|
||||
Ensures(result.size() == size);
|
||||
@@ -469,6 +473,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||
base::flat_set<QString> recentEmojiSkip;
|
||||
qint32 trayIconMonochrome = (_trayIconMonochrome.current() ? 1 : 0);
|
||||
qint32 ttlVoiceClickTooltipHidden = _ttlVoiceClickTooltipHidden.current() ? 1 : 0;
|
||||
QByteArray ivPosition;
|
||||
|
||||
stream >> themesAccentColors;
|
||||
if (!stream.atEnd()) {
|
||||
@@ -747,6 +752,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||
? QString()
|
||||
: legacyCallCaptureDeviceId;
|
||||
}
|
||||
if (!stream.atEnd()) {
|
||||
stream >> ivPosition;
|
||||
}
|
||||
if (stream.status() != QDataStream::Ok) {
|
||||
LOG(("App Error: "
|
||||
"Bad data for Core::Settings::constructFromSerialized()"));
|
||||
@@ -945,6 +953,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||
_recentEmojiSkip = std::move(recentEmojiSkip);
|
||||
_trayIconMonochrome = (trayIconMonochrome == 1);
|
||||
_ttlVoiceClickTooltipHidden = (ttlVoiceClickTooltipHidden == 1);
|
||||
if (!ivPosition.isEmpty()) {
|
||||
_ivPosition = Deserialize(ivPosition);
|
||||
}
|
||||
}
|
||||
|
||||
QString Settings::getSoundPath(const QString &key) const {
|
||||
|
@@ -863,6 +863,13 @@ public:
|
||||
_ttlVoiceClickTooltipHidden = value;
|
||||
}
|
||||
|
||||
[[nodiscard]] const WindowPosition &ivPosition() const {
|
||||
return _ivPosition;
|
||||
}
|
||||
void setIvPosition(const WindowPosition &position) {
|
||||
_ivPosition = position;
|
||||
}
|
||||
|
||||
[[nodiscard]] static bool ThirdColumnByDefault();
|
||||
[[nodiscard]] static float64 DefaultDialogsWidthRatio();
|
||||
|
||||
@@ -990,6 +997,7 @@ private:
|
||||
std::optional<uint64> _macRoundIconDigest;
|
||||
rpl::variable<bool> _storiesClickTooltipHidden = false;
|
||||
rpl::variable<bool> _ttlVoiceClickTooltipHidden = false;
|
||||
WindowPosition _ivPosition;
|
||||
|
||||
bool _tabbedReplacedWithInfo = false; // per-window
|
||||
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window
|
||||
|
Reference in New Issue
Block a user