Skip to content

Commit 1a00db8

Browse files
Merge branch 'gui_linux'
2 parents 1d3ba62 + 7b06145 commit 1a00db8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2563
-159
lines changed

keychain_cmd_app/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ if(APPLE)
2222
endif()
2323

2424
SET(BOOST_COMPONENTS)
25-
LIST(APPEND BOOST_COMPONENTS log date_time system filesystem program_options signals serialization chrono unit_test_framework locale thread exception iostreams)
25+
LIST(APPEND BOOST_COMPONENTS log date_time system filesystem program_options serialization chrono unit_test_framework locale thread exception iostreams)
2626
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
2727

2828
SET(BOOST_ROOT $ENV{BOOST_ROOT})

keychain_lib/include/keychain_lib/keychain_commands.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ struct keychain_command<command_te::create>: keychain_command_base
587587
hash = dev::ethash::sha3_ethash(keys.pub());
588588
priv_key = keys.secret();
589589
filename = hash.hex().substr(0,16);
590-
keyname = params.keyname + "@"+ filename;
590+
keyname = params.keyname ;
591591
filename += ".json";
592592
}
593593
break;

keychain_linux/passentry_cmd/pass_entry_term.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ std::wstring pass_entry_term::input_password(const KeySym * map, int socket)
216216
char name[256] = "Unknown";
217217
bool first_key = true;
218218
auto gui = polling(socket);
219-
ChangeKbProperty(dev_info, kbd_atom, device_enabled_prop, dev_cnt, 0);
219+
//ChangeKbProperty(dev_info, kbd_atom, device_enabled_prop, dev_cnt, 0);
220220

221221
capslock = keyState(XK_Caps_Lock);
222222
numlock = keyState(XK_Num_Lock);
@@ -257,7 +257,7 @@ std::wstring pass_entry_term::input_password(const KeySym * map, int socket)
257257
if ( ev[1].code <= 255)
258258
{
259259
kbd_id = fd_list[id];
260-
if (ioctl(kbd_id, EVIOCGRAB, 1) != 0) throw std::runtime_error("cannot get exclusive access to keyboard");
260+
//if (ioctl(kbd_id, EVIOCGRAB, 1) != 0) throw std::runtime_error("cannot get exclusive access to keyboard");
261261
break;
262262
}
263263
}

keychain_linux/passentry_gui/CMakeLists.txt

+48-13
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,72 @@ set(CMAKE_CXX_STANDARD 14)
33
#set(CMAKE_CXX_FLAGS "-std=c++14 --verbose -fno-limit-debug-info")
44
set(CMAKE_CXX_FLAGS "-std=c++14 ")
55

6+
project(testproject)
7+
8+
69
if (NOT MSVC)
710
if ( LIBCXX_BUILD )
811
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
912
endif()
1013
endif()
1114

12-
set (CMAKE_PREFIX_PATH "${QT_ROOT}/gcc_64/lib/cmake/Qt5Widgets/")
15+
#set (CMAKE_PREFIX_PATH "${QT_ROOT}/gcc_64/lib/cmake/Qt5Widgets/")
16+
set (CMAKE_PREFIX_PATH "/home/user/Qt5.12.0/5.12.0/gcc_64/lib/cmake/Qt5Widgets")
1317

1418
project(passentrygui)
1519
# Find includes in corresponding build directories
1620

1721
set(CMAKE_INCLUDE_CURRENT_DIR ON)
18-
# Instruct CMake to run moc automatically when needed
22+
23+
#set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_SOURCE_DIR}/keychain_linux/passentry_gui/src")
24+
#set(AUTOGEN_BUILD_DIR "${CMAKE_SOURCE_DIR}/keychain_linux/passentry_gui/GeneratedFiles")
25+
1926
set(CMAKE_AUTOMOC ON)
20-
# Create code from a list of Qt designer ui files
21-
#set(CMAKE_AUTOUIC ON)
27+
set(CMAKE_AUTOUIC ON)
28+
#set(CMAKE_AUTORCC ON)
29+
30+
SET(Qt5_DIR /home/user/Qt5.12.0/5.12.0/gcc_64/lib/cmake/Qt5)
31+
SET(Qt5Core_DIR /home/user/Qt5.12.0/5.12.0/gcc_64/lib/cmake/Qt5Core)
32+
33+
find_package(Qt5Widgets CONFIG REQUIRED)
34+
find_package(Qt5Core)
35+
#find_package(Qt5 5.12.0 REQUIRED Gui Xml)
2236

