Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[main]
host = https://www.transifex.com

[dash.dash_ents]
[o:defcon:p:defcon:r:defcon-qt-wallet]
file_filter = src/qt/locale/dash_<lang>.ts
source_file = src/qt/locale/dash_en.xlf
source_file = src/qt/locale/dash_en.ts
source_lang = en
type = QT
71 changes: 23 additions & 48 deletions src/qt/emptystatewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QSpacerItem>
#include <QVBoxLayout>

#include <tuple>

EmptyStateWidget::State EmptyStateWidget::stateFor(bool modern, int rows, int unfiltered_rows, bool loading)
EmptyStateWidget::State EmptyStateWidget::stateFor(bool modern, int rows, int unfiltered_rows, bool syncing)
{
if (!modern || rows > 0) return State::Hidden;
// A filter explains an empty list better than a sync still running.
if (unfiltered_rows > 0) return State::Filtered;
return loading ? State::Loading : State::Empty;
return syncing ? State::Syncing : State::Empty;
}

EmptyStateWidget::EmptyStateWidget(const QString& glyph, const QString& title, const QString& text,
Expand Down Expand Up @@ -75,7 +74,8 @@ EmptyStateWidget::EmptyStateWidget(const QString& glyph, const QString& title, c
text_row->addWidget(m_text, 1);
text_row->addStretch(0);
message->addLayout(text_row);
message->addSpacing(16);
m_action_gap = new QSpacerItem(0, 16, QSizePolicy::Minimum, QSizePolicy::Fixed);
message->addItem(m_action_gap);
m_action = new QPushButton(m_message);
m_action->setObjectName("emptyStateAction");
m_action->setMinimumWidth(150);
Expand All @@ -90,45 +90,8 @@ EmptyStateWidget::EmptyStateWidget(const QString& glyph, const QString& title, c
}
});

// Placeholder rows, as the list will look once its data is in.
m_skeleton = new QWidget(this);
m_skeleton->setObjectName("emptyStateSkeleton");
auto* skeleton = new QVBoxLayout(m_skeleton);
skeleton->setContentsMargins(12, 12, 12, 0);
skeleton->setSpacing(24);
for (int row = 0; row < 3; ++row) {
auto* line = new QHBoxLayout;
line->setSpacing(14);
auto* dot = new QFrame(m_skeleton);
dot->setObjectName("skeletonDot");
dot->setFixedSize(36, 36);
line->addWidget(dot);
auto* bars = new QVBoxLayout;
bars->setSpacing(9);
// A long bar over a short one, about three quarters and two fifths wide.
for (const auto& [name, width, height] : {std::tuple{"skeletonLine", 76, 11}, std::tuple{"skeletonLineShort", 42, 8}}) {
auto* bar_row = new QHBoxLayout;
bar_row->setSpacing(0);
auto* bar = new QFrame(m_skeleton);
bar->setObjectName(name);
bar->setFixedHeight(height);
bar_row->addWidget(bar, width);
bar_row->addStretch(100 - width);
bars->addLayout(bar_row);
}
line->addLayout(bars, 1);
skeleton->addLayout(line);
}
auto* loading = new QLabel(tr("Loading…"), m_skeleton);
loading->setObjectName("emptyStateLoading");
loading->setAlignment(Qt::AlignCenter);
skeleton->addSpacing(6);
skeleton->addWidget(loading);
skeleton->addStretch();
layout->addWidget(m_skeleton);

