Add method to center widgets & clean up unused headers
This commit is contained in:
parent
ecc346a6da
commit
ce26f041ad
@ -1,11 +1,9 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
#include "InviteeItem.h"
|
#include "InviteeItem.h"
|
||||||
#include "ui/FlatButton.h"
|
|
||||||
#include "ui/Theme.h"
|
|
||||||
|
|
||||||
constexpr int SidePadding = 10;
|
constexpr int SidePadding = 10;
|
||||||
constexpr int IconSize = 13;
|
|
||||||
|
|
||||||
InviteeItem::InviteeItem(mtx::identifiers::User user, QWidget *parent)
|
InviteeItem::InviteeItem(mtx::identifiers::User user, QWidget *parent)
|
||||||
: QWidget{parent}
|
: QWidget{parent}
|
||||||
@ -15,23 +13,11 @@ InviteeItem::InviteeItem(mtx::identifiers::User user, QWidget *parent)
|
|||||||
topLayout_->setSpacing(0);
|
topLayout_->setSpacing(0);
|
||||||
topLayout_->setContentsMargins(SidePadding, 0, 3 * SidePadding, 0);
|
topLayout_->setContentsMargins(SidePadding, 0, 3 * SidePadding, 0);
|
||||||
|
|
||||||
QFont font;
|
|
||||||
font.setPixelSize(15);
|
|
||||||
|
|
||||||
name_ = new QLabel(user_, this);
|
name_ = new QLabel(user_, this);
|
||||||
name_->setFont(font);
|
removeUserBtn_ = new QPushButton(tr("Remove"), this);
|
||||||
|
|
||||||
QIcon removeUserIcon;
|
|
||||||
removeUserIcon.addFile(":/icons/icons/ui/remove-symbol.png");
|
|
||||||
|
|
||||||
removeUserBtn_ = new FlatButton(this);
|
|
||||||
removeUserBtn_->setIcon(removeUserIcon);
|
|
||||||
removeUserBtn_->setIconSize(QSize(IconSize, IconSize));
|
|
||||||
removeUserBtn_->setFixedSize(QSize(IconSize, IconSize));
|
|
||||||
removeUserBtn_->setRippleStyle(ui::RippleStyle::NoRipple);
|
|
||||||
|
|
||||||
topLayout_->addWidget(name_);
|
topLayout_->addWidget(name_);
|
||||||
topLayout_->addWidget(removeUserBtn_);
|
topLayout_->addWidget(removeUserBtn_, 0, Qt::AlignRight);
|
||||||
|
|
||||||
connect(removeUserBtn_, &FlatButton::clicked, this, &InviteeItem::removeItem);
|
connect(removeUserBtn_, &QPushButton::clicked, this, &InviteeItem::removeItem);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#include "mtx.hpp"
|
#include "mtx.hpp"
|
||||||
|
|
||||||
class FlatButton;
|
class QPushButton;
|
||||||
|
|
||||||
class InviteeItem : public QWidget
|
class InviteeItem : public QWidget
|
||||||
{
|
{
|
||||||
@ -23,5 +23,5 @@ private:
|
|||||||
QString user_;
|
QString user_;
|
||||||
|
|
||||||
QLabel *name_;
|
QLabel *name_;
|
||||||
FlatButton *removeUserBtn_;
|
QPushButton *removeUserBtn_;
|
||||||
};
|
};
|
||||||
|
@ -384,3 +384,18 @@ utils::linkColor()
|
|||||||
|
|
||||||
return QPalette().color(QPalette::Link).name();
|
return QPalette().color(QPalette::Link).name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
utils::centerWidget(QWidget *widget, QWidget *parent)
|
||||||
|
{
|
||||||
|
if (parent) {
|
||||||
|
widget->move(parent->geometry().center() - widget->rect().center());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
||||||
|
const int x = (screenGeometry.width() - widget->width()) / 2;
|
||||||
|
const int y = (screenGeometry.height() - widget->height()) / 2;
|
||||||
|
|
||||||
|
widget->move(x, y);
|
||||||
|
}
|
||||||
|
@ -221,6 +221,11 @@ linkifyMessage(const QString &body);
|
|||||||
QString
|
QString
|
||||||
markdownToHtml(const QString &text);
|
markdownToHtml(const QString &text);
|
||||||
|
|
||||||
|
//! Retrieve the color of the links based on the current theme.
|
||||||
QString
|
QString
|
||||||
linkColor();
|
linkColor();
|
||||||
|
|
||||||
|
//! Center a widget in relation to another widget.
|
||||||
|
void
|
||||||
|
centerWidget(QWidget *widget, QWidget *parent);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/TextField.h"
|
#include "ui/TextField.h"
|
||||||
#include "ui/Theme.h"
|
|
||||||
#include "ui/ToggleButton.h"
|
#include "ui/ToggleButton.h"
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStyleOption>
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "dialogs/JoinRoom.h"
|
#include "dialogs/JoinRoom.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/TextField.h"
|
#include "ui/TextField.h"
|
||||||
#include "ui/Theme.h"
|
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStyleOption>
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "dialogs/LeaveRoom.h"
|
#include "dialogs/LeaveRoom.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/Theme.h"
|
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
|
||||||
|
@ -16,16 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPaintEvent>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QStyleOption>
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "dialogs/Logout.h"
|
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "ui/Theme.h"
|
#include "dialogs/Logout.h"
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
#include "ui/Theme.h"
|
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "ui/LoadingIndicator.h"
|
#include "ui/LoadingIndicator.h"
|
||||||
#include "ui/Painter.h"
|
#include "ui/Painter.h"
|
||||||
#include "ui/TextField.h"
|
#include "ui/TextField.h"
|
||||||
#include "ui/Theme.h"
|
|
||||||
#include "ui/ToggleButton.h"
|
#include "ui/ToggleButton.h"
|
||||||
|
|
||||||
using namespace dialogs;
|
using namespace dialogs;
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QPaintEvent>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QStyleOption>
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "AvatarProvider.h"
|
#include "AvatarProvider.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user