forked from input-leap/input-leap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request input-leap#1823 from sithlord48/cleanerGui2
Code cleanup: AboutDialog
- Loading branch information
Showing
3 changed files
with
21 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* InputLeap -- mouse and keyboard sharing utility | ||
* Copyright (C) 2023-2024 InputLeap Developers | ||
* Copyright (C) 2012-2016 Symless Ltd. | ||
* Copyright (C) 2008 Volker Lanz ([email protected]) | ||
* | ||
|
@@ -19,36 +20,25 @@ | |
#include "AboutDialog.h" | ||
#include "ui_AboutDialog.h" | ||
|
||
#include <QtCore> | ||
#include <QtGui> | ||
#include "common/Version.h" | ||
|
||
AboutDialog::AboutDialog(QWidget* parent, const QString& app_name) : | ||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), | ||
ui_{std::make_unique<Ui::AboutDialog>()} | ||
{ | ||
ui_->setupUi(this); | ||
|
||
QString version = kVersion; | ||
version = version + '-' + INPUTLEAP_VERSION_STAGE; | ||
QString version = QStringLiteral("%1-%2").arg(kVersion, INPUTLEAP_VERSION_STAGE); | ||
#ifdef INPUTLEAP_REVISION | ||
version += '-'; | ||
version += INPUTLEAP_REVISION; | ||
version.append(QStringLiteral("-%1").arg(INPUTLEAP_REVISION)); | ||
#endif | ||
ui_->m_pLabelAppVersion->setText(version); | ||
|
||
// change default size based on os | ||
#if defined(Q_OS_MAC) | ||
QSize size(600, 380); | ||
setMaximumSize(size); | ||
setMinimumSize(size); | ||
resize(size); | ||
#elif defined(Q_OS_LINUX) | ||
QSize size(600, 330); | ||
setMaximumSize(size); | ||
setMinimumSize(size); | ||
resize(size); | ||
#endif | ||
const int scaled_logo_height = sizeHint().width() <= 300 ? 45 : 90; | ||
const QPixmap scaled_logo = QPixmap(":/res/image/about.png") | ||
.scaled(QSize(sizeHint().width(), scaled_logo_height), | ||
Qt::KeepAspectRatio, Qt::SmoothTransformation | ||
); | ||
ui_->logoLabel->setPixmap(scaled_logo); | ||
setFixedSize(sizeHint()); | ||
} | ||
|
||
AboutDialog::~AboutDialog() = default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/* | ||
* InputLeap -- mouse and keyboard sharing utility | ||
* Copyright (C) 2023-2024 InputLeap Developers | ||
* Copyright (C) 2012-2016 Symless Ltd. | ||
* Copyright (C) 2008 Volker Lanz ([email protected]) | ||
* | ||
|
@@ -26,9 +27,6 @@ namespace Ui | |
class AboutDialog; | ||
} | ||
|
||
class QWidget; | ||
class QString; | ||
|
||
class AboutDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters