Skip to content

Commit

Permalink
Fixed minimum height issue (#1152)
Browse files Browse the repository at this point in the history
* Fixed minimum height issue

* Recovery page height reduced

* One more try to fix recovery window height

* Reducing font size on Recovery window when screen has low resolution

* Making GroupElement deserialize test stable

* Review comment applied
  • Loading branch information
levonpetrosyan93 authored Apr 3, 2022
1 parent 45f4bd6 commit 532346c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 39 deletions.
3 changes: 2 additions & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ RES_ICONS = \
qt/res/icons/ext_add_light.png

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

RES_FONTS = \
qt/res/fonts/Saira_SemiCondensed-Bold.ttf \
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoin.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
<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
18 changes: 0 additions & 18 deletions src/qt/forms/lelantusdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -764,18 +764,6 @@
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelYourAnoymizedCoinsText">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="font">
<font>
<weight>75</weight>
Expand All @@ -785,12 +773,6 @@
<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
2 changes: 1 addition & 1 deletion src/qt/forms/recover.ui
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Advanced: If you don't wish to generate a wallet with a seed phrase backup (not
</string>
</property>
<property name="wordWrap">
<bool>true</bool>
<bool>false</bool>
</property>
<property name="margin">
<number>10</number>
Expand Down
12 changes: 12 additions & 0 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ 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 @@ -1038,6 +1039,17 @@ 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
6 changes: 2 additions & 4 deletions src/qt/res/css/firo.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ WalletFrame,
QDialog {
border: 0px;
margin: 0;
padding-top: 20px;
padding-bottom: 20px;
font-size: 12pt;
}

Expand Down Expand Up @@ -551,8 +549,8 @@ QPushButton {
min-height: 26px;
padding-left: 12px;
padding-right: 12px;
padding-top: 4px;
padding-bottom: 4px;
padding-top: 1px;
padding-bottom: 1px;
font: 12pt 'Source Sans Pro';
}

Expand Down
27 changes: 27 additions & 0 deletions src/qt/res/css/firo_low.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**********************************************************************
* Copyright (c) 2021-2021 The Firo Core developers
* Distributed under the MIT software license, see the accompanying
* file COPYING or http://www.opensource.org/licenses/mit-license.php.
**********************************************************************/

/* Recover */

QWidget#Recover QLabel#textLabel,
QWidget#Recover QLabel#textLabel2,
QWidget#Recover QLabel#textLabel3,
QWidget#Recover QLabel#textLabel4,
QWidget#Recover QRadioButton#use12,
QWidget#Recover QRadioButton#use24,
QWidget#Recover QRadioButton#createNew,
QWidget#Recover QRadioButton#recoverExisting,
QWidget#Recover QLabel#errorMessage,
QWidget#Recover QLabel#labelPcodes,
QWidget#Recover QLineEdit#mnemonicWords,
QWidget#Recover QLineEdit#mnemonicPassPhrase,
QWidget#Recover QLineEdit#mnemonicPassPhrase2,
QWidget#Recover QCheckBox#usePassphrase{
min-height: 0px;
border-radius: 1px;
font: 10pt 'Source Sans Pro';
}

24 changes: 9 additions & 15 deletions src/sigma/test/serialize_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,14 @@ BOOST_AUTO_TEST_CASE(group_element_serialize)

BOOST_AUTO_TEST_CASE(group_element_invalid)
{
secp_primitives::GroupElement initial;
initial.randomize();
unsigned char buffer [initial.memoryRequired()];
initial.serialize(buffer);
//Shift all elements to right by 2, to make it invalid
for (int i = initial.memoryRequired() - 1; i > 1; i--)
buffer[i] = buffer[i - 2];
buffer[0] = std::rand();
buffer[1] = std::rand();

// Making the point not infinity as it is allowed in deserialization
buffer[33] = 0;

// Invalid GroupElement generated in advance
std::string str = " F I R O T E S T S T R I N G ";
std::vector<unsigned char> buffer(str.begin(), str.end());
buffer.push_back(0);
std::cout<<buffer.size()<<std::endl;
secp_primitives::GroupElement resulted;
BOOST_CHECK_THROW(resulted.deserialize(buffer), std::exception);
BOOST_CHECK_THROW(resulted.deserialize(buffer.data()), std::exception);

}

BOOST_AUTO_TEST_CASE(group_element_serialize_infinity)
Expand All @@ -44,7 +37,8 @@ BOOST_AUTO_TEST_CASE(group_element_serialize_infinity)
unsigned char buffer [initial.memoryRequired()];
initial.serialize(buffer);
secp_primitives::GroupElement resulted;
resulted.deserialize(buffer);
BOOST_CHECK_NO_THROW(resulted.deserialize(buffer));
BOOST_CHECK(resulted.isInfinity());
BOOST_CHECK(initial == resulted);
}

Expand Down

0 comments on commit 532346c

Please sign in to comment.