Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dbg
Browse files Browse the repository at this point in the history
metsma committed Oct 10, 2023
1 parent f2493e2 commit d4af329
Showing 8 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion client/widgets/AddressItem.cpp
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ AddressItem::AddressItem(CKey k, QWidget *parent, bool showIcon)

ui->remove->setIcons(QStringLiteral("/images/icon_remove.svg"), QStringLiteral("/images/icon_remove_hover.svg"),
QStringLiteral("/images/icon_remove_pressed.svg"), 17, 17);
ui->remove->init(LabelButton::White, {}, 0);
ui->remove->init(LabelButton::White);
connect(ui->add, &QToolButton::clicked, this, [this]{ emit add(this);});
connect(ui->remove, &LabelButton::clicked, this, [this]{ emit remove(this);});

37 changes: 22 additions & 15 deletions client/widgets/ContainerPage.cpp
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
#include "widgets/SignatureItem.h"
#include "widgets/WarningItem.h"

#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QFontMetrics>
@@ -51,33 +52,38 @@ ContainerPage::ContainerPage(QWidget *parent)
ui->container->setFont(Styles::font(Styles::Regular, 14));
ui->containerFile->setFont(Styles::font(Styles::Regular, 14));

ui->containerFile->installEventFilter(this);
ui->changeLocation->setIcons(QStringLiteral("/images/icon_Edit.svg"),
QStringLiteral("/images/icon_Edit_hover.svg"), QStringLiteral("/images/icon_Edit_pressed.svg"), 18, 18);
ui->changeLocation->init( LabelButton::BoxedDeepCeruleanWithCuriousBlue, tr("CHANGE"), Actions::ContainerLocation );
ui->containerFile->installEventFilter(this);
ui->cancel->init( LabelButton::BoxedMojo, tr("CANCEL"), Actions::ContainerCancel );
ui->convert->init( LabelButton::BoxedDeepCerulean, tr("ENCRYPT"), Actions::ContainerConvert );
ui->saveAs->init( LabelButton::BoxedDeepCerulean, tr("SAVE AS"), Actions::ContainerSaveAs );
ui->email->init( LabelButton::BoxedDeepCerulean, tr("SEND WITH E-MAIL"), Actions::ContainerEmail );
ui->summary->init( LabelButton::BoxedDeepCerulean, tr("PRINT SUMMARY"), Actions::ContainerSummary );
ui->save->init( LabelButton::BoxedDeepCerulean, tr("SAVE WITHOUT SIGNING"), Actions::ContainerSave );
ui->changeLocation->init(LabelButton::BoxedDeepCeruleanWithCuriousBlue, tr("CHANGE"));
ui->cancel->init(LabelButton::BoxedMojo, tr("CANCEL"));
ui->convert->init(LabelButton::BoxedDeepCerulean, tr("ENCRYPT"));
ui->saveAs->init(LabelButton::BoxedDeepCerulean, tr("SAVE AS"));
ui->email->init(LabelButton::BoxedDeepCerulean, tr("SEND WITH E-MAIL"));
ui->summary->init(LabelButton::BoxedDeepCerulean, tr("PRINT SUMMARY"));
ui->save->init(LabelButton::BoxedDeepCerulean, tr("SAVE WITHOUT SIGNING"));

mobileCode = Settings::MOBILEID_CODE;

auto connectCode = [this](QToolButton *btn, int code) {
connect(btn, &QToolButton::clicked, btn, [btn] { qDebug() << btn->objectName() << "::clicked"; });
connect(btn, &QToolButton::clicked, this, [this,code] { emit forward(code); });
};

connect(this, &ContainerPage::moved,this, &ContainerPage::setHeader);
connect(ui->changeLocation, &LabelButton::clicked, this, &ContainerPage::forward);
connect(ui->cancel, &LabelButton::clicked, this, &ContainerPage::forward);
connect(ui->save, &LabelButton::clicked, this, &ContainerPage::forward);
connectCode(ui->changeLocation, Actions::ContainerLocation);
connectCode(ui->cancel, Actions::ContainerCancel);
connectCode(ui->convert, Actions::ContainerConvert);
connectCode(ui->saveAs, Actions::ContainerSaveAs);
connectCode(ui->email, Actions::ContainerEmail);
connectCode(ui->summary, Actions::ContainerSummary);
connectCode(ui->save, Actions::ContainerSave);
connect(ui->leftPane, &FileList::addFiles, this, &ContainerPage::addFiles);
connect(ui->leftPane, &ItemList::removed, this, &ContainerPage::fileRemoved);
connect(ui->leftPane, &ItemList::addItem, this, &ContainerPage::forward);
connect(ui->rightPane, &ItemList::addItem, this, &ContainerPage::forward);
connect(ui->rightPane, &ItemList::addressSearch, this, &ContainerPage::addressSearch);
connect(ui->rightPane, &ItemList::removed, this, &ContainerPage::removed);
connect(ui->email, &LabelButton::clicked, this, &ContainerPage::forward);
connect(ui->summary, &LabelButton::clicked, this, &ContainerPage::forward);
connect(ui->saveAs, &LabelButton::clicked, this, &ContainerPage::forward);
connect(ui->convert, &LabelButton::clicked, this, &ContainerPage::forward);
connect(ui->containerFile, &QLabel::linkActivated, this, [this](const QString &link)
{ emit action(Actions::ContainerNavigate, link); });