37+
#find_package(Qt5Qml )
38+
#find_package(Qt5Svg)
39+
40+
#get_target_property(QtCore_location Qt5::Core LOCATION)
41+
42+
#add_definitions(-DUNICODE -D_UNICODE)
43+
44+
#qt5_add_resources(RESOURCES "${CMAKE_SOURCE_DIR}/keychain_linux/passentry_gui/Resources/*.qrc")
45+
#QT5_WRAP_UI(MOC_FILES "${CMAKE_SOURCE_DIR}/keychain_linux/passentry_gui/src/*.ui")
46+
#include_directories(${Qt5Widgets_INCLUDES})
47+
#include_directories(${Qt5Core_INCLUDES})
48+
#include_directories(${Qt5Qml_INCLUDES})
49+
#include_directories(${Qt5Svg_INCLUDES})
50+
#add_definitions(${Qt5Widgets_DEFINITIONS})
2351

2452
find_library(LIB_PTHREAD NAME pthread HINTS "/usr/lib/x86_64-linux-gnu")
2553

2654
SET(BOOST_COMPONENTS)
27-
LIST(APPEND BOOST_COMPONENTS date_time system filesystem program_options signals serialization chrono unit_test_framework locale iostreams)
55+
LIST(APPEND BOOST_COMPONENTS log date_time system filesystem program_options serialization chrono locale thread exception iostreams)
2856
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
2957

58+
#SET(BOOST_ROOT $ENV{BOOST_ROOT})
3059
set(Boost_USE_MULTITHREADED ON)
3160
set(BOOST_ALL_DYN_LINK OFF)
3261

