Skip to content

Commit

Permalink
Make UI smaller for ubuntu (#1210)
Browse files Browse the repository at this point in the history
* Make UI smaller for ubuntu

* Make UI smaller
  • Loading branch information
firstcryptoman authored and levonpetrosyan93 committed May 17, 2023
1 parent f492160 commit 0ce0cfc
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 93 deletions.
3 changes: 1 addition & 2 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ RES_ICONS = \
qt/res/icons/ext_add_light.png

RES_CSS = \
qt/res/css/firo.css \
qt/res/css/firo_low.css
qt/res/css/firo.css

RES_FONTS = \
qt/res/fonts/Saira_SemiCondensed-Bold.ttf \
Expand Down
3 changes: 0 additions & 3 deletions src/qt/bitcoin.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@
<qresource prefix="/css">
<file alias="firoTheme">res/css/firo.css</file>
</qresource>
<qresource prefix="/css">
<file alias="firoLowTheme">res/css/firo_low.css</file>
</qresource>
<qresource prefix="/fonts">
<file alias="Saira_SemiCondensed-Bold">res/fonts/Saira_SemiCondensed-Bold.ttf</file>
<file alias="SourceSansPro-Regular">res/fonts/SourceSansPro-Regular.ttf</file>
Expand Down
11 changes: 8 additions & 3 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include <QAction>
#include <QApplication>
#include <QDateTime>
#include <QDesktopWidget>
#include <QDragEnterEvent>
#include <QIcon>
#include <QLabel>
Expand All @@ -62,6 +61,7 @@
#include <QMessageBox>
#include <QMimeData>
#include <QProgressDialog>
#include <QScreen>
#include <QSettings>
#include <QShortcut>
#include <QStackedWidget>
Expand Down Expand Up @@ -151,7 +151,11 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
// load stylesheet
GUIUtil::loadTheme();

GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
QSettings settings;
if (!restoreGeometry(settings.value("nWindow").toByteArray())) {
// Restore failed (perhaps missing setting), center the window
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
}

QString windowTitle = tr(PACKAGE_NAME) + " - ";
#ifdef ENABLE_WALLET
Expand Down Expand Up @@ -306,7 +310,8 @@ BitcoinGUI::~BitcoinGUI()
// Unsubscribe from notifications from core
unsubscribeFromCoreSignals();

GUIUtil::saveWindowGeometry("nWindow", this);
QSettings settings;
settings.setValue("nWindow", saveGeometry());
if(trayIcon) // Hide tray icon, as deleting will let it linger until quit (on Ubuntu)
trayIcon->hide();
#ifdef Q_OS_MAC
Expand Down
4 changes: 2 additions & 2 deletions src/qt/forms/blanksigmadialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>835</width>
<height>593</height>
<width>770</width>
<height>395</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_1">
Expand Down
4 changes: 2 additions & 2 deletions src/qt/forms/coincontroldialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1000</width>
<height>500</height>
<width>781</width>
<height>358</height>
</rect>
</property>
<property name="windowTitle">
Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/elyassetsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>664</width>
<height>474</height>
<height>362</height>
</rect>
</property>
<property name="windowTitle">
Expand Down
23 changes: 17 additions & 6 deletions src/qt/forms/lelantusdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>914</width>
<height>815</height>
<height>699</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -582,10 +582,13 @@
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>10</number>
<number>5</number>
</property>
<property name="topMargin">
<number>10</number>
<number>1</number>
</property>
<property name="spacing">
<number>3</number>
</property>
<item row="5" column="0">
<widget class="QLabel" name="spendableText">
Expand Down Expand Up @@ -764,6 +767,9 @@
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelYourAnoymizedCoinsText">
<property name="enabled">
<bool>true</bool>
</property>
<property name="font">
<font>
<weight>75</weight>
Expand All @@ -773,6 +779,12 @@
<property name="text">
<string>Your Anonymized Coins</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="5" column="1">
Expand Down Expand Up @@ -952,8 +964,7 @@
</widget>
</item>
<item>
<widget class="BitcoinAmountField" name="anonymizeAmount">
</widget>
<widget class="BitcoinAmountField" name="anonymizeAmount"/>
</item>
<item>
<widget class="QLabel" name="anonymizeUnit">
Expand Down Expand Up @@ -1627,7 +1638,7 @@
</resources>
<connections/>
<buttongroups>
<buttongroup name="groupFee"/>
<buttongroup name="groupCustomFee"/>
<buttongroup name="groupFee"/>
</buttongroups>
</ui>
2 changes: 1 addition & 1 deletion src/qt/forms/receiverequestdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>487</width>
<height>597</height>
<height>426</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/sendcoinsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>850</width>
<height>578</height>
<height>535</height>
</rect>
</property>
<property name="windowTitle">
Expand Down
4 changes: 2 additions & 2 deletions src/qt/forms/sigmacoincontroldialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1000</width>
<height>500</height>
<width>748</width>
<height>319</height>
</rect>
</property>
<property name="windowTitle">
Expand Down
35 changes: 0 additions & 35 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ namespace GUIUtil {

static QString stylesheetDirectory = ":css";
static QString firoTheme = "firoTheme";
static QString firoLowTheme = "firoLowTheme";
static CCriticalSection cs_css;

QString dateTimeStr(const QDateTime &date)
Expand Down Expand Up @@ -847,29 +846,6 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }

#endif

void saveWindowGeometry(const QString& strSetting, QWidget *parent)
{
QSettings settings;
settings.setValue(strSetting + "Pos", parent->pos());
settings.setValue(strSetting + "Size", parent->size());
}

void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSize, QWidget *parent)
{
QSettings settings;
QPoint pos = settings.value(strSetting + "Pos").toPoint();
QSize size = settings.value(strSetting + "Size", defaultSize).toSize();

if (!pos.x() && !pos.y()) {
QRect screen = QApplication::desktop()->screenGeometry();
pos.setX((screen.width() - size.width()) / 2);
pos.setY((screen.height() - size.height()) / 2);
}

parent->resize(size);
parent->move(pos);
}