GUIUtil::setFont({m_title}, GUIUtil::FontWeight::Bold, 16);
GUIUtil::setFont({m_text, loading}, GUIUtil::FontWeight::Normal, 13);
GUIUtil::setFont({m_text}, GUIUtil::FontWeight::Normal, 13);
GUIUtil::updateFonts();
paintSymbol();
hide();
Expand Down Expand Up @@ -163,12 +126,24 @@ void EmptyStateWidget::setState(State state)
return;
}
const bool filtered = state == State::Filtered;
m_title->setText(filtered ? tr("No matching results") : m_title_text);
m_text->setText(filtered ? tr("Try a different search or clear your filters.") : m_text_text);
// The wallet's rows come with the blocks it catches up on, which can take
// hours on a first start: that is a wait for the network, not a list
// being loaded, and the list says which. There is nothing to press
// meanwhile, so the action goes, and its gap with it.
const bool syncing = state == State::Syncing;
m_title->setText(filtered ? tr("No matching results") : syncing ? tr("Waiting for synchronization") : m_title_text);
m_text->setText(filtered ? tr("Try a different search or clear your filters.") :
syncing ? tr("Your transactions will appear here as the wallet catches up with the network.") : m_text_text);
m_action->setText(filtered ? tr("Clear filters") : m_action_text);
m_message->setVisible(state != State::Loading);
m_skeleton->setVisible(state == State::Loading);
setAccessibleName(state == State::Loading ? tr("Loading…") : m_title->text());
if (m_action->isHidden() != syncing) {
// The gap first, and both before the list is fitted below: showing
// the button lays the card out at once, so fitList() measures the
// message with its button and the room above it.
m_action_gap->changeSize(0, syncing ? 0 : 16, QSizePolicy::Minimum, QSizePolicy::Fixed);
m_message->layout()->invalidate();
m_action->setVisible(!syncing);
}
setAccessibleName(m_title->text());
followViewport();
show();
raise();
Expand Down
19 changes: 11 additions & 8 deletions src/qt/emptystatewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ QT_BEGIN_NAMESPACE
class QAbstractScrollArea;
class QLabel;
class QPushButton;
class QSpacerItem;
class QWidget;
QT_END_NAMESPACE

/**
* What Abyss shows where a list has nothing to show: a glyph, a title, one
* sentence and one action. When only a filter hides the rows it offers to
* clear the filter instead, and while the wallet is still catching up it
* draws placeholder rows. Laid over a list's viewport, the list keeps its own
* header. The pages decide the state; classic themes always pass Hidden, so
* they never see it.
* clear the filter instead, and while the wallet is still catching up it says
* that it waits for the synchronization, with no action. Laid over a list's
* viewport, the list keeps its own header. The pages decide the state; classic
* themes always pass Hidden, so they never see it.
*/
class EmptyStateWidget : public QFrame
{
Expand All @@ -32,11 +33,12 @@ class EmptyStateWidget : public QFrame
Hidden, //!< the list has rows, or the theme is classic
Empty, //!< nothing yet: the page's own sentence and action
Filtered, //!< there are rows, but the filters hide all of them
Loading, //!< nothing yet, and the wallet is still synchronizing
Syncing, //!< nothing yet, and the wallet is still synchronizing
};

//! The state for a list showing `rows` of `unfiltered_rows`.
static State stateFor(bool modern, int rows, int unfiltered_rows, bool loading);
//! The state for a list showing `rows` of `unfiltered_rows`. Only the
//! transaction lists wait on the synchronization.
static State stateFor(bool modern, int rows, int unfiltered_rows, bool syncing);

EmptyStateWidget(const QString& glyph, const QString& title, const QString& text,
const QString& action, QWidget* parent);
Expand Down Expand Up @@ -75,10 +77,11 @@ class EmptyStateWidget : public QFrame
int m_list_minimum{0};
int m_floor{0};
QWidget* m_message{nullptr};
QWidget* m_skeleton{nullptr};
QLabel* m_symbol{nullptr};
QLabel* m_title{nullptr};
QLabel* m_text{nullptr};
//! The room between the sentence and the action; it goes with the action.
QSpacerItem* m_action_gap{nullptr};
QPushButton* m_action{nullptr};