3362
FIND_PACKAGE(Boost 1.65 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
3463
SET(Boost_LIBRARIES ${Boost_LIBRARIES})
3564

36-
include_directories(
37-
"../../libraries/fc_light/include"
65+
66+
include_directories("${CMAKE_SOURCE_DIR}/keychain_linux/passentry_gui/include"
67+
# "${AUTOGEN_BUILD_DIR}"
68+
"${CMAKE_SOURCE_DIR}/libraries/fc_light/include"
69+
"${CMAKE_SOURCE_DIR}/keychain_lib/include"
70+
"${CMAKE_SOURCE_DIR}/libraries/kaitai_struct_cpp_stl_runtime"
71+
${Boost_INCLUDE_DIR}
3872
"/usr/include/libcxxabi"
3973
"${OPENSSL_ROOT_DIR}/include"
4074
${Boost_INCLUDE_DIR})
@@ -43,12 +77,13 @@ include_directories(
4377
find_package(Qt5Widgets CONFIG REQUIRED)
4478
find_library(LIB_OPENSSL NAME crypto HINTS "${OPENSSL_ROOT_DIR}/lib")
4579

46-
file(GLOB GUI_SOURCES "./*.cpp")
47-
file(GLOB GUI_INCLUDE "./*.hpp")
48-
49-
add_executable(passentry_gui ${GUI_SOURCES} ${GUI_INCLUDE})
80+
file(GLOB GUI_SOURCES "${CMAKE_SOURCE_DIR}/keychain_linux/passentry_gui/src/*.cpp")
81+
file(GLOB GUI_INCLUDE "${CMAKE_SOURCE_DIR}/keychain_linux/passentry_gui/include/*.h*")
82+
file(GLOB GUI_RESOURCES "./Resources/*.qrc")
83+
file(GLOB GUI_UIS "./src/*.ui")
5084

85+
add_executable(passentry_gui ${GUI_SOURCES} ${GUI_INCLUDE} ${GUI_RESOURCES} ${GUI_UIS} )
5186

5287
# Use the Widgets module from Qt 5
53-
target_link_libraries(passentry_gui Qt5::Widgets fc_light ${LIB_PTHREAD} ${LIB_OPENSSL} ${Boost_LIBRARIES} )
54-
88+
#target_link_libraries(passentry_gui Qt5::Widgets Qt5::Core Qt5::Qml Qt5::Svg keychain_common secmodlib kaitai_struct_cpp_stl_runtime fc_light ${LIB_PTHREAD} ${LIB_OPENSSL} ${Boost_LIBRARIES} )
89+
target_link_libraries(passentry_gui Qt5::Widgets Qt5::Core keychain_common kaitai_struct_cpp_stl_runtime fc_light ${LIB_PTHREAD} ${LIB_OPENSSL} ${Boost_LIBRARIES} )
Loading
292 Bytes
Loading
736 Bytes
Loading
635 Bytes
Loading
Loading
315 Bytes
Loading
397 Bytes
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<RCC>
2+
<qresource prefix="/keychain_gui_win">
3+
<file>background.png</file>
4+
<file>bg_edit.png</file>
5+
<file>bg_ephir.png</file>
6+
<file>but_cancel.png</file>
7+
<file>but_ok.png</file>
8+
<file>lock.png</file>
9+
<file>notify_back.png</file>
10+
<file>expert.png</file>
11+
<file>more_arrow.png</file>
12+
<file>header.png</file>
13+
<file>swap_logo.png</file>
14+
<file>btc_logo.png</file>
15+
<file>unsecure_lock.png</file>
16+
</qresource>
17+
</RCC>
583 Bytes
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#ifndef BITCOINWIDGET_H
2+
#define BITCOINWIDGET_H
3+
4+
#include <QWidget>
5+
#include <QLabel>
6+
#include "KeychainWidget.h"
7+
#include "SecureWindowElement.h"
8+
#include "Transaction.h"
9+
#include "ExpertModeElement.h"
10+
#include "PrivateKeyInMemoryWidget.h"
11+
#include <QVBoxLayout>
12+
#include <QLabel>
13+
14+
class BitcoinWidget : public KeychainWidget
15+
{
16+
Q_OBJECT
17+
public:
18+
BitcoinWidget(Transaction& trnsaction, QWidget *parent = Q_NULLPTR);
19+
void SetPosition(int x, int y, int width) override;
20+
int GetCurrentHeight() override;
21+
int GetCurrentWidth() override;
22+
~BitcoinWidget();
23+
24+
private:
25+
SecureWindowElement * cryptoType = Q_NULLPTR;
26+
//SecureWindowElement **from;
27+
SecureWindowElement ** to;
28+
SecureWindowElement ** amount;
29+
SecureWindowElement * from;
30+
//SecureWindowElement * to;
31+
//SecureWindowElement * amount;
32+
PrivateKeyInMemory * unlockTime=Q_NULLPTR;
33+
ExpertModeElement * expertModeElement = Q_NULLPTR;
34+
QPushButton * lookAll = Q_NULLPTR;
35+
int currentHeight = 0;
36+
int currentWidth = 0;
37+
int inElementCount = 0;
38+
int outElementCount = 0;
39+
int num_vins = 0;
40+
int num_vouts = 0;
41+
42+
public slots:
43+
void lookUpAll();
44+
};
45+
46+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#ifndef CHECKPASSWORDSTRENGTH_H
2+
#define CHECKPASSWORDSTRENGTH_H
3+
4+
#include <QString>
5+
#include <QRegExp>
6+
7+
class CheckPasswordStrength {
8+
public :
9+
enum PasswordStrength {
10+
weak=1,
11+
middle=2,
12+
strong=3
13+
};
14+
public:
15+
CheckPasswordStrength();
16+
~CheckPasswordStrength();
17+
PasswordStrength check(QString password);
18+
};
19+
20+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#ifndef ETHEREUMSWAPWIDGET_H
2+
#define ETHEREUMSWAPWIDGET_H
3+
4+
#include <QWidget>
5+
#include <Transaction.h>
6+
#include "KeychainWidget.h"
7+
#include "SecureWindowElement.h"
8+
#include "PrivateKeyInMemoryWidget.h"
9+
#include "ExpertModeElement.h"
10+
11+
class EthereumSwapWidget : public KeychainWidget
12+
{
13+
Q_OBJECT
14+
public:
15+
EthereumSwapWidget(Transaction &transaction, QWidget * parent = Q_NULLPTR);
16+
void SetPosition(int x, int y, int width) override;
17+
int GetCurrentHeight() override;
18+
int GetCurrentWidth() override;
19+
~EthereumSwapWidget();
20+
21+
private:
22+
23+
SecureWindowElement * swap = Q_NULLPTR;
24+
SecureWindowElement * action = Q_NULLPTR;
25+
SecureWindowElement * hash = Q_NULLPTR;
26+
SecureWindowElement * address = Q_NULLPTR;
27+
28+
SecureWindowElement * cryptoType = Q_NULLPTR;
29+
SecureWindowElement * from = Q_NULLPTR;
30+
SecureWindowElement * to = Q_NULLPTR;
31+
SecureWindowElement * amount = Q_NULLPTR;
32+
PrivateKeyInMemory * unlockTime = Q_NULLPTR;
33+
ExpertModeElement * expertModeElement = Q_NULLPTR;
34+
int currentHeight = 0;
35+
int currentWidth = 0;
36+
};
37+
#endif // !ETHEREUMSWAPWIDGET_H
38+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#ifndef ETHEREUMWIDGET_H
2+
#define ETHEREUMWIDGET_H
3+
4+
#include <QWidget>
5+
#include "Transaction.h"
6+
#include "SecureWindowElement.h"
7+
#include "ExpertModeElement.h"
8+
#include "PrivateKeyInMemoryWidget.h"
9+
#include "KeychainWidget.h"
10+
11+
12+
class EthereumWidget : public KeychainWidget
13+
{
14+
Q_OBJECT
15+
public:
16+
EthereumWidget(Transaction &transaction, QWidget * parent = Q_NULLPTR);
17+
void SetPosition(int x, int y, int width) override;
18+
int GetCurrentHeight() override;
19+
int GetCurrentWidth() override;
20+
~EthereumWidget();
21+
22+
private:
23+
SecureWindowElement * cryptoType = Q_NULLPTR;
24+
SecureWindowElement * from = Q_NULLPTR;
25+
SecureWindowElement * to = Q_NULLPTR;
26+
SecureWindowElement * amount = Q_NULLPTR;
27+
ExpertModeElement * expertModeElement = Q_NULLPTR;
28+
PrivateKeyInMemory * unlockTime= Q_NULLPTR;
29+
int currentHeight = 0;
30+
int currentWidth = 0;
31+
};
32+
33+
#endif
34+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef EXPERTMODE_DIALOG_H
2+
#define EXPERTMODE_DIALOG_H
3+
4+
#include <QWidget>
5+
#include <QDialog>
6+
#include <QString>
7+
#include <QPushButton>
8+
#include <QPlainTextEdit>
9+
10+
class ExpertModeDialog : public QDialog
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
ExpertModeDialog(QWidget * parent = Q_NULLPTR);
16+
~ExpertModeDialog();
17+
void SetExpertModeText(QString string);
18+
19+
protected:
20+
void keyPressEvent(QKeyEvent *event) override;
21+
private:
22+
QPlainTextEdit * transactionDescription;
23+
QPushButton * OKButton;
24+
25+
public slots:
26+
void closeExpertMode();
27+
};
28+
29+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#ifndef EXPERTMODELEMENT_H
2+
#define EXPERTMODELEMENT_H
3+
4+
#include <QWidget>
5+
#include <QLabel>
6+
#include <QPushButton>
7+
#include "ExpertModeDialog.h"
8+
#include "ExpertModeLabel.h"
9+
10+
class ExpertModeElement : public QWidget
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
ExpertModeElement(QWidget* parent = Q_NULLPTR);
16+
~ExpertModeElement();
17+
void SetExpertModeText(QString expertMode, bool cut=true);
18+
void SetPosition(int x, int y, int labelWidth, int valueWidth);
19+
20+
private:
21+
QLabel * expertLabel;
22+
ExpertModeLabel * expertValue;
23+
QPushButton * moreButton;
24+
25+
QString expertModeText;
26+
27+
public slots:
28+
void showMoreForExpert();
29+
};
30+
31+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#ifndef EXPERTMODELABEL_H
2+
#define EXPERTMODELABEL_H
3+
4+
#include <QWidget>
5+
#include <QLabel>
6+
#include <QString>
7+
8+
class ExpertModeLabel : public QLabel
9+
{
10+
Q_OBJECT
11+
public:
12+
ExpertModeLabel(QWidget * parent = Q_NULLPTR);
13+
~ExpertModeLabel() {}
14+
15+
signals:
16+
void clicked();
17+
18+
protected:
19+
void mousePressEvent(QMouseEvent * event);
20+
21+
};
22+
#endif

0 commit comments

Comments
 (0)