mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Return terminate session button to the list.
This commit is contained in:
parent
168711b352
commit
28eb2f1a91
2 changed files with 13 additions and 10 deletions
|
@ -147,7 +147,6 @@ void RenameBox(not_null<Ui::GenericBox*> box) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Type TypeFromEntry(const EntryData &entry) {
|
[[nodiscard]] Type TypeFromEntry(const EntryData &entry) {
|
||||||
using List = std::vector<int>;
|
|
||||||
const auto platform = entry.platform.toLower();
|
const auto platform = entry.platform.toLower();
|
||||||
const auto device = entry.name.toLower();
|
const auto device = entry.name.toLower();
|
||||||
const auto system = entry.system.toLower();
|
const auto system = entry.system.toLower();
|
||||||
|
@ -500,6 +499,8 @@ void Row::update(const EntryData &data) {
|
||||||
setCustomStatus(_data.info);
|
setCustomStatus(_data.info);
|
||||||
refreshName(st::sessionListItem);
|
refreshName(st::sessionListItem);
|
||||||
_location.setText(st::defaultTextStyle, LocationAndDate(_data));
|
_location.setText(st::defaultTextStyle, LocationAndDate(_data));
|
||||||
|
_type = TypeFromEntry(_data);
|
||||||
|
_userpic = GenerateUserpic(_type);
|
||||||
_delegate->rowUpdateRow(this);
|
_delegate->rowUpdateRow(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,15 +548,15 @@ QRect Row::elementGeometry(int element, int outerWidth) const {
|
||||||
} break;
|
} break;
|
||||||
case 2: {
|
case 2: {
|
||||||
const auto size = QSize(
|
const auto size = QSize(
|
||||||
st::sessionListThreeDotsIcon.width(),
|
st::sessionTerminate.width,
|
||||||
st::sessionListThreeDotsIcon.height());
|
st::sessionTerminate.height);
|
||||||
const auto margins = QMargins(
|
const auto margins = QMargins(
|
||||||
0,
|
0,
|
||||||
(st::sessionListItem.height - size.height()) / 2,
|
(st::sessionListItem.height - size.height()) / 2,
|
||||||
st::sessionListThreeDotsSkip,
|
st::sessionListThreeDotsSkip,
|
||||||
0);
|
0);
|
||||||
const auto right = margins.right();
|
const auto right = st::sessionTerminateSkip;
|
||||||
const auto top = margins.top();
|
const auto top = st::sessionTerminateTop;
|
||||||
const auto left = outerWidth - right - size.width();
|
const auto left = outerWidth - right - size.width();
|
||||||
return QRect(QPoint(left, top), size);
|
return QRect(QPoint(left, top), size);
|
||||||
} break;
|
} break;
|
||||||
|
@ -587,10 +588,12 @@ void Row::elementsPaint(
|
||||||
int selectedElement) {
|
int selectedElement) {
|
||||||
if (id()) {
|
if (id()) {
|
||||||
const auto geometry = elementGeometry(2, outerWidth);
|
const auto geometry = elementGeometry(2, outerWidth);
|
||||||
|
const auto position = geometry.topLeft()
|
||||||
|
+ st::sessionTerminate.iconPosition;
|
||||||
const auto &icon = (selectedElement == 2)
|
const auto &icon = (selectedElement == 2)
|
||||||
? st::sessionListThreeDotsIconOver
|
? st::sessionTerminate.iconOver
|
||||||
: st::sessionListThreeDotsIcon;
|
: st::sessionTerminate.icon;
|
||||||
icon.paint(p, geometry.x(), geometry.y(), outerWidth);
|
icon.paint(p, position.x(), position.y(), outerWidth);
|
||||||
}
|
}
|
||||||
p.setFont(st::msgFont);
|
p.setFont(st::msgFont);
|
||||||
p.setPen(st::sessionInfoFg);
|
p.setPen(st::sessionInfoFg);
|
||||||
|
@ -1062,7 +1065,7 @@ void SessionsContent::ListController::rowClicked(
|
||||||
void SessionsContent::ListController::rowElementClicked(
|
void SessionsContent::ListController::rowElementClicked(
|
||||||
not_null<PeerListRow*> row,
|
not_null<PeerListRow*> row,
|
||||||
int element) {
|
int element) {
|
||||||
if (element == 1) {
|
if (element == 2) {
|
||||||
if (const auto hash = static_cast<Row*>(row.get())->data().hash) {
|
if (const auto hash = static_cast<Row*>(row.get())->data().hash) {
|
||||||
_terminateRequests.fire_copy(hash);
|
_terminateRequests.fire_copy(hash);
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,7 +255,7 @@ sessionSubtitleSkip: 14px;
|
||||||
sessionLocationFg: windowSubTextFg;
|
sessionLocationFg: windowSubTextFg;
|
||||||
sessionInfoFg: windowSubTextFg;
|
sessionInfoFg: windowSubTextFg;
|
||||||
sessionTerminateTop: 9px;
|
sessionTerminateTop: 9px;
|
||||||
sessionTerminateSkip: 22px;
|
sessionTerminateSkip: 12px;
|
||||||
sessionTerminate: IconButton {
|
sessionTerminate: IconButton {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|
Loading…
Add table
Reference in a new issue