mirror of https://github.com/procxx/kepka.git
Removed old SettingsWidget from code, deleted old settings module.
This commit is contained in:
parent
b520cf0f78
commit
2aab8bbae8
|
@ -25,7 +25,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
class AppClass;
|
class AppClass;
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class MainWidget;
|
class MainWidget;
|
||||||
class SettingsWidget;
|
|
||||||
class ApiWrap;
|
class ApiWrap;
|
||||||
class FileUploader;
|
class FileUploader;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "backgroundbox.h"
|
#include "backgroundbox.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settingswidget.h"
|
|
||||||
#include "window/chat_background.h"
|
#include "window/chat_background.h"
|
||||||
#include "styles/style_overview.h"
|
#include "styles/style_overview.h"
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "stickersetbox.h"
|
#include "stickersetbox.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settingswidget.h"
|
|
||||||
#include "boxes/confirmbox.h"
|
#include "boxes/confirmbox.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "localstorage.h"
|
#include "localstorage.h"
|
||||||
|
|
|
@ -39,7 +39,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "fileuploader.h"
|
#include "fileuploader.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "settingswidget.h"
|
|
||||||
#include "inline_bots/inline_bot_layout_item.h"
|
#include "inline_bots/inline_bot_layout_item.h"
|
||||||
#include "boxes/confirmbox.h"
|
#include "boxes/confirmbox.h"
|
||||||
#include "boxes/stickersetbox.h"
|
#include "boxes/stickersetbox.h"
|
||||||
|
|
|
@ -32,7 +32,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "intro/introwidget.h"
|
#include "intro/introwidget.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "layerwidget.h"
|
#include "layerwidget.h"
|
||||||
#include "settingswidget.h"
|
|
||||||
#include "boxes/confirmbox.h"
|
#include "boxes/confirmbox.h"
|
||||||
#include "boxes/contactsbox.h"
|
#include "boxes/contactsbox.h"
|
||||||
#include "boxes/addcontactbox.h"
|
#include "boxes/addcontactbox.h"
|
||||||
|
@ -698,29 +697,12 @@ void MainWindow::showSettings() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true) {
|
if (!layerBg) {
|
||||||
if (!layerBg) {
|
layerBg = new LayerStackWidget(this);
|
||||||
layerBg = new LayerStackWidget(this);
|
|
||||||
}
|
|
||||||
settings = new Settings::Widget();
|
|
||||||
connect(settings, SIGNAL(destroyed(QObject*)), this, SLOT(onSettingsDestroyed(QObject*)));
|
|
||||||
layerBg->showSpecialLayer(settings);
|
|
||||||
} else {
|
|
||||||
QPixmap bg = grabInner();
|
|
||||||
|
|
||||||
if (intro) {
|
|
||||||
intro->stop_show();
|
|
||||||
intro->hide();
|
|
||||||
} else if (main) {
|
|
||||||
main->animStop_show();
|
|
||||||
main->hide();
|
|
||||||
}
|
|
||||||
auto settings = new SettingsWidget(this);
|
|
||||||
settings->animShow(bg);
|
|
||||||
title->updateBackButton();
|
|
||||||
|
|
||||||
fixOrder();
|
|
||||||
}
|
}
|
||||||
|
settings = new Settings::Widget();
|
||||||
|
connect(settings, SIGNAL(destroyed(QObject*)), this, SLOT(onSettingsDestroyed(QObject*)));
|
||||||
|
layerBg->showSpecialLayer(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ui_hideSettingsAndLayer(ShowLayerOptions options) {
|
void MainWindow::ui_hideSettingsAndLayer(ShowLayerOptions options) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,373 +0,0 @@
|
||||||
/*
|
|
||||||
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
|
|
||||||
|
|
||||||
#include "ui/flatbutton.h"
|
|
||||||
#include "ui/flatcheckbox.h"
|
|
||||||
#include "sysbuttons.h"
|
|
||||||
#include "core/observer.h"
|
|
||||||
#include "boxes/downloadpathbox.h"
|
|
||||||
|
|
||||||
class MainWindow;
|
|
||||||
|
|
||||||
class Slider : public QWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Slider(QWidget *parent, const style::slider &st, int32 count, int32 sel = 0);
|
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mouseReleaseEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
int32 selected() const;
|
|
||||||
void setSelected(int32 sel);
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
void changed(int32 oldSelected);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
int32 _count, _sel, _wasSel;
|
|
||||||
style::slider _st;
|
|
||||||
bool _pressed;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Notify {
|
|
||||||
struct PeerUpdate;
|
|
||||||
} // namespace Notify
|
|
||||||
|
|
||||||
class SettingsInner : public TWidget, public RPCSender, public Notify::Observer {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SettingsInner(SettingsWidget *parent);
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void contextMenuEvent(QContextMenuEvent *e);
|
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
|
||||||
|
|
||||||
void step_photo(float64 ms, bool timer);
|
|
||||||
|
|
||||||
void updateSize(int32 newWidth);
|
|
||||||
|
|
||||||
void updateOnlineDisplay();
|
|
||||||
|
|
||||||
void showAll();
|
|
||||||
|
|
||||||
void chooseCustomLang();
|
|
||||||
|
|
||||||
void updateChatBackground();
|
|
||||||
void needBackgroundUpdate(bool tile);
|
|
||||||
void enableDisplayNotify(bool enable);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void usernameChanged();
|
|
||||||
void updateConnectionType();
|
|
||||||
|
|
||||||
void passcodeChanged();
|
|
||||||
|
|
||||||
void updateBackgroundRect();
|
|
||||||
|
|
||||||
void peerUpdated(PeerData *data);
|
|
||||||
|
|
||||||
void onUpdatePhoto();
|
|
||||||
void onUpdatePhotoCancel();
|
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void onAutoUpdate();
|
|
||||||
void onCheckNow();
|
|
||||||
#endif
|
|
||||||
void onRestartNow();
|
|
||||||
|
|
||||||
void onFullPeerUpdated(PeerData *peer);
|
|
||||||
|
|
||||||
void onPasscode();
|
|
||||||
void onPasscodeOff();
|
|
||||||
void onAutoLock();
|
|
||||||
void onPassword();
|
|
||||||
void onPasswordOff();
|
|
||||||
void onReloadPassword(Qt::ApplicationState state = Qt::ApplicationActive);
|
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
|
||||||
void onConnectionType();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void onUsername();
|
|
||||||
|
|
||||||
void onWorkmodeTray();
|
|
||||||
void onWorkmodeWindow();
|
|
||||||
|
|
||||||
void onAutoStart();
|
|
||||||
void onStartMinimized();
|
|
||||||
void onSendToMenu();
|
|
||||||
|
|
||||||
void onScaleAuto();
|
|
||||||
void onScaleChange();
|
|
||||||
|
|
||||||
void onSoundNotify();
|
|
||||||
void onIncludeMuted();
|
|
||||||
void onDesktopNotify();
|
|
||||||
void onSenderName();
|
|
||||||
void onMessagePreview();
|
|
||||||
|
|
||||||
void onWindowsNotifications();
|
|
||||||
|
|
||||||
void onReplaceEmojis();
|
|
||||||
void onViewEmojis();
|
|
||||||
void onStickers();
|
|
||||||
|
|
||||||
void onEnterSend();
|
|
||||||
void onCtrlEnterSend();
|
|
||||||
|
|
||||||
void onDontAskDownloadPath();
|
|
||||||
void onDownloadPathEdit();
|
|
||||||
void onDownloadPathClear();
|
|
||||||
void onDownloadPathClearSure();
|
|
||||||
void onTempDirCleared(int task);
|
|
||||||
void onTempDirClearFailed(int task);
|
|
||||||
|
|
||||||
void onAutoDownload();
|
|
||||||
|
|
||||||
void onBackFromGallery();
|
|
||||||
void onBackFromFile();
|
|
||||||
void onTileBackground();
|
|
||||||
void onAdaptiveForWide();
|
|
||||||
|
|
||||||
void onLocalStorageClear();
|
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void onUpdateChecking();
|
|
||||||
void onUpdateLatest();
|
|
||||||
void onUpdateDownloading(qint64 ready, qint64 total);
|
|
||||||
void onUpdateReady();
|
|
||||||
void onUpdateFailed();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void onShowSessions();
|
|
||||||
|
|
||||||
void onPhotoUpdateDone(PeerId peer);
|
|
||||||
void onPhotoUpdateFail(PeerId peer);
|
|
||||||
void onPhotoUpdateStart();
|
|
||||||
|
|
||||||
void onChangeLanguage();
|
|
||||||
void onSaveTestLang();
|
|
||||||
|
|
||||||
void onUpdateLocalStorage();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onSwitchModerateMode();
|
|
||||||
|
|
||||||
void onAskQuestion();
|
|
||||||
void onAskQuestionSure();
|
|
||||||
void onTelegramFAQ();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void notifyPeerUpdated(const Notify::PeerUpdate &update);
|
|
||||||
|
|
||||||
void saveError(const QString &str = QString());
|
|
||||||
|
|
||||||
void supportGot(const MTPhelp_Support &support);
|
|
||||||
|
|
||||||
void setScale(DBIScale newScale);
|
|
||||||
|
|
||||||
QString _testlang, _secretText;
|
|
||||||
|
|
||||||
UserData *_self;
|
|
||||||
UserData *self() const {
|
|
||||||
return App::self() ? _self : static_cast<UserData*>(0);
|
|
||||||
}
|
|
||||||
int32 _left;
|
|
||||||
|
|
||||||
// profile
|
|
||||||
Text _nameText;
|
|
||||||
QString _nameCache;
|
|
||||||
ClickHandlerPtr _photoLink;
|
|
||||||
FlatButton _uploadPhoto;
|
|
||||||
LinkButton _cancelPhoto;
|
|
||||||
bool _nameOver, _photoOver;
|
|
||||||
anim::fvalue a_photoOver;
|
|
||||||
Animation _a_photo;
|
|
||||||
|
|
||||||
QString _errorText;
|
|
||||||
|
|
||||||
// contact info
|
|
||||||
QString _phoneText;
|
|
||||||
LinkButton _chooseUsername;
|
|
||||||
|
|
||||||
// notifications
|
|
||||||
FlatCheckbox _desktopNotify, _senderName, _messagePreview, _windowsNotifications, _soundNotify, _includeMuted;
|
|
||||||
|
|
||||||
// general
|
|
||||||
LinkButton _changeLanguage;
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
FlatCheckbox _autoUpdate;
|
|
||||||
LinkButton _checkNow, _restartNow;
|
|
||||||
#endif
|
|
||||||
bool _supportTray; // cSupportTray() value on settings create
|
|
||||||
FlatCheckbox _workmodeTray, _workmodeWindow;
|
|
||||||
FlatCheckbox _autoStart, _startMinimized, _sendToMenu;
|
|
||||||
FlatCheckbox _dpiAutoScale;
|
|
||||||
Slider _dpiSlider;
|
|
||||||
int32 _dpiWidth1, _dpiWidth2, _dpiWidth3, _dpiWidth4;
|
|
||||||
|
|
||||||
QString _curVersionText, _newVersionText;
|
|
||||||
int32 _curVersionWidth, _newVersionWidth;
|
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
enum UpdatingState {
|
|
||||||
UpdatingNone,
|
|
||||||
UpdatingCheck,
|
|
||||||
UpdatingLatest,
|
|
||||||
UpdatingDownload,
|
|
||||||
UpdatingFail,
|
|
||||||
UpdatingReady
|
|
||||||
};
|
|
||||||
UpdatingState _updatingState;
|
|
||||||
QString _newVersionDownload;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// chat options
|
|
||||||
FlatCheckbox _replaceEmojis;
|
|
||||||
LinkButton _viewEmojis, _stickers;
|
|
||||||
FlatRadiobutton _enterSend, _ctrlEnterSend;
|
|
||||||
FlatCheckbox _dontAskDownloadPath;
|
|
||||||
int32 _downloadPathWidth;
|
|
||||||
LinkButton _downloadPathEdit, _downloadPathClear;
|
|
||||||
int32 _tempDirClearingWidth, _tempDirClearedWidth, _tempDirClearFailedWidth;
|
|
||||||
enum TempDirClearState {
|
|
||||||
TempDirClearFailed = 0,
|
|
||||||
TempDirEmpty = 1,
|
|
||||||
TempDirExists = 2,
|
|
||||||
TempDirClearing = 3,
|
|
||||||
TempDirCleared = 4,
|
|
||||||
};
|
|
||||||
TempDirClearState _tempDirClearState;
|
|
||||||
LinkButton _autoDownload;
|
|
||||||
|
|
||||||
// local storage
|
|
||||||
LinkButton _localStorageClear;
|
|
||||||
int32 _localStorageHeight;
|
|
||||||
int32 _storageClearingWidth, _storageClearedWidth, _storageClearFailedWidth;
|
|
||||||
TempDirClearState _storageClearState;
|
|
||||||
|
|
||||||
// chat background
|
|
||||||
QPixmap _background;
|
|
||||||
LinkButton _backFromGallery, _backFromFile;
|
|
||||||
FlatCheckbox _tileBackground, _adaptiveForWide;
|
|
||||||
bool _needBackgroundUpdate;
|
|
||||||
|
|
||||||
// Radial animation interface.
|
|
||||||
RadialAnimation _radial;
|
|
||||||
float64 radialProgress() const;
|
|
||||||
bool radialLoading() const;
|
|
||||||
QRect radialRect() const;
|
|
||||||
void radialStart();
|
|
||||||
uint64 radialTimeShift() const;
|
|
||||||
void step_radial(uint64 ms, bool timer);
|
|
||||||
|
|
||||||
// advanced
|
|
||||||
LinkButton _passcodeEdit, _passcodeTurnOff, _autoLock;
|
|
||||||
QString _autoLockText;
|
|
||||||
int32 _autoLockWidth;
|
|
||||||
LinkButton _passwordEdit, _passwordTurnOff;
|
|
||||||
QString _waitingConfirm;
|
|
||||||
QByteArray _curPasswordSalt;
|
|
||||||
bool _hasPasswordRecovery;
|
|
||||||
QString _curPasswordHint;
|
|
||||||
QByteArray _newPasswordSalt;
|
|
||||||
LinkButton _connectionType;
|
|
||||||
QString _connectionTypeText;
|
|
||||||
int32 _connectionTypeWidth;
|
|
||||||
LinkButton _showSessions, _askQuestion, _telegramFAQ, _logOut;
|
|
||||||
|
|
||||||
mtpRequestId _supportGetRequest;
|
|
||||||
|
|
||||||
void gotPassword(const MTPaccount_Password &result);
|
|
||||||
void offPasswordDone(const MTPBool &result);
|
|
||||||
bool offPasswordFail(const RPCError &error);
|
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
||||||
void setUpdatingState(UpdatingState state, bool force = false);
|
|
||||||
void setDownloadProgress(qint64 ready, qint64 total);
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
class SettingsWidget : public TWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SettingsWidget(MainWindow *parent);
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void dragEnterEvent(QDragEnterEvent *e);
|
|
||||||
void dropEvent(QDropEvent *e);
|
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
|
||||||
|
|
||||||
void animShow(const QPixmap &bgAnimCache, bool back = false);
|
|
||||||
void step_show(float64 ms, bool timer);
|
|
||||||
void stop_show();
|
|
||||||
|
|
||||||
void updateOnlineDisplay();
|
|
||||||
void updateConnectionType();
|
|
||||||
|
|
||||||
void updateDisplayNotify();
|
|
||||||
|
|
||||||
void rpcClear();
|
|
||||||
|
|
||||||
void setInnerFocus();
|
|
||||||
void needBackgroundUpdate(bool tile);
|
|
||||||
|
|
||||||
~SettingsWidget();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void onParentResize(const QSize &newSize);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void showAll();
|
|
||||||
void hideAll();
|
|
||||||
|
|
||||||
Animation _a_show;
|
|
||||||
QPixmap _cacheUnder, _cacheOver;
|
|
||||||
anim::ivalue a_coordUnder, a_coordOver;
|
|
||||||
anim::fvalue a_shadow;
|
|
||||||
|
|
||||||
ScrollArea _scroll;
|
|
||||||
SettingsInner _inner;
|
|
||||||
IconedButton _close;
|
|
||||||
};
|
|
|
@ -127,8 +127,6 @@
|
||||||
'<(src_loc)/mainwidget.h',
|
'<(src_loc)/mainwidget.h',
|
||||||
'<(src_loc)/settings.cpp',
|
'<(src_loc)/settings.cpp',
|
||||||
'<(src_loc)/settings.h',
|
'<(src_loc)/settings.h',
|
||||||
'<(src_loc)/settingswidget.cpp',
|
|
||||||
'<(src_loc)/settingswidget.h',
|
|
||||||
'<(src_loc)/shortcuts.cpp',
|
'<(src_loc)/shortcuts.cpp',
|
||||||
'<(src_loc)/shortcuts.h',
|
'<(src_loc)/shortcuts.h',
|
||||||
'<(src_loc)/structs.cpp',
|
'<(src_loc)/structs.cpp',
|
||||||
|
|
Loading…
Reference in New Issue