mirror of https://github.com/procxx/kepka.git
New way of working with boxes (layers).
Now the background of boxes is separated to another widget. This will allow to use a special layer widget (like settings) together with the usual layers-boxes upon it, moving the special widget behind the dark background when a usual layer-box is shown.
This commit is contained in:
parent
05697374c5
commit
392984f276
|
@ -42,8 +42,6 @@ typedef QHash<Media::Clip::Reader*, HistoryItem*> GifItems;
|
||||||
typedef QHash<PhotoId, PhotoData*> PhotosData;
|
typedef QHash<PhotoId, PhotoData*> PhotosData;
|
||||||
typedef QHash<DocumentId, DocumentData*> DocumentsData;
|
typedef QHash<DocumentId, DocumentData*> DocumentsData;
|
||||||
|
|
||||||
class LayeredWidget;
|
|
||||||
|
|
||||||
namespace App {
|
namespace App {
|
||||||
AppClass *app();
|
AppClass *app();
|
||||||
MainWindow *wnd();
|
MainWindow *wnd();
|
||||||
|
|
|
@ -48,14 +48,6 @@ AboutBox::AboutBox() : AbstractBox(st::aboutWidth)
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AboutBox::hideAll() {
|
|
||||||
_version.hide();
|
|
||||||
_text1.hide();
|
|
||||||
_text2.hide();
|
|
||||||
_text3.hide();
|
|
||||||
_done.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AboutBox::showAll() {
|
void AboutBox::showAll() {
|
||||||
_version.show();
|
_version.show();
|
||||||
_text1.show();
|
_text1.show();
|
||||||
|
|
|
@ -27,29 +27,25 @@ class AboutBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AboutBox();
|
AboutBox();
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent *e);
|
|
||||||
void dropEvent(QDropEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onVersion();
|
void onVersion();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void dragEnterEvent(QDragEnterEvent *e) override;
|
||||||
|
void dropEvent(QDropEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
LinkButton _version;
|
LinkButton _version;
|
||||||
FlatLabel _text1, _text2, _text3;
|
FlatLabel _text1, _text2, _text3;
|
||||||
BoxButton _done;
|
BoxButton _done;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QString telegramFaqLink();
|
QString telegramFaqLink();
|
||||||
|
|
|
@ -73,28 +73,25 @@ void BlueTitleClose::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractBox::AbstractBox(int32 w) : LayeredWidget()
|
AbstractBox::AbstractBox(int32 w) : LayerWidget()
|
||||||
, _maxHeight(0)
|
, _maxHeight(0)
|
||||||
, _hiding(false)
|
|
||||||
, _closed(false)
|
, _closed(false)
|
||||||
, a_opacity(0, 1)
|
|
||||||
, _blueTitle(false)
|
, _blueTitle(false)
|
||||||
, _blueClose(0)
|
, _blueClose(0)
|
||||||
, _blueShadow(0) {
|
, _blueShadow(0) {
|
||||||
|
setAttribute(Qt::WA_OpaquePaintEvent);
|
||||||
resize(w, 0);
|
resize(w, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::prepare() {
|
void AbstractBox::prepare() {
|
||||||
showAll();
|
showAll();
|
||||||
_cache = myGrab(this);
|
|
||||||
hideAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::keyPressEvent(QKeyEvent *e) {
|
void AbstractBox::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Escape) {
|
if (e->key() == Qt::Key_Escape) {
|
||||||
onClose();
|
onClose();
|
||||||
} else {
|
} else {
|
||||||
LayeredWidget::keyPressEvent(e);
|
LayerWidget::keyPressEvent(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,17 +112,8 @@ void AbstractBox::parentResized() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractBox::paint(QPainter &p) {
|
bool AbstractBox::paint(QPainter &p) {
|
||||||
bool result = true;
|
p.fillRect(rect(), st::boxBg);
|
||||||
if (_cache.isNull()) {
|
return false;
|
||||||
result = (_hiding && a_opacity.current() < 0.01);
|
|
||||||
|
|
||||||
// fill bg
|
|
||||||
p.fillRect(rect(), st::boxBg->b);
|
|
||||||
} else {
|
|
||||||
p.setOpacity(a_opacity.current());
|
|
||||||
p.drawPixmap(0, 0, _cache);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::paintTitle(Painter &p, const QString &title, const QString &additional) {
|
void AbstractBox::paintTitle(Painter &p, const QString &title, const QString &additional) {
|
||||||
|
@ -153,21 +141,6 @@ void AbstractBox::paintEvent(QPaintEvent *e) {
|
||||||
if (paint(p)) return;
|
if (paint(p)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::showStep(float64 ms) {
|
|
||||||
if (ms >= 1) {
|
|
||||||
a_opacity.finish();
|
|
||||||
_cache = QPixmap();
|
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent);
|
|
||||||
if (!_hiding) {
|
|
||||||
showAll();
|
|
||||||
showDone();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
a_opacity.update(ms, anim::linear);
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractBox::setMaxHeight(int32 maxHeight) {
|
void AbstractBox::setMaxHeight(int32 maxHeight) {
|
||||||
resizeMaxHeight(width(), maxHeight);
|
resizeMaxHeight(width(), maxHeight);
|
||||||
}
|
}
|
||||||
|
@ -200,17 +173,7 @@ void AbstractBox::onClose() {
|
||||||
_closed = true;
|
_closed = true;
|
||||||
closePressed();
|
closePressed();
|
||||||
}
|
}
|
||||||
emit closed();
|
emit closed(this);
|
||||||
}
|
|
||||||
|
|
||||||
void AbstractBox::startHide() {
|
|
||||||
_hiding = true;
|
|
||||||
if (_cache.isNull()) {
|
|
||||||
_cache = myGrab(this);
|
|
||||||
hideAll();
|
|
||||||
}
|
|
||||||
a_opacity.start(0);
|
|
||||||
setAttribute(Qt::WA_OpaquePaintEvent, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractBox::setBlueTitle(bool blue) {
|
void AbstractBox::setBlueTitle(bool blue) {
|
||||||
|
@ -248,11 +211,6 @@ void ScrollableBox::init(QWidget *inner, int32 bottomSkip, int32 topSkip) {
|
||||||
ScrollableBox::resizeEvent(0);
|
ScrollableBox::resizeEvent(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollableBox::hideAll() {
|
|
||||||
_scroll.hide();
|
|
||||||
AbstractBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScrollableBox::showAll() {
|
void ScrollableBox::showAll() {
|
||||||
_scroll.show();
|
_scroll.show();
|
||||||
AbstractBox::showAll();
|
AbstractBox::showAll();
|
||||||
|
|
|
@ -47,27 +47,26 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AbstractBox : public LayeredWidget {
|
class AbstractBox : public LayerWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AbstractBox(int32 w = st::boxWideWidth);
|
AbstractBox(int32 w = st::boxWideWidth);
|
||||||
void parentResized();
|
void parentResized() override;
|
||||||
void showStep(float64 ms);
|
void showDone() override {
|
||||||
void keyPressEvent(QKeyEvent *e);
|
showAll();
|
||||||
void resizeEvent(QResizeEvent *e);
|
}
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void startHide();
|
|
||||||
|
|
||||||
void setBlueTitle(bool blue);
|
void setBlueTitle(bool blue);
|
||||||
void raiseShadow();
|
void raiseShadow();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onClose();
|
void onClose();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
void prepare();
|
void prepare();
|
||||||
bool paint(QPainter &p);
|
bool paint(QPainter &p);
|
||||||
|
@ -77,31 +76,21 @@ protected:
|
||||||
|
|
||||||
virtual void closePressed() {
|
virtual void closePressed() {
|
||||||
}
|
}
|
||||||
virtual void hideAll() {
|
|
||||||
if (_blueClose) _blueClose->hide();
|
|
||||||
if (_blueShadow) _blueShadow->hide();
|
|
||||||
}
|
|
||||||
virtual void showAll() {
|
virtual void showAll() {
|
||||||
if (_blueClose) _blueClose->show();
|
if (_blueClose) _blueClose->show();
|
||||||
if (_blueShadow) _blueShadow->show();
|
if (_blueShadow) _blueShadow->show();
|
||||||
}
|
}
|
||||||
virtual void showDone() {
|
|
||||||
setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int32 _maxHeight;
|
int32 _maxHeight;
|
||||||
int32 countHeight() const;
|
int32 countHeight() const;
|
||||||
|
|
||||||
bool _hiding, _closed;
|
bool _closed;
|
||||||
QPixmap _cache;
|
|
||||||
|
|
||||||
anim::fvalue a_opacity;
|
|
||||||
|
|
||||||
bool _blueTitle;
|
bool _blueTitle;
|
||||||
BlueTitleClose *_blueClose;
|
BlueTitleClose *_blueClose;
|
||||||
BlueTitleShadow *_blueShadow;
|
BlueTitleShadow *_blueShadow;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScrollableBoxShadow : public PlainShadow {
|
class ScrollableBoxShadow : public PlainShadow {
|
||||||
|
@ -112,21 +101,17 @@ public:
|
||||||
|
|
||||||
class ScrollableBox : public AbstractBox {
|
class ScrollableBox : public AbstractBox {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ScrollableBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth);
|
ScrollableBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth);
|
||||||
void resizeEvent(QResizeEvent *e);
|
void resizeEvent(QResizeEvent *e);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void init(QWidget *inner, int32 bottomSkip = st::boxScrollSkip, int32 topSkip = st::boxTitleHeight);
|
void init(QWidget *inner, int32 bottomSkip = st::boxScrollSkip, int32 topSkip = st::boxTitleHeight);
|
||||||
|
|
||||||
virtual void hideAll();
|
void showAll() override;
|
||||||
virtual void showAll();
|
|
||||||
|
|
||||||
ScrollArea _scroll;
|
ScrollArea _scroll;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QWidget *_innerPtr;
|
QWidget *_innerPtr;
|
||||||
int32 _topSkip, _bottomSkip;
|
int32 _topSkip, _bottomSkip;
|
||||||
|
|
||||||
|
@ -134,7 +119,6 @@ private:
|
||||||
|
|
||||||
class ItemListBox : public ScrollableBox {
|
class ItemListBox : public ScrollableBox {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ItemListBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth);
|
ItemListBox(const style::flatScroll &scroll, int32 w = st::boxWideWidth);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -84,15 +84,6 @@ void AddContactBox::initBox() {
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddContactBox::hideAll() {
|
|
||||||
_first.hide();
|
|
||||||
_last.hide();
|
|
||||||
_phone.hide();
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_retry.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddContactBox::showAll() {
|
void AddContactBox::showAll() {
|
||||||
_first.show();
|
_first.show();
|
||||||
_last.show();
|
_last.show();
|
||||||
|
@ -101,7 +92,7 @@ void AddContactBox::showAll() {
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddContactBox::showDone() {
|
void AddContactBox::doSetInnerFocus() {
|
||||||
if ((_first.getLastText().isEmpty() && _last.getLastText().isEmpty()) || !_phone.isEnabled()) {
|
if ((_first.getLastText().isEmpty() && _last.getLastText().isEmpty()) || !_phone.isEnabled()) {
|
||||||
(_invertOrder ? _last : _first).setFocus();
|
(_invertOrder ? _last : _first).setFocus();
|
||||||
} else {
|
} else {
|
||||||
|
@ -203,7 +194,7 @@ bool AddContactBox::onSaveUserFail(const RPCError &error) {
|
||||||
QString firstName = _first.getLastText().trimmed(), lastName = _last.getLastText().trimmed();
|
QString firstName = _first.getLastText().trimmed(), lastName = _last.getLastText().trimmed();
|
||||||
if (err == "CHAT_TITLE_NOT_MODIFIED") {
|
if (err == "CHAT_TITLE_NOT_MODIFIED") {
|
||||||
_user->setName(firstName, lastName, _user->nameOrPhone, _user->username);
|
_user->setName(firstName, lastName, _user->nameOrPhone, _user->username);
|
||||||
emit closed();
|
onClose();
|
||||||
return true;
|
return true;
|
||||||
} else if (err == "NO_CHAT_TITLE") {
|
} else if (err == "NO_CHAT_TITLE") {
|
||||||
_first.setFocus();
|
_first.setFocus();
|
||||||
|
@ -243,9 +234,9 @@ void AddContactBox::onImportDone(const MTPcontacts_ImportedContacts &res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddContactBox::onSaveUserDone(const MTPcontacts_ImportedContacts &res) {
|
void AddContactBox::onSaveUserDone(const MTPcontacts_ImportedContacts &res) {
|
||||||
const auto &d(res.c_contacts_importedContacts());
|
auto &d = res.c_contacts_importedContacts();
|
||||||
App::feedUsers(d.vusers);
|
App::feedUsers(d.vusers);
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddContactBox::onRetry() {
|
void AddContactBox::onRetry() {
|
||||||
|
@ -282,13 +273,6 @@ _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewGroupBox::hideAll() {
|
|
||||||
_group.hide();
|
|
||||||
_channel.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_next.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewGroupBox::showAll() {
|
void NewGroupBox::showAll() {
|
||||||
_group.show();
|
_group.show();
|
||||||
_channel.show();
|
_channel.show();
|
||||||
|
@ -296,10 +280,6 @@ void NewGroupBox::showAll() {
|
||||||
_next.show();
|
_next.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewGroupBox::showDone() {
|
|
||||||
setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewGroupBox::keyPressEvent(QKeyEvent *e) {
|
void NewGroupBox::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||||
onNext();
|
onNext();
|
||||||
|
@ -364,13 +344,6 @@ _creationRequestId(0), _createdChannel(0) {
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInfoBox::hideAll() {
|
|
||||||
_title.hide();
|
|
||||||
_description.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_next.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GroupInfoBox::showAll() {
|
void GroupInfoBox::showAll() {
|
||||||
_title.show();
|
_title.show();
|
||||||
if (_creating == CreatingGroupChannel) {
|
if (_creating == CreatingGroupChannel) {
|
||||||
|
@ -382,7 +355,7 @@ void GroupInfoBox::showAll() {
|
||||||
_next.show();
|
_next.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInfoBox::showDone() {
|
void GroupInfoBox::doSetInnerFocus() {
|
||||||
_title.setFocus();
|
_title.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,14 +610,6 @@ SetupChannelBox::SetupChannelBox(ChannelData *channel, bool existing) : Abstract
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupChannelBox::hideAll() {
|
|
||||||
_public.hide();
|
|
||||||
_private.hide();
|
|
||||||
_link.hide();
|
|
||||||
_save.hide();
|
|
||||||
_skip.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetupChannelBox::showAll() {
|
void SetupChannelBox::showAll() {
|
||||||
_public.show();
|
_public.show();
|
||||||
_private.show();
|
_private.show();
|
||||||
|
@ -657,8 +622,12 @@ void SetupChannelBox::showAll() {
|
||||||
_skip.show();
|
_skip.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupChannelBox::showDone() {
|
void SetupChannelBox::doSetInnerFocus() {
|
||||||
_link.setFocus();
|
if (_link.isHidden()) {
|
||||||
|
setFocus();
|
||||||
|
} else {
|
||||||
|
_link.setFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupChannelBox::updateMaxHeight() {
|
void SetupChannelBox::updateMaxHeight() {
|
||||||
|
@ -1007,13 +976,6 @@ _requestId(0) {
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditNameTitleBox::hideAll() {
|
|
||||||
_first.hide();
|
|
||||||
_last.hide();
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditNameTitleBox::showAll() {
|
void EditNameTitleBox::showAll() {
|
||||||
_first.show();
|
_first.show();
|
||||||
if (_peer->isChat()) {
|
if (_peer->isChat()) {
|
||||||
|
@ -1025,7 +987,7 @@ void EditNameTitleBox::showAll() {
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditNameTitleBox::showDone() {
|
void EditNameTitleBox::doSetInnerFocus() {
|
||||||
(_invertOrder ? _last : _first).setFocus();
|
(_invertOrder ? _last : _first).setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1105,7 +1067,7 @@ void EditNameTitleBox::onSave() {
|
||||||
|
|
||||||
void EditNameTitleBox::onSaveSelfDone(const MTPUser &user) {
|
void EditNameTitleBox::onSaveSelfDone(const MTPUser &user) {
|
||||||
App::feedUsers(MTP_vector<MTPUser>(1, user));
|
App::feedUsers(MTP_vector<MTPUser>(1, user));
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditNameTitleBox::onSaveSelfFail(const RPCError &error) {
|
bool EditNameTitleBox::onSaveSelfFail(const RPCError &error) {
|
||||||
|
@ -1115,7 +1077,7 @@ bool EditNameTitleBox::onSaveSelfFail(const RPCError &error) {
|
||||||
QString first = textOneLine(_first.getLastText().trimmed()), last = textOneLine(_last.getLastText().trimmed());
|
QString first = textOneLine(_first.getLastText().trimmed()), last = textOneLine(_last.getLastText().trimmed());
|
||||||
if (err == "NAME_NOT_MODIFIED") {
|
if (err == "NAME_NOT_MODIFIED") {
|
||||||
App::self()->setName(first, last, QString(), textOneLine(App::self()->username));
|
App::self()->setName(first, last, QString(), textOneLine(App::self()->username));
|
||||||
emit closed();
|
onClose();
|
||||||
return true;
|
return true;
|
||||||
} else if (err == "FIRSTNAME_INVALID") {
|
} else if (err == "FIRSTNAME_INVALID") {
|
||||||
_first.setFocus();
|
_first.setFocus();
|
||||||
|
@ -1139,7 +1101,7 @@ bool EditNameTitleBox::onSaveChatFail(const RPCError &error) {
|
||||||
if (auto chatData = _peer->asChat()) {
|
if (auto chatData = _peer->asChat()) {
|
||||||
chatData->setName(_sentName);
|
chatData->setName(_sentName);
|
||||||
}
|
}
|
||||||
emit closed();
|
onClose();
|
||||||
return true;
|
return true;
|
||||||
} else if (err == qstr("NO_CHAT_TITLE")) {
|
} else if (err == qstr("NO_CHAT_TITLE")) {
|
||||||
_first.setFocus();
|
_first.setFocus();
|
||||||
|
@ -1152,7 +1114,7 @@ bool EditNameTitleBox::onSaveChatFail(const RPCError &error) {
|
||||||
|
|
||||||
void EditNameTitleBox::onSaveChatDone(const MTPUpdates &updates) {
|
void EditNameTitleBox::onSaveChatDone(const MTPUpdates &updates) {
|
||||||
App::main()->sentUpdatesReceived(updates);
|
App::main()->sentUpdatesReceived(updates);
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
EditChannelBox::EditChannelBox(ChannelData *channel) : AbstractBox()
|
EditChannelBox::EditChannelBox(ChannelData *channel) : AbstractBox()
|
||||||
|
@ -1188,15 +1150,6 @@ EditChannelBox::EditChannelBox(ChannelData *channel) : AbstractBox()
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditChannelBox::hideAll() {
|
|
||||||
_title.hide();
|
|
||||||
_description.hide();
|
|
||||||
_sign.hide();
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_publicLink.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditChannelBox::showAll() {
|
void EditChannelBox::showAll() {
|
||||||
_title.show();
|
_title.show();
|
||||||
_description.show();
|
_description.show();
|
||||||
|
@ -1214,7 +1167,7 @@ void EditChannelBox::showAll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditChannelBox::showDone() {
|
void EditChannelBox::doSetInnerFocus() {
|
||||||
_title.setFocus();
|
_title.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,30 +26,22 @@ class AddContactBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AddContactBox(QString fname = QString(), QString lname = QString(), QString phone = QString());
|
AddContactBox(QString fname = QString(), QString lname = QString(), QString phone = QString());
|
||||||
AddContactBox(UserData *user);
|
AddContactBox(UserData *user);
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
_first.setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSubmit();
|
void onSubmit();
|
||||||
void onSave();
|
void onSave();
|
||||||
void onRetry();
|
void onRetry();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void onImportDone(const MTPcontacts_ImportedContacts &res);
|
void onImportDone(const MTPcontacts_ImportedContacts &res);
|
||||||
|
|
||||||
void onSaveUserDone(const MTPcontacts_ImportedContacts &res);
|
void onSaveUserDone(const MTPcontacts_ImportedContacts &res);
|
||||||
|
@ -76,24 +68,19 @@ class NewGroupBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
NewGroupBox();
|
NewGroupBox();
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onNext();
|
void onNext();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Radiobutton _group, _channel;
|
Radiobutton _group, _channel;
|
||||||
int32 _aboutGroupWidth, _aboutGroupHeight;
|
int32 _aboutGroupWidth, _aboutGroupHeight;
|
||||||
Text _aboutGroup, _aboutChannel;
|
Text _aboutGroup, _aboutChannel;
|
||||||
|
@ -105,20 +92,9 @@ class GroupInfoBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
GroupInfoBox(CreatingGroupType creating, bool fromTypeChoose);
|
GroupInfoBox(CreatingGroupType creating, bool fromTypeChoose);
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
_title.setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onPhoto();
|
void onPhoto();
|
||||||
void onPhotoReady(const QImage &img);
|
void onPhotoReady(const QImage &img);
|
||||||
|
|
||||||
|
@ -127,13 +103,16 @@ public slots:
|
||||||
void onDescriptionResized();
|
void onDescriptionResized();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void step_photoOver(float64 ms, bool timer);
|
void step_photoOver(float64 ms, bool timer);
|
||||||
|
|
||||||
QRect photoRect() const;
|
QRect photoRect() const;
|
||||||
|
@ -160,33 +139,16 @@ private:
|
||||||
void creationDone(const MTPUpdates &updates);
|
void creationDone(const MTPUpdates &updates);
|
||||||
bool creationFail(const RPCError &e);
|
bool creationFail(const RPCError &e);
|
||||||
void exportDone(const MTPExportedChatInvite &result);
|
void exportDone(const MTPExportedChatInvite &result);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SetupChannelBox : public AbstractBox, public RPCSender {
|
class SetupChannelBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SetupChannelBox(ChannelData *channel, bool existing = false);
|
SetupChannelBox(ChannelData *channel, bool existing = false);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
|
|
||||||
void closePressed();
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
if (_link.isHidden()) {
|
|
||||||
setFocus();
|
|
||||||
} else {
|
|
||||||
_link.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSave();
|
void onSave();
|
||||||
void onChange();
|
void onChange();
|
||||||
void onCheck();
|
void onCheck();
|
||||||
|
@ -194,13 +156,18 @@ public slots:
|
||||||
void onPrivacyChange();
|
void onPrivacyChange();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void closePressed() override;
|
||||||
void showAll();
|
void showAll() override;
|
||||||
void showDone();
|
void doSetInnerFocus() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateSelected(const QPoint &cursorGlobalPosition);
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||||
void step_goodFade(float64 ms, bool timer);
|
void step_goodFade(float64 ms, bool timer);
|
||||||
|
|
||||||
|
@ -234,34 +201,27 @@ private:
|
||||||
Animation _a_goodFade;
|
Animation _a_goodFade;
|
||||||
|
|
||||||
QTimer _checkTimer;
|
QTimer _checkTimer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditNameTitleBox : public AbstractBox, public RPCSender {
|
class EditNameTitleBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EditNameTitleBox(PeerData *peer);
|
EditNameTitleBox(PeerData *peer);
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
_first.setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSave();
|
void onSave();
|
||||||
void onSubmit();
|
void onSubmit();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void onSaveSelfDone(const MTPUser &user);
|
void onSaveSelfDone(const MTPUser &user);
|
||||||
bool onSaveSelfFail(const RPCError &error);
|
bool onSaveSelfFail(const RPCError &error);
|
||||||
|
|
||||||
|
@ -278,26 +238,16 @@ private:
|
||||||
|
|
||||||
mtpRequestId _requestId;
|
mtpRequestId _requestId;
|
||||||
QString _sentName;
|
QString _sentName;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditChannelBox : public AbstractBox, public RPCSender {
|
class EditChannelBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EditChannelBox(ChannelData *channel);
|
EditChannelBox(ChannelData *channel);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
if (!_description.hasFocus()) {
|
|
||||||
_title.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void peerUpdated(PeerData *peer);
|
void peerUpdated(PeerData *peer);
|
||||||
|
|
||||||
void onSave();
|
void onSave();
|
||||||
|
@ -305,13 +255,14 @@ public slots:
|
||||||
void onPublicLink();
|
void onPublicLink();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateMaxHeight();
|
void updateMaxHeight();
|
||||||
|
|
||||||
void onSaveTitleDone(const MTPUpdates &updates);
|
void onSaveTitleDone(const MTPUpdates &updates);
|
||||||
|
@ -333,4 +284,5 @@ private:
|
||||||
|
|
||||||
mtpRequestId _saveTitleRequestId, _saveDescriptionRequestId, _saveSignRequestId;
|
mtpRequestId _saveTitleRequestId, _saveDescriptionRequestId, _saveSignRequestId;
|
||||||
QString _sentTitle, _sentDescription;
|
QString _sentTitle, _sentDescription;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,13 +53,6 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoLockBox::hideAll() {
|
|
||||||
_close.hide();
|
|
||||||
for (int32 i = 0, l = _options.size(); i < l; ++i) {
|
|
||||||
_options[i]->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AutoLockBox::showAll() {
|
void AutoLockBox::showAll() {
|
||||||
_close.show();
|
_close.show();
|
||||||
for (int32 i = 0, l = _options.size(); i < l; ++i) {
|
for (int32 i = 0, l = _options.size(); i < l; ++i) {
|
||||||
|
@ -87,9 +80,3 @@ void AutoLockBox::onChange() {
|
||||||
App::wnd()->checkAutoLock();
|
App::wnd()->checkAutoLock();
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoLockBox::~AutoLockBox() {
|
|
||||||
for (int32 i = 0, l = _options.size(); i < l; ++i) {
|
|
||||||
delete _options[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,22 +26,18 @@ class AutoLockBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AutoLockBox();
|
AutoLockBox();
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
~AutoLockBox();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onChange();
|
void onChange();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QVector<Radiobutton*> _options;
|
QVector<Radiobutton*> _options;
|
||||||
BoxButton _close;
|
BoxButton _close;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,9 +172,6 @@ void BackgroundInner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BackgroundInner::~BackgroundInner() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void BackgroundInner::resizeEvent(QResizeEvent *e) {
|
void BackgroundInner::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,5 +198,5 @@ void BackgroundBox::onBackgroundChosen(int index) {
|
||||||
if (App::main()) App::main()->setChatBackground(paper);
|
if (App::main()) App::main()->setChatBackground(paper);
|
||||||
if (App::settings()) App::settings()->needBackgroundUpdate(!paper.id);
|
if (App::settings()) App::settings()->needBackgroundUpdate(!paper.id);
|
||||||
}
|
}
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,23 +26,19 @@ class BackgroundInner : public QWidget, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BackgroundInner();
|
BackgroundInner();
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void mouseReleaseEvent(QMouseEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
~BackgroundInner();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void backgroundChosen(int index);
|
void backgroundChosen(int index);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
void gotWallpapers(const MTPVector<MTPWallPaper> &result);
|
void gotWallpapers(const MTPVector<MTPWallPaper> &result);
|
||||||
void updateWallpapers();
|
void updateWallpapers();
|
||||||
|
|
||||||
|
@ -55,16 +51,15 @@ class BackgroundBox : public ItemListBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BackgroundBox();
|
BackgroundBox();
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onBackgroundChosen(int index);
|
void onBackgroundChosen(int index);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
BackgroundInner _inner;
|
BackgroundInner _inner;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -86,7 +86,7 @@ void ConfirmBox::mousePressEvent(QMouseEvent *e) {
|
||||||
_lastMousePos = e->globalPos();
|
_lastMousePos = e->globalPos();
|
||||||
updateHover();
|
updateHover();
|
||||||
ClickHandler::pressed();
|
ClickHandler::pressed();
|
||||||
return LayeredWidget::mousePressEvent(e);
|
return LayerWidget::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmBox::mouseReleaseEvent(QMouseEvent *e) {
|
void ConfirmBox::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
|
@ -130,11 +130,6 @@ void ConfirmBox::closePressed() {
|
||||||
emit cancelled();
|
emit cancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmBox::hideAll() {
|
|
||||||
_confirm.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfirmBox::showAll() {
|
void ConfirmBox::showAll() {
|
||||||
if (_informative) {
|
if (_informative) {
|
||||||
_confirm.show();
|
_confirm.show();
|
||||||
|
@ -246,10 +241,6 @@ void MaxInviteBox::step_good(float64 ms, bool timer) {
|
||||||
if (timer) update();
|
if (timer) update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaxInviteBox::hideAll() {
|
|
||||||
_close.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaxInviteBox::showAll() {
|
void MaxInviteBox::showAll() {
|
||||||
_close.show();
|
_close.show();
|
||||||
}
|
}
|
||||||
|
@ -342,11 +333,6 @@ bool ConvertToSupergroupBox::convertFail(const RPCError &error) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvertToSupergroupBox::hideAll() {
|
|
||||||
_convert.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConvertToSupergroupBox::showAll() {
|
void ConvertToSupergroupBox::showAll() {
|
||||||
_convert.show();
|
_convert.show();
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
|
@ -417,13 +403,6 @@ void PinMessageBox::showAll() {
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PinMessageBox::hideAll() {
|
|
||||||
_text.hide();
|
|
||||||
_notify.hide();
|
|
||||||
_pin.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PinMessageBox::pinDone(const MTPUpdates &updates) {
|
void PinMessageBox::pinDone(const MTPUpdates &updates) {
|
||||||
if (App::main()) {
|
if (App::main()) {
|
||||||
App::main()->sentUpdatesReceived(updates);
|
App::main()->sentUpdatesReceived(updates);
|
||||||
|
@ -497,15 +476,6 @@ void RichDeleteMessageBox::showAll() {
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RichDeleteMessageBox::hideAll() {
|
|
||||||
_text.hide();
|
|
||||||
_banUser.hide();
|
|
||||||
_reportSpam.hide();
|
|
||||||
_deleteAll.hide();
|
|
||||||
_delete.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
KickMemberBox::KickMemberBox(PeerData *chat, UserData *member)
|
KickMemberBox::KickMemberBox(PeerData *chat, UserData *member)
|
||||||
: ConfirmBox(lng_profile_sure_kick(lt_user, member->firstName), lang(lng_box_remove))
|
: ConfirmBox(lng_profile_sure_kick(lt_user, member->firstName), lang(lng_box_remove))
|
||||||
, _chat(chat)
|
, _chat(chat)
|
||||||
|
@ -600,7 +570,3 @@ void ConfirmInviteBox::paintEvent(QPaintEvent *e) {
|
||||||
void ConfirmInviteBox::showAll() {
|
void ConfirmInviteBox::showAll() {
|
||||||
showChildren();
|
showChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfirmInviteBox::hideAll() {
|
|
||||||
hideChildren();
|
|
||||||
}
|
|
||||||
|
|
|
@ -28,39 +28,35 @@ class ConfirmBox : public AbstractBox, public ClickHandlerHost {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ConfirmBox(const QString &text, const QString &doneText = QString(), const style::RoundButton &doneStyle = st::defaultBoxButton, const QString &cancelText = QString(), const style::RoundButton &cancelStyle = st::cancelBoxButton);
|
ConfirmBox(const QString &text, const QString &doneText = QString(), const style::RoundButton &doneStyle = st::defaultBoxButton, const QString &cancelText = QString(), const style::RoundButton &cancelStyle = st::cancelBoxButton);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void mouseReleaseEvent(QMouseEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
void updateLink();
|
void updateLink();
|
||||||
|
|
||||||
// ClickHandlerHost interface
|
// ClickHandlerHost interface
|
||||||
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active);
|
void clickHandlerActiveChanged(const ClickHandlerPtr &p, bool active) override;
|
||||||
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed);
|
void clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed) override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onCancel();
|
void onCancel();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void confirmed();
|
void confirmed();
|
||||||
void cancelled();
|
void cancelled();
|
||||||
void cancelPressed();
|
void cancelPressed();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
|
||||||
void closePressed();
|
void closePressed() override;
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ConfirmBox(const QString &text, const QString &doneText, const style::RoundButton &doneStyle, bool informative);
|
ConfirmBox(const QString &text, const QString &doneText, const style::RoundButton &doneStyle, bool informative);
|
||||||
friend class InformBox;
|
friend class InformBox;
|
||||||
|
|
||||||
|
@ -76,12 +72,14 @@ private:
|
||||||
QPoint _lastMousePos;
|
QPoint _lastMousePos;
|
||||||
|
|
||||||
BoxButton _confirm, _cancel;
|
BoxButton _confirm, _cancel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class InformBox : public ConfirmBox {
|
class InformBox : public ConfirmBox {
|
||||||
public:
|
public:
|
||||||
InformBox(const QString &text, const QString &doneText = QString(), const style::RoundButton &doneStyle = st::defaultBoxButton) : ConfirmBox(text, doneText, doneStyle, true) {
|
InformBox(const QString &text, const QString &doneText = QString(), const style::RoundButton &doneStyle = st::defaultBoxButton) : ConfirmBox(text, doneText, doneStyle, true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SharePhoneConfirmBox : public ConfirmBox {
|
class SharePhoneConfirmBox : public ConfirmBox {
|
||||||
|
@ -105,15 +103,12 @@ class ConfirmLinkBox : public ConfirmBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ConfirmLinkBox(const QString &url);
|
ConfirmLinkBox(const QString &url);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onOpenLink();
|
void onOpenLink();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QString _url;
|
QString _url;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -122,21 +117,18 @@ class MaxInviteBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MaxInviteBox(const QString &link);
|
MaxInviteBox(const QString &link);
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateSelected(const QPoint &cursorGlobalPosition);
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||||
void step_good(float64 ms, bool timer);
|
void step_good(float64 ms, bool timer);
|
||||||
|
|
||||||
|
@ -153,29 +145,26 @@ private:
|
||||||
QString _goodTextLink;
|
QString _goodTextLink;
|
||||||
anim::fvalue a_goodOpacity;
|
anim::fvalue a_goodOpacity;
|
||||||
Animation _a_good;
|
Animation _a_good;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConvertToSupergroupBox : public AbstractBox, public RPCSender {
|
class ConvertToSupergroupBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ConvertToSupergroupBox(ChatData *chat);
|
ConvertToSupergroupBox(ChatData *chat);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onConvert();
|
void onConvert();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void convertDone(const MTPUpdates &updates);
|
void convertDone(const MTPUpdates &updates);
|
||||||
bool convertFail(const RPCError &error);
|
bool convertFail(const RPCError &error);
|
||||||
|
|
||||||
|
@ -184,28 +173,24 @@ private:
|
||||||
int32 _textWidth, _textHeight;
|
int32 _textWidth, _textHeight;
|
||||||
|
|
||||||
BoxButton _convert, _cancel;
|
BoxButton _convert, _cancel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PinMessageBox : public AbstractBox, public RPCSender {
|
class PinMessageBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PinMessageBox(ChannelData *channel, MsgId msgId);
|
PinMessageBox(ChannelData *channel, MsgId msgId);
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onPin();
|
void onPin();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void showAll();
|
void showAll() override;
|
||||||
void hideAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void pinDone(const MTPUpdates &updates);
|
void pinDone(const MTPUpdates &updates);
|
||||||
bool pinFail(const RPCError &error);
|
bool pinFail(const RPCError &error);
|
||||||
|
|
||||||
|
@ -225,22 +210,17 @@ class RichDeleteMessageBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RichDeleteMessageBox(ChannelData *channel, UserData *from, MsgId msgId);
|
RichDeleteMessageBox(ChannelData *channel, UserData *from, MsgId msgId);
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onDelete();
|
void onDelete();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void showAll();
|
void showAll() override;
|
||||||
void hideAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ChannelData *_channel;
|
ChannelData *_channel;
|
||||||
UserData *_from;
|
UserData *_from;
|
||||||
MsgId _msgId;
|
MsgId _msgId;
|
||||||
|
@ -278,7 +258,6 @@ protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
void showAll() override;
|
void showAll() override;
|
||||||
void hideAll() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChildWidget<FlatLabel> _title, _status;
|
ChildWidget<FlatLabel> _title, _status;
|
||||||
|
|
|
@ -40,13 +40,10 @@ private slots:
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void hideAll() override {
|
|
||||||
hideChildren();
|
|
||||||
}
|
|
||||||
void showAll() override {
|
void showAll() override {
|
||||||
showChildren();
|
showChildren();
|
||||||
}
|
}
|
||||||
void showDone() override {
|
void doSetInnerFocus() override {
|
||||||
_code->setFocus();
|
_code->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,21 +54,6 @@ ConnectionBox::ConnectionBox() : AbstractBox(st::boxWidth)
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionBox::hideAll() {
|
|
||||||
_autoRadio.hide();
|
|
||||||
_httpProxyRadio.hide();
|
|
||||||
_tcpProxyRadio.hide();
|
|
||||||
_tryIPv6.hide();
|
|
||||||
|
|
||||||
_hostInput.hide();
|
|
||||||
_portInput.hide();
|
|
||||||
_userInput.hide();
|
|
||||||
_passwordInput.hide();
|
|
||||||
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionBox::showAll() {
|
void ConnectionBox::showAll() {
|
||||||
_autoRadio.show();
|
_autoRadio.show();
|
||||||
_httpProxyRadio.show();
|
_httpProxyRadio.show();
|
||||||
|
@ -96,7 +81,7 @@ void ConnectionBox::showAll() {
|
||||||
resizeEvent(0);
|
resizeEvent(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionBox::showDone() {
|
void ConnectionBox::doSetInnerFocus() {
|
||||||
if (!_hostInput.isHidden()) {
|
if (!_hostInput.isHidden()) {
|
||||||
_hostInput.setFocus();
|
_hostInput.setFocus();
|
||||||
}
|
}
|
||||||
|
@ -218,7 +203,7 @@ void ConnectionBox::onSave() {
|
||||||
MTP::restart();
|
MTP::restart();
|
||||||
reinitImageLinkManager();
|
reinitImageLinkManager();
|
||||||
reinitWebLoadManager();
|
reinitWebLoadManager();
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,19 +227,6 @@ AutoDownloadBox::AutoDownloadBox() : AbstractBox(st::boxWidth)
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoDownloadBox::hideAll() {
|
|
||||||
_photoPrivate.hide();
|
|
||||||
_photoGroups.hide();
|
|
||||||
_audioPrivate.hide();
|
|
||||||
_audioGroups.hide();
|
|
||||||
_gifPrivate.hide();
|
|
||||||
_gifGroups.hide();
|
|
||||||
_gifPlay.hide();
|
|
||||||
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AutoDownloadBox::showAll() {
|
void AutoDownloadBox::showAll() {
|
||||||
_photoPrivate.show();
|
_photoPrivate.show();
|
||||||
_photoGroups.show();
|
_photoGroups.show();
|
||||||
|
|
|
@ -26,25 +26,21 @@ class ConnectionBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ConnectionBox();
|
ConnectionBox();
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onChange();
|
void onChange();
|
||||||
void onSubmit();
|
void onSubmit();
|
||||||
void onSave();
|
void onSave();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
InputField _hostInput;
|
InputField _hostInput;
|
||||||
PortInput _portInput;
|
PortInput _portInput;
|
||||||
InputField _userInput;
|
InputField _userInput;
|
||||||
|
@ -53,28 +49,25 @@ private:
|
||||||
Checkbox _tryIPv6;
|
Checkbox _tryIPv6;
|
||||||
|
|
||||||
BoxButton _save, _cancel;
|
BoxButton _save, _cancel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AutoDownloadBox : public AbstractBox {
|
class AutoDownloadBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AutoDownloadBox();
|
AutoDownloadBox();
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSave();
|
void onSave();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Checkbox _photoPrivate, _photoGroups;
|
Checkbox _photoPrivate, _photoGroups;
|
||||||
Checkbox _audioPrivate, _audioGroups;
|
Checkbox _audioPrivate, _audioGroups;
|
||||||
Checkbox _gifPrivate, _gifGroups, _gifPlay;
|
Checkbox _gifPrivate, _gifGroups, _gifPlay;
|
||||||
|
@ -82,4 +75,5 @@ private:
|
||||||
int32 _sectionHeight;
|
int32 _sectionHeight;
|
||||||
|
|
||||||
BoxButton _save, _cancel;
|
BoxButton _save, _cancel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1439,16 +1439,6 @@ bool ContactsBox::peopleFailed(const RPCError &error, mtpRequestId req) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactsBox::hideAll() {
|
|
||||||
_filter.hide();
|
|
||||||
_filterCancel.hide();
|
|
||||||
_next.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_topShadow.hide();
|
|
||||||
if (_bottomShadow) _bottomShadow->hide();
|
|
||||||
ItemListBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContactsBox::showAll() {
|
void ContactsBox::showAll() {
|
||||||
_filter.show();
|
_filter.show();
|
||||||
if (_filter.getLastText().isEmpty()) {
|
if (_filter.getLastText().isEmpty()) {
|
||||||
|
@ -1474,7 +1464,7 @@ void ContactsBox::showAll() {
|
||||||
ItemListBox::showAll();
|
ItemListBox::showAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactsBox::showDone() {
|
void ContactsBox::doSetInnerFocus() {
|
||||||
_filter.setFocus();
|
_filter.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1725,7 +1715,7 @@ bool ContactsBox::creationFail(const RPCError &error) {
|
||||||
|
|
||||||
_saveRequestId = 0;
|
_saveRequestId = 0;
|
||||||
if (error.type() == "NO_CHAT_TITLE") {
|
if (error.type() == "NO_CHAT_TITLE") {
|
||||||
emit closed();
|
onClose();
|
||||||
return true;
|
return true;
|
||||||
} else if (error.type() == "USERS_TOO_FEW") {
|
} else if (error.type() == "USERS_TOO_FEW") {
|
||||||
_filter.setFocus();
|
_filter.setFocus();
|
||||||
|
@ -2317,8 +2307,3 @@ void MembersBox::onAdminAdded() {
|
||||||
_addBox = 0;
|
_addBox = 0;
|
||||||
_loadTimer.start(ReloadChannelMembersTimeout);
|
_loadTimer.start(ReloadChannelMembersTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MembersBox::showDone() {
|
|
||||||
_inner.clearSel();
|
|
||||||
setFocus();
|
|
||||||
}
|
|
||||||
|
|
|
@ -40,11 +40,9 @@ class ContactsInner : public TWidget, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct ContactData;
|
struct ContactData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ContactsInner(CreatingGroupType creating = CreatingGroupNone);
|
ContactsInner(CreatingGroupType creating = CreatingGroupNone);
|
||||||
ContactsInner(ChannelData *channel, MembersFilter membersFilter, const MembersAlreadyIn &already);
|
ContactsInner(ChannelData *channel, MembersFilter membersFilter, const MembersAlreadyIn &already);
|
||||||
ContactsInner(ChatData *chat, MembersFilter membersFilter);
|
ContactsInner(ChatData *chat, MembersFilter membersFilter);
|
||||||
|
@ -52,13 +50,6 @@ public:
|
||||||
void init();
|
void init();
|
||||||
void initList();
|
void initList();
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void enterEvent(QEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void paintDialog(Painter &p, PeerData *peer, ContactData *data, bool sel);
|
void paintDialog(Painter &p, PeerData *peer, ContactData *data, bool sel);
|
||||||
void updateFilter(QString filter = QString());
|
void updateFilter(QString filter = QString());
|
||||||
|
|
||||||
|
@ -97,7 +88,6 @@ public:
|
||||||
~ContactsInner();
|
~ContactsInner();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void mustScrollTo(int ymin, int ymax);
|
void mustScrollTo(int ymin, int ymax);
|
||||||
void selectAllQuery();
|
void selectAllQuery();
|
||||||
void searchByUsername();
|
void searchByUsername();
|
||||||
|
@ -106,7 +96,6 @@ signals:
|
||||||
void addRequested();
|
void addRequested();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onDialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow);
|
void onDialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow);
|
||||||
|
|
||||||
void updateSel();
|
void updateSel();
|
||||||
|
@ -119,8 +108,15 @@ public slots:
|
||||||
|
|
||||||
void onAllAdminsChanged();
|
void onAllAdminsChanged();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void enterEvent(QEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
void updateSelectedRow();
|
void updateSelectedRow();
|
||||||
void addAdminDone(const MTPUpdates &result, mtpRequestId req);
|
void addAdminDone(const MTPUpdates &result, mtpRequestId req);
|
||||||
bool addAdminFail(const RPCError &error, mtpRequestId req);
|
bool addAdminFail(const RPCError &error, mtpRequestId req);
|
||||||
|
@ -193,29 +189,17 @@ class ContactsBox : public ItemListBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ContactsBox();
|
ContactsBox();
|
||||||
ContactsBox(const QString &name, const QImage &photo); // group creation
|
ContactsBox(const QString &name, const QImage &photo); // group creation
|
||||||
ContactsBox(ChannelData *channel); // channel setup
|
ContactsBox(ChannelData *channel); // channel setup
|
||||||
ContactsBox(ChannelData *channel, MembersFilter filter, const MembersAlreadyIn &already);
|
ContactsBox(ChannelData *channel, MembersFilter filter, const MembersAlreadyIn &already);
|
||||||
ContactsBox(ChatData *chat, MembersFilter filter);
|
ContactsBox(ChatData *chat, MembersFilter filter);
|
||||||
ContactsBox(UserData *bot);
|
ContactsBox(UserData *bot);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void closePressed();
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
_filter.setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void adminAdded();
|
void adminAdded();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onFilterUpdate();
|
void onFilterUpdate();
|
||||||
void onFilterCancel();
|
void onFilterCancel();
|
||||||
void onChosenChanged();
|
void onChosenChanged();
|
||||||
|
@ -231,13 +215,15 @@ public slots:
|
||||||
void onNeedSearchByUsername();
|
void onNeedSearchByUsername();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void closePressed() override;
|
||||||
void showAll();
|
void showAll() override;
|
||||||
void showDone();
|
void doSetInnerFocus() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
ContactsInner _inner;
|
ContactsInner _inner;
|
||||||
|
@ -280,26 +266,18 @@ private:
|
||||||
|
|
||||||
void creationDone(const MTPUpdates &updates);
|
void creationDone(const MTPUpdates &updates);
|
||||||
bool creationFail(const RPCError &e);
|
bool creationFail(const RPCError &e);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MembersInner : public TWidget, public RPCSender {
|
class MembersInner : public TWidget, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct MemberData;
|
struct MemberData;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MembersInner(ChannelData *channel, MembersFilter filter);
|
MembersInner(ChannelData *channel, MembersFilter filter);
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void enterEvent(QEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void mouseReleaseEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
void paintDialog(Painter &p, PeerData *peer, MemberData *data, bool sel, bool kickSel, bool kickDown);
|
void paintDialog(Painter &p, PeerData *peer, MemberData *data, bool sel, bool kickSel, bool kickDown);
|
||||||
|
|
||||||
void selectSkip(int32 dir);
|
void selectSkip(int32 dir);
|
||||||
|
@ -323,13 +301,11 @@ public:
|
||||||
~MembersInner();
|
~MembersInner();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void mustScrollTo(int ymin, int ymax);
|
void mustScrollTo(int ymin, int ymax);
|
||||||
void addRequested();
|
void addRequested();
|
||||||
void loaded();
|
void loaded();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
void updateSel();
|
void updateSel();
|
||||||
|
@ -338,8 +314,15 @@ public slots:
|
||||||
void onKickConfirm();
|
void onKickConfirm();
|
||||||
void onKickBoxDestroyed(QObject *obj);
|
void onKickBoxDestroyed(QObject *obj);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void enterEvent(QEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
void updateSelectedRow();
|
void updateSelectedRow();
|
||||||
MemberData *data(int32 index);
|
MemberData *data(int32 index);
|
||||||
|
|
||||||
|
@ -409,32 +392,24 @@ class MembersBox : public ItemListBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MembersBox(ChannelData *channel, MembersFilter filter);
|
MembersBox(ChannelData *channel, MembersFilter filter);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onScroll();
|
void onScroll();
|
||||||
|
|
||||||
void onAdd();
|
void onAdd();
|
||||||
void onAdminAdded();
|
void onAdminAdded();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
void showDone();
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
MembersInner _inner;
|
MembersInner _inner;
|
||||||
|
|
||||||
ContactsBox *_addBox;
|
ContactsBox *_addBox;
|
||||||
|
|
||||||
SingleTimer _loadTimer;
|
SingleTimer _loadTimer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,17 +51,6 @@ DownloadPathBox::DownloadPathBox() : AbstractBox()
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadPathBox::hideAll() {
|
|
||||||
_default.hide();
|
|
||||||
_temp.hide();
|
|
||||||
_dir.hide();
|
|
||||||
|
|
||||||
_pathLink.hide();
|
|
||||||
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DownloadPathBox::showAll() {
|
void DownloadPathBox::showAll() {
|
||||||
_default.show();
|
_default.show();
|
||||||
_temp.show();
|
_temp.show();
|
||||||
|
@ -79,7 +68,7 @@ void DownloadPathBox::showAll() {
|
||||||
int32 h = st::boxTitleHeight + st::boxOptionListPadding.top() + _default.height() + st::boxOptionListPadding.top() + _temp.height() + st::boxOptionListPadding.top() + _dir.height();
|
int32 h = st::boxTitleHeight + st::boxOptionListPadding.top() + _default.height() + st::boxOptionListPadding.top() + _temp.height() + st::boxOptionListPadding.top() + _dir.height();
|
||||||
if (_dir.checked()) h += st::downloadPathSkip + _pathLink.height();
|
if (_dir.checked()) h += st::downloadPathSkip + _pathLink.height();
|
||||||
h += st::boxOptionListPadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom();
|
h += st::boxOptionListPadding.bottom() + st::boxButtonPadding.top() + _save.height() + st::boxButtonPadding.bottom();
|
||||||
|
|
||||||
setMaxHeight(h);
|
setMaxHeight(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +132,7 @@ void DownloadPathBox::onSave() {
|
||||||
cSetDownloadPath(_default.checked() ? QString() : (_temp.checked() ? qsl("tmp") : _path));
|
cSetDownloadPath(_default.checked() ? QString() : (_temp.checked() ? qsl("tmp") : _path));
|
||||||
cSetDownloadPathBookmark((_default.checked() || _temp.checked()) ? QByteArray() : _pathBookmark);
|
cSetDownloadPathBookmark((_default.checked() || _temp.checked()) ? QByteArray() : _pathBookmark);
|
||||||
Local::writeUserSettings();
|
Local::writeUserSettings();
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadPathBox::setPathText(const QString &text) {
|
void DownloadPathBox::setPathText(const QString &text) {
|
||||||
|
|
|
@ -26,24 +26,20 @@ class DownloadPathBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DownloadPathBox();
|
DownloadPathBox();
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onChange();
|
void onChange();
|
||||||
void onEditPath();
|
void onEditPath();
|
||||||
void onSave();
|
void onSave();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void setPathText(const QString &text);
|
void setPathText(const QString &text);
|
||||||
|
|
||||||
QString _path;
|
QString _path;
|
||||||
|
@ -52,4 +48,5 @@ private:
|
||||||
Radiobutton _default, _temp, _dir;
|
Radiobutton _default, _temp, _dir;
|
||||||
LinkButton _pathLink;
|
LinkButton _pathLink;
|
||||||
BoxButton _save, _cancel;
|
BoxButton _save, _cancel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,13 +26,13 @@ class EmojiBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EmojiBox();
|
EmojiBox();
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void fillBlocks();
|
void fillBlocks();
|
||||||
|
|
||||||
int32 _esize;
|
int32 _esize;
|
||||||
|
@ -47,4 +47,5 @@ private:
|
||||||
typedef QVector<Block> BlockRow;
|
typedef QVector<Block> BlockRow;
|
||||||
typedef QVector<BlockRow> Blocks;
|
typedef QVector<BlockRow> Blocks;
|
||||||
Blocks _blocks;
|
Blocks _blocks;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,13 +65,6 @@ _close(this, lang(lng_box_ok), st::defaultBoxButton) {
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LanguageBox::hideAll() {
|
|
||||||
_close.hide();
|
|
||||||
for (int32 i = 0, l = _langs.size(); i < l; ++i) {
|
|
||||||
_langs[i]->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LanguageBox::showAll() {
|
void LanguageBox::showAll() {
|
||||||
_close.show();
|
_close.show();
|
||||||
for (int32 i = 0, l = _langs.size(); i < l; ++i) {
|
for (int32 i = 0, l = _langs.size(); i < l; ++i) {
|
||||||
|
@ -123,7 +116,7 @@ void LanguageBox::onChange() {
|
||||||
cancel = result.value(lng_cancel, langOriginal(lng_cancel));
|
cancel = result.value(lng_cancel, langOriginal(lng_cancel));
|
||||||
ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel);
|
ConfirmBox *box = new ConfirmBox(text, save, st::defaultBoxButton, cancel);
|
||||||
connect(box, SIGNAL(confirmed()), this, SLOT(onSave()));
|
connect(box, SIGNAL(confirmed()), this, SLOT(onSave()));
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(onRestore()));
|
connect(box, SIGNAL(cancelled()), this, SLOT(onRestore()));
|
||||||
Ui::showLayer(box, KeepOtherLayers);
|
Ui::showLayer(box, KeepOtherLayers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,9 +141,3 @@ void LanguageBox::onSave() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LanguageBox::~LanguageBox() {
|
|
||||||
for (int32 i = 0, l = _langs.size(); i < l; ++i) {
|
|
||||||
delete _langs[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -26,25 +26,21 @@ class LanguageBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LanguageBox();
|
LanguageBox();
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
~LanguageBox();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onChange();
|
void onChange();
|
||||||
void onRestore();
|
void onRestore();
|
||||||
void onSave();
|
void onSave();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QVector<Radiobutton*> _langs;
|
QVector<Radiobutton*> _langs;
|
||||||
BoxButton _close;
|
BoxButton _close;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -116,18 +116,6 @@ void PasscodeBox::init() {
|
||||||
connect(&_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
|
connect(&_recover, SIGNAL(clicked()), this, SLOT(onRecoverByEmail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasscodeBox::hideAll() {
|
|
||||||
_oldPasscode.hide();
|
|
||||||
_newPasscode.hide();
|
|
||||||
_reenterPasscode.hide();
|
|
||||||
_passwordHint.hide();
|
|
||||||
_recoverEmail.hide();
|
|
||||||
_recover.hide();
|
|
||||||
_saveButton.hide();
|
|
||||||
_cancelButton.hide();
|
|
||||||
AbstractBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PasscodeBox::showAll() {
|
void PasscodeBox::showAll() {
|
||||||
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
|
bool has = _cloudPwd ? (!_curSalt.isEmpty()) : cHasPasscode();
|
||||||
if (_turningOff) {
|
if (_turningOff) {
|
||||||
|
@ -265,7 +253,7 @@ void PasscodeBox::resizeEvent(QResizeEvent *e) {
|
||||||
AbstractBox::resizeEvent(e);
|
AbstractBox::resizeEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasscodeBox::showDone() {
|
void PasscodeBox::doSetInnerFocus() {
|
||||||
if (_skipEmailWarning && !_recoverEmail.isHidden()) {
|
if (_skipEmailWarning && !_recoverEmail.isHidden()) {
|
||||||
_recoverEmail.setFocus();
|
_recoverEmail.setFocus();
|
||||||
} else if (_oldPasscode.isHidden()) {
|
} else if (_oldPasscode.isHidden()) {
|
||||||
|
@ -273,7 +261,6 @@ void PasscodeBox::showDone() {
|
||||||
} else {
|
} else {
|
||||||
_oldPasscode.setFocus();
|
_oldPasscode.setFocus();
|
||||||
}
|
}
|
||||||
_skipEmailWarning = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasscodeBox::setPasswordDone(const MTPBool &result) {
|
void PasscodeBox::setPasswordDone(const MTPBool &result) {
|
||||||
|
@ -419,7 +406,7 @@ void PasscodeBox::onSave(bool force) {
|
||||||
Local::setPasscode(pwd.toUtf8());
|
Local::setPasscode(pwd.toUtf8());
|
||||||
App::wnd()->checkAutoLock();
|
App::wnd()->checkAutoLock();
|
||||||
App::wnd()->getTitle()->showUpdateBtn();
|
App::wnd()->getTitle()->showUpdateBtn();
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,13 +510,6 @@ RecoverBox::RecoverBox(const QString &pattern) : AbstractBox(st::boxWidth)
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecoverBox::hideAll() {
|
|
||||||
_recoverCode.hide();
|
|
||||||
_saveButton.hide();
|
|
||||||
_cancelButton.hide();
|
|
||||||
AbstractBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void RecoverBox::showAll() {
|
void RecoverBox::showAll() {
|
||||||
_recoverCode.show();
|
_recoverCode.show();
|
||||||
_saveButton.show();
|
_saveButton.show();
|
||||||
|
@ -564,7 +544,7 @@ void RecoverBox::resizeEvent(QResizeEvent *e) {
|
||||||
AbstractBox::resizeEvent(e);
|
AbstractBox::resizeEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecoverBox::showDone() {
|
void RecoverBox::doSetInnerFocus() {
|
||||||
_recoverCode.setFocus();
|
_recoverCode.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,8 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void hideAll() override;
|
|
||||||
void showAll() override;
|
void showAll() override;
|
||||||
void showDone() override;
|
void doSetInnerFocus() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
@ -68,7 +67,7 @@ private:
|
||||||
mtpRequestId _setRequest;
|
mtpRequestId _setRequest;
|
||||||
|
|
||||||
QByteArray _newSalt, _curSalt;
|
QByteArray _newSalt, _curSalt;
|
||||||
bool _hasRecovery, _skipEmailWarning;
|
bool _hasRecovery, _skipEmailWarning = false;
|
||||||
|
|
||||||
int32 _aboutHeight;
|
int32 _aboutHeight;
|
||||||
|
|
||||||
|
@ -81,35 +80,31 @@ private:
|
||||||
LinkButton _recover;
|
LinkButton _recover;
|
||||||
|
|
||||||
QString _oldError, _newError, _emailError;
|
QString _oldError, _newError, _emailError;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RecoverBox : public AbstractBox, public RPCSender {
|
class RecoverBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RecoverBox(const QString &pattern);
|
RecoverBox(const QString &pattern);
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSubmit();
|
void onSubmit();
|
||||||
void onCodeChanged();
|
void onCodeChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void reloadPassword();
|
void reloadPassword();
|
||||||
void recoveryExpired();
|
void recoveryExpired();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void codeSubmitDone(bool recover, const MTPauth_Authorization &result);
|
void codeSubmitDone(bool recover, const MTPauth_Authorization &result);
|
||||||
bool codeSubmitFail(const RPCError &error);
|
bool codeSubmitFail(const RPCError &error);
|
||||||
|
|
||||||
|
@ -121,4 +116,5 @@ private:
|
||||||
InputField _recoverCode;
|
InputField _recoverCode;
|
||||||
|
|
||||||
QString _error;
|
QString _error;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,7 @@ void PhotoCropBox::init(const QImage &img, PeerData *peer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::mousePressEvent(QMouseEvent *e) {
|
void PhotoCropBox::mousePressEvent(QMouseEvent *e) {
|
||||||
if (e->button() != Qt::LeftButton) return LayeredWidget::mousePressEvent(e);
|
if (e->button() != Qt::LeftButton) return LayerWidget::mousePressEvent(e);
|
||||||
|
|
||||||
_downState = mouseState(e->pos());
|
_downState = mouseState(e->pos());
|
||||||
_fromposx = e->pos().x();
|
_fromposx = e->pos().x();
|
||||||
|
@ -89,7 +89,7 @@ void PhotoCropBox::mousePressEvent(QMouseEvent *e) {
|
||||||
_fromcropy = _cropy;
|
_fromcropy = _cropy;
|
||||||
_fromcropw = _cropw;
|
_fromcropw = _cropw;
|
||||||
|
|
||||||
return LayeredWidget::mousePressEvent(e);
|
return LayerWidget::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 PhotoCropBox::mouseState(QPoint p) {
|
int32 PhotoCropBox::mouseState(QPoint p) {
|
||||||
|
@ -301,11 +301,6 @@ void PhotoCropBox::onReady(const QImage &tosend) {
|
||||||
App::app()->uploadProfilePhoto(tosend, _peerId);
|
App::app()->uploadProfilePhoto(tosend, _peerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoCropBox::hideAll() {
|
|
||||||
_done.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoCropBox::showAll() {
|
void PhotoCropBox::showAll() {
|
||||||
_done.show();
|
_done.show();
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
|
|
|
@ -26,34 +26,29 @@ class PhotoCropBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PhotoCropBox(const QImage &img, const PeerId &peer);
|
PhotoCropBox(const QImage &img, const PeerId &peer);
|
||||||
PhotoCropBox(const QImage &img, PeerData *peer);
|
PhotoCropBox(const QImage &img, PeerData *peer);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void mouseReleaseEvent(QMouseEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
int32 mouseState(QPoint p);
|
int32 mouseState(QPoint p);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSend();
|
void onSend();
|
||||||
void onReady(const QImage &tosend);
|
void onReady(const QImage &tosend);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void ready(const QImage &tosend);
|
void ready(const QImage &tosend);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void init(const QImage &img, PeerData *peer);
|
void init(const QImage &img, PeerData *peer);
|
||||||
|
|
||||||
QString _title;
|
QString _title;
|
||||||
|
|
|
@ -304,13 +304,6 @@ void PhotoSendBox::closePressed() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSendBox::hideAll() {
|
|
||||||
_send.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_caption.hide();
|
|
||||||
_compressed.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PhotoSendBox::showAll() {
|
void PhotoSendBox::showAll() {
|
||||||
_send.show();
|
_send.show();
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
|
@ -325,8 +318,12 @@ void PhotoSendBox::showAll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSendBox::showDone() {
|
void PhotoSendBox::doSetInnerFocus() {
|
||||||
setInnerFocus();
|
if (_caption.isHidden()) {
|
||||||
|
setFocus();
|
||||||
|
} else {
|
||||||
|
_caption.setFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhotoSendBox::onSend(bool ctrlShiftEnter) {
|
void PhotoSendBox::onSend(bool ctrlShiftEnter) {
|
||||||
|
@ -622,20 +619,14 @@ void EditCaptionBox::resizeEvent(QResizeEvent *e) {
|
||||||
_field->moveToLeft(st::boxPhotoPadding.left(), _save.y() - st::boxButtonPadding.top() - st::normalFont->height - _field->height());
|
_field->moveToLeft(st::boxPhotoPadding.left(), _save.y() - st::boxButtonPadding.top() - st::normalFont->height - _field->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditCaptionBox::hideAll() {
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_field->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditCaptionBox::showAll() {
|
void EditCaptionBox::showAll() {
|
||||||
_save.show();
|
_save.show();
|
||||||
_cancel.show();
|
_cancel.show();
|
||||||
_field->show();
|
_field->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditCaptionBox::showDone() {
|
void EditCaptionBox::doSetInnerFocus() {
|
||||||
setInnerFocus();
|
_field->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditCaptionBox::onSave(bool ctrlShiftEnter) {
|
void EditCaptionBox::onSave(bool ctrlShiftEnter) {
|
||||||
|
|
|
@ -27,36 +27,24 @@ class PhotoSendBox : public AbstractBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PhotoSendBox(const FileLoadResultPtr &file);
|
PhotoSendBox(const FileLoadResultPtr &file);
|
||||||
PhotoSendBox(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo);
|
PhotoSendBox(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo);
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
if (_caption.isHidden()) {
|
|
||||||
setFocus();
|
|
||||||
} else {
|
|
||||||
_caption.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onCompressedChange();
|
void onCompressedChange();
|
||||||
void onCaptionResized();
|
void onCaptionResized();
|
||||||
void onSend(bool ctrlShiftEnter = false);
|
void onSend(bool ctrlShiftEnter = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void closePressed();
|
void closePressed() override;
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateBoxSize();
|
void updateBoxSize();
|
||||||
|
|
||||||
FileLoadResultPtr _file;
|
FileLoadResultPtr _file;
|
||||||
|
@ -87,30 +75,22 @@ class EditCaptionBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EditCaptionBox(HistoryItem *msg);
|
EditCaptionBox(HistoryItem *msg);
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
bool captionFound() const;
|
bool captionFound() const;
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
_field->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onCaptionResized();
|
void onCaptionResized();
|
||||||
void onSave(bool ctrlShiftEnter = false);
|
void onSave(bool ctrlShiftEnter = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void updateBoxSize();
|
void updateBoxSize();
|
||||||
|
|
||||||
void saveDone(const MTPUpdates &updates);
|
void saveDone(const MTPUpdates &updates);
|
||||||
|
|
|
@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "styles/style_profile.h"
|
#include "styles/style_profile.h"
|
||||||
#include "boxes/confirmbox.h"
|
#include "boxes/confirmbox.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
ReportBox::ReportBox(ChannelData *channel) : AbstractBox(st::boxWidth)
|
ReportBox::ReportBox(ChannelData *channel) : AbstractBox(st::boxWidth)
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
|
@ -85,10 +86,10 @@ void ReportBox::onChange() {
|
||||||
_reasonOtherText.destroy();
|
_reasonOtherText.destroy();
|
||||||
updateMaxHeight();
|
updateMaxHeight();
|
||||||
}
|
}
|
||||||
setInnerFocus();
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportBox::setInnerFocus() {
|
void ReportBox::doSetInnerFocus() {
|
||||||
if (_reasonOtherText) {
|
if (_reasonOtherText) {
|
||||||
_reasonOtherText->setFocus();
|
_reasonOtherText->setFocus();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,10 +40,7 @@ protected:
|
||||||
void showAll() override {
|
void showAll() override {
|
||||||
showChildren();
|
showChildren();
|
||||||
}
|
}
|
||||||
void hideAll() override {
|
void doSetInnerFocus() override;
|
||||||
hideChildren();
|
|
||||||
}
|
|
||||||
void setInnerFocus() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateMaxHeight();
|
void updateMaxHeight();
|
||||||
|
|
|
@ -220,12 +220,6 @@ void SessionsInner::listUpdated() {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionsInner::~SessionsInner() {
|
|
||||||
for (int32 i = 0, l = _terminateButtons.size(); i < l; ++i) {
|
|
||||||
delete _terminateButtons[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
|
SessionsBox::SessionsBox() : ScrollableBox(st::sessionsScroll)
|
||||||
, _loading(true)
|
, _loading(true)
|
||||||
, _inner(&_list, &_current)
|
, _inner(&_list, &_current)
|
||||||
|
@ -255,11 +249,6 @@ void SessionsBox::resizeEvent(QResizeEvent *e) {
|
||||||
_done.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done.height());
|
_done.moveToRight(st::boxButtonPadding.right(), height() - st::boxButtonPadding.bottom() - _done.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionsBox::hideAll() {
|
|
||||||
_done.hide();
|
|
||||||
ScrollableBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SessionsBox::showAll() {
|
void SessionsBox::showAll() {
|
||||||
_done.show();
|
_done.show();
|
||||||
if (_loading) {
|
if (_loading) {
|
||||||
|
|
|
@ -37,24 +37,20 @@ class SessionsInner : public TWidget, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SessionsInner(SessionsList *list, SessionData *current);
|
SessionsInner(SessionsList *list, SessionData *current);
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void listUpdated();
|
void listUpdated();
|
||||||
|
|
||||||
~SessionsInner();
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void oneTerminated();
|
void oneTerminated();
|
||||||
void allTerminated();
|
void allTerminated();
|
||||||
void terminateAll();
|
void terminateAll();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onTerminate();
|
void onTerminate();
|
||||||
void onTerminateSure();
|
void onTerminateSure();
|
||||||
void onTerminateAll();
|
void onTerminateAll();
|
||||||
|
@ -62,7 +58,6 @@ public slots:
|
||||||
void onNoTerminateBox(QObject *obj);
|
void onNoTerminateBox(QObject *obj);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void terminateDone(uint64 hash, const MTPBool &result);
|
void terminateDone(uint64 hash, const MTPBool &result);
|
||||||
bool terminateFail(uint64 hash, const RPCError &error);
|
bool terminateFail(uint64 hash, const RPCError &error);
|
||||||
|
|
||||||
|
@ -85,13 +80,9 @@ class SessionsBox : public ScrollableBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SessionsBox();
|
SessionsBox();
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onOneTerminated();
|
void onOneTerminated();
|
||||||
void onAllTerminated();
|
void onAllTerminated();
|
||||||
void onTerminateAll();
|
void onTerminateAll();
|
||||||
|
@ -99,12 +90,12 @@ public slots:
|
||||||
void onNewAuthorization();
|
void onNewAuthorization();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void gotAuthorizations(const MTPaccount_Authorizations &result);
|
void gotAuthorizations(const MTPaccount_Authorizations &result);
|
||||||
|
|
||||||
bool _loading;
|
bool _loading;
|
||||||
|
|
|
@ -398,15 +398,6 @@ void StickerSetBox::onScroll() {
|
||||||
_inner.setScrollBottom(_scroll.scrollTop() + _scroll.height());
|
_inner.setScrollBottom(_scroll.scrollTop() + _scroll.height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickerSetBox::hideAll() {
|
|
||||||
ScrollableBox::hideAll();
|
|
||||||
_shadow.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_add.hide();
|
|
||||||
_share.hide();
|
|
||||||
_done.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
void StickerSetBox::showAll() {
|
void StickerSetBox::showAll() {
|
||||||
ScrollableBox::showAll();
|
ScrollableBox::showAll();
|
||||||
int32 cnt = _inner.notInstalled();
|
int32 cnt = _inner.notInstalled();
|
||||||
|
@ -1676,20 +1667,6 @@ void StickersBox::onSave() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersBox::hideAll() {
|
|
||||||
if (_topShadow) {
|
|
||||||
_topShadow->hide();
|
|
||||||
}
|
|
||||||
if (_save) {
|
|
||||||
_save->hide();
|
|
||||||
}
|
|
||||||
if (_cancel) {
|
|
||||||
_cancel->hide();
|
|
||||||
_bottomShadow->hide();
|
|
||||||
}
|
|
||||||
ItemListBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void StickersBox::showAll() {
|
void StickersBox::showAll() {
|
||||||
if (_topShadow) {
|
if (_topShadow) {
|
||||||
_topShadow->show();
|
_topShadow->show();
|
||||||
|
|
|
@ -90,12 +90,8 @@ class StickerSetBox : public ScrollableBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
StickerSetBox(const MTPInputStickerSet &set);
|
StickerSetBox(const MTPInputStickerSet &set);
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onStickersUpdated();
|
void onStickersUpdated();
|
||||||
void onAddStickers();
|
void onAddStickers();
|
||||||
|
@ -111,8 +107,10 @@ signals:
|
||||||
void installed(uint64 id);
|
void installed(uint64 id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void hideAll();
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void showAll();
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
|
void showAll() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StickerSetInner _inner;
|
StickerSetInner _inner;
|
||||||
|
@ -139,11 +137,6 @@ public:
|
||||||
StickersBox(Section section = Section::Installed);
|
StickersBox(Section section = Section::Installed);
|
||||||
StickersBox(const Stickers::Order &archivedIds);
|
StickersBox(const Stickers::Order &archivedIds);
|
||||||
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
|
|
||||||
void closePressed();
|
|
||||||
|
|
||||||
~StickersBox();
|
~StickersBox();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -159,8 +152,11 @@ private slots:
|
||||||
void onScroll();
|
void onScroll();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void hideAll();
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
void showAll();
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
|
void closePressed() override;
|
||||||
|
void showAll() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setup();
|
void setup();
|
||||||
|
|
|
@ -55,15 +55,6 @@ _about(st::boxWidth - st::usernamePadding.left()) {
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameBox::hideAll() {
|
|
||||||
_username.hide();
|
|
||||||
_save.hide();
|
|
||||||
_cancel.hide();
|
|
||||||
_link.hide();
|
|
||||||
|
|
||||||
AbstractBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void UsernameBox::showAll() {
|
void UsernameBox::showAll() {
|
||||||
_username.show();
|
_username.show();
|
||||||
_save.show();
|
_save.show();
|
||||||
|
@ -73,7 +64,7 @@ void UsernameBox::showAll() {
|
||||||
AbstractBox::showAll();
|
AbstractBox::showAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UsernameBox::showDone() {
|
void UsernameBox::doSetInnerFocus() {
|
||||||
_username.setFocus();
|
_username.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +186,7 @@ void UsernameBox::onLinkClick() {
|
||||||
|
|
||||||
void UsernameBox::onUpdateDone(const MTPUser &user) {
|
void UsernameBox::onUpdateDone(const MTPUser &user) {
|
||||||
App::feedUsers(MTP_vector<MTPUser>(1, user));
|
App::feedUsers(MTP_vector<MTPUser>(1, user));
|
||||||
emit closed();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UsernameBox::onUpdateFail(const RPCError &error) {
|
bool UsernameBox::onUpdateFail(const RPCError &error) {
|
||||||
|
@ -205,7 +196,7 @@ bool UsernameBox::onUpdateFail(const RPCError &error) {
|
||||||
QString err(error.type());
|
QString err(error.type());
|
||||||
if (err == qstr("USERNAME_NOT_MODIFIED") || _sentUsername == App::self()->username) {
|
if (err == qstr("USERNAME_NOT_MODIFIED") || _sentUsername == App::self()->username) {
|
||||||
App::self()->setName(textOneLine(App::self()->firstName), textOneLine(App::self()->lastName), textOneLine(App::self()->nameOrPhone), textOneLine(_sentUsername));
|
App::self()->setName(textOneLine(App::self()->firstName), textOneLine(App::self()->lastName), textOneLine(App::self()->nameOrPhone), textOneLine(_sentUsername));
|
||||||
emit closed();
|
onClose();
|
||||||
return true;
|
return true;
|
||||||
} else if (err == qstr("USERNAME_INVALID")) {
|
} else if (err == qstr("USERNAME_INVALID")) {
|
||||||
_username.setFocus();
|
_username.setFocus();
|
||||||
|
|
|
@ -26,28 +26,24 @@ class UsernameBox : public AbstractBox, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
UsernameBox();
|
UsernameBox();
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onSave();
|
void onSave();
|
||||||
|
|
||||||
void onCheck();
|
void onCheck();
|
||||||
void onChanged();
|
void onChanged();
|
||||||
|
|
||||||
void onLinkClick();
|
void onLinkClick();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
void doSetInnerFocus() override;
|
||||||
void showDone();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void onUpdateDone(const MTPUser &result);
|
void onUpdateDone(const MTPUser &result);
|
||||||
bool onUpdateFail(const RPCError &error);
|
bool onUpdateFail(const RPCError &error);
|
||||||
|
|
||||||
|
@ -66,4 +62,5 @@ private:
|
||||||
|
|
||||||
Text _about;
|
Text _about;
|
||||||
QTimer _checkTimer;
|
QTimer _checkTimer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -194,7 +194,7 @@ void hideMediaPreview() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showLayer(LayeredWidget *box, ShowLayerOptions options) {
|
void showLayer(LayerWidget *box, ShowLayerOptions options) {
|
||||||
if (auto w = App::wnd()) {
|
if (auto w = App::wnd()) {
|
||||||
w->ui_showLayer(box, options);
|
w->ui_showLayer(box, options);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,7 +20,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class LayeredWidget;
|
class LayerWidget;
|
||||||
|
|
||||||
namespace App {
|
namespace App {
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void showMediaPreview(DocumentData *document);
|
||||||
void showMediaPreview(PhotoData *photo);
|
void showMediaPreview(PhotoData *photo);
|
||||||
void hideMediaPreview();
|
void hideMediaPreview();
|
||||||
|
|
||||||
void showLayer(LayeredWidget *box, ShowLayerOptions options = CloseOtherLayers);
|
void showLayer(LayerWidget *box, ShowLayerOptions options = CloseOtherLayers);
|
||||||
void hideLayer(bool fast = false);
|
void hideLayer(bool fast = false);
|
||||||
bool isLayerShown();
|
bool isLayerShown();
|
||||||
bool isMediaViewShown();
|
bool isMediaViewShown();
|
||||||
|
|
|
@ -2760,7 +2760,7 @@ void HistoryHider::paintEvent(QPaintEvent *e) {
|
||||||
toText.drawElided(p, box.left() + st::boxPadding.left(), box.top() + st::boxPadding.top(), toTextWidth + 2);
|
toText.drawElided(p, box.left() + st::boxPadding.left(), box.top() + st::boxPadding.top(), toTextWidth + 2);
|
||||||
} else {
|
} else {
|
||||||
int32 w = st::forwardMargins.left() + _chooseWidth + st::forwardMargins.right(), h = st::forwardMargins.top() + st::forwardFont->height + st::forwardMargins.bottom();
|
int32 w = st::forwardMargins.left() + _chooseWidth + st::forwardMargins.right(), h = st::forwardMargins.top() + st::forwardFont->height + st::forwardMargins.bottom();
|
||||||
App::roundRect(p, (width() - w) / 2, (height() - h) / 2, w, h, st::forwardBg, ForwardCorners);
|
App::roundRect(p, (width() - w) / 2, (height() - st::titleHeight - h) / 2, w, h, st::forwardBg, ForwardCorners);
|
||||||
|
|
||||||
p.setPen(st::white->p);
|
p.setPen(st::white->p);
|
||||||
p.drawText(box, lang(_botAndQuery.isEmpty() ? lng_forward_choose : lng_inline_switch_choose), QTextOption(style::al_center));
|
p.drawText(box, lang(_botAndQuery.isEmpty() ? lng_forward_choose : lng_inline_switch_choose), QTextOption(style::al_center));
|
||||||
|
@ -2849,7 +2849,7 @@ void HistoryHider::resizeEvent(QResizeEvent *e) {
|
||||||
_send.hide();
|
_send.hide();
|
||||||
_cancel.hide();
|
_cancel.hide();
|
||||||
}
|
}
|
||||||
box = QRect((width() - w) / 2, (height() - h) / 2, w, h);
|
box = QRect((width() - w) / 2, (height() - st::titleHeight - h) / 2, w, h);
|
||||||
_send.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right(), box.y() + h - st::boxButtonPadding.bottom() - _send.height());
|
_send.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right(), box.y() + h - st::boxButtonPadding.bottom() - _send.height());
|
||||||
_cancel.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right() + _send.width() + st::boxButtonPadding.left(), _send.y());
|
_cancel.moveToRight(width() - (box.x() + box.width()) + st::boxButtonPadding.right() + _send.width() + st::boxButtonPadding.left(), _send.y());
|
||||||
}
|
}
|
||||||
|
@ -7742,7 +7742,7 @@ void HistoryWidget::onReplyToMessage() {
|
||||||
onReplyToMessage();
|
onReplyToMessage();
|
||||||
App::contextItem(to);
|
App::contextItem(to);
|
||||||
} else {
|
} else {
|
||||||
LayeredWidget *box = 0;
|
LayerWidget *box = nullptr;
|
||||||
if (to->type() != HistoryItemMsg || to->serviceMsg()) {
|
if (to->type() != HistoryItemMsg || to->serviceMsg()) {
|
||||||
box = new InformBox(lang(lng_reply_cant));
|
box = new InformBox(lang(lng_reply_cant));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -433,7 +433,6 @@ class HistoryHider : public TWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
HistoryHider(MainWidget *parent, bool forwardSelected); // forward messages
|
HistoryHider(MainWidget *parent, bool forwardSelected); // forward messages
|
||||||
HistoryHider(MainWidget *parent, UserData *sharedContact); // share contact
|
HistoryHider(MainWidget *parent, UserData *sharedContact); // share contact
|
||||||
HistoryHider(MainWidget *parent); // send path from command line argument
|
HistoryHider(MainWidget *parent); // send path from command line argument
|
||||||
|
@ -443,11 +442,6 @@ public:
|
||||||
void step_appearance(float64 ms, bool timer);
|
void step_appearance(float64 ms, bool timer);
|
||||||
bool withConfirm() const;
|
bool withConfirm() const;
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
bool offerPeer(PeerId peer);
|
bool offerPeer(PeerId peer);
|
||||||
QString offeredText() const;
|
QString offeredText() const;
|
||||||
QString botAndQuery() const {
|
QString botAndQuery() const {
|
||||||
|
@ -460,17 +454,20 @@ public:
|
||||||
|
|
||||||
~HistoryHider();
|
~HistoryHider();
|
||||||
|
|
||||||
public slots:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
|
public slots:
|
||||||
void startHide();
|
void startHide();
|
||||||
void forward();
|
void forward();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void forwarded();
|
void forwarded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
MainWidget *parent();
|
MainWidget *parent();
|
||||||
|
|
||||||
|
|
|
@ -28,167 +28,357 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "ui/filedialog.h"
|
#include "ui/filedialog.h"
|
||||||
|
|
||||||
BackgroundWidget::BackgroundWidget(QWidget *parent, LayeredWidget *w) : TWidget(parent)
|
void LayerWidget::setInnerFocus() {
|
||||||
, w(w)
|
auto focused = App::wnd()->focusWidget();
|
||||||
, a_bg(0)
|
if (!isAncestorOf(focused)) {
|
||||||
, _a_background(animation(this, &BackgroundWidget::step_background))
|
doSetInnerFocus();
|
||||||
, hiding(false)
|
|
||||||
, shadow(st::boxShadow) {
|
|
||||||
w->setParent(this);
|
|
||||||
if (App::app()) App::app()->mtpPause();
|
|
||||||
setGeometry(0, 0, App::wnd()->width(), App::wnd()->height());
|
|
||||||
a_bg.start(1);
|
|
||||||
_a_background.start();
|
|
||||||
show();
|
|
||||||
connect(w, SIGNAL(closed()), this, SLOT(onInnerClose()));
|
|
||||||
connect(w, SIGNAL(resized()), this, SLOT(update()));
|
|
||||||
connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(boxDestroyed(QObject*)));
|
|
||||||
w->setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BackgroundWidget::showFast() {
|
|
||||||
_a_background.step(getms() + st::layerSlideDuration + 1);
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BackgroundWidget::paintEvent(QPaintEvent *e) {
|
|
||||||
if (!w) return;
|
|
||||||
bool trivial = (rect() == e->rect());
|
|
||||||
|
|
||||||
QPainter p(this);
|
|
||||||
if (!trivial) {
|
|
||||||
p.setClipRect(e->rect());
|
|
||||||
}
|
}
|
||||||
p.setOpacity(st::layerAlpha * a_bg.current());
|
|
||||||
p.fillRect(rect(), st::layerBg->b);
|
|
||||||
|
|
||||||
p.setOpacity(a_bg.current());
|
|
||||||
shadow.paint(p, w->geometry(), st::boxShadowShift);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::keyPressEvent(QKeyEvent *e) {
|
class LayerStackWidget::BackgroundWidget : public TWidget {
|
||||||
|
public:
|
||||||
|
BackgroundWidget(QWidget *parent) : TWidget(parent)
|
||||||
|
, _shadow(st::boxShadow) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void setLayerBox(const QRect &box) {
|
||||||
|
_box = box;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
void setOpacity(float64 opacity) {
|
||||||
|
_opacity = opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override {
|
||||||
|
Painter p(this);
|
||||||
|
|
||||||
|
p.setOpacity(st::layerAlpha * _opacity);
|
||||||
|
if (_box.isNull()) {
|
||||||
|
p.fillRect(rect(), st::layerBg);
|
||||||
|
} else {
|
||||||
|
auto clip = QRegion(rect()) - _box;
|
||||||
|
for (auto &r : clip.rects()) {
|
||||||
|
p.fillRect(r, st::layerBg);
|
||||||
|
}
|
||||||
|
p.setClipRegion(clip);
|
||||||
|
p.setOpacity(_opacity);
|
||||||
|
_shadow.paint(p, _box, st::boxShadowShift);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QRect _box;
|
||||||
|
float64 _opacity = 0.;
|
||||||
|
|
||||||
|
BoxShadow _shadow;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
LayerStackWidget::LayerStackWidget(QWidget *parent) : TWidget(parent)
|
||||||
|
, _background(this)
|
||||||
|
, a_bg(0)
|
||||||
|
, a_layer(0)
|
||||||
|
, _a_background(animation(this, &LayerStackWidget::step_background)) {
|
||||||
|
setGeometry(parentWidget()->rect());
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::paintEvent(QPaintEvent *e) {
|
||||||
|
if (!layer() && !_specialLayer && _layerCache.isNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_layerCache.isNull()) {
|
||||||
|
Painter p(this);
|
||||||
|
p.setClipRect(rect());
|
||||||
|
p.setOpacity(a_layer.current());
|
||||||
|
p.drawPixmap(_layerCacheBox.topLeft(), _layerCache);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
if (e->key() == Qt::Key_Escape) {
|
if (e->key() == Qt::Key_Escape) {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::mousePressEvent(QMouseEvent *e) {
|
void LayerStackWidget::mousePressEvent(QMouseEvent *e) {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::onClose() {
|
void LayerStackWidget::onClose() {
|
||||||
startHide();
|
startHide();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BackgroundWidget::onInnerClose() {
|
void LayerStackWidget::onLayerClosed(LayerWidget *l) {
|
||||||
if (_hidden.isEmpty()) {
|
l->deleteLater();
|
||||||
|
if (l == _specialLayer) {
|
||||||
onClose();
|
onClose();
|
||||||
|
_specialLayer = nullptr;
|
||||||
|
} else if (l == layer()) {
|
||||||
|
_layers.pop_back();
|
||||||
|
if (auto newLayer = layer()) {
|
||||||
|
l->hide();
|
||||||
|
newLayer->parentResized();
|
||||||
|
if (!_a_background.animating()) {
|
||||||
|
newLayer->show();
|
||||||
|
}
|
||||||
|
} else if (_specialLayer) {
|
||||||
|
l->hide();
|
||||||
|
} else {
|
||||||
|
_layers.push_back(l); // For animation cache grab.
|
||||||
|
onClose();
|
||||||
|
_layers.pop_back();
|
||||||
|
}
|
||||||
|
fixOrder();
|
||||||
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
|
updateLayerBox();
|
||||||
|
} else {
|
||||||
|
for (auto i = _layers.begin(), e = _layers.end(); i != e; ++i) {
|
||||||
|
if (l == *i) {
|
||||||
|
_layers.erase(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::onLayerResized() {
|
||||||
|
updateLayerBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::updateLayerBox() {
|
||||||
|
auto getLayerBox = [this]() {
|
||||||
|
if (!_layerCache.isNull()) {
|
||||||
|
return _layerCacheBox;
|
||||||
|
} else if (auto l = layer()) {
|
||||||
|
return l->geometry();
|
||||||
|
} else if (_specialLayer) {
|
||||||
|
return _specialLayer->geometry();
|
||||||
|
}
|
||||||
|
return QRect();
|
||||||
|
};
|
||||||
|
_background->setLayerBox(getLayerBox());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::startShow() {
|
||||||
|
startAnimation(1);
|
||||||
|
show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::showFast() {
|
||||||
|
if (_a_background.animating()) {
|
||||||
|
_a_background.step(getms() + st::layerSlideDuration + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::startHide() {
|
||||||
|
if (isHidden() || _hiding) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_hiding = true;
|
||||||
|
startAnimation(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::startAnimation(float64 toOpacity) {
|
||||||
|
if (App::app()) App::app()->mtpPause();
|
||||||
|
a_bg.start(toOpacity);
|
||||||
|
a_layer.start(toOpacity);
|
||||||
|
_a_background.start();
|
||||||
|
if (_layerCache.isNull()) {
|
||||||
|
if (auto cacheLayer = layer() ? layer() : _specialLayer) {
|
||||||
|
_layerCache = myGrab(cacheLayer);
|
||||||
|
_layerCacheBox = cacheLayer->geometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_specialLayer) {
|
||||||
|
_specialLayer->hide();
|
||||||
|
}
|
||||||
|
if (auto l = layer()) {
|
||||||
|
l->hide();
|
||||||
|
}
|
||||||
|
updateLayerBox();
|
||||||
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LayerStackWidget::canSetFocus() const {
|
||||||
|
return (layer() || _specialLayer) && !_hiding;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::setInnerFocus() {
|
||||||
|
if (_a_background.animating()) {
|
||||||
|
setFocus();
|
||||||
|
} else if (auto l = layer()) {
|
||||||
|
l->setInnerFocus();
|
||||||
|
} else if (_specialLayer) {
|
||||||
|
_specialLayer->setInnerFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LayerStackWidget::contentOverlapped(const QRect &globalRect) {
|
||||||
|
if (isHidden()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_specialLayer && _specialLayer->overlaps(globalRect)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
w->hide();
|
if (auto l = layer()) {
|
||||||
w->deleteLater();
|
return l->overlaps(globalRect);
|
||||||
w = _hidden.back();
|
}
|
||||||
_hidden.pop_back();
|
|
||||||
w->show();
|
|
||||||
resizeEvent(0);
|
|
||||||
w->showStep(1);
|
|
||||||
update();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::startHide() {
|
void LayerStackWidget::resizeEvent(QResizeEvent *e) {
|
||||||
if (hiding) return;
|
_background->setGeometry(rect());
|
||||||
if (App::app()) App::app()->mtpPause();
|
if (_specialLayer) {
|
||||||
|
_specialLayer->parentResized();
|
||||||
hiding = true;
|
}
|
||||||
if (App::wnd()) App::wnd()->setInnerFocus();
|
if (auto l = layer()) {
|
||||||
a_bg.start(0);
|
l->parentResized();
|
||||||
_a_background.start();
|
}
|
||||||
w->startHide();
|
updateLayerBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BackgroundWidget::canSetFocus() const {
|
void LayerStackWidget::updateAdaptiveLayout() {
|
||||||
return w && !hiding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::setInnerFocus() {
|
void LayerStackWidget::showLayer(LayerWidget *l) {
|
||||||
if (w) {
|
clearLayers();
|
||||||
w->setInnerFocus();
|
appendLayer(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::showSpecialLayer(LayerWidget *l) {
|
||||||
|
clearLayers();
|
||||||
|
if (_specialLayer) {
|
||||||
|
_specialLayer->hide();
|
||||||
|
_specialLayer->deleteLater();
|
||||||
|
}
|
||||||
|
_specialLayer = l;
|
||||||
|
activateLayer(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::appendLayer(LayerWidget *l) {
|
||||||
|
if (auto oldLayer = layer()) {
|
||||||
|
oldLayer->hide();
|
||||||
|
}
|
||||||
|
_layers.push_back(l);
|
||||||
|
activateLayer(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LayerStackWidget::prependLayer(LayerWidget *l) {
|
||||||
|
if (_layers.empty()) {
|
||||||
|
showLayer(l);
|
||||||
|
} else {
|
||||||
|
l->hide();
|
||||||
|
_layers.push_front(l);
|
||||||
|
initChildLayer(l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BackgroundWidget::contentOverlapped(const QRect &globalRect) {
|
void LayerStackWidget::clearLayers() {
|
||||||
if (isHidden()) return false;
|
for_const (auto oldLayer, _layers) {
|
||||||
return w && w->overlaps(globalRect);
|
oldLayer->hide();
|
||||||
|
oldLayer->deleteLater();
|
||||||
|
}
|
||||||
|
_layers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::resizeEvent(QResizeEvent *e) {
|
void LayerStackWidget::initChildLayer(LayerWidget *l) {
|
||||||
w->parentResized();
|
l->setParent(this);
|
||||||
|
connect(l, SIGNAL(closed(LayerWidget*)), this, SLOT(onLayerClosed(LayerWidget*)));
|
||||||
|
connect(l, SIGNAL(resized()), this, SLOT(onLayerResized()));
|
||||||
|
connect(l, SIGNAL(destroyed(QObject*)), this, SLOT(onLayerDestroyed(QObject*)));
|
||||||
|
l->parentResized();
|
||||||
|
fixOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::updateAdaptiveLayout() {
|
void LayerStackWidget::activateLayer(LayerWidget *l) {
|
||||||
|
initChildLayer(l);
|
||||||
|
if (isHidden()) {
|
||||||
|
startShow();
|
||||||
|
} else {
|
||||||
|
l->show();
|
||||||
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
|
updateLayerBox();
|
||||||
|
}
|
||||||
|
fixOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::replaceInner(LayeredWidget *n) {
|
void LayerStackWidget::fixOrder() {
|
||||||
_hidden.push_back(w);
|
if (auto l = layer()) {
|
||||||
w->hide();
|
_background->raise();
|
||||||
w = n;
|
l->raise();
|
||||||
w->setParent(this);
|
} else if (_specialLayer) {
|
||||||
connect(w, SIGNAL(closed()), this, SLOT(onInnerClose()));
|
_specialLayer->raise();
|
||||||
connect(w, SIGNAL(resized()), this, SLOT(update()));
|
}
|
||||||
connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(boxDestroyed(QObject*)));
|
|
||||||
w->show();
|
|
||||||
resizeEvent(0);
|
|
||||||
w->showStep(1);
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::showLayerLast(LayeredWidget *n) {
|
void LayerStackWidget::step_background(float64 ms, bool timer) {
|
||||||
_hidden.push_front(n);
|
float64 dt = ms / (_hiding ? st::layerHideDuration : st::layerSlideDuration);
|
||||||
n->setParent(this);
|
|
||||||
connect(n, SIGNAL(closed()), this, SLOT(onInnerClose()));
|
|
||||||
connect(n, SIGNAL(resized()), this, SLOT(update()));
|
|
||||||
connect(n, SIGNAL(destroyed(QObject*)), this, SLOT(boxDestroyed(QObject*)));
|
|
||||||
n->parentResized();
|
|
||||||
n->showStep(1);
|
|
||||||
n->hide();
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BackgroundWidget::step_background(float64 ms, bool timer) {
|
|
||||||
float64 dt = ms / (hiding ? st::layerHideDuration : st::layerSlideDuration);
|
|
||||||
w->showStep(dt);
|
|
||||||
if (dt >= 1) {
|
if (dt >= 1) {
|
||||||
a_bg.finish();
|
a_bg.finish();
|
||||||
if (hiding) {
|
a_layer.finish();
|
||||||
App::wnd()->layerFinishedHide(this);
|
|
||||||
}
|
|
||||||
_a_background.stop();
|
_a_background.stop();
|
||||||
|
_layerCache = QPixmap();
|
||||||
|
if (_hiding) {
|
||||||
|
App::wnd()->layerFinishedHide(this);
|
||||||
|
} else {
|
||||||
|
if (_specialLayer) {
|
||||||
|
_specialLayer->show();
|
||||||
|
_specialLayer->showDone();
|
||||||
|
}
|
||||||
|
if (auto l = layer()) {
|
||||||
|
l->show();
|
||||||
|
l->showDone();
|
||||||
|
}
|
||||||
|
fixOrder();
|
||||||
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
|
}
|
||||||
|
updateLayerBox();
|
||||||
if (App::app()) App::app()->mtpUnpause();
|
if (App::app()) App::app()->mtpUnpause();
|
||||||
} else {
|
} else {
|
||||||
a_bg.update(dt, anim::easeOutCirc);
|
a_bg.update(dt, anim::easeOutCirc);
|
||||||
|
a_layer.update(dt, anim::linear);
|
||||||
|
}
|
||||||
|
_background->setOpacity(a_bg.current());
|
||||||
|
if (timer) {
|
||||||
|
_background->update();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
if (timer) update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BackgroundWidget::boxDestroyed(QObject *obj) {
|
void LayerStackWidget::onLayerDestroyed(QObject *obj) {
|
||||||
if (obj == w) {
|
if (obj == _specialLayer) {
|
||||||
if (App::wnd()) App::wnd()->layerFinishedHide(this);
|
_specialLayer = nullptr;
|
||||||
w = 0;
|
onClose();
|
||||||
|
} else if (obj == layer()) {
|
||||||
|
_layers.pop_back();
|
||||||
|
if (auto newLayer = layer()) {
|
||||||
|
newLayer->parentResized();
|
||||||
|
if (!_a_background.animating()) {
|
||||||
|
newLayer->show();
|
||||||
|
}
|
||||||
|
} else if (!_specialLayer) {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
fixOrder();
|
||||||
|
if (App::wnd()) App::wnd()->setInnerFocus();
|
||||||
|
updateLayerBox();
|
||||||
} else {
|
} else {
|
||||||
int32 index = _hidden.indexOf(static_cast<LayeredWidget*>(obj));
|
for (auto i = _layers.begin(), e = _layers.end(); i != e; ++i) {
|
||||||
if (index >= 0) {
|
if (obj == *i) {
|
||||||
_hidden.removeAt(index);
|
_layers.erase(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BackgroundWidget::~BackgroundWidget() {
|
LayerStackWidget::~LayerStackWidget() {
|
||||||
if (App::wnd()) App::wnd()->noBox(this);
|
if (App::wnd()) App::wnd()->noLayerStack(this);
|
||||||
w->deleteLater();
|
|
||||||
for (HiddenLayers::const_iterator i = _hidden.cbegin(), e = _hidden.cend(); i != e; ++i) {
|
|
||||||
(*i)->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPreviewWidget::MediaPreviewWidget(QWidget *parent) : TWidget(parent)
|
MediaPreviewWidget::MediaPreviewWidget(QWidget *parent) : TWidget(parent)
|
||||||
|
|
|
@ -22,24 +22,14 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include "ui/boxshadow.h"
|
#include "ui/boxshadow.h"
|
||||||
|
|
||||||
class LayeredWidget : public TWidget {
|
class LayerWidget : public TWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void showStep(float64 ms) {
|
|
||||||
}
|
|
||||||
virtual void parentResized() = 0;
|
virtual void parentResized() = 0;
|
||||||
virtual void startHide() {
|
virtual void showDone() {
|
||||||
}
|
|
||||||
|
|
||||||
virtual void setInnerFocus() {
|
|
||||||
setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void resizeEvent(QResizeEvent *e) {
|
|
||||||
emit resized();
|
|
||||||
}
|
}
|
||||||
|
void setInnerFocus();
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *e) {
|
void mousePressEvent(QMouseEvent *e) {
|
||||||
e->accept();
|
e->accept();
|
||||||
|
@ -50,60 +40,91 @@ public:
|
||||||
return rect().contains(QRect(mapFromGlobal(globalRect.topLeft()), globalRect.size()));
|
return rect().contains(QRect(mapFromGlobal(globalRect.topLeft()), globalRect.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
protected:
|
||||||
|
void resizeEvent(QResizeEvent *e) override {
|
||||||
|
emit resized();
|
||||||
|
}
|
||||||
|
virtual void doSetInnerFocus() {
|
||||||
|
setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
void closed();
|
signals:
|
||||||
|
void closed(LayerWidget *layer);
|
||||||
void resized();
|
void resized();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BackgroundWidget : public TWidget {
|
class LayerStackWidget : public TWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
LayerStackWidget(QWidget *parent);
|
||||||
BackgroundWidget(QWidget *parent, LayeredWidget *w);
|
|
||||||
|
|
||||||
void showFast();
|
void showFast();
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void updateAdaptiveLayout();
|
void updateAdaptiveLayout();
|
||||||
|
|
||||||
void replaceInner(LayeredWidget *n);
|
void showLayer(LayerWidget *l);
|
||||||
void showLayerLast(LayeredWidget *n);
|
void showSpecialLayer(LayerWidget *l);
|
||||||
|
void appendLayer(LayerWidget *l);
|
||||||
void step_background(float64 ms, bool timer);
|
void prependLayer(LayerWidget *l);
|
||||||
|
|
||||||
bool canSetFocus() const;
|
bool canSetFocus() const;
|
||||||
void setInnerFocus();
|
void setInnerFocus();
|
||||||
|
|
||||||
bool contentOverlapped(const QRect &globalRect);
|
bool contentOverlapped(const QRect &globalRect);
|
||||||
|
|
||||||
~BackgroundWidget();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void onClose();
|
void onClose();
|
||||||
bool onInnerClose();
|
|
||||||
void boxDestroyed(QObject *obj);
|
~LayerStackWidget();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onLayerDestroyed(QObject *obj);
|
||||||
|
void onLayerClosed(LayerWidget *l);
|
||||||
|
void onLayerResized();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void clearLayers();
|
||||||
|
void initChildLayer(LayerWidget *l);
|
||||||
|
void activateLayer(LayerWidget *l);
|
||||||
|
void updateLayerBox();
|
||||||
|
void fixOrder();
|
||||||
|
|
||||||
|
void startShow();
|
||||||
void startHide();
|
void startHide();
|
||||||
|
void startAnimation(float64 toOpacity);
|
||||||
|
|
||||||
LayeredWidget *w;
|
void step_background(float64 ms, bool timer);
|
||||||
typedef QList<LayeredWidget*> HiddenLayers;
|
|
||||||
HiddenLayers _hidden;
|
LayerWidget *layer() {
|
||||||
anim::fvalue a_bg;
|
return _layers.empty() ? nullptr : _layers.back();
|
||||||
|
}
|
||||||
|
const LayerWidget *layer() const {
|
||||||
|
return const_cast<LayerStackWidget*>(this)->layer();
|
||||||
|
}
|
||||||
|
|
||||||
|
using Layers = QList<LayerWidget*>;
|
||||||
|
Layers _layers;
|
||||||
|
|
||||||
|
ChildWidget<LayerWidget> _specialLayer = { nullptr };
|
||||||
|
|
||||||
|
class BackgroundWidget;
|
||||||
|
ChildWidget<BackgroundWidget> _background;
|
||||||
|
|
||||||
|
anim::fvalue a_bg, a_layer;
|
||||||
Animation _a_background;
|
Animation _a_background;
|
||||||
|
|
||||||
bool hiding;
|
QPixmap _layerCache;
|
||||||
|
QRect _layerCacheBox;
|
||||||
|
|
||||||
|
bool _hiding = false;
|
||||||
|
|
||||||
BoxShadow shadow;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MediaPreviewWidget : public TWidget {
|
class MediaPreviewWidget : public TWidget {
|
||||||
|
|
|
@ -535,7 +535,7 @@ void MainWidget::noHider(HistoryHider *destroyed) {
|
||||||
_hider = nullptr;
|
_hider = nullptr;
|
||||||
if (Adaptive::OneColumn()) {
|
if (Adaptive::OneColumn()) {
|
||||||
if (_forwardConfirm) {
|
if (_forwardConfirm) {
|
||||||
_forwardConfirm->startHide();
|
_forwardConfirm->onClose();
|
||||||
_forwardConfirm = 0;
|
_forwardConfirm = 0;
|
||||||
}
|
}
|
||||||
onHistoryShown(_history->history(), _history->msgId());
|
onHistoryShown(_history->history(), _history->msgId());
|
||||||
|
@ -589,9 +589,11 @@ void MainWidget::hiderLayer(HistoryHider *h) {
|
||||||
} else {
|
} else {
|
||||||
_history->hide();
|
_history->hide();
|
||||||
}
|
}
|
||||||
_dialogs->show();
|
if (_dialogs->isHidden()) {
|
||||||
resizeEvent(0);
|
_dialogs->show();
|
||||||
_dialogs->showAnimated(Window::SlideDirection::FromLeft, animationParams);
|
resizeEvent(0);
|
||||||
|
_dialogs->showAnimated(Window::SlideDirection::FromLeft, animationParams);
|
||||||
|
}
|
||||||
App::wnd()->getTitle()->updateBackButton();
|
App::wnd()->getTitle()->updateBackButton();
|
||||||
} else {
|
} else {
|
||||||
_hider->show();
|
_hider->show();
|
||||||
|
@ -693,7 +695,7 @@ void MainWidget::offerPeer(PeerId peer) {
|
||||||
void MainWidget::onForwardCancel(QObject *obj) {
|
void MainWidget::onForwardCancel(QObject *obj) {
|
||||||
if (!obj || obj == _forwardConfirm) {
|
if (!obj || obj == _forwardConfirm) {
|
||||||
if (_forwardConfirm) {
|
if (_forwardConfirm) {
|
||||||
if (!obj) _forwardConfirm->startHide();
|
if (!obj) _forwardConfirm->onClose();
|
||||||
_forwardConfirm = 0;
|
_forwardConfirm = 0;
|
||||||
}
|
}
|
||||||
if (_hider) _hider->offerPeer(0);
|
if (_hider) _hider->offerPeer(0);
|
||||||
|
@ -1510,7 +1512,7 @@ void MainWidget::onDownloadPathSettings() {
|
||||||
cSetDownloadPathBookmark(QByteArray());
|
cSetDownloadPathBookmark(QByteArray());
|
||||||
DownloadPathBox *box = new DownloadPathBox();
|
DownloadPathBox *box = new DownloadPathBox();
|
||||||
if (App::wnd() && App::wnd()->settingsWidget()) {
|
if (App::wnd() && App::wnd()->settingsWidget()) {
|
||||||
connect(box, SIGNAL(closed()), App::wnd()->settingsWidget(), SLOT(onDownloadPathEdited()));
|
connect(box, SIGNAL(closed(LayerWidget*)), App::wnd()->settingsWidget(), SLOT(onDownloadPathEdited()));
|
||||||
}
|
}
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
@ -2597,12 +2599,14 @@ void MainWidget::showAll() {
|
||||||
_dialogs->show();
|
_dialogs->show();
|
||||||
_history->hide();
|
_history->hide();
|
||||||
}
|
}
|
||||||
if (_wideSection) {
|
if (!selectingPeer()) {
|
||||||
_topBar->hide();
|
if (_wideSection) {
|
||||||
_dialogs->hide();
|
_topBar->hide();
|
||||||
} else if (!selectingPeer() && (_overview || _history->peer())) {
|
_dialogs->hide();
|
||||||
_topBar->show();
|
} else if (_overview || _history->peer()) {
|
||||||
_dialogs->hide();
|
_topBar->show();
|
||||||
|
_dialogs->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_sideShadow.show();
|
_sideShadow.show();
|
||||||
|
|
|
@ -799,28 +799,21 @@ void MainWindow::showDocument(DocumentData *doc, HistoryItem *item) {
|
||||||
_mediaView->setFocus();
|
_mediaView->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ui_showLayer(LayeredWidget *box, ShowLayerOptions options) {
|
void MainWindow::ui_showLayer(LayerWidget *box, ShowLayerOptions options) {
|
||||||
if (box) {
|
if (box) {
|
||||||
bool fast = (options.testFlag(ForceFastShowLayer)) || Ui::isLayerShown();
|
if (!layerBg) {
|
||||||
if (layerBg) {
|
layerBg = new LayerStackWidget(this);
|
||||||
if (options.testFlag(KeepOtherLayers)) {
|
|
||||||
if (options.testFlag(ShowAfterOtherLayers)) {
|
|
||||||
layerBg->showLayerLast(box);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
layerBg->replaceInner(box);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
layerBg->onClose();
|
|
||||||
layerBg->hide();
|
|
||||||
layerBg->deleteLater();
|
|
||||||
layerBg = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (options.testFlag(KeepOtherLayers)) {
|
||||||
layerBg = new BackgroundWidget(this, box);
|
if (options.testFlag(ShowAfterOtherLayers)) {
|
||||||
if (fast) {
|
layerBg->prependLayer(box);
|
||||||
|
} else {
|
||||||
|
layerBg->appendLayer(box);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
layerBg->showLayer(box);
|
||||||
|
}
|
||||||
|
if (options.testFlag(ForceFastShowLayer)) {
|
||||||
layerBg->showFast();
|
layerBg->showFast();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -829,7 +822,7 @@ void MainWindow::ui_showLayer(LayeredWidget *box, ShowLayerOptions options) {
|
||||||
if (options.testFlag(ForceFastShowLayer)) {
|
if (options.testFlag(ForceFastShowLayer)) {
|
||||||
layerBg->hide();
|
layerBg->hide();
|
||||||
layerBg->deleteLater();
|
layerBg->deleteLater();
|
||||||
layerBg = 0;
|
layerBg = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hideMediaview();
|
hideMediaview();
|
||||||
|
@ -922,7 +915,7 @@ void MainWindow::layerHidden() {
|
||||||
layerBg->hide();
|
layerBg->hide();
|
||||||
layerBg->deleteLater();
|
layerBg->deleteLater();
|
||||||
}
|
}
|
||||||
layerBg = 0;
|
layerBg = nullptr;
|
||||||
hideMediaview();
|
hideMediaview();
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
}
|
}
|
||||||
|
@ -1238,13 +1231,13 @@ void MainWindow::noMain(MainWidget *was) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::noBox(BackgroundWidget *was) {
|
void MainWindow::noLayerStack(LayerStackWidget *was) {
|
||||||
if (was == layerBg) {
|
if (was == layerBg) {
|
||||||
layerBg = 0;
|
layerBg = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::layerFinishedHide(BackgroundWidget *was) {
|
void MainWindow::layerFinishedHide(LayerStackWidget *was) {
|
||||||
if (was == layerBg) {
|
if (was == layerBg) {
|
||||||
QTimer::singleShot(0, this, SLOT(layerHidden()));
|
QTimer::singleShot(0, this, SLOT(layerHidden()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,11 @@ class PasscodeWidget;
|
||||||
class IntroWidget;
|
class IntroWidget;
|
||||||
class MainWidget;
|
class MainWidget;
|
||||||
class SettingsWidget;
|
class SettingsWidget;
|
||||||
class BackgroundWidget;
|
class LayerStackWidget;
|
||||||
class LayeredWidget;
|
class LayerWidget;
|
||||||
namespace Local {
|
namespace Local {
|
||||||
class ClearManager;
|
class ClearManager;
|
||||||
}
|
} // namespace Local
|
||||||
|
|
||||||
class ConnectingWidget : public QWidget {
|
class ConnectingWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -192,8 +192,8 @@ public:
|
||||||
void noIntro(IntroWidget *was);
|
void noIntro(IntroWidget *was);
|
||||||
void noSettings(SettingsWidget *was);
|
void noSettings(SettingsWidget *was);
|
||||||
void noMain(MainWidget *was);
|
void noMain(MainWidget *was);
|
||||||
void noBox(BackgroundWidget *was);
|
void noLayerStack(LayerStackWidget *was);
|
||||||
void layerFinishedHide(BackgroundWidget *was);
|
void layerFinishedHide(LayerStackWidget *was);
|
||||||
|
|
||||||
void fixOrder();
|
void fixOrder();
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
return contentOverlapped(QRect(w->mapToGlobal(r.boundingRect().topLeft()), r.boundingRect().size()));
|
return contentOverlapped(QRect(w->mapToGlobal(r.boundingRect().topLeft()), r.boundingRect().size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_showLayer(LayeredWidget *box, ShowLayerOptions options);
|
void ui_showLayer(LayerWidget *box, ShowLayerOptions options);
|
||||||
bool ui_isLayerShown();
|
bool ui_isLayerShown();
|
||||||
bool ui_isMediaViewShown();
|
bool ui_isMediaViewShown();
|
||||||
void ui_showMediaPreview(DocumentData *document);
|
void ui_showMediaPreview(DocumentData *document);
|
||||||
|
@ -317,7 +317,7 @@ private:
|
||||||
IntroWidget *intro = nullptr;
|
IntroWidget *intro = nullptr;
|
||||||
MainWidget *main = nullptr;
|
MainWidget *main = nullptr;
|
||||||
SettingsWidget *settings = nullptr;
|
SettingsWidget *settings = nullptr;
|
||||||
BackgroundWidget *layerBg = nullptr;
|
ChildWidget<LayerStackWidget> layerBg = { nullptr };
|
||||||
std_::unique_ptr<MediaPreviewWidget> _mediaPreview;
|
std_::unique_ptr<MediaPreviewWidget> _mediaPreview;
|
||||||
|
|
||||||
QTimer _isActiveTimer;
|
QTimer _isActiveTimer;
|
||||||
|
|
|
@ -508,7 +508,7 @@ void CoverWidget::showSetPhotoBox(const QImage &img) {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto box = new PhotoCropBox(img, _peer);
|
auto box = new PhotoCropBox(img, _peer);
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(onPhotoUploadStatusChanged()));
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(onPhotoUploadStatusChanged()));
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
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
|
||||||
|
*/
|
||||||
|
using "basic.style";
|
||||||
|
using "basic_types.style";
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
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 "settings/settings_widget.h"
|
||||||
|
|
||||||
|
namespace Settings {
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
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 Settings {
|
||||||
|
|
||||||
|
} // namespace Settings
|
|
@ -1253,7 +1253,7 @@ void SettingsInner::onUpdatePhoto() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
PhotoCropBox *box = new PhotoCropBox(img, self());
|
PhotoCropBox *box = new PhotoCropBox(img, self());
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(onPhotoUpdateStart()));
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(onPhotoUpdateStart()));
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1374,13 +1374,13 @@ void SettingsInner::onRestartNow() {
|
||||||
|
|
||||||
void SettingsInner::onPasscode() {
|
void SettingsInner::onPasscode() {
|
||||||
PasscodeBox *box = new PasscodeBox();
|
PasscodeBox *box = new PasscodeBox();
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(passcodeChanged()));
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(passcodeChanged()));
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsInner::onPasscodeOff() {
|
void SettingsInner::onPasscodeOff() {
|
||||||
PasscodeBox *box = new PasscodeBox(true);
|
PasscodeBox *box = new PasscodeBox(true);
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(passcodeChanged()));
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(passcodeChanged()));
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1413,21 +1413,21 @@ void SettingsInner::onReloadPassword(Qt::ApplicationState state) {
|
||||||
|
|
||||||
void SettingsInner::onAutoLock() {
|
void SettingsInner::onAutoLock() {
|
||||||
AutoLockBox *box = new AutoLockBox();
|
AutoLockBox *box = new AutoLockBox();
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(passcodeChanged()));
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(passcodeChanged()));
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
|
||||||
void SettingsInner::onConnectionType() {
|
void SettingsInner::onConnectionType() {
|
||||||
ConnectionBox *box = new ConnectionBox();
|
ConnectionBox *box = new ConnectionBox();
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(updateConnectionType()), Qt::QueuedConnection);
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(updateConnectionType()), Qt::QueuedConnection);
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SettingsInner::onUsername() {
|
void SettingsInner::onUsername() {
|
||||||
UsernameBox *box = new UsernameBox();
|
UsernameBox *box = new UsernameBox();
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(usernameChanged()));
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(usernameChanged()));
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1775,7 +1775,7 @@ void SettingsInner::onDontAskDownloadPath() {
|
||||||
|
|
||||||
void SettingsInner::onDownloadPathEdit() {
|
void SettingsInner::onDownloadPathEdit() {
|
||||||
DownloadPathBox *box = new DownloadPathBox();
|
DownloadPathBox *box = new DownloadPathBox();
|
||||||
connect(box, SIGNAL(closed()), this, SLOT(onDownloadPathEdited()));
|
connect(box, SIGNAL(closed(LayerWidget*)), this, SLOT(onDownloadPathEdited()));
|
||||||
Ui::showLayer(box);
|
Ui::showLayer(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,9 +192,6 @@ void CountryInput::setText(const QString &newText) {
|
||||||
_text = _st.font->elided(newText, width() - _st.textMrg.left() - _st.textMrg.right());
|
_text = _st.font->elided(newText, width() - _st.textMrg.left() - _st.textMrg.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
CountryInput::~CountryInput() {
|
|
||||||
}
|
|
||||||
|
|
||||||
CountrySelectInner::CountrySelectInner() : TWidget()
|
CountrySelectInner::CountrySelectInner() : TWidget()
|
||||||
, _rowHeight(st::countryRowHeight)
|
, _rowHeight(st::countryRowHeight)
|
||||||
, _sel(0)
|
, _sel(0)
|
||||||
|
@ -483,13 +480,6 @@ void CountrySelectBox::resizeEvent(QResizeEvent *e) {
|
||||||
_topShadow.setGeometry(0, st::boxTitleHeight + _filter.height(), width(), st::lineWidth);
|
_topShadow.setGeometry(0, st::boxTitleHeight + _filter.height(), width(), st::lineWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelectBox::hideAll() {
|
|
||||||
_filter.hide();
|
|
||||||
_filterCancel.hide();
|
|
||||||
_topShadow.hide();
|
|
||||||
ItemListBox::hideAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CountrySelectBox::showAll() {
|
void CountrySelectBox::showAll() {
|
||||||
_filter.show();
|
_filter.show();
|
||||||
if (_filter.getLastText().isEmpty()) {
|
if (_filter.getLastText().isEmpty()) {
|
||||||
|
@ -515,6 +505,6 @@ void CountrySelectBox::onFilterUpdate() {
|
||||||
_inner.updateFilter(_filter.getLastText());
|
_inner.updateFilter(_filter.getLastText());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CountrySelectBox::showDone() {
|
void CountrySelectBox::doSetInnerFocus() {
|
||||||
_filter.setFocus();
|
_filter.setFocus();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,28 +34,23 @@ class CountryInput : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CountryInput(QWidget *parent, const style::countryInput &st);
|
CountryInput(QWidget *parent, const style::countryInput &st);
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
void enterEvent(QEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
|
|
||||||
~CountryInput();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onChooseCode(const QString &code);
|
void onChooseCode(const QString &code);
|
||||||
bool onChooseCountry(const QString &country);
|
bool onChooseCountry(const QString &country);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void codeChanged(const QString &code);
|
void codeChanged(const QString &code);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
void enterEvent(QEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
void setText(const QString &newText);
|
void setText(const QString &newText);
|
||||||
|
|
||||||
QPixmap _arrow;
|
QPixmap _arrow;
|
||||||
|
@ -72,13 +67,7 @@ class CountrySelectInner : public TWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CountrySelectInner();
|
CountrySelectInner();
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void enterEvent(QEvent *e);
|
|
||||||
void leaveEvent(QEvent *e);
|
|
||||||
void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
|
||||||
|
|
||||||
void updateFilter(QString filter = QString());
|
void updateFilter(QString filter = QString());
|
||||||
|
|
||||||
|
@ -86,20 +75,24 @@ public:
|
||||||
void selectSkipPage(int32 h, int32 dir);
|
void selectSkipPage(int32 h, int32 dir);
|
||||||
|
|
||||||
void chooseCountry();
|
void chooseCountry();
|
||||||
|
|
||||||
void refresh();
|
void refresh();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void countryChosen(const QString &iso);
|
void countryChosen(const QString &iso);
|
||||||
void mustScrollTo(int ymin, int ymax);
|
void mustScrollTo(int ymin, int ymax);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void updateSel();
|
void updateSel();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void enterEvent(QEvent *e) override;
|
||||||
|
void leaveEvent(QEvent *e) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent *e) override;
|
||||||
|
void mousePressEvent(QMouseEvent *e) override;
|
||||||
|
|
||||||
|
private:
|
||||||
void updateSelectedRow();
|
void updateSelectedRow();
|
||||||
|
|
||||||
int32 _rowHeight;
|
int32 _rowHeight;
|
||||||
|
@ -109,43 +102,36 @@ private:
|
||||||
bool _mouseSel;
|
bool _mouseSel;
|
||||||
|
|
||||||
QPoint _lastMousePos;
|
QPoint _lastMousePos;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CountrySelectBox : public ItemListBox {
|
class CountrySelectBox : public ItemListBox {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CountrySelectBox();
|
CountrySelectBox();
|
||||||
void keyPressEvent(QKeyEvent *e);
|
|
||||||
void paintEvent(QPaintEvent *e);
|
|
||||||
void resizeEvent(QResizeEvent *e);
|
|
||||||
|
|
||||||
void setInnerFocus() {
|
|
||||||
_filter.setFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void countryChosen(const QString &iso);
|
void countryChosen(const QString &iso);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void onFilterUpdate();
|
void onFilterUpdate();
|
||||||
void onFilterCancel();
|
void onFilterCancel();
|
||||||
void onSubmit();
|
void onSubmit();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
void showDone();
|
void doSetInnerFocus() override;
|
||||||
void hideAll();
|
void showAll() override;
|
||||||
void showAll();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
CountrySelectInner _inner;
|
CountrySelectInner _inner;
|
||||||
InputField _filter;
|
InputField _filter;
|
||||||
IconedButton _filterCancel;
|
IconedButton _filterCancel;
|
||||||
|
|
||||||
ScrollableBoxShadow _topShadow;
|
ScrollableBoxShadow _topShadow;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
'<(src_loc)/media/view/mediaview.style',
|
'<(src_loc)/media/view/mediaview.style',
|
||||||
'<(src_loc)/overview/overview.style',
|
'<(src_loc)/overview/overview.style',
|
||||||
'<(src_loc)/profile/profile.style',
|
'<(src_loc)/profile/profile.style',
|
||||||
|
'<(src_loc)/settings/settings.style',
|
||||||
'<(src_loc)/ui/widgets/widgets.style',
|
'<(src_loc)/ui/widgets/widgets.style',
|
||||||
],
|
],
|
||||||
'qrc_files': [
|
'qrc_files': [
|
||||||
|
@ -329,6 +330,8 @@
|
||||||
'<(src_loc)/serialize/serialize_common.h',
|
'<(src_loc)/serialize/serialize_common.h',
|
||||||
'<(src_loc)/serialize/serialize_document.cpp',
|
'<(src_loc)/serialize/serialize_document.cpp',
|
||||||
'<(src_loc)/serialize/serialize_document.h',
|
'<(src_loc)/serialize/serialize_document.h',
|
||||||
|
'<(src_loc)/settings/settings_widget.cpp',
|
||||||
|
'<(src_loc)/settings/settings_widget.h',
|
||||||
'<(src_loc)/ui/buttons/history_down_button.cpp',
|
'<(src_loc)/ui/buttons/history_down_button.cpp',
|
||||||
'<(src_loc)/ui/buttons/history_down_button.h',
|
'<(src_loc)/ui/buttons/history_down_button.h',
|
||||||
'<(src_loc)/ui/buttons/icon_button.cpp',
|
'<(src_loc)/ui/buttons/icon_button.cpp',
|
||||||
|
|
Loading…
Reference in New Issue