void setClipboard(const QString& str)
{
QApplication::clipboard()->setText(str, QClipboard::Clipboard);
Expand Down Expand Up @@ -1039,17 +1015,6 @@ void loadTheme()

stylesheet->append(strStyle);

if (QApplication::desktop()->screenGeometry().height() <= 800) {
fileName = stylesheetDirectory + "/" + firoLowTheme;
QFile qFile_(fileName);
if (!qFile_.open(QFile::ReadOnly)) {
throw std::runtime_error(strprintf("%s: Failed to open file: %s", __func__, fileName.toStdString()));
}

QString strLowStyle = QLatin1String(qFile_.readAll());
stylesheet->append(strLowStyle);
}

qApp->setStyleSheet(*stylesheet);
}

Expand Down
5 changes: 0 additions & 5 deletions src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,6 @@ namespace GUIUtil
bool GetStartOnSystemStartup();
bool SetStartOnSystemStartup(bool fAutoStart);

/** Save window size and position */
void saveWindowGeometry(const QString& strSetting, QWidget *parent);
/** Restore window size and position */
void restoreWindowGeometry(const QString& strSetting, const QSize &defaultSizeIn, QWidget *parent);

/* load stylesheet */
void loadTheme();

Expand Down
27 changes: 0 additions & 27 deletions src/qt/res/css/firo_low.css

This file was deleted.

11 changes: 8 additions & 3 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <QKeyEvent>
#include <QMenu>
#include <QMessageBox>
#include <QScreen>
#include <QScrollBar>
#include <QSettings>
#include <QThread>
Expand Down Expand Up @@ -420,7 +421,11 @@ RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) :
consoleFontSize(0)
{
ui->setupUi(this);
GUIUtil::restoreWindowGeometry("nRPCConsoleWindow", this->size(), this);
QSettings settings;
if (!restoreGeometry(settings.value("nRPCConsoleWindow").toByteArray())) {
// Restore failed (perhaps missing setting), center the window
move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
}

ui->openDebugLogfileButton->setToolTip(ui->openDebugLogfileButton->toolTip().arg(tr(PACKAGE_NAME)));

Expand Down Expand Up @@ -458,14 +463,14 @@ RPCConsole::RPCConsole(const PlatformStyle *_platformStyle, QWidget *parent) :
ui->detailWidget->hide();
ui->peerHeading->setText(tr("Select a peer to view detailed information."));

QSettings settings;
consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(QFont()).pointSize()).toInt();
clear();
}

RPCConsole::~RPCConsole()
{
GUIUtil::saveWindowGeometry("nRPCConsoleWindow", this);
QSettings settings;
settings.setValue("nRPCConsoleWindow", saveGeometry());
RPCUnsetTimerInterface(rpcTimerInterface);
delete rpcTimerInterface;
delete ui;
Expand Down

0 comments on commit 0ce0cfc

Please sign in to comment.