diff --git a/resources.qrc b/resources.qrc --- a/resources.qrc +++ b/resources.qrc @@ -1,7 +1,6 @@ artwork/64-gpgpass.png - artwork/32-gpgpass.png artwork/sc-gpgpass.svg artwork/gnupg-logo-320x100tr.png diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,6 +21,7 @@ userinfo.h usersdialog.h util.h + welcomewidget.h clipboardhelper.cpp configdialog.cpp filecontent.cpp @@ -32,6 +33,7 @@ storemodel.cpp usersdialog.cpp util.cpp + welcomewidget.cpp ../resources.qrc ) @@ -41,6 +43,7 @@ usersdialog.ui passworddialog.ui userswidget.ui + welcomewidget.ui ) target_link_libraries(gpgpass_internal Qt6::Widgets KF6::Prison KF6::IconThemes KF6::I18n KF6::WidgetsAddons diff --git a/src/clipboardhelper.cpp b/src/clipboardhelper.cpp --- a/src/clipboardhelper.cpp +++ b/src/clipboardhelper.cpp @@ -63,8 +63,6 @@ } if (cleared) { m_mainWindow->statusBar()->showMessage(i18n("Clipboard cleared"), 2000); - } else { - m_mainWindow->statusBar()->showMessage(i18n("Clipboard not cleared"), 2000); } clippedText.clear(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -11,8 +11,6 @@ */ #include "mainwindow.h" -#include - #include "clipboardhelper.h" #include "configdialog.h" #include "filecontent.h" @@ -253,16 +251,14 @@ } /** - * @brief MainWindow::initStatusBar init statusBar with default message and logo + * @brief MainWindow::initStatusBar init statusBar */ void MainWindow::initStatusBar() { - ui->statusBar->showMessage(i18nc("placeholder is version number","Welcome to GnuPG Password Manager %1", QString::fromLocal8Bit(GPGPASS_VERSION_STRING))); - - QPixmap logo = QPixmap(QStringLiteral(":/artwork/32-gpgpass.png")); - QLabel *logoApp = new QLabel(statusBar()); - logoApp->setPixmap(logo); - statusBar()->addPermanentWidget(logoApp); + statusBar()->hide(); + connect(statusBar(), &QStatusBar::messageChanged, [this](const QString &message) { + statusBar()->setVisible(!message.isEmpty()); + }); } const QModelIndex MainWindow::getCurrentTreeViewIndex() @@ -320,10 +316,12 @@ ui->passwordName->setText(index.data().toString()); if (!file.isEmpty() && QFileInfo(file).isFile() && !cleared) { m_pass->Show(file); + ui->stackedWidget->setCurrentIndex(1); } else { clearPanel(); ui->actionEdit->setEnabled(false); ui->actionDelete->setEnabled(true); + ui->stackedWidget->setCurrentIndex(0); } } @@ -352,6 +350,7 @@ ui->actionDelete->setEnabled(false); ui->passwordName->setText(QString{}); clearPanel(); + ui->stackedWidget->setCurrentIndex(0); } void MainWindow::passShowHandler(const QString &p_output) @@ -438,11 +437,9 @@ /** * @brief Executes when the string in the search box changes, collapses the * TreeView - * @param arg1 */ -void MainWindow::filterList(const QString &arg1) +void MainWindow::filterList(const QString &) { - ui->statusBar->showMessage(i18n("Looking for: %1", arg1), 1000); ui->treeView->expandAll(); clearPanel(); ui->passwordName->setText(QString{}); diff --git a/src/mainwindow.ui b/src/mainwindow.ui --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -90,86 +90,88 @@ - - - 0 - - - 7 - - - - - - 0 - 0 - - - - - 0 - 20 - - - - - 10000000 - 30 - - - - Welcome to GnuPG Password Manager - - - - - - - - - - - 0 - 0 - - - - - 0 - 20 - - - - false - - - background: transparent - - - QFrame::NoFrame - - - QFrame::Plain - - + + + + + 0 - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + 7 + + + + + + 0 + 0 + + + + + 0 + 20 + + + + + 10000000 + 30 + + + + + + + + + + + + 0 + 0 + + + + + 0 + 20 + + + + false + + + background: transparent + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> - - - true - - - true - - - - + + + true + + + true + + + + + + @@ -269,6 +271,11 @@ signal1() + + WelcomeWidget + QWidget +
welcomewidget.h
+
lineEdit diff --git a/src/welcomewidget.h b/src/welcomewidget.h new file mode 100644 --- /dev/null +++ b/src/welcomewidget.h @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2024 g10 Code GmbH +// SPDX-Contributor: Carl Schwan +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include + +namespace Ui +{ +class WelcomeWidget; +} + +class WelcomeWidget : public QWidget +{ + Q_OBJECT +public: + WelcomeWidget(QWidget *parent = nullptr); + ~WelcomeWidget(); + +private: + QScopedPointer ui; +}; diff --git a/src/welcomewidget.cpp b/src/welcomewidget.cpp new file mode 100644 --- /dev/null +++ b/src/welcomewidget.cpp @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 g10 Code GmbH +// SPDX-Contributor: Carl Schwan +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "welcomewidget.h" +#include "ui_welcomewidget.h" +#include + +using namespace Qt::Literals::StringLiterals; + +WelcomeWidget::WelcomeWidget(QWidget *parent) + : QWidget(parent) + , ui(new Ui::WelcomeWidget) +{ + ui->setupUi(this); + + // center vertically + ui->mainLayout->insertStretch(0); + ui->mainLayout->addStretch(); + + const double titleFontSize = QApplication::font().pointSize() * 2; + auto font = ui->title->font(); + font.setPointSize(titleFontSize); + ui->title->setFont(font); + + QPixmap logo = QPixmap(QStringLiteral(":/artwork/64-gpgpass.png")); + ui->logo->setPixmap(logo); + + ui->version->setText(i18nc("@info", "Version: %1", QString::fromLocal8Bit(GPGPASS_VERSION_STRING))); +} + +WelcomeWidget::~WelcomeWidget() = default; diff --git a/src/welcomewidget.ui b/src/welcomewidget.ui new file mode 100644 --- /dev/null +++ b/src/welcomewidget.ui @@ -0,0 +1,26 @@ + + + + WelcomeWidget + + + + + + + + + Welcome to GnuPG Password Manager + + + + + + + + +