mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Slightly improved code style in MainWidget.
This commit is contained in:
parent
43c0197445
commit
f9df37960b
2 changed files with 23 additions and 13 deletions
|
@ -522,24 +522,24 @@ bool MainWidget::setForwardDraft(PeerId peerId, Data::ForwardDraft &&draft) {
|
||||||
bool MainWidget::shareUrl(
|
bool MainWidget::shareUrl(
|
||||||
PeerId peerId,
|
PeerId peerId,
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QString &text) {
|
const QString &text) const {
|
||||||
Expects(peerId != 0);
|
Expects(peerId != 0);
|
||||||
|
|
||||||
const auto peer = session().data().peer(peerId);
|
const auto peer = session().data().peer(peerId);
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
Ui::show(Ui::MakeInformBox(tr::lng_share_cant()));
|
_controller->show(Ui::MakeInformBox(tr::lng_share_cant()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TextWithTags textWithTags = {
|
const auto textWithTags = TextWithTags{
|
||||||
url + '\n' + text,
|
url + '\n' + text,
|
||||||
TextWithTags::Tags()
|
TextWithTags::Tags()
|
||||||
};
|
};
|
||||||
MessageCursor cursor = {
|
const auto cursor = MessageCursor{
|
||||||
int(url.size()) + 1,
|
int(url.size()) + 1,
|
||||||
int(url.size()) + 1 + int(text.size()),
|
int(url.size()) + 1 + int(text.size()),
|
||||||
QFIXED_MAX
|
QFIXED_MAX
|
||||||
};
|
};
|
||||||
auto history = peer->owner().history(peer);
|
const auto history = peer->owner().history(peer);
|
||||||
history->setLocalDraft(std::make_unique<Data::Draft>(
|
history->setLocalDraft(std::make_unique<Data::Draft>(
|
||||||
textWithTags,
|
textWithTags,
|
||||||
0,
|
0,
|
||||||
|
@ -552,7 +552,9 @@ bool MainWidget::shareUrl(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWidget::inlineSwitchChosen(PeerId peerId, const QString &botAndQuery) {
|
bool MainWidget::inlineSwitchChosen(
|
||||||
|
PeerId peerId,
|
||||||
|
const QString &botAndQuery) const {
|
||||||
Expects(peerId != 0);
|
Expects(peerId != 0);
|
||||||
|
|
||||||
const auto peer = session().data().peer(peerId);
|
const auto peer = session().data().peer(peerId);
|
||||||
|
@ -561,8 +563,15 @@ bool MainWidget::inlineSwitchChosen(PeerId peerId, const QString &botAndQuery) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto h = peer->owner().history(peer);
|
const auto h = peer->owner().history(peer);
|
||||||
TextWithTags textWithTags = { botAndQuery, TextWithTags::Tags() };
|
const auto textWithTags = TextWithTags{
|
||||||
MessageCursor cursor = { int(botAndQuery.size()), int(botAndQuery.size()), QFIXED_MAX };
|
botAndQuery,
|
||||||
|
TextWithTags::Tags(),
|
||||||
|
};
|
||||||
|
const auto cursor = MessageCursor{
|
||||||
|
int(botAndQuery.size()),
|
||||||
|
int(botAndQuery.size()),
|
||||||
|
QFIXED_MAX
|
||||||
|
};
|
||||||
h->setLocalDraft(std::make_unique<Data::Draft>(
|
h->setLocalDraft(std::make_unique<Data::Draft>(
|
||||||
textWithTags,
|
textWithTags,
|
||||||
0,
|
0,
|
||||||
|
|
|
@ -177,11 +177,6 @@ public:
|
||||||
void inlineSwitchLayer(const QString &botAndQuery);
|
void inlineSwitchLayer(const QString &botAndQuery);
|
||||||
void hiderLayer(base::unique_qptr<Window::HistoryHider> h);
|
void hiderLayer(base::unique_qptr<Window::HistoryHider> h);
|
||||||
bool setForwardDraft(PeerId peer, Data::ForwardDraft &&draft);
|
bool setForwardDraft(PeerId peer, Data::ForwardDraft &&draft);
|
||||||
bool shareUrl(
|
|
||||||
PeerId peerId,
|
|
||||||
const QString &url,
|
|
||||||
const QString &text);
|
|
||||||
bool inlineSwitchChosen(PeerId peerId, const QString &botAndQuery);
|
|
||||||
bool sendPaths(PeerId peerId);
|
bool sendPaths(PeerId peerId);
|
||||||
void onFilesOrForwardDrop(const PeerId &peer, const QMimeData *data);
|
void onFilesOrForwardDrop(const PeerId &peer, const QMimeData *data);
|
||||||
bool selectingPeer() const;
|
bool selectingPeer() const;
|
||||||
|
@ -258,6 +253,12 @@ private:
|
||||||
[[nodiscard]] auto thirdSectionForCurrentMainSection(Dialogs::Key key)
|
[[nodiscard]] auto thirdSectionForCurrentMainSection(Dialogs::Key key)
|
||||||
-> std::shared_ptr<Window::SectionMemento>;
|
-> std::shared_ptr<Window::SectionMemento>;
|
||||||
|
|
||||||
|
bool shareUrl(
|
||||||
|
PeerId peerId,
|
||||||
|
const QString &url,
|
||||||
|
const QString &text) const;
|
||||||
|
bool inlineSwitchChosen(PeerId peerId, const QString &botAndQuery) const;
|
||||||
|
|
||||||
void setupConnectingWidget();
|
void setupConnectingWidget();
|
||||||
void createPlayer();
|
void createPlayer();
|
||||||
void playerHeightUpdated();
|
void playerHeightUpdated();
|
||||||
|
|
Loading…
Add table
Reference in a new issue