mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
feat: Windows console window (#860)
* Add console option for windows * add changelog entry * chnagelog * update changelog * Daran solls nicht fehlen * nsis: Install vcredist * Disable vc_redist detection
This commit is contained in:
parent
0f3da1ccc7
commit
de9ece5139
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@ -106,7 +106,7 @@
|
||||
"type": "shell",
|
||||
"command": "${workspaceFolder}/build/bin/hyperiond -d",
|
||||
"windows": {
|
||||
"command": "${workspaceFolder}/build/bin/Debug/hyperiond"
|
||||
"command": "${workspaceFolder}/build/bin/Debug/hyperiond -d -c"
|
||||
},
|
||||
"group": "build"
|
||||
},
|
||||
@ -115,7 +115,7 @@
|
||||
"type": "shell",
|
||||
"command": "${workspaceFolder}/build/bin/hyperiond -d",
|
||||
"windows": {
|
||||
"command": "${workspaceFolder}/build/bin/Release/hyperiond"
|
||||
"command": "${workspaceFolder}/build/bin/Release/hyperiond -d -c"
|
||||
},
|
||||
"group": "build"
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- An option to reset (delete) the database for the commandline has been added (#820)
|
||||
- Improve language selection usability (#812)
|
||||
- readded V4L2 Input method from old Hyperion (#825)
|
||||
- Windows: Start Hyperion with a console window `hyperiond -c` (Or new start menu entry) (#860)
|
||||
|
||||
### Changed
|
||||
- Updated dependency rpi_ws281x to latest upstream (#820)
|
||||
- Updated websocket-extensions (#826)
|
||||
|
@ -48,6 +48,9 @@ Covers these topics (WorkInProgress)
|
||||
|
||||
[![Visit Documentation](https://img.shields.io/website?down_message=offline&label=Documentation%20%20&up_message=online&url=https%3A%2F%2Fdocs.hyperion-project.org)](https://docs.hyperion-project.org)
|
||||
|
||||
## Changelog
|
||||
Released and unreleased changes at [Changelog.md](CHANGELOG.md)
|
||||
|
||||
## Building
|
||||
See [CompileHowto](CompileHowto.md) and [CrossCompileHowto](CrossCompileHowto.md).
|
||||
|
||||
|
@ -724,6 +724,24 @@ Section "-Core installation"
|
||||
|
||||
@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
|
||||
|
||||
; Custom vcredist install script, detection is not reliable
|
||||
;ReadRegStr $1 HKLM "SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\X64" "Bld"
|
||||
;DetailPrint "VCREDIS KEY: $1"
|
||||
;
|
||||
;IntCmp $1 28508 Equal Val1Less Val1More
|
||||
;Equal:
|
||||
; DetailPrint "$1 = 28508 "
|
||||
; Goto End
|
||||
;Val1Less:
|
||||
; DetailPrint "$1 < 28508 "
|
||||
; Goto End
|
||||
;Val1More:
|
||||
; DetailPrint "$1 > 28508 "
|
||||
; Goto End
|
||||
;End:
|
||||
|
||||
ExecWait '"$INSTDIR\bin\vc_redist.x64.exe" /install /quiet'
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section "-Add to path"
|
||||
|
@ -101,14 +101,16 @@ SET ( CPACK_NSIS_PACKAGE_NAME "Hyperion" )
|
||||
SET ( CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\hyperiond.exe")
|
||||
SET ( CPACK_NSIS_HELP_LINK "https://www.hyperion-project.org")
|
||||
SET ( CPACK_NSIS_URL_INFO_ABOUT "https://www.hyperion-project.org")
|
||||
# hyperiond startmenu link
|
||||
# additional hyperiond startmenu link, won't be created if the user disables startmenu links
|
||||
SET ( CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Hyperion (Console).lnk' '$INSTDIR\\\\bin\\\\hyperiond.exe' '-d -c'")
|
||||
SET ( CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Hyperion (Console).lnk'")
|
||||
|
||||
|
||||
#SET ( CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Hyperion.lnk' '$INSTDIR\\\\bin\\\\hyperiond.exe'")
|
||||
#SET ( CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$SMPROGRAMS\\\\$START_MENU\\\\Hyperion.lnk'")
|
||||
# hyperiond desktop link
|
||||
#SET ( CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$DESKTOP\\\\Hyperion.lnk' '$INSTDIR\\\\bin\\\\hyperiond.exe' ")
|
||||
#SET ( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "Delete '$DESKTOP\\\\Hyperion.lnk' ")
|
||||
|
||||
# With cli args: SET ( CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Hyperion (Debug).lnk' '$INSTDIR\\\\bin\\\\hyperiond.exe' '-d'")
|
||||
#SET ( CPACK_NSIS_EXTRA_INSTALL_COMMANDS "CreateShortCut \\\"$DESKTOP\\\\Hyperion.lnk\\\" \\\"$INSTDIR\\\\bin\\\\hyperiond.exe\\\" ")
|
||||
#SET ( CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "Delete \\\"$DESKTOP\\\\Hyperion.lnk\\\" ")
|
||||
|
||||
|
@ -9,6 +9,7 @@ endif()
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
add_executable(hyperiond
|
||||
console.h
|
||||
hyperiond.h
|
||||
systray.h
|
||||
hyperiond.cpp
|
||||
|
34
src/hyperiond/console.h
Normal file
34
src/hyperiond/console.h
Normal file
@ -0,0 +1,34 @@
|
||||
#include <Windows.h>
|
||||
|
||||
// https://stackoverflow.com/a/57241985
|
||||
void CreateConsole()
|
||||
{
|
||||
if (!AllocConsole()) {
|
||||
// Add some error handling here.
|
||||
// You can call GetLastError() to get more info about the error.
|
||||
return;
|
||||
}
|
||||
|
||||
// std::cout, std::clog, std::cerr, std::cin
|
||||
FILE* fDummy;
|
||||
freopen_s(&fDummy, "CONOUT$", "w", stdout);
|
||||
freopen_s(&fDummy, "CONOUT$", "w", stderr);
|
||||
freopen_s(&fDummy, "CONIN$", "r", stdin);
|
||||
//std::cout.clear();
|
||||
//std::clog.clear();
|
||||
//std::cerr.clear();
|
||||
//std::cin.clear();
|
||||
|
||||
|
||||
/*// std::wcout, std::wclog, std::wcerr, std::wcin
|
||||
HANDLE hConOut = CreateFile(_T("CONOUT$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
HANDLE hConIn = CreateFile(_T("CONIN$"), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
SetStdHandle(STD_OUTPUT_HANDLE, hConOut);
|
||||
SetStdHandle(STD_ERROR_HANDLE, hConOut);
|
||||
SetStdHandle(STD_INPUT_HANDLE, hConIn);
|
||||
std::wcout.clear();
|
||||
std::wclog.clear();
|
||||
std::wcerr.clear();
|
||||
std::wcin.clear();
|
||||
*/
|
||||
}
|
@ -9,8 +9,8 @@
|
||||
#endif
|
||||
// getpid()
|
||||
#ifdef _WIN32
|
||||
#include "console.h"
|
||||
#include <process.h>
|
||||
//#include <Windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -143,10 +143,6 @@ int main(int argc, char** argv)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
setenv("AVAHI_COMPAT_NOWARN", "1", 1);
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
// We can get a console window also in app gui mode conditional
|
||||
//AllocConsole();
|
||||
#endif
|
||||
// initialize main logger and set global log level
|
||||
Logger *log = Logger::getInstance("MAIN");
|
||||
@ -195,12 +191,22 @@ int main(int argc, char** argv)
|
||||
BooleanOption & silentOption = parser.add<BooleanOption> ('s', "silent", "do not print any outputs");
|
||||
BooleanOption & verboseOption = parser.add<BooleanOption> ('v', "verbose", "Increase verbosity");
|
||||
BooleanOption & debugOption = parser.add<BooleanOption> ('d', "debug", "Show debug messages");
|
||||
#ifdef WIN32
|
||||
BooleanOption & consoleOption = parser.add<BooleanOption> ('c', "console", "Open a console window to view log output");
|
||||
#endif
|
||||
parser.add<BooleanOption> (0x0, "desktop", "show systray on desktop");
|
||||
parser.add<BooleanOption> (0x0, "service", "force hyperion to start as console service");
|
||||
Option & exportEfxOption = parser.add<Option> (0x0, "export-effects", "export effects to given path");
|
||||
|
||||
parser.process(*qApp);
|
||||
|
||||
#ifdef WIN32
|
||||
if (parser.isSet(consoleOption))
|
||||
{
|
||||
CreateConsole();
|
||||
}
|
||||
#endif
|
||||
|
||||
int logLevelCheck = 0;
|
||||
if (parser.isSet(silentOption))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user