mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-26 09:41:03 +00:00
Added a (crappy) app icon to win32 musikbox build.
This commit is contained in:
parent
b05cfabd6f
commit
11f07f7040
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@
|
||||
**/Release
|
||||
**/Debug
|
||||
**/*.deb
|
||||
**/*.aps
|
||||
.vs
|
||||
.vscode
|
||||
bin
|
||||
|
@ -64,7 +64,8 @@
|
||||
#include <boost/filesystem/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <app/util/Win32Util.h>
|
||||
#include <cursespp/Win32Util.h>
|
||||
#include "resource.h"
|
||||
#undef MOUSE_MOVED
|
||||
#endif
|
||||
|
||||
@ -126,6 +127,10 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
App app("musikbox"); /* must be before layout creation */
|
||||
|
||||
#ifdef WIN32
|
||||
app.SetIcon(IDI_ICON1);
|
||||
#endif
|
||||
|
||||
auto prefs = Preferences::ForComponent(
|
||||
musik::core::prefs::components::Settings);
|
||||
|
||||
@ -172,7 +177,7 @@ int main(int argc, char* argv[])
|
||||
app.Run(mainLayout);
|
||||
|
||||
#ifdef WIN32
|
||||
musik::box::win32::HideMainWindow();
|
||||
win32::HideMainWindow();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <thread>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <app/util/Win32Util.h>
|
||||
#include "Win32Util.h"
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
@ -73,7 +73,9 @@ static void resizedHandler(int signal) {
|
||||
App::App(const std::string& title) {
|
||||
this->minWidth = this->minHeight = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
#ifdef WIN32
|
||||
this->iconId = 0;
|
||||
#else
|
||||
setlocale(LC_ALL, "");
|
||||
std::signal(SIGWINCH, resizedHandler);
|
||||
std::signal(SIGHUP, hangupHandler);
|
||||
@ -122,6 +124,15 @@ void App::SetMinimumSize(int minWidth, int minHeight) {
|
||||
this->minHeight = std::max(0, minHeight);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
void App::SetIcon(int resourceId) {
|
||||
this->iconId = resourceId;
|
||||
if (win32::GetMainWindow()) {
|
||||
win32::SetIcon(resourceId);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void App::OnResized() {
|
||||
int cx = Screen::GetWidth();
|
||||
int cy = Screen::GetHeight();
|
||||
|
@ -55,6 +55,10 @@ namespace cursespp {
|
||||
void SetMinimumSize(int width, int height);
|
||||
bool IsOverlayVisible() { return this->state.overlay != nullptr; }
|
||||
|
||||
#ifdef WIN32
|
||||
void SetIcon(int resourceId);
|
||||
#endif
|
||||
|
||||
void Run(ILayoutPtr layout);
|
||||
void ChangeLayout(ILayoutPtr layout);
|
||||
|
||||
@ -89,5 +93,9 @@ namespace cursespp {
|
||||
ResizeHandler resizeHandler;
|
||||
bool disableCustomColors;
|
||||
int minWidth, minHeight;
|
||||
|
||||
#ifdef WIN32
|
||||
int iconId;
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
@ -63,28 +63,44 @@ static void findMainWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
namespace musik {
|
||||
namespace box {
|
||||
namespace win32 {
|
||||
void ShowMainWindow() {
|
||||
findMainWindow();
|
||||
if (mainWindow) {
|
||||
ShowWindow(mainWindow, SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
static HICON loadIcon(int resourceId, int size) {
|
||||
return (HICON) ::LoadImageA(
|
||||
GetModuleHandle(nullptr),
|
||||
MAKEINTRESOURCEA(resourceId),
|
||||
IMAGE_ICON,
|
||||
size,
|
||||
size,
|
||||
0);
|
||||
}
|
||||
|
||||
void HideMainWindow() {
|
||||
findMainWindow();
|
||||
if (mainWindow) {
|
||||
ShowWindow(mainWindow, SW_HIDE);
|
||||
}
|
||||
namespace cursespp {
|
||||
namespace win32 {
|
||||
void ShowMainWindow() {
|
||||
findMainWindow();
|
||||
if (mainWindow) {
|
||||
ShowWindow(mainWindow, SW_SHOWNORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
HWND GetMainWindow() {
|
||||
findMainWindow();
|
||||
return mainWindow;
|
||||
void HideMainWindow() {
|
||||
findMainWindow();
|
||||
if (mainWindow) {
|
||||
ShowWindow(mainWindow, SW_HIDE);
|
||||
}
|
||||
}
|
||||
|
||||
HWND GetMainWindow() {
|
||||
findMainWindow();
|
||||
return mainWindow;
|
||||
}
|
||||
|
||||
void SetIcon(int resourceId) {
|
||||
const HWND hwnd = GetMainWindow();
|
||||
const HICON icon16 = loadIcon(resourceId, 16);
|
||||
const HICON icon32 = loadIcon(resourceId, 48);
|
||||
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM) icon16);
|
||||
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM) icon32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,13 +38,12 @@
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
namespace musik {
|
||||
namespace box {
|
||||
namespace win32 {
|
||||
void ShowMainWindow();
|
||||
void HideMainWindow();
|
||||
HWND GetMainWindow();
|
||||
}
|
||||
namespace cursespp {
|
||||
namespace win32 {
|
||||
void ShowMainWindow();
|
||||
void HideMainWindow();
|
||||
HWND GetMainWindow();
|
||||
void SetIcon(int resourceId);
|
||||
}
|
||||
}
|
||||
|
BIN
src/musikbox/icon.ico
Normal file
BIN
src/musikbox/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
src/musikbox/musikbox.rc
Normal file
BIN
src/musikbox/musikbox.rc
Normal file
Binary file not shown.
@ -140,7 +140,6 @@
|
||||
<ClCompile Include="app\util\Hotkeys.cpp" />
|
||||
<ClCompile Include="app\util\Playback.cpp" />
|
||||
<ClCompile Include="app\util\PreferenceKeys.cpp" />
|
||||
<ClCompile Include="app\util\Win32Util.cpp" />
|
||||
<ClCompile Include="app\window\CategoryListView.cpp" />
|
||||
<ClCompile Include="app\window\EntryWithHeader.cpp" />
|
||||
<ClCompile Include="app\window\LogWindow.cpp" />
|
||||
@ -165,6 +164,7 @@
|
||||
<ClCompile Include="cursespp\Text.cpp" />
|
||||
<ClCompile Include="cursespp\TextInput.cpp" />
|
||||
<ClCompile Include="cursespp\TextLabel.cpp" />
|
||||
<ClCompile Include="cursespp\Win32Util.cpp" />
|
||||
<ClCompile Include="cursespp\Window.cpp" />
|
||||
<ClCompile Include="Main.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@ -192,7 +192,6 @@
|
||||
<ClInclude Include="app\util\Playback.h" />
|
||||
<ClInclude Include="app\util\PreferenceKeys.h" />
|
||||
<ClInclude Include="app\util\Version.h" />
|
||||
<ClInclude Include="app\util\Win32Util.h" />
|
||||
<ClInclude Include="app\window\CategoryListView.h" />
|
||||
<ClInclude Include="app\window\EntryWithHeader.h" />
|
||||
<ClInclude Include="app\window\LogWindow.h" />
|
||||
@ -230,7 +229,9 @@
|
||||
<ClInclude Include="cursespp\Text.h" />
|
||||
<ClInclude Include="cursespp\TextInput.h" />
|
||||
<ClInclude Include="cursespp\TextLabel.h" />
|
||||
<ClInclude Include="cursespp\Win32Util.h" />
|
||||
<ClInclude Include="cursespp\Window.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -246,6 +247,12 @@
|
||||
<Project>{01869283-4cc3-4da4-a06c-3df6a0de98cc}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="musikbox.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
@ -120,9 +120,6 @@
|
||||
<ClCompile Include="app\overlay\PlaybackOverlays.cpp">
|
||||
<Filter>app\overlay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="app\util\Win32Util.cpp">
|
||||
<Filter>app\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="app\overlay\PlayQueueOverlays.cpp">
|
||||
<Filter>app\overlay</Filter>
|
||||
</ClCompile>
|
||||
@ -132,6 +129,9 @@
|
||||
<ClCompile Include="app\overlay\PluginOverlay.cpp">
|
||||
<Filter>app\overlay</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="cursespp\Win32Util.cpp">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
@ -297,9 +297,6 @@
|
||||
<ClInclude Include="cursespp\IViewRoot.h">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="app\util\Win32Util.h">
|
||||
<Filter>app\util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="app\overlay\PlayQueueOverlays.h">
|
||||
<Filter>app\overlay</Filter>
|
||||
</ClInclude>
|
||||
@ -309,6 +306,10 @@
|
||||
<ClInclude Include="app\overlay\PluginOverlay.h">
|
||||
<Filter>app\overlay</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="cursespp\Win32Util.h">
|
||||
<Filter>cursespp</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="cursespp">
|
||||
@ -333,4 +334,10 @@
|
||||
<UniqueIdentifier>{a84f242d-d70b-49e9-975e-63fc73954a2b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="musikbox.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="icon.ico" />
|
||||
</ItemGroup>
|
||||
</Project>
|
BIN
src/musikbox/resource.h
Normal file
BIN
src/musikbox/resource.h
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user