forked from lthn/blockchain
Remove qt-daemon GUI source files
Deleted all files related to the qt-daemon GUI, including source code, resources, and configuration files. This removes the Qt-based GUI application from the project.
This commit is contained in:
parent
7b18c06d2f
commit
ac6778dc34
16 changed files with 0 additions and 3560 deletions
1
src/gui/qt-daemon/.gitignore
vendored
1
src/gui/qt-daemon/.gitignore
vendored
|
|
@ -1 +0,0 @@
|
|||
*.user
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LSEnvironment</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>14E46</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Zano</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>app.icns</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string></string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>Zano</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>6E35b</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>14D125</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.10</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0640</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>6E35b</string>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>ZanoApp</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>zano</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 109 KiB |
|
|
@ -1,5 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>app.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
|
||||
IDI_ICON1 ICON DISCARDABLE "app.ico"
|
||||
|
|
@ -1,320 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2015 Boolberry developers
|
||||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "gui_utils.h"
|
||||
|
||||
// #include <QAbstractItemView>
|
||||
#include <QApplication>
|
||||
// #include <QClipboard>
|
||||
// #include <QDateTime>
|
||||
// #include <QDesktopServices>
|
||||
// #include <QDesktopWidget>
|
||||
// #include <QDoubleValidator>
|
||||
// #include <QFileDialog>
|
||||
// #include <QFont>
|
||||
// #include <QLineEdit>
|
||||
#include <QSettings>
|
||||
// #include <QTextDocument> // for Qt::mightBeRichText
|
||||
// #include <QThread>
|
||||
|
||||
// #if QT_VERSION < 0x050000
|
||||
// #include <QUrl>
|
||||
// #else
|
||||
// #include <QUrlQuery>
|
||||
// #endif
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include "currency_core/currency_config.h"
|
||||
#define GUI_LINK_NAME "Zano"
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _WIN32_WINNT
|
||||
#undef _WIN32_WINNT
|
||||
#endif
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#ifdef _WIN32_IE
|
||||
#undef _WIN32_IE
|
||||
#endif
|
||||
#define _WIN32_IE 0x0501
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlwapi.h>
|
||||
#endif
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/fstream.hpp>
|
||||
#if BOOST_FILESYSTEM_VERSION >= 3
|
||||
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
|
||||
#endif
|
||||
#include <boost/scoped_array.hpp>
|
||||
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 1000
|
||||
#endif
|
||||
|
||||
#if BOOST_FILESYSTEM_VERSION >= 3
|
||||
static boost::filesystem::detail::utf8_codecvt_facet utf8;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace gui_tools
|
||||
{
|
||||
|
||||
#ifdef WIN32
|
||||
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true)
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
wchar_t pszPath[MAX_PATH] = L"";
|
||||
|
||||
if (SHGetSpecialFolderPathW(NULL, pszPath, nFolder, fCreate))
|
||||
{
|
||||
return fs::path(pszPath);
|
||||
}
|
||||
|
||||
//LogPrintf("SHGetSpecialFolderPathW() failed, could not obtain requested path.\n");
|
||||
return fs::path("");
|
||||
}
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
boost::filesystem::path static StartupShortcutPath()
|
||||
{
|
||||
return GetSpecialFolderPath(CSIDL_STARTUP) / GUI_LINK_NAME ".lnk";
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
// check for Bitcoin*.lnk
|
||||
return boost::filesystem::exists(StartupShortcutPath());
|
||||
}
|
||||
|
||||
bool SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
// If the shortcut exists already, remove it for updating
|
||||
boost::system::error_code ec;
|
||||
std::wstring shrtcut_path = StartupShortcutPath().c_str();
|
||||
boost::filesystem::remove(shrtcut_path.c_str(), ec);
|
||||
if (ec)
|
||||
{
|
||||
//LOG_ERROR("Autostart disable failed: " << ec.message());
|
||||
}
|
||||
|
||||
if (fAutoStart)
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
|
||||
// Get a pointer to the IShellLink interface.
|
||||
IShellLink* psl = NULL;
|
||||
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL,
|
||||
CLSCTX_INPROC_SERVER, IID_IShellLink,
|
||||
reinterpret_cast<void**>(&psl));
|
||||
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
// Get the current executable path
|
||||
TCHAR pszExePath[MAX_PATH];
|
||||
GetModuleFileName(NULL, pszExePath, sizeof(pszExePath));
|
||||
|
||||
// Start client minimized
|
||||
//QString strArgs = "-min";
|
||||
// Set -testnet /-regtest options
|
||||
//strArgs += QString::fromStdString(strprintf(" -testnet=%d -regtest=%d", GetBoolArg("-testnet", false), GetBoolArg("-regtest", false)));
|
||||
|
||||
//#ifdef UNICODE
|
||||
// boost::scoped_array<TCHAR> args(new TCHAR[strArgs.length() + 1]);
|
||||
// Convert the QString to TCHAR*
|
||||
// strArgs.toWCharArray(args.get());
|
||||
// Add missing '\0'-termination to string
|
||||
// args[strArgs.length()] = '\0';
|
||||
//#endif
|
||||
|
||||
// Set the path to the shortcut target
|
||||
psl->SetPath(pszExePath);
|
||||
PathRemoveFileSpec(pszExePath);
|
||||
psl->SetWorkingDirectory(pszExePath);
|
||||
psl->SetShowCmd(SW_SHOWMINNOACTIVE);
|
||||
//#ifndef UNICODE
|
||||
// psl->SetArguments(strArgs.toStdString().c_str());
|
||||
//#else
|
||||
// psl->SetArguments(args.get());
|
||||
//#endif
|
||||
|
||||
// Query IShellLink for the IPersistFile interface for
|
||||
// saving the shortcut in persistent storage.
|
||||
IPersistFile* ppf = NULL;
|
||||
hres = psl->QueryInterface(IID_IPersistFile, reinterpret_cast<void**>(&ppf));
|
||||
if (SUCCEEDED(hres))
|
||||
{
|
||||
WCHAR pwsz[MAX_PATH];
|
||||
// Ensure that the string is ANSI.
|
||||
MultiByteToWideChar(CP_ACP, 0, StartupShortcutPath().string().c_str(), -1, pwsz, MAX_PATH);
|
||||
// Save the link by calling IPersistFile::Save.
|
||||
hres = ppf->Save(pwsz, TRUE);
|
||||
ppf->Release();
|
||||
psl->Release();
|
||||
CoUninitialize();
|
||||
return true;
|
||||
}
|
||||
psl->Release();
|
||||
}
|
||||
CoUninitialize();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
|
||||
// Follow the Desktop Application Autostart Spec:
|
||||
// http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html
|
||||
|
||||
boost::filesystem::path static GetAutostartDir()
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
char* pszConfigHome = getenv("XDG_CONFIG_HOME");
|
||||
if (pszConfigHome) return fs::path(pszConfigHome) / "autostart";
|
||||
char* pszHome = getenv("HOME");
|
||||
if (pszHome) return fs::path(pszHome) / ".config" / "autostart";
|
||||
return fs::path();
|
||||
}
|
||||
|
||||
boost::filesystem::path static GetAutostartFilePath()
|
||||
{
|
||||
return GetAutostartDir() / GUI_LINK_NAME ".desktop";
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
boost::filesystem::ifstream optionFile(GetAutostartFilePath());
|
||||
if (!optionFile.good())
|
||||
return false;
|
||||
// Scan through file for "Hidden=true":
|
||||
std::string line;
|
||||
while (!optionFile.eof())
|
||||
{
|
||||
getline(optionFile, line);
|
||||
if (line.find("Hidden") != std::string::npos &&
|
||||
line.find("true") != std::string::npos)
|
||||
return false;
|
||||
}
|
||||
optionFile.close();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
if (!fAutoStart)
|
||||
boost::filesystem::remove(GetAutostartFilePath());
|
||||
else
|
||||
{
|
||||
char pszExePath[MAX_PATH + 1];
|
||||
memset(pszExePath, 0, sizeof(pszExePath));
|
||||
if (readlink("/proc/self/exe", pszExePath, sizeof(pszExePath)-1) == -1)
|
||||
return false;
|
||||
|
||||
boost::filesystem::create_directories(GetAutostartDir());
|
||||
|
||||
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out | std::ios_base::trunc);
|
||||
if (!optionFile.good())
|
||||
return false;
|
||||
// Write a bitcoin.desktop file to the autostart directory:
|
||||
optionFile << "[Desktop Entry]\n";
|
||||
optionFile << "Type=Application\n";
|
||||
optionFile << "Name=" << CURRENCY_NAME_BASE << "\n";
|
||||
optionFile << "Exec=" << pszExePath << "\n";
|
||||
optionFile << "Terminal=false\n";
|
||||
optionFile << "Hidden=false\n";
|
||||
optionFile.close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#elif defined(Q_OS_MAC)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
// based on: https://github.com/Mozketo/LaunchAtLoginController/blob/master/LaunchAtLoginController.m
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
|
||||
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
|
||||
{
|
||||
SInt32 macos_ver_maj, macos_ver_min;
|
||||
Gestalt(gestaltSystemVersionMajor, &macos_ver_maj); // very old and deprecated, consider change
|
||||
Gestalt(gestaltSystemVersionMinor, &macos_ver_min); // very old and deprecated, consider change
|
||||
|
||||
// loop through the list of startup items and try to find the bitcoin app
|
||||
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL);
|
||||
for(int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
|
||||
LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
|
||||
UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
|
||||
CFURLRef currentItemURL = NULL;
|
||||
|
||||
#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 10100
|
||||
if (&LSSharedFileListItemCopyResolvedURL != NULL && (macos_ver_maj > 10 || (macos_ver_maj == 10 && macos_ver_min >= 10)))
|
||||
currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, NULL); // this is available only on macOS 10.10-10.11 (then deprecated)
|
||||
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 10100
|
||||
else
|
||||
LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, NULL);
|
||||
#endif
|
||||
#else
|
||||
LSSharedFileListItemResolve(item, resolutionFlags, ¤tItemURL, NULL);
|
||||
#endif
|
||||
|
||||
if(currentItemURL && CFEqual(currentItemURL, findUrl)) {
|
||||
// found
|
||||
CFRelease(currentItemURL);
|
||||
return item;
|
||||
}
|
||||
if(currentItemURL) {
|
||||
CFRelease(currentItemURL);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
|
||||
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
|
||||
return !!foundItem; // return boolified object
|
||||
}
|
||||
|
||||
bool SetStartOnSystemStartup(bool fAutoStart)
|
||||
{
|
||||
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
|
||||
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);
|
||||
|
||||
if(fAutoStart && !foundItem) {
|
||||
// add bitcoin app to startup item list
|
||||
LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, bitcoinAppUrl, NULL, NULL);
|
||||
}
|
||||
else if(!fAutoStart && foundItem) {
|
||||
// remove item
|
||||
LSSharedFileListItemRemove(loginItems, foundItem);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
#else
|
||||
|
||||
bool GetStartOnSystemStartup() { return false; }
|
||||
bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Copyright (c) 2015 Boolberry developers
|
||||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace gui_tools
|
||||
{
|
||||
bool GetStartOnSystemStartup();
|
||||
bool SetStartOnSystemStartup(bool fAutoStart);
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,363 +0,0 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Copyright (c) 2012-2013 The Boolberry developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#pragma once
|
||||
#include <QtWidgets>
|
||||
#include <QWebChannel>
|
||||
#include <boost/interprocess/ipc/message_queue.hpp>
|
||||
|
||||
#include "wallet/view_iface.h"
|
||||
#include "serialization/keyvalue_helper_structs.h"
|
||||
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#include "wallet/wallets_manager.h"
|
||||
#include "currency_core/offers_services_helpers.h"
|
||||
#endif
|
||||
|
||||
#include "common/threads_pool.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QWebEngineView;
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
#define APP_DATA_FILE_BINARY_SIGNATURE 0x1000111101101021LL
|
||||
|
||||
|
||||
// class MediatorObject : public QObject
|
||||
// {
|
||||
// Q_OBJECT
|
||||
//
|
||||
// public:
|
||||
//
|
||||
// signals :
|
||||
// /*!
|
||||
// This signal is emitted from the C++ side and the text displayed on the HTML client side.
|
||||
// */
|
||||
// void from_c_to_html(const QString &text);
|
||||
//
|
||||
// public slots:
|
||||
// /*!
|
||||
// This slot is invoked from the HTML client side and the text displayed on the server side.
|
||||
// */
|
||||
// void from_html_to_c(const QString &text);
|
||||
// };
|
||||
|
||||
//
|
||||
class MainWindow : public QMainWindow,
|
||||
public currency::i_core_event_handler,
|
||||
public view::i_view,
|
||||
public QAbstractNativeEventFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow() override;
|
||||
|
||||
bool init_backend(int argc, char* argv[]);
|
||||
bool show_inital();
|
||||
void show_notification(const std::string& title, const std::string& message);
|
||||
bool handle_ipc_event(const std::string& arguments);
|
||||
|
||||
struct app_config
|
||||
{
|
||||
|
||||
epee::kvserializable_pair<int64_t, int64_t> m_window_position;
|
||||
epee::kvserializable_pair<int64_t, int64_t> m_window_size;
|
||||
bool is_maximazed;
|
||||
bool is_showed;
|
||||
bool disable_notifications;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(m_window_position)
|
||||
KV_SERIALIZE(m_window_size)
|
||||
KV_SERIALIZE(is_maximazed)
|
||||
KV_SERIALIZE(is_showed)
|
||||
KV_SERIALIZE(disable_notifications)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
protected slots:
|
||||
|
||||
void on_load_finished(bool ok);
|
||||
bool do_close();
|
||||
|
||||
|
||||
public slots:
|
||||
QString show_openfile_dialog(const QString& param);
|
||||
QString show_savefile_dialog(const QString& param);
|
||||
QString open_wallet(const QString& param);
|
||||
QString get_my_offers(const QString& param);
|
||||
QString get_fav_offers(const QString& param);
|
||||
QString generate_wallet(const QString& param);
|
||||
QString run_wallet(const QString& param);
|
||||
QString close_wallet(const QString& wallet_id);
|
||||
QString get_contracts(const QString& wallet_id);
|
||||
QString create_proposal(const QString& param);
|
||||
QString accept_proposal(const QString& param);
|
||||
QString release_contract(const QString& param);
|
||||
QString request_cancel_contract(const QString& param);
|
||||
QString accept_cancel_contract(const QString& param);
|
||||
|
||||
|
||||
QString on_request_quit(const QString& param);
|
||||
QString get_version(const QString& param);
|
||||
QString get_os_version(const QString& param);
|
||||
QString get_network_type(const QString& param);
|
||||
QString transfer(const QString& param);
|
||||
QString have_secure_app_data(const QString& param);
|
||||
QString drop_secure_app_data();
|
||||
QString get_secure_app_data(const QString& param);
|
||||
QString store_secure_app_data(const QString& param, const QString& password);
|
||||
QString set_master_password(const QString& param);
|
||||
QString check_master_password(const QString& param);
|
||||
QString get_app_data(const QString& param);
|
||||
QString store_app_data(const QString& param);
|
||||
QString get_default_user_dir(const QString& param);
|
||||
// QString get_all_offers(const QString& param);
|
||||
QString get_offers_ex(const QString& param);
|
||||
QString push_offer(const QString& param);
|
||||
QString cancel_offer(const QString& param);
|
||||
QString push_update_offer(const QString& param);
|
||||
QString get_alias_info_by_address(const QString& param);
|
||||
QString get_alias_info_by_name(const QString& param);
|
||||
QString get_all_aliases(const QString& param);
|
||||
QString request_alias_registration(const QString& param);
|
||||
QString request_alias_update(const QString& param);
|
||||
QString get_alias_coast(const QString& param);
|
||||
QString validate_address(const QString& param);
|
||||
QString resync_wallet(const QString& param);
|
||||
QString get_recent_transfers(const QString& param);
|
||||
QString get_mining_history(const QString& param);
|
||||
QString start_pos_mining(const QString& param);
|
||||
QString stop_pos_mining(const QString& param);
|
||||
QString set_log_level(const QString& param);
|
||||
QString get_log_level(const QString& param);
|
||||
QString set_enable_tor(const QString& param);
|
||||
// QString dump_all_offers();
|
||||
QString webkit_launched_script(const QString& param);
|
||||
QString get_smart_wallet_info(const QString& param);
|
||||
QString restore_wallet(const QString& param);
|
||||
QString use_whitelisting(const QString& param);
|
||||
QString is_pos_allowed(const QString& param);
|
||||
QString store_to_file(const QString& path, const QString& buff);
|
||||
QString load_from_file(const QString& path);
|
||||
QString is_file_exist(const QString& path);
|
||||
QString get_mining_estimate(const QString& obj);
|
||||
QString backup_wallet_keys(const QString& obj);
|
||||
QString reset_wallet_password(const QString& param);
|
||||
QString is_wallet_password_valid(const QString& param);
|
||||
QString is_autostart_enabled(const QString& param);
|
||||
QString toggle_autostart(const QString& param);
|
||||
QString is_valid_restore_wallet_text(const QString& param);
|
||||
QString get_seed_phrase_info(const QString& param);
|
||||
QString print_text(const QString& param);
|
||||
QString print_log(const QString& param);
|
||||
QString set_clipboard(const QString& param);
|
||||
QString set_localization_strings(const QString str);
|
||||
QString get_clipboard(const QString& param);
|
||||
void message_box(const QString& msg);
|
||||
bool toggle_mining(const QString& param);
|
||||
QString get_exchange_last_top(const QString& params);
|
||||
QString get_tx_pool_info(const QString& param);
|
||||
QString get_default_fee(const QString& param);
|
||||
QString get_options(const QString& param);
|
||||
void bool_toggle_icon(const QString& param);
|
||||
QString add_custom_asset_id(const QString& param);
|
||||
QString remove_custom_asset_id(const QString& param);
|
||||
QString get_wallet_info(const QString& param);
|
||||
|
||||
QString create_ionic_swap_proposal(const QString& param);
|
||||
QString get_ionic_swap_proposal_info(const QString& param);
|
||||
QString accept_ionic_swap_proposal(const QString& param);
|
||||
|
||||
bool get_is_disabled_notifications(const QString& param);
|
||||
bool set_is_disabled_notifications(const bool& param);
|
||||
QString export_wallet_history(const QString& param);
|
||||
QString get_log_file(const QString& param);
|
||||
//QString check_available_sources(const QString& param);
|
||||
QString open_url_in_browser(const QString& param);
|
||||
QString setup_jwt_wallet_rpc(const QString& param);
|
||||
|
||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
void tray_quit_requested(const QString& param);
|
||||
void on_menu_show(const QString& param);
|
||||
QString is_remnotenode_mode_preconfigured(const QString& param);
|
||||
QString start_backend(const QString& params);
|
||||
void show_notification(const QString& title, const QString& message);
|
||||
|
||||
QString async_call(const QString& func_name, const QString& params);
|
||||
QString sync_call(const QString& func_name, const QString& params);
|
||||
|
||||
QString async_call_2a(const QString& func_name, const QString& params1, const QString& params2);
|
||||
QString sync_call_2a(const QString& func_name, const QString& params1, const QString& params2);
|
||||
|
||||
//for test purposes only
|
||||
QString request_dummy(const QString& param);
|
||||
|
||||
QString call_rpc(const QString& params);
|
||||
QString call_wallet_rpc(const QString& wallet_id, const QString& params);
|
||||
|
||||
signals:
|
||||
void quit_requested(const QString str);
|
||||
void update_daemon_state(const QString str);
|
||||
void update_wallet_status(const QString str);
|
||||
void update_wallet_info(const QString str);
|
||||
void money_transfer(const QString str);
|
||||
void money_transfer_cancel(const QString str);
|
||||
void wallet_sync_progress(const QString str);
|
||||
void handle_internal_callback(const QString str, const QString callback_name);
|
||||
void update_pos_mining_text(const QString str);
|
||||
void on_core_event(const QString method_name); //general function
|
||||
void set_options(const QString str); //general function
|
||||
void handle_deeplink_click(const QString str);
|
||||
void handle_current_action_state(const QString str);
|
||||
void dispatch_async_call_result(const QString id, const QString resp); //general function
|
||||
|
||||
private:
|
||||
//-------------------- i_core_event_handler --------------------
|
||||
virtual void on_core_event(const std::string event_name, const currency::core_event_v& e);
|
||||
virtual void on_complete_events();
|
||||
virtual void on_clear_events();
|
||||
|
||||
//------- i_view ---------
|
||||
virtual bool update_daemon_status(const view::daemon_status_info& info);
|
||||
virtual bool on_backend_stopped();
|
||||
virtual bool show_msg_box(const std::string& message);
|
||||
virtual bool update_wallet_status(const view::wallet_status_info& wsi);
|
||||
virtual bool update_wallets_info(const view::wallets_summary_info& wsi);
|
||||
virtual bool money_transfer(const view::transfer_event_info& tei);
|
||||
virtual bool wallet_sync_progress(const view::wallet_sync_progres_param& p);
|
||||
virtual bool money_transfer_cancel(const view::transfer_event_info& wsi);
|
||||
virtual bool init(const std::string& path);
|
||||
virtual bool pos_block_found(const currency::block& block_found);
|
||||
virtual bool set_options(const view::gui_options& opt);
|
||||
virtual bool update_tor_status(const view::current_action_status& opt);
|
||||
//--------- QAbstractNativeEventFilter ---------------------------
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
//----------------------------------------------
|
||||
|
||||
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void contextMenuEvent(QContextMenuEvent * event);
|
||||
void changeEvent(QEvent *e);
|
||||
void on_maximized();
|
||||
bool handle_deeplink_params_in_commandline();
|
||||
//void setOrientation(Qt::ScreenOrientation orientation);
|
||||
|
||||
|
||||
|
||||
void init_tray_icon(const std::string& htmlPath);
|
||||
bool set_html_path(const std::string& path);
|
||||
void load_file(const QString &fileName);
|
||||
void store_pos(bool consider_showed = false);
|
||||
void store_window_pos();
|
||||
void restore_pos(bool consider_showed = false);
|
||||
bool store_app_config();
|
||||
bool load_app_config();
|
||||
bool init_window();
|
||||
bool init_ipc_server();
|
||||
bool remove_ipc();
|
||||
|
||||
|
||||
std::string get_wallet_log_prefix(size_t wallet_id) const { return m_backend.get_wallet_log_prefix(wallet_id); }
|
||||
|
||||
|
||||
//MediatorObject mo;
|
||||
// UI
|
||||
QWebEngineView *m_view;
|
||||
QWebChannel* m_channel;
|
||||
|
||||
// DATA
|
||||
wallets_manager m_backend;
|
||||
//std::atomic<bool> m_quit_requested;
|
||||
std::atomic<bool> m_gui_deinitialize_done_1;
|
||||
std::atomic<bool> m_backend_stopped_2;
|
||||
std::atomic<bool> m_system_shutdown;
|
||||
std::atomic<uint64_t> m_ui_dispatch_id_counter;
|
||||
utils::threads_pool m_threads_pool;
|
||||
|
||||
std::string m_master_password;
|
||||
|
||||
|
||||
app_config m_config;
|
||||
|
||||
epee::locked_object<std::map<uint64_t, uint64_t>> m_wallet_states;
|
||||
std::thread m_ipc_worker;
|
||||
struct events_que_struct
|
||||
{
|
||||
std::list<currency::core_event> m_que;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(m_que)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
events_que_struct m_events;
|
||||
|
||||
std::vector<std::string> m_localization;
|
||||
|
||||
enum localization_string_indices
|
||||
{
|
||||
// order is surprisingly important here! (see also updateLocalisation in AppController.js)
|
||||
localization_id_quit = 0,
|
||||
localization_id_is_received,
|
||||
localization_id_is_confirmed,
|
||||
localization_id_income_transfer_unconfirmed,
|
||||
localization_id_income_transfer_confirmed,
|
||||
localization_id_mined,
|
||||
localization_id_locked,
|
||||
localization_id_minimized_text,
|
||||
localization_id_minimized_title,
|
||||
localization_id_tray_menu_show,
|
||||
localization_id_tray_menu_minimize,
|
||||
|
||||
localization_id_couter // keep it at the end of list
|
||||
};
|
||||
|
||||
std::string m_normal_icon_path;
|
||||
std::string m_blocked_icon_path;
|
||||
|
||||
std::unique_ptr<QSystemTrayIcon> m_tray_icon;
|
||||
std::unique_ptr<QMenu> m_tray_icon_menu;
|
||||
std::unique_ptr<QAction> m_restore_action;
|
||||
std::unique_ptr<QAction> m_quit_action;
|
||||
std::unique_ptr<QAction> m_minimize_action;
|
||||
|
||||
std::string m_last_update_daemon_status_json;
|
||||
|
||||
template<typename argument_type, typename response_type, typename callback_t>
|
||||
QString prepare_call(const char* name, const QString& param, callback_t cb)
|
||||
{
|
||||
LOG_PRINT_L0("que_call: [" << name << "]");
|
||||
view::api_response_t<view::api_void> ar;
|
||||
argument_type wio = AUTO_VAL_INIT(wio);
|
||||
if (!epee::serialization::load_t_from_json(wio, param.toStdString()))
|
||||
{
|
||||
ar.error_code = API_RETURN_CODE_BAD_ARG;
|
||||
return epee::serialization::store_t_to_json(ar).c_str();
|
||||
}
|
||||
cb(wio, ar);
|
||||
return epee::serialization::store_t_to_json(ar).c_str();
|
||||
}
|
||||
};
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
template<class archive_t>
|
||||
void serialize(archive_t & ar, MainWindow::app_config& ac, const unsigned int version)
|
||||
{
|
||||
ar & ac.is_maximazed;
|
||||
ar & ac.is_showed;
|
||||
ar & ac.m_window_position;
|
||||
ar & ac.m_window_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "epee/include/misc_log_ex.h"
|
||||
|
||||
struct notification_helper
|
||||
{
|
||||
static void show(const std::string& title, const std::string& message)
|
||||
#if !defined(__APPLE__)
|
||||
{
|
||||
// just a stub, implemented for macOS only, see .mm
|
||||
LOG_PRINT_RED("system notifications are supported only for macOS!", LOG_LEVEL_0);
|
||||
}
|
||||
#endif
|
||||
;
|
||||
};
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#include "notification_helper.h"
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSUserNotification.h>
|
||||
|
||||
void notification_helper::show(const std::string& title, const std::string& message)
|
||||
{
|
||||
NSUserNotification *userNotification = [[[NSUserNotification alloc] init] autorelease];
|
||||
userNotification.title = [NSString stringWithUTF8String:title.c_str()];
|
||||
userNotification.informativeText = [NSString stringWithUTF8String:message.c_str()];
|
||||
|
||||
NSUserNotificationCenter* center = [NSUserNotificationCenter defaultUserNotificationCenter];
|
||||
[center deliverNotification:userNotification];
|
||||
}
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#include "urleventfilter.h"
|
||||
#include <QMessageBox>
|
||||
|
||||
bool URLEventFilter::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
QFileOpenEvent *fileEvent = static_cast<QFileOpenEvent*>(event);
|
||||
if(!fileEvent->url().isEmpty())
|
||||
{
|
||||
m_pmainwindow->handle_deeplink_click(fileEvent->url().toString());
|
||||
//QMessageBox msg;
|
||||
//msg.setText(fileEvent->url().toString());
|
||||
//msg.exec();
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
// standard event processing
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
};
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#include <QObject>
|
||||
#include <QFileOpenEvent>
|
||||
#include <QDebug>
|
||||
#include "mainwindow.h"
|
||||
|
||||
class URLEventFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
URLEventFilter(MainWindow* pmainwindow) : m_pmainwindow(pmainwindow),QObject()
|
||||
{};
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
MainWindow* m_pmainwindow;
|
||||
};
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
// Copyright (c) 2017-2025 Lethean VPN
|
||||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Copyright (c) 2012-2013 The Boolberry developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <QApplication>
|
||||
#include "application/mainwindow.h"
|
||||
// #include "qdebug.h"
|
||||
#include <iostream>
|
||||
// ReSharper disable once CppUnusedIncludeDirective
|
||||
#include "include_base_utils.h"
|
||||
#include "currency_core/currency_config.h"
|
||||
#ifdef Q_OS_DARWIN
|
||||
#include "application/urleventfilter.h"
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
using string_encoding::wstring_to_utf8;
|
||||
using string_tools::set_module_name_and_folder;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
if(argc > 1)
|
||||
std::cout << argv[1] << std::endl;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN64
|
||||
_set_FMA3_enable(0);
|
||||
#endif
|
||||
//mutex to let InnoSetup know about running instance
|
||||
CreateMutexA(nullptr, FALSE, CURRENCY_NAME_BASE "_instance");
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
WCHAR sz_file_name[MAX_PATH + 1] = L"";
|
||||
GetModuleFileNameW(nullptr, sz_file_name, MAX_PATH + 1);
|
||||
std::string path_to_process_utf8 = wstring_to_utf8(sz_file_name);
|
||||
#else
|
||||
std::string path_to_process_utf8 = argv[0];
|
||||
#endif
|
||||
|
||||
TRY_ENTRY();
|
||||
set_module_name_and_folder(path_to_process_utf8);
|
||||
|
||||
log_space::get_set_log_detalisation_level(true, LOG_LEVEL_0);
|
||||
log_space::get_set_need_thread_id(true, true);
|
||||
log_space::log_singletone::enable_channels("core,currency_protocol,tx_pool,p2p,wallet");
|
||||
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
MainWindow viewer;
|
||||
if (!viewer.init_backend(argc, argv))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef Q_OS_DARWIN
|
||||
URLEventFilter url_event_filter(&viewer);
|
||||
app.installEventFilter(&url_event_filter);
|
||||
#endif
|
||||
|
||||
app.installNativeEventFilter(&viewer);
|
||||
viewer.setWindowTitle(CURRENCY_NAME_BASE);
|
||||
viewer.show_inital();
|
||||
|
||||
int res = QApplication::exec();
|
||||
LOG_PRINT_L0("Process exit with code: " << res);
|
||||
return res;
|
||||
CATCH_ENTRY2(0);
|
||||
}
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
// Copyright (c) 2014-2018 Zano Project
|
||||
// Copyright (c) 2014-2018 The Louisdor Project
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
|
||||
//#define QT_CONSOLE_STREAM qDebug()
|
||||
|
||||
#define QT_CONSOLE_STREAM(s) \
|
||||
{std::stringstream ss; ss << s; fputs(ss.str().c_str(), stderr); fflush(stderr);}
|
||||
|
||||
|
||||
|
||||
//fputs(buf.c_str(), stderr);
|
||||
//fflush(stderr);
|
||||
|
||||
|
||||
void customHandler(QtMsgType type, const char* msg) {
|
||||
fputs(msg, stderr);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
class qt_console_stream : public epee::log_space::ibase_log_stream
|
||||
{
|
||||
QDebug db;
|
||||
public:
|
||||
qt_console_stream() : db(qDebug())
|
||||
{
|
||||
// Somewhere in your program
|
||||
//qInstallMsgHandler(customHandler);
|
||||
}
|
||||
|
||||
~qt_console_stream()
|
||||
{
|
||||
}
|
||||
|
||||
int get_type(){ return LOGGER_CONSOLE; }
|
||||
|
||||
inline void set_console_color(int color, bool bright)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case epee::log_space::console_color_default:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;37m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0m");}
|
||||
break;
|
||||
case epee::log_space::console_color_white:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;37m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0;37m");}
|
||||
break;
|
||||
case epee::log_space::console_color_red:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;31m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0;31m");}
|
||||
break;
|
||||
case epee::log_space::console_color_green:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;32m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0;32m");}
|
||||
break;
|
||||
|
||||
case epee::log_space::console_color_blue:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;34m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0;34m");}
|
||||
break;
|
||||
|
||||
case epee::log_space::console_color_cyan:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;36m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0;36m");}
|
||||
break;
|
||||
|
||||
case epee::log_space::console_color_magenta:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;35m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0;35m");}
|
||||
break;
|
||||
|
||||
case epee::log_space::console_color_yellow:
|
||||
if (bright)
|
||||
{QT_CONSOLE_STREAM("\033[1;33m");}
|
||||
else
|
||||
{QT_CONSOLE_STREAM("\033[0;33m");}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
inline void reset_console_color()
|
||||
{
|
||||
{QT_CONSOLE_STREAM("\033[0m");}
|
||||
}
|
||||
|
||||
virtual bool out_buffer(const char* buffer, int buffer_len, int log_level, int color, const char* plog_name = NULL)
|
||||
{
|
||||
if (plog_name)
|
||||
return true; //skip alternative logs from console
|
||||
|
||||
set_console_color(color, log_level < 1);
|
||||
|
||||
std::string buf(buffer, buffer_len);
|
||||
for (size_t i = 0; i != buf.size(); i++)
|
||||
{
|
||||
if (buf[i] == 7 || buf[i] == -107)
|
||||
buf[i] = '^';
|
||||
//remove \n
|
||||
//if (i == buf.size()-1)
|
||||
// buf[i] = ' ';
|
||||
}
|
||||
|
||||
QT_CONSOLE_STREAM(buf.c_str());
|
||||
|
||||
|
||||
reset_console_color();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue