Skip to content

Commit

Permalink
qt: move more code to actual stylesheet
Browse files Browse the repository at this point in the history
will deal with html styling at a later date
  • Loading branch information
TheComputerGenie committed Feb 13, 2024
1 parent 8089acd commit fe79e9d
Show file tree
Hide file tree
Showing 17 changed files with 124 additions and 110 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,5 @@ src/cryptoconditions/src/stamp-h1
configure.ac.patch

src/gui/komodoku/

launchTest.sh
6 changes: 5 additions & 1 deletion src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,11 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog) {
}

// turn label red when dust
l7->setStyleSheet((fDust) ? "color:red;" : "");
if (fDust) {
l7->setProperty("urgent", true);
} else {
l7->setProperty("urgent", false);
}

// tool tips
QString toolTipDust = tr("This label turns red if any recipient receives an amount smaller than the current dust threshold.");
Expand Down
3 changes: 0 additions & 3 deletions src/qt/forms/intro.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="welcomeLabel">
<property name="styleSheet">
<string notr="true">QLabel { font-style:italic; }</string>
</property>
<property name="text">
<string>Welcome to %1.</string>
</property>
Expand Down
8 changes: 0 additions & 8 deletions src/qt/forms/modaloverlay.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
</property>
<item>
<widget class="QWidget" name="bgWidget" native="true">
<property name="styleSheet">
<string notr="true">#bgWidget { background: rgba(0,0,0,220); }</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutMain" stretch="1">
<property name="leftMargin">
<number>60</number>
Expand All @@ -49,11 +46,6 @@
</property>
<item>
<widget class="QWidget" name="contentWidget" native="true">
<property name="styleSheet">
<string notr="true">#contentWidget { background: rgba(255,255,255,240); border-radius: 6px; }

QLabel { color: rgb(40,40,40); }</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutSub" stretch="1,0,0,0">
<property name="spacing">
<number>0</number>
Expand Down
12 changes: 0 additions & 12 deletions src/qt/forms/overviewpage.ui
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@
<property name="visible">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">QLabel { background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488); color:#000000; }</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>3</number>
</property>
<property name="textInteractionFlags">
<set>Qt::TextSelectableByMouse</set>
</property>
Expand Down Expand Up @@ -560,9 +551,6 @@
</item>
<item>
<widget class="TransactionOverviewWidget" name="listTransactions">
<property name="styleSheet">
<string notr="true">QListView { background: transparent; }</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
Expand Down
21 changes: 0 additions & 21 deletions src/qt/forms/sendcoinsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,8 @@
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Coin Control Features</string>
</property>
Expand All @@ -103,9 +99,6 @@
</property>
<item>
<widget class="QPushButton" name="pushButtonCoinControl">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Inputs...</string>
</property>
Expand All @@ -129,18 +122,11 @@
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color:red;font-weight:bold;</string>
</property>
<property name="text">
<string>Insufficient funds!</string>
</property>
<property name="margin">
<number>5</number>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -172,9 +158,6 @@
<height>0</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QHBoxLayout" name="horizontalLayoutCoinControl5">
<property name="leftMargin">
<number>0</number>
Expand Down Expand Up @@ -717,12 +700,8 @@
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Transaction Fee:</string>
</property>
Expand Down
11 changes: 0 additions & 11 deletions src/qt/forms/zsendcoinsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Pay From:</string>
</property>
Expand Down Expand Up @@ -274,12 +271,8 @@
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Transaction Fee:</string>
</property>
Expand Down Expand Up @@ -417,12 +410,8 @@
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Operation ID:</string>
</property>
Expand Down
7 changes: 2 additions & 5 deletions src/qt/intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,10 @@ void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable
switch(status) {
case FreespaceChecker::ST_OK:
ui->errorMessage->setText(message);
ui->errorMessage->setStyleSheet("");
break;
case FreespaceChecker::ST_ERROR:
ui->errorMessage->setText(tr("Error") + ": " + message);
ui->errorMessage->setStyleSheet("QLabel { color: #800000 }");
ui->errorMessage->setProperty("urgent", true);
break;
}
/* Indicate number of bytes available */
Expand All @@ -237,9 +236,7 @@ void Intro::setStatus(int status, const QString &message, quint64 bytesAvailable
QString freeString = tr("%n GB of free space available", "", bytesAvailable/GB_BYTES);
if(bytesAvailable < requiredSpace * GB_BYTES) {
freeString += " " + tr("(of %n GB needed)", "", requiredSpace);
ui->freeSpace->setStyleSheet("QLabel { color: #800000 }");
} else {
ui->freeSpace->setStyleSheet("");
ui->freeSpace->setProperty("urgent", true);
}
ui->freeSpace->setText(freeString + ".");
}
Expand Down
15 changes: 11 additions & 4 deletions src/qt/komodoamountfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,17 @@ bool KomodoAmountField::validate() {
}

void KomodoAmountField::setValid(bool valid) {
if (valid)
amount->setStyleSheet("");
else
amount->setStyleSheet(STYLE_INVALID);
if (valid) {
amount->setProperty("valid", true);
amount->style()->unpolish(amount);
amount->style()->polish(amount);
amount->update();
} else {
amount->setProperty("valid", false);
amount->style()->unpolish(amount);
amount->style()->polish(amount);
amount->update();
}
}

bool KomodoAmountField::eventFilter(QObject *object, QEvent *event) {
Expand Down
4 changes: 2 additions & 2 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void OptionsDialog::on_hideTrayIcon_stateChanged(int fState) {
}

void OptionsDialog::showRestartWarning(bool fPersistent) {
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
ui->statusLabel->setProperty("urgent", true);

if(fPersistent) {
ui->statusLabel->setText(tr("Client restart required to activate changes."));
Expand All @@ -260,7 +260,7 @@ void OptionsDialog::updateProxyValidationState() {
clearStatusLabel();
} else {
setOkButtonState(false);
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
ui->statusLabel->setProperty("urgent", true);
ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/qt/qvalidatedlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ void QValidatedLineEdit::setValid(bool _valid) {
if(_valid == this->valid) {
return;
}

if(_valid) {
setStyleSheet("");
} else {
setStyleSheet(STYLE_INVALID);
}
this->valid = _valid;
}

Expand Down
22 changes: 15 additions & 7 deletions src/qt/res/themes/global.qss
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
/* Global Styles */
/* * = everything (if we don't set it then we want it to be this) */
/* setting this as a default lets us know what isn't themed and */
/* lets the baseline consistently be whatever we want it to be */
* {
background: white;
background-color: white;
color: black;
font-weight: normal;
}
/* All QFrame look like this unless we style them specific later */
QFrame { border: none; }

QFrame {
border: none;
}

/* Highlight in context menu */
QValidatedLineEdit { selection-background-color: green; }

/* makes tool buttons match Komodo logo colors */
QToolButton { background: QLinearGradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 #1B467C, stop: 1 #00EDD3); }

QToolButton {
background: QLinearGradient(x1: 0, y1: 1, x2: 0, y2: 0, stop: 0 #1B467C, stop: 1 #00EDD3);
QMenu::item:selected{
background-color: darkgreen;
color: white;
}

66 changes: 60 additions & 6 deletions src/qt/res/themes/pulled.qss
Original file line number Diff line number Diff line change
@@ -1,18 +1,72 @@
/* no need to hard code stylesheets and bury them */
QStatusBar QLabel {
color: black;
}
QStatusBar QLabel { color: black; }

/* The whole bar - both the status and overlay (since generic global) */
/* Yes, this was intended to only match specific styles; however, it needs to be here for obvious reasons */
QProgressBar {
background-color: #e8e8e8;
background-color: gainsboro;
border: 1px solid grey;
border-radius: 7px;
padding: 1px;
text-align: center;
}

/* incremental part */
QProgressBar::chunk {
background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 #FF8000, stop: 1 orange);
background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 chocolate, stop: 1 orange);
border-radius: 7px;
margin: 0px;
}
/* Payments */
/* note: currently payTo is NOT validated on entry like lineEditCoinControlChange(change address) is
presumably to decrease checks if multiple payees to just when send button clicked */
AmountSpinBox, QValidatedLineEdit { color: black; }
AmountSpinBox[valid="true"], QValidatedLineEdit[valid="true"] { background-color: white; }
AmountSpinBox[valid="false"], QValidatedLineEdit[valid="false"] { background-color: lightcoral; }

/* helps limit popup items - numbers represent states and not numerical digits */
QComboBox { combobox-popup: 0; }

/* Error status based on setProperty */
QLabel[urgent=true] { color: red; }
QLabel[urgent=false] { color: black; }
QLabel[waiting=true] { color: tomato; }
QLabel[passing=true] { color: green; }

/* this isn't pulled, but here as a reminder from when taking care of html */
#messagesWidget { background-color: white; }

/* ModalOverlay */
/* outer "border" */
#bgWidget { background: rgba(0,0,0,220); }
/* words */
#contentWidget QLabel { color: rgb(40,40,40); }
/* center "pane" */
#contentWidget {
background: rgba(255,255,255,240);
border-radius: 6px;
}

/* Overview page */
/* release notice */
#labelAlerts {
background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop:0 #F0D0A0, stop:1 #F8D488);
color: #000000;
qproperty-wordWrap: true;
margin: 3;
}
/* tx history list */
#listTransactions { background: transparent; }

/* SendCoinsDialog (both t and z, since they have same item names) */
/* these could be separated out by calling out dialog by name */
/* eg:
ZSendCoinsDialog #labelCoinControlFeatures { color: blue; }
*/
#labelCoinControlFeatures, #labelFeeHeadline, #labelCoinControlInsuffFunds { font-weight: bold; }
#labelCoinControlInsuffFunds {
color: red;
margin: 5;
}

/* 1st run */
#welcomeLabel { font-style:italic; }
Loading

0 comments on commit fe79e9d

Please sign in to comment.