mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-01-06 09:03:58 +00:00
Add minor visual improvements to the menu widgets
This commit is contained in:
@@ -30,22 +30,14 @@ InfoWindow::InfoWindow(QWidget *parent) : QWidget(parent) {
|
||||
setWindowIcon(QIcon(":img/flameshot.png"));
|
||||
setWindowTitle(tr("About"));
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->addWidget(new QLabel(tr("<b>Shortcuts</b>"), this));
|
||||
m_layout = new QVBoxLayout(this);
|
||||
initLabels();
|
||||
initInfoTable();
|
||||
layout->addWidget(new QLabel(tr("<b>License</b>"), this));
|
||||
|
||||
auto imgGPL = new QLabel(this);
|
||||
imgGPL->setStyleSheet("background: white; border-color: black; border-width: 2px");
|
||||
imgGPL->setPixmap(QPixmap(":img/gplv3.png"));
|
||||
imgGPL->setFixedWidth(imgGPL->pixmap()->width());
|
||||
layout->addWidget(imgGPL);
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
|
||||
QVector<const char *> InfoWindow::keys = {
|
||||
QVector<const char *> InfoWindow::m_keys = {
|
||||
"←↓↑→",
|
||||
"SHIFT + ←↓↑→",
|
||||
"ESC",
|
||||
@@ -55,7 +47,7 @@ QVector<const char *> InfoWindow::keys = {
|
||||
QT_TR_NOOP("Right Click")
|
||||
};
|
||||
|
||||
QVector<const char *> InfoWindow::description = {
|
||||
QVector<const char *> InfoWindow::m_description = {
|
||||
QT_TR_NOOP("Move selection 1px"),
|
||||
QT_TR_NOOP("Resize selection 1px"),
|
||||
QT_TR_NOOP("Quit capture"),
|
||||
@@ -70,10 +62,10 @@ void InfoWindow::initInfoTable() {
|
||||
QTableWidget *table = new QTableWidget(this);
|
||||
table->setToolTip(tr("Available shorcuts in the screen capture mode."));
|
||||
|
||||
layout->addWidget(table);
|
||||
m_layout->addWidget(table);
|
||||
|
||||
table->setColumnCount(2);
|
||||
table->setRowCount(keys.size());
|
||||
table->setRowCount(m_keys.size());
|
||||
table->setSelectionMode(QAbstractItemView::NoSelection);
|
||||
table->setFocusPolicy(Qt::NoFocus);
|
||||
table->verticalHeader()->hide();
|
||||
@@ -82,9 +74,9 @@ void InfoWindow::initInfoTable() {
|
||||
names << tr("Key") << tr("Description");
|
||||
table->setHorizontalHeaderLabels(names);
|
||||
//add content
|
||||
for (int i= 0; i < keys.size(); ++i){
|
||||
table->setItem(i, 0, new QTableWidgetItem(tr(keys.at(i))));
|
||||
table->setItem(i, 1, new QTableWidgetItem(tr(description.at(i))));
|
||||
for (int i= 0; i < m_keys.size(); ++i){
|
||||
table->setItem(i, 0, new QTableWidgetItem(tr(m_keys.at(i))));
|
||||
table->setItem(i, 1, new QTableWidgetItem(tr(m_description.at(i))));
|
||||
}
|
||||
// adjust size
|
||||
table->resizeColumnsToContents();
|
||||
@@ -96,6 +88,29 @@ void InfoWindow::initInfoTable() {
|
||||
QSizePolicy::Expanding);
|
||||
}
|
||||
|
||||
void InfoWindow::initLabels() {
|
||||
m_layout->addStretch();
|
||||
QLabel *licenseTitleLabel = new QLabel(tr("<b>License</b>"), this);
|
||||
licenseTitleLabel->setAlignment(Qt::AlignHCenter);
|
||||
m_layout->addWidget(licenseTitleLabel);
|
||||
QLabel *licenseLabel = new QLabel("GPLv3+", this);
|
||||
licenseLabel->setAlignment(Qt::AlignHCenter);
|
||||
m_layout->addWidget(licenseLabel);
|
||||
m_layout->addStretch();
|
||||
|
||||
QLabel *versionTitleLabel = new QLabel(tr("<b>Version</b>"), this);
|
||||
versionTitleLabel->setAlignment(Qt::AlignHCenter);
|
||||
m_layout->addWidget(versionTitleLabel);
|
||||
QLabel *versionLabel = new QLabel(APP_VERSION, this);
|
||||
versionLabel->setAlignment(Qt::AlignHCenter);
|
||||
m_layout->addWidget(versionLabel);
|
||||
m_layout->addStretch();
|
||||
m_layout->addSpacing(10);
|
||||
QLabel *shortcutsTitleLabel = new QLabel(tr("<b>Shortcuts</b>"), this);
|
||||
shortcutsTitleLabel->setAlignment(Qt::AlignHCenter);;
|
||||
m_layout->addWidget(shortcutsTitleLabel);
|
||||
}
|
||||
|
||||
void InfoWindow::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Escape) {
|
||||
close();
|
||||
|
||||
Reference in New Issue
Block a user