Skip to content

Commit 22c7d7c

Browse files
task update
1 parent f3fa82a commit 22c7d7c

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

keychain_linux/passentry_gui/include/cmd.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <boost/hana/range.hpp>
1414
#include <boost/hana/for_each.hpp>
1515
#include <boost/hana/size.hpp>
16-
#include "widget.hpp"
16+
#include "keychain_gui_win.h"
1717

1818
namespace slave {
1919
enum struct cmds {unknown = 0, rawtrx, close, modify, length, last }; // to gui
@@ -26,7 +26,7 @@ namespace slave {
2626
struct cmd_base {
2727
cmd_base(cmds cmd_) : cmd(cmd_) {};
2828
cmds cmd;
29-
virtual void operator()(Widget* w, const fc_light::variant&) const = 0;
29+
virtual void operator()(keychain_gui_win* w, const fc_light::variant&) const = 0;
3030
virtual ~cmd_base() {};
3131
};
3232
struct cmd_list_singletone

keychain_linux/passentry_gui/src/cmd.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace slave
1111
struct cmd : cmd_base {
1212
cmd() : cmd_base(cmd_) {};
1313
virtual ~cmd() {};
14-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
14+
virtual void operator()(keychain_gui_win* w, const fc_light::variant& v) const override {
1515
throw std::runtime_error("operation is not implemented");
1616
};
1717
using params_t = void;
@@ -24,10 +24,10 @@ namespace slave
2424
virtual ~cmd() {};
2525
struct params {std::string rawtrx;};
2626
using params_t = params;
27-
virtual void operator()(Widget * w, const fc_light::variant& v) const override {
27+
virtual void operator()(keychain_gui_win * w, const fc_light::variant& v) const override {
2828
try {
2929
auto a = v.as<params_t>();
30-
w->pte->setText(QString(a.rawtrx.c_str()));
30+
// w->pte->setText(QString(a.rawtrx.c_str()));
3131
}
3232
catch (const std::exception &e) {throw std::runtime_error(e.what());}
3333
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}
@@ -39,7 +39,7 @@ namespace slave
3939
cmd() : cmd_base(cmds::close) {};
4040
virtual ~cmd() {};
4141
using params_t = void;
42-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
42+
virtual void operator()(keychain_gui_win* w, const fc_light::variant& v) const override {
4343
try { w->close(); }
4444
catch (const std::exception &e) {throw std::runtime_error(e.what());}
4545
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}
@@ -52,12 +52,12 @@ namespace slave
5252
virtual ~cmd() {};
5353
struct params { bool caps, num, shift; };
5454
using params_t = params;
55-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
55+
virtual void operator()(keychain_gui_win* w, const fc_light::variant& v) const override {
5656
try {
5757
auto a = v.as<params_t>();
58-
a.caps ? w->caps->setText("caps: on") : w->caps->setText("caps: off");
59-
a.num ? w->num->setText("num: on") : w->num->setText("num: off");
60-
a.shift ? w->shift->setText("shift: on") : w->shift->setText("shift: off");
58+
//a.caps ? w->caps->setText("caps: on") : w->caps->setText("caps: off");
59+
//a.num ? w->num->setText("num: on") : w->num->setText("num: off");
60+
//a.shift ? w->shift->setText("shift: on") : w->shift->setText("shift: off");
6161
}
6262
catch (const std::exception &e) {throw std::runtime_error(e.what());}
6363
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}
@@ -70,10 +70,10 @@ namespace slave
7070
virtual ~cmd() {};
7171
struct params {int len;};
7272
using params_t = params;
73-
virtual void operator()(Widget* w, const fc_light::variant& v) const override {
73+
virtual void operator()(keychain_gui_win* w, const fc_light::variant& v) const override {
7474
try {
7575
auto a = v.as<params_t>();
76-
w->ple->setText(QString (a.len, '*'));
76+
// w->ple->setText(QString (a.len, '*'));
7777
}
7878
catch (const std::exception &e) {throw std::runtime_error(e.what());}
7979
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}

keychain_linux/passentry_gui/src/keychain_gui_win.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,12 @@ void keychain_gui_win::keyPressEvent(QKeyEvent *event)
271271
void keychain_gui_win::parse(const std::string s)
272272
{
273273
auto a = fc_light::json::from_string(s);
274+
using namespace slave;
274275
try {
275276
auto cmd = a.as<slave::cmd_common>();
276277
auto cmd_map = slave::cmd_list_singletone::instance();
277278
auto p_func = cmd_map[cmd.cmd];
278-
// (*p_func)(this, cmd.params);
279+
(*p_func)(this, cmd.params);
279280
}
280281
catch (const std::exception &e) {throw std::runtime_error(e.what());}
281282
catch (const fc_light::exception &e) {throw std::runtime_error(e.what());}

0 commit comments

Comments
 (0)