Skip to content

Commit

Permalink
Merge pull request input-leap#1823 from sithlord48/cleanerGui2
Browse files Browse the repository at this point in the history
Code cleanup: AboutDialog
  • Loading branch information
p12tic authored Feb 26, 2024
2 parents a006787 + ced41ed commit 6cfeacd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 47 deletions.
30 changes: 10 additions & 20 deletions src/gui/src/AboutDialog.cpp
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])
*
Expand All @@ -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;
4 changes: 1 addition & 3 deletions src/gui/src/AboutDialog.h
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])
*
Expand All @@ -26,9 +27,6 @@ namespace Ui
class AboutDialog;
}

class QWidget;
class QString;

class AboutDialog : public QDialog
{
Q_OBJECT
Expand Down
34 changes: 10 additions & 24 deletions src/gui/src/AboutDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>300</height>
<width>0</width>
<height>0</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -22,18 +22,6 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>450</width>
<height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string>About InputLeap</string>
</property>
Expand All @@ -52,6 +40,7 @@
<property name="text">
<string>&lt;p&gt;
Keyboard and mouse sharing application. Cross platform and open source.&lt;br /&gt;&lt;br /&gt;
Copyright © 2022-2024 InputLeap Developers&lt;br /&gt;
Copyright © 2018 Debauchee Open Source Group&lt;br /&gt;
Copyright © 2012-2016 Symless Ltd.&lt;br /&gt;
Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.&lt;br /&gt;&lt;br /&gt;
Expand All @@ -76,21 +65,18 @@ The InputLeap GUI is based on QSynergy by Volker Lanz.
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>100</height>
<height>50</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res/InputLeap.qrc">:/res/image/about.png</pixmap>
</property>
<property name="margin">
<number>0</number>
<widget class="QLabel" name="logoLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
Expand Down

0 comments on commit 6cfeacd

Please sign in to comment.