Icon changes
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -256,3 +256,4 @@ ModelManifest.xml
|
||||
/SiaDrive_Packager_Debug.iss
|
||||
/include/siadrive_api/siacommon.h
|
||||
/SiaDrive_Packager_Release.iss
|
||||
/3rd_party/Sia-v1.2.1-windows-amd64.zip
|
||||
|
BIN
htdocs/favicon.ico
Normal file
BIN
htdocs/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@@ -1,6 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>SiaDrive</title>
|
||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" type="text/css" href="css/cryptocoins.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/cryptocoins-colors.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/general.css">
|
||||
|
@@ -112,6 +112,14 @@ get_access:\
|
||||
type Get##name() const { return json_doc[#name].get<type>();}\
|
||||
set_access:\
|
||||
type Set##name(const type& value) { json_doc[#name] = value; return value; }\
|
||||
protected:\
|
||||
bool Check##name() { return json_doc.find(#name) != json_doc.end(); }
|
||||
|
||||
#define JPropertyCb(type, name, get_access, set_access, json_doc, cb) \
|
||||
get_access:\
|
||||
type Get##name() const { return json_doc[#name].get<type>();}\
|
||||
set_access:\
|
||||
type Set##name(const type& value) { json_doc[#name] = value; cb(value); return value; }\
|
||||
protected:\
|
||||
bool Check##name() { return json_doc.find(#name) != json_doc.end(); }
|
||||
|
||||
@@ -212,6 +220,8 @@ BOOL SIADRIVE_EXPORTABLE RecurDeleteFilesByExtentsion(const SString& folder, con
|
||||
std::vector<SString> SIADRIVE_EXPORTABLE GetAvailableDrives();
|
||||
|
||||
std::int32_t SIADRIVE_EXPORTABLE GetRegistry(const SString& name, const std::int32_t& defaultValue);
|
||||
|
||||
HRESULT SIADRIVE_EXPORTABLE CreateShortcut(const SString& execPath, const SString& description, const SString& shortcutPath, const bool& minimized);
|
||||
#endif
|
||||
|
||||
bool SIADRIVE_EXPORTABLE ExecuteProcess(CSiaDriveConfig* siaDriveConfig, FilePath process, FilePath workingDir, const bool& waitForExit);
|
||||
|
BIN
res/SiaDriveLogo.ico
Normal file
BIN
res/SiaDriveLogo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
BIN
res/SiaDriveLogo.png
Normal file
BIN
res/SiaDriveLogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
res/SiaDriveLogo.xcf
Normal file
BIN
res/SiaDriveLogo.xcf
Normal file
Binary file not shown.
@@ -22,7 +22,6 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
|
||||
std::shared_ptr<CSiaDriveConfig> siaDriveConfig(new CSiaDriveConfig);
|
||||
const EventLevel eventLevel = EventLevelFromString(siaDriveConfig->GetEventLevel());
|
||||
@@ -72,7 +71,5 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
CefRunMessageLoop();
|
||||
CefShutdown();
|
||||
|
||||
::CoUninitialize();
|
||||
|
||||
return 0;;
|
||||
}
|
||||
|
@@ -383,7 +383,7 @@ void CSiaDriveApp::OnContextInitialized()
|
||||
#endif
|
||||
windowInfo.width = 800;
|
||||
windowInfo.height = 675;
|
||||
|
||||
|
||||
CefBrowserHost::CreateBrowser(windowInfo, handler, url.str(), browserSettings, nullptr);
|
||||
}
|
||||
}
|
||||
|
@@ -5,11 +5,16 @@
|
||||
#include <include/cef_app.h>
|
||||
#include <include/base/cef_bind.h>
|
||||
#include <include/wrapper/cef_closure_task.h>
|
||||
|
||||
#include <filepath.h>
|
||||
using namespace Sia;
|
||||
using namespace Sia::Api;
|
||||
|
||||
CSiaDriveHandler* g_instance = nullptr;
|
||||
|
||||
#ifdef _WIN32
|
||||
static NOTIFYICONDATA g_notifyIcon = { 0 };
|
||||
#endif
|
||||
|
||||
CSiaDriveHandler::CSiaDriveHandler(const bool& useViews) :
|
||||
_useViews(useViews),
|
||||
_isClosing(false)
|
||||
@@ -51,6 +56,29 @@ void CSiaDriveHandler::OnTitleChange(CefRefPtr<CefBrowser> browser, const CefStr
|
||||
void CSiaDriveHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
#ifdef _WIN32
|
||||
SString filePath(FilePath(".\\htdocs\\favicon.ico").MakeAbsolute());
|
||||
HWND hwnd = browser->GetHost()->GetWindowHandle();
|
||||
HINSTANCE hinstance = ::GetModuleHandle(nullptr);
|
||||
HICON icon = static_cast<HICON>(::LoadImage(hinstance, &filePath[0], IMAGE_ICON, 16, 16, LR_LOADFROMFILE | LR_SHARED));
|
||||
|
||||
::SendMessage(hwnd, WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icon));
|
||||
::SendMessage(hwnd, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icon));
|
||||
::SendMessage(GetWindow(hwnd, GW_OWNER), WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icon));
|
||||
::SendMessage(GetWindow(hwnd, GW_OWNER), WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icon));
|
||||
|
||||
g_notifyIcon.cbSize = sizeof(g_notifyIcon);
|
||||
g_notifyIcon.hWnd = hwnd;
|
||||
g_notifyIcon.hIcon = icon;
|
||||
GUID g = { 0 };
|
||||
::CoCreateGuid(&g);
|
||||
g_notifyIcon.guidItem = g;
|
||||
g_notifyIcon.uVersion = NOTIFYICON_VERSION_4;
|
||||
g_notifyIcon.uFlags = NIF_ICON | NIF_GUID;
|
||||
::Shell_NotifyIcon(NIM_ADD, &g_notifyIcon);
|
||||
#else
|
||||
a
|
||||
#endif
|
||||
|
||||
_browserList.push_back(browser);
|
||||
}
|
||||
@@ -87,6 +115,7 @@ void CSiaDriveHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser)
|
||||
if (_browserList.empty())
|
||||
{
|
||||
CefQuitMessageLoop();
|
||||
::Shell_NotifyIcon(NIM_DELETE, &g_notifyIcon);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -234,7 +234,7 @@ bool ExecuteProcess(CSiaDriveConfig* siaDriveConfig, FilePath process, FilePath
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT CreateShortcut(const SString& execPath, const SString& description, const SString& shortcutPath)
|
||||
HRESULT CreateShortcut(const SString& execPath, const SString& description, const SString& shortcutPath, const bool& minimized)
|
||||
{
|
||||
IShellLink* shellLink(nullptr);
|
||||
HRESULT hr = ::CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER, IID_IShellLink, reinterpret_cast<LPVOID*>(&shellLink));
|
||||
@@ -243,6 +243,7 @@ HRESULT CreateShortcut(const SString& execPath, const SString& description, cons
|
||||
shellLink->SetPath(&execPath[0]);
|
||||
shellLink->SetWorkingDirectory(&FilePath(execPath).RemoveFileName()[0]);
|
||||
shellLink->SetDescription(&description[0]);
|
||||
shellLink->SetShowCmd(minimized ? SW_MINIMIZE : SW_SHOWDEFAULT);
|
||||
|
||||
IPersistFile* persistFile(nullptr);
|
||||
hr = shellLink->QueryInterface(IID_IPersistFile, reinterpret_cast<LPVOID*>(&persistFile));
|
||||
|
@@ -23,8 +23,9 @@ CSiaDriveConfig::~CSiaDriveConfig()
|
||||
|
||||
void CSiaDriveConfig::OnAutoStartOnLogonChanged(const bool& value)
|
||||
{
|
||||
#ifndef _DEBUG
|
||||
#ifdef _WIN32
|
||||
PWSTR startupPath;
|
||||
PWSTR startupPath = nullptr;
|
||||
if (SUCCEEDED(::SHGetKnownFolderPath(FOLDERID_Startup, 0, nullptr, &startupPath)))
|
||||
{
|
||||
FilePath shortcutPath(startupPath, "SiaDrive.lnk");
|
||||
@@ -37,7 +38,7 @@ void CSiaDriveConfig::OnAutoStartOnLogonChanged(const bool& value)
|
||||
SString execPath;
|
||||
execPath.Resize(MAX_PATH + 1);
|
||||
GetModuleFileName(::GetModuleHandle(nullptr), &execPath[0], MAX_PATH);
|
||||
CreateShortcut(execPath, "SiaDrive", shortcutPath);
|
||||
CreateShortcut(execPath, "SiaDrive", shortcutPath, true);
|
||||
}
|
||||
}
|
||||
else if (exists)
|
||||
@@ -49,6 +50,7 @@ void CSiaDriveConfig::OnAutoStartOnLogonChanged(const bool& value)
|
||||
#else
|
||||
a
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CSiaDriveConfig::LoadDefaults()
|
||||
@@ -150,6 +152,10 @@ bool CSiaDriveConfig::LoadDefaults()
|
||||
SetLaunchFileMgrOnMount(true);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Do this to add/remove shortcut on start-up
|
||||
OnAutoStartOnLogonChanged(GetAutoStartOnLogon());
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user