void paintSymbol();
Expand Down
2 changes: 1 addition & 1 deletion src/qt/forms/optionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@
</property>
<property name="text">
<string>Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</string>
https://app.transifex.com/defcon/defcon/</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/dash_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3052,9 +3052,9 @@ Nur der Listeneintrag wird entfernt. Falls die Adresse in die Wallet importiert
</message>
<message>
<source>Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</source>
https://app.transifex.com/defcon/defcon/</source>
<translation>Fehlt eine Sprache oder ist eine Übersetzung unvollständig? Helfen Sie hier, die Übersetzung zu verbessern:
https://explore.transifex.com/dash/dash/</translation>
https://app.transifex.com/defcon/defcon/</translation>
</message>
<message>
<source>Options set in this dialog are overridden by the command line or in the configuration file:</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/dash_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3836,9 +3836,9 @@ Only the list entry is removed. If the address was imported into the wallet it r
<message>
<location line="+169"/>
<source>Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</source>
https://app.transifex.com/defcon/defcon/</source>
<translation>Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</translation>
https://app.transifex.com/defcon/defcon/</translation>
</message>
<message>
<location line="+131"/>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/dash_en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -4135,9 +4135,9 @@ Only the list entry is removed. If the address was imported into the wallet it r
</trans-unit>
<trans-unit id="_msg778" approved="yes">
<source xml:space="preserve">Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</source>
https://app.transifex.com/defcon/defcon/</source>
<target xml:space="preserve">Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</target>
https://app.transifex.com/defcon/defcon/</target>
<context-group purpose="location"><context context-type="linenumber">982</context></context-group>
</trans-unit>
<trans-unit id="_msg779" approved="yes">
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/dash_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3052,9 +3052,9 @@ Seule l’entrée de la liste sera retirée. Si l’adresse a été importée da
</message>
<message>
<source>Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</source>
https://app.transifex.com/defcon/defcon/</source>
<translation>Langue absent ou traduction incompléte ? Aidez à traduire ici :
https://explore.transifex.com/dash/dash/</translation>
https://app.transifex.com/defcon/defcon/</translation>
</message>
<message>
<source>Options set in this dialog are overridden by the command line or in the configuration file:</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/dash_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1813,9 +1813,9 @@
</message>
<message>
<source>Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</source>
https://app.transifex.com/defcon/defcon/</source>
<translation>Нет Вашего языка или перевод неполон? Помогите нам сделать перевод лучше:
https://explore.transifex.com/dash/dash/</translation>
https://app.transifex.com/defcon/defcon/</translation>
</message>
<message>
<source>Options set in this dialog are overridden by the command line or in the configuration file:</source>
Expand Down
4 changes: 2 additions & 2 deletions src/qt/locale/dash_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1801,9 +1801,9 @@
</message>
<message>
<source>Language missing or translation incomplete? Help contributing translations here:
https://explore.transifex.com/dash/dash/</source>
https://app.transifex.com/defcon/defcon/</source>
<translation>缺少相关语言或翻译不完整?请到这里协助翻译:
https://explore.transifex.com/dash/dash/</translation>
https://app.transifex.com/defcon/defcon/</translation>
</message>
<message>
<source>Options set in this dialog are overridden by the command line or in the configuration file:</source>
Expand Down
30 changes: 21 additions & 9 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ OverviewPage::OverviewPage(QWidget* parent) :

connect(ui->listTransactions, &TransactionOverviewWidget::clicked, this, &OverviewPage::handleTransactionClicked);

// Abyss says what an empty list means, or that it is still loading.
// Abyss says what an empty list means, or that it waits for the sync.
m_transactions_empty = new EmptyStateWidget("history", tr("No recent transactions"),
tr("Your recent transactions will appear here."), tr("Receive"), ui->listTransactions);
m_transactions_empty->coverViewport(ui->listTransactions);
Expand Down Expand Up @@ -686,7 +686,8 @@ void OverviewPage::updateEmptyState()
{
if (m_transactions_empty == nullptr) return;
// Rows the overview leaves out (inactive ones, past the limit) are not a
// filter the user could clear, so an empty list is only empty or loading.
// filter the user could clear, so an empty list is only empty or waiting
// for the sync.
m_transactions_empty->setState(filter == nullptr ? EmptyStateWidget::State::Hidden :
EmptyStateWidget::stateFor(GUIUtil::isModernTheme(), filter->rowCount(), 0, m_out_of_sync));
}
Expand Down Expand Up @@ -969,7 +970,10 @@ void OverviewPage::updateStakingCard()
if (m_staking_card == nullptr) return;
const bool modern = GUIUtil::isModernTheme();
const StakingState state = stakingState();
QString word, detail, button;
// The line says what is the matter and what to do about it; what only a
// log or a command line can use (the thread, the option's name) is the
// line's tooltip.
QString word, detail, tip, button;
GUIUtil::ThemedColor color = GUIUtil::ThemedColor::UNCONFIRMED;
switch (state) {
case StakingState::Unavailable:
Expand All @@ -978,10 +982,16 @@ void OverviewPage::updateStakingCard()
break;
case StakingState::Disabled:
word = tr("Off");
// Not running while configured: the thread stopped on an error and is
// between retries; the log has the reason, the card must not guess one.
detail = m_staking.configured ? tr("The node's staking thread is not running. See debug.log.")
: tr("This node runs without staking (-staking=0).");
if (m_staking.configured) {
// Not running while configured: the thread stopped on an error and
// is between retries; the log has the reason, the card must not
// guess one.
detail = tr("Staking stopped and will retry soon. If it stays off, restart the wallet.");
tip = tr("The staking thread is not running. The debug log file has the reason.");
} else {
detail = tr("Staking is turned off in the startup settings. To stake, turn it on and restart.");
tip = tr("The wallet was started with -staking=0, in its configuration file or on its command line.");
}
break;
case StakingState::Locked:
// The banner over the network bar says why and holds the unlock, so
Expand Down Expand Up @@ -1013,6 +1023,9 @@ void OverviewPage::updateStakingCard()
detail = m_staking.wallet_state == NOT_STAKING_BALANCE ? tr("No spendable balance to stake.") :
m_staking.wallet_state == NOT_STAKING_DEPTH ? tr("None of the coins can stake right now.") :
tr("Looking for coins to stake.");
if (m_staking.wallet_state == NOT_STAKING_DEPTH) {
tip = tr("Coins stay out while immature or too young, under the smallest or over the largest stake, or exactly a masternode collateral.");
}
button = tr("Pause staking");
color = GUIUtil::ThemedColor::BLUE;
break;
Expand All @@ -1028,8 +1041,7 @@ void OverviewPage::updateStakingCard()
m_staking_detail->setText(detail);
// An empty line would still take a row and its spacing.
if (m_staking_detail->isHidden() == !detail.isEmpty()) m_staking_detail->setVisible(!detail.isEmpty());
m_staking_detail->setToolTip(state == StakingState::Ready && m_staking.wallet_state == NOT_STAKING_DEPTH ?
tr("Coins stay out while immature or too young, under the smallest or over the largest stake, or exactly a masternode collateral.") : QString());
m_staking_detail->setToolTip(tip);
m_staking_button->setText(button);
// Each tick lands here: a name that did not change is not announced again.
if (m_staking_button->accessibleName() != button) m_staking_button->setAccessibleName(button);
Expand Down
21 changes: 2 additions & 19 deletions src/qt/res/css/defcon-dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -1473,10 +1473,9 @@ QMenu QFrame#abyssMenuPairDivider {
border: none;
}

/* Stage 3: empty and loading states. Only Abyss shows them. */
/* Stage 3: empty lists, and lists waiting for the synchronization. Only Abyss shows them. */
QFrame#emptyState,
QFrame#emptyState QWidget#emptyStateMessage,
QFrame#emptyState QWidget#emptyStateSkeleton,
QFrame#emptyState QLabel {
background: transparent;
border: none;
Expand All @@ -1489,8 +1488,7 @@ QFrame#emptyState QFrame#emptyStateSymbol {
QFrame#emptyState QLabel#emptyStateTitle {
color: #ffffff;
}
QFrame#emptyState QLabel#emptyStateText,
QFrame#emptyState QLabel#emptyStateLoading {
QFrame#emptyState QLabel#emptyStateText {
color: #91a5bc;
}
QFrame#emptyState QPushButton#emptyStateAction,
Expand Down Expand Up @@ -1521,21 +1519,6 @@ QFrame#emptyState QPushButton#emptyStateSecondary:pressed {
border-color: #1297ff;
color: #ffffff;
}
QFrame#emptyState QFrame#skeletonDot {
background-color: #183048;
border: none;
border-radius: 18px;
}
QFrame#emptyState QFrame#skeletonLine {
background-color: #183048;
border: none;
border-radius: 4px;
}
QFrame#emptyState QFrame#skeletonLineShort {
background-color: #13283b;
border: none;
border-radius: 4px;
}

/* A neutral chip where the classic themes print a red "(out of sync)". */
QWidget#OverviewPage QFrame#frame QLabel#labelWalletStatus,
Expand Down
Loading
Loading