@@ -174,6 +180,7 @@ bool ContainerPage::eventFilter(QObject *o, QEvent *e)

void ContainerPage::forward(int code)
{
qDebug() << objectName() << "::forward " << code;
switch (code)
{
case SignatureMobile:
4 changes: 2 additions & 2 deletions client/widgets/FileItem.cpp
Original file line number Diff line number Diff line change
@@ -31,9 +31,9 @@ FileItem::FileItem(QString file, ContainerState state, QWidget *parent)
ui->setupUi(this);
ui->fileName->setFont(Styles::font(Styles::Regular, 14));
ui->download->setIcons(QStringLiteral("/images/icon_download.svg"), QStringLiteral("/images/icon_download_hover.svg"), QStringLiteral("/images/icon_download_pressed.svg"), 17, 17);
ui->download->init(LabelButton::White, {}, 0);
ui->download->init(LabelButton::White);
ui->remove->setIcons(QStringLiteral("/images/icon_remove.svg"), QStringLiteral("/images/icon_remove_hover.svg"), QStringLiteral("/images/icon_remove_pressed.svg"), 17, 17);
ui->remove->init(LabelButton::White, {}, 0);
ui->remove->init(LabelButton::White);

stateChange(state);

2 changes: 1 addition & 1 deletion client/widgets/FileList.cpp
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ FileList::FileList(QWidget *parent)
{
ui->download->setIcons(QStringLiteral("/images/icon_download.svg"), QStringLiteral("/images/icon_download_hover.svg"),
QStringLiteral("/images/icon_download_pressed.svg"), 17, 17);
ui->download->init(LabelButton::White, QString(), 0);
ui->download->init(LabelButton::White);
ui->download->installEventFilter(
new ButtonHoverFilter(QStringLiteral(":/images/icon_download.svg"), QStringLiteral(":/images/icon_download_hover.svg"), this));
connect(ui->add, &LabelButton::clicked, this, &FileList::selectFile);
2 changes: 1 addition & 1 deletion client/widgets/ItemList.cpp
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ void ItemList::init(ItemType item, const char *header)
}
else
{
ui->add->init(LabelButton::DeepCeruleanWithLochmara, addLabel(), itemType == ItemFile ? FileAdd : AddressAdd);
ui->add->init(LabelButton::DeepCeruleanWithLochmara, addLabel());
ui->add->setFont(Styles::font(Styles::Condensed, 12));
}

6 changes: 2 additions & 4 deletions client/widgets/LabelButton.cpp
Original file line number Diff line number Diff line change
@@ -21,21 +21,19 @@
#include "Colors.h"
#include "Styles.h"

#include <QMouseEvent>
#include <QEvent>

using namespace ria::qdigidoc4::colors;

LabelButton::LabelButton( QWidget *parent ): QToolButton(parent)
{}

void LabelButton::init( Style style, const QString &label, int code )
void LabelButton::init(Style style, const QString &label)
{
setText(label);
setFont(Styles::font(Styles::Condensed, 12));
if(!label.isEmpty())
setAccessibleName(label.toLower());
disconnect(connection);
connection = connect(this, &QToolButton::clicked, this, [this, code]{ emit clicked(code); });
static const QString borderRadius = QStringLiteral(" border-radius: 2px;");
static const QString none = QStringLiteral("none");
static const QString solid = QStringLiteral("1px solid %1");
7 changes: 1 addition & 6 deletions client/widgets/LabelButton.h
Original file line number Diff line number Diff line change
@@ -34,20 +34,15 @@ class LabelButton : public QToolButton
BoxedDeepCeruleanWithCuriousBlue, // Edit
DeepCeruleanWithLochmara, // Add files
White,
None
};

explicit LabelButton(QWidget *parent = nullptr);

void init( Style style, const QString &label, int code );
void init(Style style, const QString &label = {});
void setIcons(const QString &normalIcon, const QString &hoverIcon, const QString &pressedIcon, int w, int h);

signals:
void clicked(int code);

private:
bool event(QEvent *e) override;

QString normal, hover, pressed;
QMetaObject::Connection connection;
};
2 changes: 1 addition & 1 deletion client/widgets/SignatureItem.cpp
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ SignatureItem::SignatureItem(DigiDocSignature s, ContainerState /*state*/, QWidg
ui->role->installEventFilter(this);
ui->remove->setIcons(QStringLiteral("/images/icon_remove.svg"), QStringLiteral("/images/icon_remove_hover.svg"),
QStringLiteral("/images/icon_remove_pressed.svg"), 17, 17);
ui->remove->init(LabelButton::White, {}, 0);
ui->remove->init(LabelButton::White);
ui->remove->setVisible(ui->signature.parent()->isSupported());
connect(ui->remove, &LabelButton::clicked, this, &SignatureItem::removeSignature);
init();

0 comments on commit d4af329

Please sign in to comment.