diff --git a/audioengine.sln b/audioengine.sln index 729b81138..05a4ad4c5 100644 --- a/audioengine.sln +++ b/audioengine.sln @@ -4,7 +4,7 @@ VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp3decoder", "src\contrib\mp3decoder\mp3decoder.vcxproj", "{293471C3-93F8-4C70-AC2B-9F9211529C3B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "square", "src\square\player.vcxproj", "{C7102EB1-7311-4B36-A7FF-89DD7F077FF9}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "musikbox", "src\musikbox\musikbox.vcxproj", "{C7102EB1-7311-4B36-A7FF-89DD7F077FF9}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oggdecoder", "src\contrib\oggdecoder\oggdecoder.vcxproj", "{292974B0-C8B7-41EF-B603-554A2B25CB90}" EndProject diff --git a/installer/LanguageStrings.nsh b/installer/LanguageStrings.nsh deleted file mode 100644 index 3ae024609..000000000 --- a/installer/LanguageStrings.nsh +++ /dev/null @@ -1,12 +0,0 @@ -LangString MUI_INNERTEXT_LICENSE_TOP ${LANG_ENGLISH} "" -LangString MUI_INNERTEXT_LICENSE_BOTTOM ${LANG_ENGLISH} "" -LangString MUI_TEXT_LICENSE_TITLE ${LANG_ENGLISH} "mC2 Installation" -LangString MUI_TEXT_LICENSE_SUBTITLE ${LANG_ENGLISH} "New BSD License" -LangString MUI_TEXT_DIRECTORY_TITLE ${LANG_ENGLISH} "mC2 Installation" -LangString MUI_TEXT_DIRECTORY_SUBTITLE ${LANG_ENGLISH} "Choose directory" -LangString MUI_TEXT_INSTALLING_TITLE ${LANG_ENGLISH} "mC2 Installation" -LangString MUI_TEXT_INSTALLING_SUBTITLE ${LANG_ENGLISH} "Installing..." -LangString MUI_TEXT_FINISH_TITLE ${LANG_ENGLISH} "mC2 Installation" -LangString MUI_TEXT_FINISH_SUBTITLE ${LANG_ENGLISH} "Installation finished" -LangString MUI_TEXT_ABORT_TITLE ${LANG_ENGLISH} "mC2 Installation" -LangString MUI_TEXT_ABORT_SUBTITLE ${LANG_ENGLISH} "Abort installation" diff --git a/installer/mc2_installer.nsi b/installer/mc2_installer.nsi deleted file mode 100644 index 65f2e46ed..000000000 --- a/installer/mc2_installer.nsi +++ /dev/null @@ -1,131 +0,0 @@ -SetCompressor /SOLID lzma - -!include "MUI.nsh" -!include "FileFunc.nsh" -!insertmacro DirState - - -!define TRUE 1 -!define FALSE 0 - -!define MUI_BGCOLOR "FFFFFF" - -!define PROJECT_NAME "musikCube 2" -!define SUB_NAME "developers milestone 3" -!define INSTALLER_NAME "mC2dm3" -!define INSTALL_DIR "musikCube 2" - -;---------------------------------------------------------------- -!define MC2_DB_DIR "$APPDATA\mC2" - -OutFile ".\${INSTALLER_NAME}.exe" - -Name "${PROJECT_NAME} ${SUB_NAME}" - -ShowInstDetails show ;show/hide - -Var RemoveOldDatabases - -!include "LanguageStrings.nsh" -!insertmacro MUI_LANGUAGE "English" - -InstallDir "$PROGRAMFILES\${INSTALL_DIR}" -InstallDirRegKey HKCU "Software\${INSTALL_DIR}" "" - -; Installation pages order -!insertmacro MUI_PAGE_LICENSE "..\LICENSE.txt" -!insertmacro MUI_PAGE_DIRECTORY -Page custom RemoveOldFilesPage RemoveOldFilesLeave ;Custom page -!insertmacro MUI_PAGE_COMPONENTS -!insertmacro MUI_PAGE_INSTFILES - - -Section "!mC2" main - - SectionIn RO - SetShellVarContext current - SetOverwrite on - - SetOutPath "$INSTDIR" - File "..\bin\release\mC2.exe" - File "..\LICENSE.txt" - File /r "..\bin\release\resources" - - SetOutPath "$INSTDIR\plugins" - Delete "*.dll" - File "..\bin\release\plugins\httpstream_plugin.dll" - File "..\bin\release\plugins\waveout.dll" - File "..\bin\release\plugins\taglib_plugin.dll" - - IntCmpU $RemoveOldDatabases 0 DoNotRemoveDBFiles - ; Remove the app data - RMDir /r "${MC2_DB_DIR}" - DoNotRemoveDBFiles: - - CreateDirectory "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}" - CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\${PROJECT_NAME}.lnk" "$INSTDIR\mC2.exe" - -SectionEnd - -Section "musikServer" - SetShellVarContext current - SetOverwrite on - SetOutPath "$INSTDIR" - File "..\bin\release\musikServer.exe" - CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\musikServer.lnk" "$INSTDIR\musikServer.exe" -SectionEnd - -SubSection Plugins plugins - Section "MP3 decoder" - SetOutPath "$INSTDIR\plugins" - File "..\bin\release\plugins\mpg123decoder.dll" - SectionEnd - Section "OGG decoder" - SetOutPath "$INSTDIR\plugins" - File "..\bin\release\plugins\oggdecoder.dll" - SectionEnd - Section "FLAC decoder" - SetOutPath "$INSTDIR\plugins" - File "..\bin\release\plugins\flacdecoder.dll" - SectionEnd - Section /o "BPM analyzer" - SetOutPath "$INSTDIR\plugins" - File "..\bin\release\plugins\bpm_analyzer.dll" - SectionEnd - Section /o "DSP echo test" - SetOutPath "$INSTDIR\plugins" - File "..\bin\release\plugins\dsp_example_echo.dll" - SectionEnd - -SubSectionEnd - - -Section -Post - WriteRegStr HKCU "Software\${INSTALL_DIR}" "" $INSTDIR - WriteUninstaller "$INSTDIR\uninst.exe" - CreateDirectory "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}" - CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\Uninstall.lnk" "$INSTDIR\uninst.exe" -SectionEnd - -Section Uninstall - SetShellVarContext current - RMDir /r "$INSTDIR" - RMDir /r "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}" -SectionEnd - -Function .onInit - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "remove_old_db.ini" -FunctionEnd - -Function RemoveOldFilesPage - ${DirState} "${MC2_DB_DIR}" $0 - IntCmp $0 -1 0 +2 +2 - Abort - !insertmacro MUI_HEADER_TEXT "mC2 installation" "Removing old database files" - !insertmacro MUI_INSTALLOPTIONS_WRITE "remove_old_db.ini" "Field 2" "Text" "Remove old mC2 databases in ${MC2_DB_DIR}" - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "remove_old_db.ini" -FunctionEnd - -Function RemoveOldFilesLeave - !insertmacro MUI_INSTALLOPTIONS_READ $RemoveOldDatabases "remove_old_db.ini" "Field 2" "State" -FunctionEnd diff --git a/installer/remove_old_db.ini b/installer/remove_old_db.ini deleted file mode 100644 index 86c684e93..000000000 --- a/installer/remove_old_db.ini +++ /dev/null @@ -1,29 +0,0 @@ -; Ini file generated by the HM NIS Edit IO designer. -[Settings] -NumFields=3 - -[Field 1] -Type=Groupbox -Text=Remove old files -Left=10 -Right=258 -Top=7 -Bottom=83 - -[Field 2] -Type=Checkbox -Text=Remove old mC2 databases -Left=29 -Right=242 -Top=52 -Bottom=83 -State=1 - -[Field 3] -Type=Label -Text=If you have run an old version of mC2, you need to remove the old databases since they are incompatible with the latest version of mC2. -Left=22 -Right=248 -Top=23 -Bottom=52 - diff --git a/src/3rdparty/include/vld/vld.h b/src/3rdparty/include/vld/vld.h deleted file mode 100644 index a5cd63c3b..000000000 --- a/src/3rdparty/include/vld/vld.h +++ /dev/null @@ -1,98 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// $Id: vld.h,v 1.29 2006/11/18 03:12:35 dmouldin Exp $ -// -// Visual Leak Detector - Import Library Header -// Copyright (c) 2006 Dan Moulding -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -// -// See COPYING.txt for the full terms of the GNU Lesser General Public License. -// -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#ifdef _DEBUG - -#pragma comment(lib, "vld.lib") - -// Force a symbolic reference to the global VisualLeakDetector class object from -// the DLL. This enusres that the DLL is loaded and linked with the program, -// even if no code otherwise imports any of the DLL's exports. -#pragma comment(linker, "/include:__imp_?vld@@3VVisualLeakDetector@@A") - -//////////////////////////////////////////////////////////////////////////////// -// -// Visual Leak Detector APIs -// - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// VLDDisable - Disables Visual Leak Detector's memory leak detection at -// runtime. If memory leak detection is already disabled, then calling this -// function has no effect. -// -// Note: In multithreaded programs, this function operates on a per-thread -// basis. In other words, if you call this function from one thread, then -// memory leak detection is only disabled for that thread. If memory leak -// detection is enabled for other threads, then it will remain enabled for -// those other threads. It was designed to work this way to insulate you, -// the programmer, from having to ensure thread synchronization when calling -// VLDEnable() and VLDDisable(). Without this, calling these two functions -// unsychronized could result in unpredictable and unintended behavior. -// But this also means that if you want to disable memory leak detection -// process-wide, then you need to call this function from every thread in -// the process. -// -// Return Value: -// -// None. -// -__declspec(dllimport) void VLDDisable (); - -// VLDEnable - Enables Visual Leak Detector's memory leak detection at runtime. -// If memory leak detection is already enabled, which it is by default, then -// calling this function has no effect. -// -// Note: In multithreaded programs, this function operates on a per-thread -// basis. In other words, if you call this function from one thread, then -// memory leak detection is only enabled for that thread. If memory leak -// detection is disabled for other threads, then it will remain disabled for -// those other threads. It was designed to work this way to insulate you, -// the programmer, from having to ensure thread synchronization when calling -// VLDEnable() and VLDDisable(). Without this, calling these two functions -// unsychronized could result in unpredictable and unintended behavior. -// But this also means that if you want to enable memory leak detection -// process-wide, then you need to call this function from every thread in -// the process. -// -// Return Value: -// -// None. -// -__declspec(dllimport) void VLDEnable (); - -#ifdef __cplusplus -} -#endif // __cplusplus - -#else // !_DEBUG - -#define VLDEnable() -#define VLDDisable() - -#endif // _DEBUG \ No newline at end of file diff --git a/src/3rdparty/include/zconf.h b/src/3rdparty/include/zconf.h deleted file mode 100644 index 03a9431c8..000000000 --- a/src/3rdparty/include/zconf.h +++ /dev/null @@ -1,332 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define deflatePrime z_deflatePrime -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table -# define zError z_zError - -# define alloc_func z_alloc_func -# define free_func z_free_func -# define in_func z_in_func -# define out_func z_out_func -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/src/3rdparty/lib/vld.lib b/src/3rdparty/lib/vld.lib deleted file mode 100644 index 3a8cb5c2f..000000000 Binary files a/src/3rdparty/lib/vld.lib and /dev/null differ diff --git a/src/3rdparty/vld/Microsoft.DTfW.DHL.manifest b/src/3rdparty/vld/Microsoft.DTfW.DHL.manifest deleted file mode 100644 index 8c449d10f..000000000 --- a/src/3rdparty/vld/Microsoft.DTfW.DHL.manifest +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/3rdparty/vld/Microsoft.VC80.CRT.manifest b/src/3rdparty/vld/Microsoft.VC80.CRT.manifest deleted file mode 100644 index 217731fbb..000000000 --- a/src/3rdparty/vld/Microsoft.VC80.CRT.manifest +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - diff --git a/src/3rdparty/vld/dbghelp.dll b/src/3rdparty/vld/dbghelp.dll deleted file mode 100644 index e564ef46f..000000000 Binary files a/src/3rdparty/vld/dbghelp.dll and /dev/null differ diff --git a/src/3rdparty/vld/msvcr80.dll b/src/3rdparty/vld/msvcr80.dll deleted file mode 100644 index 3d9561ac5..000000000 Binary files a/src/3rdparty/vld/msvcr80.dll and /dev/null differ diff --git a/src/3rdparty/vld/vld.dll b/src/3rdparty/vld/vld.dll deleted file mode 100644 index b3f2bdcb1..000000000 Binary files a/src/3rdparty/vld/vld.dll and /dev/null differ diff --git a/src/contrib/cddadecoder/cddadecoder.vcxproj b/src/contrib/cddadecoder/cddadecoder.vcxproj index e99355fba..06976df32 100755 --- a/src/contrib/cddadecoder/cddadecoder.vcxproj +++ b/src/contrib/cddadecoder/cddadecoder.vcxproj @@ -71,6 +71,7 @@ shlwapi.lib;%(AdditionalDependencies) ../../3rdparty/lib;../../../../boost_1_60_0/lib32-msvc-14.0;%(AdditionalLibraryDirectories) true + false diff --git a/src/contrib/mp3decoder/mp3decoder.vcxproj b/src/contrib/mp3decoder/mp3decoder.vcxproj index 11be0f591..46ca677f4 100755 --- a/src/contrib/mp3decoder/mp3decoder.vcxproj +++ b/src/contrib/mp3decoder/mp3decoder.vcxproj @@ -71,6 +71,7 @@ shlwapi.lib;%(AdditionalDependencies) ../../3rdparty/lib;../../../../boost_1_60_0/lib32-msvc-14.0;%(AdditionalLibraryDirectories) true + false diff --git a/src/contrib/oggdecoder/oggdecoder.vcxproj b/src/contrib/oggdecoder/oggdecoder.vcxproj index 485285681..4e4bd2e64 100755 --- a/src/contrib/oggdecoder/oggdecoder.vcxproj +++ b/src/contrib/oggdecoder/oggdecoder.vcxproj @@ -73,6 +73,7 @@ ./lib;../../3rdparty/lib;../../../../boost_1_60_0/lib32-msvc-14.0;%(AdditionalLibraryDirectories) true Windows + false diff --git a/src/contrib/taglib_plugin/taglib_plugin.vcxproj b/src/contrib/taglib_plugin/taglib_plugin.vcxproj index 01903f0a4..baacd4851 100755 --- a/src/contrib/taglib_plugin/taglib_plugin.vcxproj +++ b/src/contrib/taglib_plugin/taglib_plugin.vcxproj @@ -79,6 +79,7 @@ true Windows MachineX86 + false diff --git a/src/contrib/waveout/waveout.vcxproj b/src/contrib/waveout/waveout.vcxproj index 191d1d5a6..74d172aa0 100755 --- a/src/contrib/waveout/waveout.vcxproj +++ b/src/contrib/waveout/waveout.vcxproj @@ -73,6 +73,7 @@ true Windows MachineX86 + false diff --git a/src/square/BorderedWindow.cpp b/src/musikbox/BorderedWindow.cpp similarity index 100% rename from src/square/BorderedWindow.cpp rename to src/musikbox/BorderedWindow.cpp diff --git a/src/square/BorderedWindow.h b/src/musikbox/BorderedWindow.h similarity index 100% rename from src/square/BorderedWindow.h rename to src/musikbox/BorderedWindow.h diff --git a/src/square/CMakeLists.txt b/src/musikbox/CMakeLists.txt similarity index 100% rename from src/square/CMakeLists.txt rename to src/musikbox/CMakeLists.txt diff --git a/src/square/Colors.cpp b/src/musikbox/Colors.cpp similarity index 87% rename from src/square/Colors.cpp rename to src/musikbox/Colors.cpp index e7abe1119..0e5838c3f 100755 --- a/src/square/Colors.cpp +++ b/src/musikbox/Colors.cpp @@ -14,5 +14,6 @@ void Colors::Init() { init_pair(BOX_COLOR_BLACK_ON_GREEN, COLOR_BLACK, COLOR_GREEN); init_pair(BOX_COLOR_YELLOW_ON_BLACK, COLOR_YELLOW, COLOR_BLACK); init_pair(BOX_COLOR_WHITE_ON_BLACK, COLOR_WHITE, COLOR_BLACK); + init_pair(BOX_COLOR_RED_ON_BLACK, COLOR_RED, COLOR_BLACK); } diff --git a/src/square/Colors.h b/src/musikbox/Colors.h similarity index 87% rename from src/square/Colors.h rename to src/musikbox/Colors.h index f5b9c69a4..0a649201c 100755 --- a/src/square/Colors.h +++ b/src/musikbox/Colors.h @@ -9,6 +9,7 @@ #define BOX_COLOR_BLACK_ON_GREEN 5 #define BOX_COLOR_YELLOW_ON_BLACK 6 #define BOX_COLOR_WHITE_ON_BLACK 7 +#define BOX_COLOR_RED_ON_BLACK 8 class Colors { private: diff --git a/src/square/CommandWindow.cpp b/src/musikbox/CommandWindow.cpp similarity index 92% rename from src/square/CommandWindow.cpp rename to src/musikbox/CommandWindow.cpp index 143e8eff4..f3f25e20e 100755 --- a/src/square/CommandWindow.cpp +++ b/src/musikbox/CommandWindow.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -39,8 +38,8 @@ CommandWindow::CommandWindow(Transport& transport, OutputWindow& output) { this->Create(); this->output = &output; this->paused = false; - - this->output->WriteLine("hello! type 'h' or 'help'"); + this->library = LibraryFactory::Libraries().at(0); + this->output->WriteLine("type 'h' or 'help'\n"); } CommandWindow::~CommandWindow() { @@ -129,8 +128,11 @@ bool CommandWindow::ProcessCommand(const std::string& cmd) { else if (name == "play" || name == "pl" || name == "p") { return this->PlayFile(args); } + else if (name == "adddir") { + std::string path = boost::algorithm::join(args, " "); + library->Indexer()->AddPath(path); + } else if (name == "rescan" || name == "scan" || name == "index") { - LibraryPtr library = LibraryFactory::Libraries().at(0); /* there's always at least 1... */ library->Indexer()->RestartSync(); } else if (name == "h" || name == "help") { diff --git a/src/square/CommandWindow.h b/src/musikbox/CommandWindow.h similarity index 86% rename from src/square/CommandWindow.h rename to src/musikbox/CommandWindow.h index 736f6fa99..265717240 100755 --- a/src/square/CommandWindow.h +++ b/src/musikbox/CommandWindow.h @@ -3,8 +3,11 @@ #include "curses_config.h" #include "BorderedWindow.h" #include "OutputWindow.h" -#include +#include +#include + +using musik::core::LibraryPtr; using namespace musik::core::audio; class CommandWindow : public BorderedWindow { @@ -30,5 +33,6 @@ class CommandWindow : public BorderedWindow { int bufferPosition; OutputWindow* output; Transport* transport; + LibraryPtr library; bool paused; }; \ No newline at end of file diff --git a/src/square/IScrollAdapter.h b/src/musikbox/IScrollAdapter.h similarity index 79% rename from src/square/IScrollAdapter.h rename to src/musikbox/IScrollAdapter.h index 2ae4f56c0..c1dff2aab 100755 --- a/src/square/IScrollAdapter.h +++ b/src/musikbox/IScrollAdapter.h @@ -5,7 +5,7 @@ class IScrollAdapter { public: virtual void SetDisplaySize(size_t width, size_t height) = 0; - virtual size_t GetLineCount(size_t width) = 0; + virtual size_t GetLineCount() = 0; virtual size_t GetEntryCount() = 0; virtual void DrawPage(WINDOW* window, size_t index) = 0; }; diff --git a/src/square/LogWindow.cpp b/src/musikbox/LogWindow.cpp similarity index 93% rename from src/square/LogWindow.cpp rename to src/musikbox/LogWindow.cpp index 7dced1da2..5a840dc32 100755 --- a/src/square/LogWindow.cpp +++ b/src/musikbox/LogWindow.cpp @@ -13,6 +13,7 @@ LogWindow::LogWindow() { this->adapter = new SimpleScrollAdapter(); this->adapter->SetDisplaySize(this->GetContentWidth(), this->GetContentHeight()); + this->adapter->SetMaxEntries(500); this->Create(); @@ -53,6 +54,8 @@ void LogWindow::Update() { "[%1%] %2%") % entry->tag % entry->message); this->adapter->AddLine(s, attrs); + + delete entry; } this->OnAdapterChanged(); diff --git a/src/square/LogWindow.h b/src/musikbox/LogWindow.h similarity index 100% rename from src/square/LogWindow.h rename to src/musikbox/LogWindow.h diff --git a/src/square/Main.cpp b/src/musikbox/Main.cpp similarity index 97% rename from src/square/Main.cpp rename to src/musikbox/Main.cpp index e7f8e757e..579c772ef 100644 --- a/src/square/Main.cpp +++ b/src/musikbox/Main.cpp @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) size_t index = 0; ScrollableWindow *scrollable = order.at(index); - scrollable->SetBorderColor(BOX_COLOR_YELLOW_ON_BLACK); + scrollable->SetBorderColor(BOX_COLOR_RED_ON_BLACK); int ch; timeout(500); @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) } scrollable = order.at(index); - scrollable->SetBorderColor(BOX_COLOR_YELLOW_ON_BLACK); + scrollable->SetBorderColor(BOX_COLOR_RED_ON_BLACK); } else if (ch >= KEY_F(0) && ch <= KEY_F(12)) { } diff --git a/src/square/OutputWindow.cpp b/src/musikbox/OutputWindow.cpp similarity index 91% rename from src/square/OutputWindow.cpp rename to src/musikbox/OutputWindow.cpp index 069dc6fab..dc2f2f144 100755 --- a/src/square/OutputWindow.cpp +++ b/src/musikbox/OutputWindow.cpp @@ -14,6 +14,7 @@ OutputWindow::OutputWindow() this->adapter = new SimpleScrollAdapter(); this->adapter->SetDisplaySize(this->GetContentWidth(), this->GetContentHeight()); + this->adapter->SetMaxEntries(500); this->Create(); } diff --git a/src/square/OutputWindow.h b/src/musikbox/OutputWindow.h similarity index 100% rename from src/square/OutputWindow.h rename to src/musikbox/OutputWindow.h diff --git a/src/square/ResourcesWindow.cpp b/src/musikbox/ResourcesWindow.cpp similarity index 100% rename from src/square/ResourcesWindow.cpp rename to src/musikbox/ResourcesWindow.cpp diff --git a/src/square/ResourcesWindow.h b/src/musikbox/ResourcesWindow.h similarity index 100% rename from src/square/ResourcesWindow.h rename to src/musikbox/ResourcesWindow.h diff --git a/src/square/Screen.cpp b/src/musikbox/Screen.cpp similarity index 100% rename from src/square/Screen.cpp rename to src/musikbox/Screen.cpp diff --git a/src/square/Screen.h b/src/musikbox/Screen.h similarity index 100% rename from src/square/Screen.h rename to src/musikbox/Screen.h diff --git a/src/square/ScrollableWindow.cpp b/src/musikbox/ScrollableWindow.cpp similarity index 88% rename from src/square/ScrollableWindow.cpp rename to src/musikbox/ScrollableWindow.cpp index 7a8dc495c..e5a70fa65 100755 --- a/src/square/ScrollableWindow.cpp +++ b/src/musikbox/ScrollableWindow.cpp @@ -32,7 +32,7 @@ size_t ScrollableWindow::GetFirstVisible() { } size_t ScrollableWindow::GetLastVisible() { - size_t total = GetScrollAdapter().GetLineCount(this->GetContentWidth()); + size_t total = GetScrollAdapter().GetLineCount(); return min(scrollPosition + this->GetContentHeight(), total); } @@ -46,7 +46,7 @@ void ScrollableWindow::ScrollToTop() { void ScrollableWindow::ScrollToBottom() { IScrollAdapter *adapter = &GetScrollAdapter(); - int total = (int) adapter->GetLineCount(this->GetWidth()); + int total = (int) adapter->GetLineCount(); int height = this->GetContentHeight(); int actual = total - height; @@ -73,7 +73,7 @@ void ScrollableWindow::ScrollUp(int delta) { void ScrollableWindow::ScrollDown(int delta) { IScrollAdapter *adapter = &GetScrollAdapter(); - int total = adapter->GetLineCount(this->GetWidth()); + int total = adapter->GetLineCount(); int height = this->GetContentHeight(); int optimal = total - height; int max = max(0, optimal); diff --git a/src/square/ScrollableWindow.h b/src/musikbox/ScrollableWindow.h similarity index 100% rename from src/square/ScrollableWindow.h rename to src/musikbox/ScrollableWindow.h diff --git a/src/square/SimpleScrollAdapter.cpp b/src/musikbox/SimpleScrollAdapter.cpp similarity index 84% rename from src/square/SimpleScrollAdapter.cpp rename to src/musikbox/SimpleScrollAdapter.cpp index 60a5fe30e..52c328558 100755 --- a/src/square/SimpleScrollAdapter.cpp +++ b/src/musikbox/SimpleScrollAdapter.cpp @@ -4,8 +4,16 @@ #include #include +#define MAX_ENTRY_COUNT 0xffffffff + SimpleScrollAdapter::SimpleScrollAdapter() { this->lineCount = 0; + + /* the adapters can have a maximum size. as we remove elements from + the back, we don't want to re-index everything. instead, we'll use + this offset for future calculations when searching for items. */ + this->removedOffset = 0; + this->maxEntries = MAX_ENTRY_COUNT; } SimpleScrollAdapter::~SimpleScrollAdapter() { @@ -20,7 +28,7 @@ void SimpleScrollAdapter::SetDisplaySize(size_t width, size_t height) { } } -size_t SimpleScrollAdapter::GetLineCount(size_t width) { +size_t SimpleScrollAdapter::GetLineCount() { return this->lineCount; } @@ -28,6 +36,10 @@ size_t SimpleScrollAdapter::GetEntryCount() { return this->entries.size(); } +void SimpleScrollAdapter::SetMaxEntries(size_t maxEntries) { + this->maxEntries = maxEntries; +} + void SimpleScrollAdapter::DrawPage(WINDOW* window, size_t lineNumber) { wclear(window); @@ -35,6 +47,14 @@ void SimpleScrollAdapter::DrawPage(WINDOW* window, size_t lineNumber) { return; } + if (lineNumber >= this->lineCount) { + lineNumber = this->lineCount - 1; + } + + if (lineNumber < 0) { + lineNumber = 0; + } + /* binary search to find where we need to start */ size_t offset = this->FindEntryIndex(lineNumber); @@ -52,7 +72,7 @@ void SimpleScrollAdapter::DrawPage(WINDOW* window, size_t lineNumber) { size_t count = (*it)->GetLineCount(); int64 attrs = (*it)->GetAttrs(); - if (attrs != 0) { + if (attrs != -1) { wattron(window, attrs); } @@ -62,7 +82,7 @@ void SimpleScrollAdapter::DrawPage(WINDOW* window, size_t lineNumber) { --remaining; } - if (attrs != 0) { + if (attrs != -1) { wattroff(window, attrs); } @@ -75,10 +95,18 @@ void SimpleScrollAdapter::DrawPage(WINDOW* window, size_t lineNumber) { void SimpleScrollAdapter::AddLine(const std::string& str, int64 attrs) { boost::shared_ptr entry(new Entry(str)); entry->SetWidth(this->width); - entry->SetIndex(this->lineCount); + entry->SetIndex(this->lineCount + this->removedOffset); entry->SetAttrs(attrs); entries.push_back(entry); this->lineCount += entry->GetLineCount(); + + while (entries.size() > this->maxEntries) { + boost::shared_ptr e = entries.front(); + size_t lineCount = e->GetLineCount(); + this->removedOffset += lineCount; + this->lineCount -= lineCount; + entries.pop_front(); + } } size_t SimpleScrollAdapter::FindEntryIndex(size_t lineNumber) { @@ -86,13 +114,13 @@ size_t SimpleScrollAdapter::FindEntryIndex(size_t lineNumber) { Reindex(); } - size_t min = 0, max = this->entries.size(); + size_t min = 0, max = this->entries.size() - 1; while (true) { size_t guess = (min + max) / 2; Entry* entry = this->entries.at(guess).get(); - size_t first = entry->GetIndex(); + size_t first = entry->GetIndex() - this->removedOffset; size_t last = first + entry->GetLineCount(); if (lineNumber >= first && lineNumber <= last) { return guess; @@ -108,11 +136,15 @@ size_t SimpleScrollAdapter::FindEntryIndex(size_t lineNumber) { void SimpleScrollAdapter::Reindex() { int index = 0; + for (Iterator it = this->entries.begin(); it != this->entries.end(); it++) { (*it)->SetIndex(index); (*it)->SetWidth(this->width); index += (*it)->GetLineCount(); } + + this->removedOffset = 0; + this->lineCount = index; } SimpleScrollAdapter::Entry::Entry(const std::string& value) { diff --git a/src/square/SimpleScrollAdapter.h b/src/musikbox/SimpleScrollAdapter.h similarity index 81% rename from src/square/SimpleScrollAdapter.h rename to src/musikbox/SimpleScrollAdapter.h index 26c562701..5e11b5038 100755 --- a/src/square/SimpleScrollAdapter.h +++ b/src/musikbox/SimpleScrollAdapter.h @@ -2,6 +2,7 @@ #include "curses_config.h" #include "IScrollAdapter.h"; +#include class SimpleScrollAdapter : public IScrollAdapter { public: @@ -9,10 +10,12 @@ class SimpleScrollAdapter : public IScrollAdapter { virtual ~SimpleScrollAdapter(); virtual void SetDisplaySize(size_t width, size_t height); - virtual size_t GetLineCount(size_t width); + virtual size_t GetLineCount(); virtual size_t GetEntryCount(); virtual void DrawPage(WINDOW* window, size_t index); - virtual void AddLine(const std::string& str, int64 attrs = 0); + + virtual void AddLine(const std::string& str, int64 attrs = -1); + virtual void SetMaxEntries(const size_t size = 500); private: class Entry { @@ -38,7 +41,7 @@ class SimpleScrollAdapter : public IScrollAdapter { }; private: - typedef std::vector> EntryList; + typedef std::deque> EntryList; typedef EntryList::iterator Iterator; @@ -47,4 +50,6 @@ class SimpleScrollAdapter : public IScrollAdapter { EntryList entries; size_t lineCount, width, height; + size_t removedOffset; + size_t maxEntries; }; diff --git a/src/square/SystemInfo.cpp b/src/musikbox/SystemInfo.cpp similarity index 94% rename from src/square/SystemInfo.cpp rename to src/musikbox/SystemInfo.cpp index 9c005855b..5a6d7cfe3 100755 --- a/src/square/SystemInfo.cpp +++ b/src/musikbox/SystemInfo.cpp @@ -78,7 +78,7 @@ double SystemInfo::GetCpuUsage() { WindowsSystemInfo::WindowsSystemInfo() { PdhOpenQuery(NULL, NULL, &cpuQuery); PdhAddCounter(cpuQuery, "\\Processor(_Total)\\% Processor Time", NULL, &cpuTotal); - PdhCollectQueryData(cpuQuery); + //PdhCollectQueryData(cpuQuery); SYSTEM_INFO sysInfo; FILETIME ftime, fsys, fuser; diff --git a/src/square/SystemInfo.h b/src/musikbox/SystemInfo.h similarity index 100% rename from src/square/SystemInfo.h rename to src/musikbox/SystemInfo.h diff --git a/src/square/TransportEvents.cpp b/src/musikbox/TransportEvents.cpp similarity index 100% rename from src/square/TransportEvents.cpp rename to src/musikbox/TransportEvents.cpp diff --git a/src/square/TransportEvents.h b/src/musikbox/TransportEvents.h similarity index 100% rename from src/square/TransportEvents.h rename to src/musikbox/TransportEvents.h diff --git a/src/square/TransportWindow.cpp b/src/musikbox/TransportWindow.cpp similarity index 100% rename from src/square/TransportWindow.cpp rename to src/musikbox/TransportWindow.cpp diff --git a/src/square/TransportWindow.h b/src/musikbox/TransportWindow.h similarity index 100% rename from src/square/TransportWindow.h rename to src/musikbox/TransportWindow.h diff --git a/src/square/Ui.h b/src/musikbox/Ui.h similarity index 100% rename from src/square/Ui.h rename to src/musikbox/Ui.h diff --git a/src/square/curses_config.h b/src/musikbox/curses_config.h similarity index 100% rename from src/square/curses_config.h rename to src/musikbox/curses_config.h diff --git a/src/square/memtrace.h b/src/musikbox/memtrace.h similarity index 100% rename from src/square/memtrace.h rename to src/musikbox/memtrace.h diff --git a/src/square/player.vcproj b/src/musikbox/musikbox.vcproj similarity index 94% rename from src/square/player.vcproj rename to src/musikbox/musikbox.vcproj index b3767cfd3..8035c7ef5 100644 --- a/src/square/player.vcproj +++ b/src/musikbox/musikbox.vcproj @@ -2,9 +2,9 @@ diff --git a/src/square/player.vcxproj b/src/musikbox/musikbox.vcxproj similarity index 96% rename from src/square/player.vcxproj rename to src/musikbox/musikbox.vcxproj index 2da8dac32..045a22abc 100755 --- a/src/square/player.vcxproj +++ b/src/musikbox/musikbox.vcxproj @@ -13,7 +13,7 @@ musikbox {C7102EB1-7311-4B36-A7FF-89DD7F077FF9} - square + musikbox Win32Proj 8.1 @@ -82,7 +82,8 @@ false - copy "$(SolutionDir)\src\3rdparty\vld\*.*" "$(TargetDir)" + + diff --git a/src/musikbox/musikbox.vcxproj.filters b/src/musikbox/musikbox.vcxproj.filters new file mode 100755 index 000000000..8f4f3fe40 --- /dev/null +++ b/src/musikbox/musikbox.vcxproj.filters @@ -0,0 +1,92 @@ + + + + + + + + curses + + + curses + + + curses + + + windows + + + windows + + + windows + + + windows + + + curses + + + curses + + + curses + + + windows + + + windows + + + + + + + curses + + + curses + + + curses + + + windows + + + windows + + + windows + + + windows + + + curses + + + curses + + + curses + + + windows + + + windows + + + + + {04a2cf62-168c-4f1b-ac33-a55f7cbecff0} + + + {c1ada983-8f4e-4ac4-86be-fa6fdffec375} + + + \ No newline at end of file diff --git a/src/square/player.vcxproj.filters b/src/musikbox/player.vcxproj.filters similarity index 100% rename from src/square/player.vcxproj.filters rename to src/musikbox/player.vcxproj.filters diff --git a/src/square/stdafx.cpp b/src/musikbox/stdafx.cpp similarity index 100% rename from src/square/stdafx.cpp rename to src/musikbox/stdafx.cpp diff --git a/src/square/stdafx.h b/src/musikbox/stdafx.h similarity index 100% rename from src/square/stdafx.h rename to src/musikbox/stdafx.h diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt deleted file mode 100644 index 4ea765767..000000000 --- a/src/server/CMakeLists.txt +++ /dev/null @@ -1,74 +0,0 @@ -set(SERVER_SOURCES - ConnectedUsersController.cpp - ConnectedUsersListController.cpp - ConnectedUsersListModel.cpp - main.cpp - MainWindowController.cpp - pch.cpp - SyncpathController.cpp - SyncpathListController.cpp - SyncpathListModel.cpp - SyncpathView.cpp - users/EditUserController.cpp - users/EditUserView.cpp - users/UsersController.cpp - users/UsersListController.cpp - users/UsersListModel.cpp - users/UsersView.cpp - #resources/resource.rc -) - -set (SERVER_HEADERS - ConnectedUsersController.hpp - ConnectedUsersListController.hpp - ConnectedUsersListModel.hpp - MainWindowController.hpp - pch.hpp - SyncpathController.hpp - SyncpathListController.hpp - SyncpathListModel.hpp - SyncpathView.hpp - resources/resource.h - users/EditUserController.hpp - users/EditUserView.hpp - users/UsersController.hpp - users/UsersListModel.hpp - users/UsersView.hpp -) - -SOURCE_GROUP("Header Files\\users" FILES - users/EditUserController.hpp - users/EditUserView.hpp - users/UsersController.hpp - users/UsersListModel.hpp - users/UsersView.hpp) -SOURCE_GROUP("Source Files\\users" FILES - users/EditUserController.cpp - users/EditUserView.cpp - users/UsersController.cpp - users/UsersListController.cpp - users/UsersListModel.cpp - users/UsersView.cpp) -SOURCE_GROUP("Header Files\\resources" FILES - resources/resource.h) - - -if(CMAKE_SYSTEM_NAME MATCHES "Windows") - add_definitions(-DWIN32) - if(NOT DEFINED MINGW) - - endif(NOT DEFINED MINGW) -else(CMAKE_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fpermissive) -endif(CMAKE_SYSTEM_NAME MATCHES "Windows") - -add_definitions( - -DXML_STATIC - -D_CRT_SECURE_NO_DEPRECATE - -D_DEBUG -) - -add_executable( musikServer WIN32 ${SERVER_SOURCES} ${SERVER_HEADERS}) -target_link_libraries( musikServer win32cpp musik comctl32) - - diff --git a/src/server/ConnectedUsersController.cpp b/src/server/ConnectedUsersController.cpp deleted file mode 100644 index 91a07ebf5..000000000 --- a/src/server/ConnectedUsersController.cpp +++ /dev/null @@ -1,216 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright 2007, mC2 team -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include - -#include - -#include -#include - -#include // uichar, uistring -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -/*ctor*/ ConnectedUsersController::ConnectedUsersController(TopLevelWindow& mainWindow,musik::core::ServerPtr server) - :mainWindow(mainWindow) - ,server(server) - ,mainFrame(NULL) - ,timer(200) - ,statusLabel(NULL) - ,listViewController(NULL) -{ - - this->mainWindow.Created.connect( - this, &ConnectedUsersController::OnMainWindowCreated); - -} - -ConnectedUsersController::~ConnectedUsersController() -{ - delete this->listViewController; -} - -void ConnectedUsersController::OnMainWindowCreated(Window* window) -{ - - // Start by setting the icon - HICON icon16 = (HICON)LoadImage(Application::Instance(), MAKEINTRESOURCE(IDI_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); - HICON icon32 = (HICON)LoadImage(Application::Instance(), MAKEINTRESOURCE(IDI_MAINFRAME), IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR); - SendMessage( window->Handle(), WM_SETICON, WPARAM( ICON_SMALL ), LPARAM( icon16 ) ); - SendMessage( window->Handle(), WM_SETICON, WPARAM( ICON_BIG ), LPARAM( icon32 ) ); - - - // Init Tray Icon - MenuRef myMenu = Menu::CreatePopup(); - - // Create Tray Menu - MenuItemRef settingsMenu = myMenu->Items().Append(MenuItem::Create(_T("S&ettings"))); - MenuItemRef trayExit = myMenu->Items().Append(MenuItem::Create(_T("E&xit"))); - - // Bind Exit to handler - trayExit->Activated.connect(this, &ConnectedUsersController::OnFileExit); - settingsMenu->Activated.connect(this, &ConnectedUsersController::OnSettings); - - UINT uidTrayIcon = Application::Instance().SysTrayManager()->AddIcon(Application::Instance().MainWindow(), icon16); - Application::Instance().SysTrayManager()->SetTooltip(uidTrayIcon, _T("musikServer")); - Application::Instance().SysTrayManager()->SetPopupMenu(uidTrayIcon, myMenu); - Application::Instance().SysTrayManager()->EnableMinimizeToTray(uidTrayIcon); - - { - // Set window size and position - musik::core::Preferences windowPrefs("ServerUsersWindow"); - this->mainWindow.MoveTo(windowPrefs.GetInt("x",200), windowPrefs.GetInt("y",200)); - this->mainWindow.Resize(windowPrefs.GetInt("width",240), windowPrefs.GetInt("height",320)); - this->mainWindow.SetMinimumSize(Size(240, 320)); - } - - - FontRef boldFont(Font::Create()); - boldFont->SetBold(true); - - - // Create the layout - this->mainFrame = new win32cpp::Frame(NULL,win32cpp::WindowPadding(10)); - this->mainFrame->SetLayoutFlags(win32cpp::LayoutFillFill); - win32cpp::LinearLayout *mainRowLayout = new win32cpp::LinearLayout(win32cpp::VerticalLayout,win32cpp::LayoutFillFill); - mainRowLayout->SetSpacing(10); - - - // First a "Status" of the server - win32cpp::LinearLayout *statusColumnLayout = mainRowLayout->AddChild( new win32cpp::LinearLayout(win32cpp::HorizontalLayout) ); - win32cpp::Label *statusHeader = new win32cpp::Label(_T("Server status ")); - statusHeader->SetFont(boldFont); - statusColumnLayout->AddChild( statusHeader ); - this->statusLabel = statusColumnLayout->AddChild( new win32cpp::Label(_T(""))); - - // Second a TabView for the settings - win32cpp::ListView *usersList = mainRowLayout->AddChild( new win32cpp::ListView() ); - usersList->SetLayoutFlags(win32cpp::LayoutFillFill); - this->listViewController = new musik::server::ConnectedUsersListController(*usersList,this); - - - this->mainFrame->AddChild(mainRowLayout); - this->mainWindow.AddChild(mainFrame); - - // Connect size and position signals - this->mainWindow.Resized.connect(this, &ConnectedUsersController::OnResize); - this->mainWindow.Destroyed.connect(this, &ConnectedUsersController::OnDestroyed); - - // Start the status timer - this->timer.OnTimeout.connect(this,&ConnectedUsersController::UpdateStatus); - this->timer.ConnectToWindow(&this->mainWindow); - this->timer.Start(); - - this->server->UserSessionsUpdated.connect(this,&ConnectedUsersController::UpdateUserlist); - -} - -void ConnectedUsersController::OnResize(Window* window, Size size) -{ - RedrawLock redrawLock(this->mainFrame); - this->mainFrame->Resize(this->mainWindow.ClientSize()); -} - -void ConnectedUsersController::OnDestroyed(Window* window) -{ - Point location( window->Location() ); - Size size( window->WindowSize() ); - musik::core::Preferences windowPrefs("ServerUsersWindow"); - windowPrefs.SetInt("x",location.x); - windowPrefs.SetInt("y",location.y); - windowPrefs.SetInt("width",size.width); - windowPrefs.SetInt("height",size.height); -} - -void ConnectedUsersController::UpdateStatus(){ - if(this->statusLabel && this->server){ - this->statusLabel->SetCaption( this->server->indexer.GetStatus() ); - } -} - -void ConnectedUsersController::OnFileExit(MenuItemRef menuItem) -{ - Application::Instance().Terminate(); -} - -void ConnectedUsersController::OnSettings(MenuItemRef menuItem){ - static bool settingsShowing(false); - - if(!settingsShowing){ - settingsShowing = true; - - this->mainWindow.Show(SW_SHOWNORMAL); - - TopLevelWindow dialog(_T("Settings")); - MainWindowController settingsController(dialog,this->server); - dialog.ShowModal(&this->mainWindow); - - this->mainWindow.Show(SW_HIDE); - this->mainWindow.Show(SW_MINIMIZE); - - settingsShowing = false; - } -} - -void ConnectedUsersController::UpdateUserlist(){ - if(!win32cpp::ApplicationThread::InMainThread()){ - win32cpp::ApplicationThread::Call0(this,&ConnectedUsersController::UpdateUserlist); - return; - } - - // Get the connected users - musik::core::server::UserSessionVector userSessions( this->server->ConnectedUserSessions() ); - -} - diff --git a/src/server/ConnectedUsersController.hpp b/src/server/ConnectedUsersController.hpp deleted file mode 100644 index 094a69330..000000000 --- a/src/server/ConnectedUsersController.hpp +++ /dev/null @@ -1,94 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 team -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace win32cpp{ - class TopLevelWindow; - class Label; - class Frame; -} -namespace musik { namespace server { - class MainWindowController; - class ConnectedUsersListController; -} } -////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace win32cpp; - -namespace musik { namespace server { - -////////////////////////////////////////////////////////////////////////////// - -class ConnectedUsersController : public EventHandler -{ - public: - ConnectedUsersController(TopLevelWindow& mainWindow,musik::core::ServerPtr server); - ~ConnectedUsersController(); - - musik::core::ServerPtr server; - protected: - void OnMainWindowCreated(Window* window); - void OnResize(Window* window, Size size); - void OnDestroyed(Window* window); - void OnFileExit(MenuItemRef menuItem); - void OnSettings(MenuItemRef menuItem); - - void UpdateStatus(); - void UpdateUserlist(); - - protected: - TopLevelWindow& mainWindow; - win32cpp::Label *statusLabel; - win32cpp::Frame *mainFrame; - - win32cpp::Timer timer; - - ConnectedUsersListController *listViewController; - -}; - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::server diff --git a/src/server/ConnectedUsersListController.cpp b/src/server/ConnectedUsersListController.cpp deleted file mode 100644 index 9a26376cf..000000000 --- a/src/server/ConnectedUsersListController.cpp +++ /dev/null @@ -1,92 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include - -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -ConnectedUsersListController::ConnectedUsersListController(win32cpp::ListView &listView,musik::server::ConnectedUsersController *connectedUsersController) -: listView(listView) -, connectedUsersController(connectedUsersController) -{ - this->model.reset(new ConnectedUsersListModel(this)); - this->listView.Handle() - ? this->OnViewCreated(&listView) - : this->listView.Created.connect(this, &ConnectedUsersListController::OnViewCreated); -} - - -void ConnectedUsersListController::OnViewCreated(Window* window){ - this->listView.SetScrollBarVisibility(HorizontalScrollBar, false); - - typedef ListView::Column Column; - - Size clientSize = this->listView.ClientSize(); - - this->nameColumn = Column::Create(_T("User"), clientSize.width/2); - this->listView.AddColumn(this->nameColumn); - this->ipColumn = Column::Create(_T("IP"), clientSize.width/2); - this->listView.AddColumn(this->ipColumn); - - this->listView.EnableColumnResizing(false); - this->listView.SetModel(this->model); - // - int itemHeight = this->listView.RowHeight(); - this->listView.SetRowHeight(max(itemHeight, 17)); - - this->listView.Resized.connect( - this, &ConnectedUsersListController::OnResized); - -} - -void ConnectedUsersListController::OnResized(Window* window, Size size) -{ - this->listView.SetColumnWidth(this->nameColumn, this->listView.ClientSize().width/2); - this->listView.SetColumnWidth(this->ipColumn, this->listView.ClientSize().width/2); -} - diff --git a/src/server/ConnectedUsersListController.hpp b/src/server/ConnectedUsersListController.hpp deleted file mode 100644 index 16c31d413..000000000 --- a/src/server/ConnectedUsersListController.hpp +++ /dev/null @@ -1,78 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// - -#include - -////////////////////////////////////////////////////////////////////////////// -// Forward -namespace musik { namespace server { - class ConnectedUsersController; - class ConnectedUsersListModel; -} } - - - -namespace musik { namespace server { - -////////////////////////////////////////////////////////////////////////////// - -class ConnectedUsersListController : public win32cpp::EventHandler{ - public: - ConnectedUsersListController(win32cpp::ListView &listView,musik::server::ConnectedUsersController *connectedUsersController); - private: - void OnViewCreated(win32cpp::Window* window); - void OnResized(win32cpp::Window* window, win32cpp::Size size); - - win32cpp::ListView& listView; - win32cpp::ListView::ModelRef model; - - friend class ConnectedUsersListModel; - win32cpp::ListView::ColumnRef nameColumn; - win32cpp::ListView::ColumnRef ipColumn; - - musik::server::ConnectedUsersController* connectedUsersController; -}; - - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::cube::settings diff --git a/src/server/ConnectedUsersListModel.cpp b/src/server/ConnectedUsersListModel.cpp deleted file mode 100644 index 7a8e85106..000000000 --- a/src/server/ConnectedUsersListModel.cpp +++ /dev/null @@ -1,96 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -ConnectedUsersListModel::ConnectedUsersListModel(ConnectedUsersListController *controller) -: controller(controller) -{ - musik::core::ServerPtr server = this->controller->connectedUsersController->server; - if(server){ - server->UserSessionsUpdated.connect(this,&ConnectedUsersListModel::OnUsersUpdated); - } - this->UpdateUsers(); - -} - - -uistring ConnectedUsersListModel::CellValueToString(int rowIndex, ListView::ColumnRef column){ - if(rowIndexusers.size() && rowIndex>=0){ - if(column==this->controller->ipColumn){ - return musik::core::ConvertUTF16(this->users[rowIndex]->IP()); - } - return this->users[rowIndex]->user->Name(); - } - - return uistring(); -} - -void ConnectedUsersListModel::UpdateUsers(){ - musik::core::ServerPtr server = this->controller->connectedUsersController->server; - if(server){ - this->users = server->ConnectedUserSessions(); - } - - this->SetRowCount(0); - this->SetRowCount((int)this->users.size()); - -} - -void ConnectedUsersListModel::OnUsersUpdated(){ - if(!win32cpp::ApplicationThread::InMainThread()){ - win32cpp::ApplicationThread::Call0(this,&ConnectedUsersListModel::OnUsersUpdated); - return; - } - - this->UpdateUsers(); - -} - diff --git a/src/server/ConnectedUsersListModel.hpp b/src/server/ConnectedUsersListModel.hpp deleted file mode 100644 index 52e1228dc..000000000 --- a/src/server/ConnectedUsersListModel.hpp +++ /dev/null @@ -1,72 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik { namespace server { - -////////////////////////////////////////////////////////////////////////////// - -class ConnectedUsersListModel : public win32cpp::ListView::Model, public win32cpp::EventHandler{ - public: - ConnectedUsersListModel(ConnectedUsersListController *controller); - virtual win32cpp::uistring CellValueToString(int rowIndex, win32cpp::ListView::ColumnRef column); - void UpdateUsers(); - private: - - void OnUsersUpdated(); - - ConnectedUsersListController *controller; - - friend class ConnectedUsersListController; - - musik::core::server::UserSessionVector users; -}; - - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::server diff --git a/src/server/MainWindowController.cpp b/src/server/MainWindowController.cpp deleted file mode 100644 index afc2429e3..000000000 --- a/src/server/MainWindowController.cpp +++ /dev/null @@ -1,148 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 team -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include - -#include -#include -#include -#include -#include - -#include - -#include // uichar, uistring -#include -#include -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -/*ctor*/ MainWindowController::MainWindowController(TopLevelWindow& mainWindow,musik::core::ServerPtr server) - :mainWindow(mainWindow) - ,server(server) - ,mainFrame(NULL) - ,syncpathController(NULL) - ,usersController(NULL) -{ - this->mainWindow.Handle() - ? this->OnMainWindowCreated(&this->mainWindow) - : this->mainWindow.Created.connect(this, &MainWindowController::OnMainWindowCreated); -} - -MainWindowController::~MainWindowController() -{ - delete this->syncpathController; - delete this->usersController; -} - -void MainWindowController::OnMainWindowCreated(Window* window) -{ - RedrawLock redrawLock(window); - - { - // Set window size and position - musik::core::Preferences windowPrefs("ServerSettingsWindow"); - this->mainWindow.MoveTo(windowPrefs.GetInt("x",200), windowPrefs.GetInt("y",200)); - this->mainWindow.Resize(windowPrefs.GetInt("width",500), windowPrefs.GetInt("height",400)); - this->mainWindow.SetMinimumSize(Size(320, 240)); - } - - - FontRef boldFont(Font::Create()); - boldFont->SetBold(true); - - - // Create the layout - this->mainFrame = new win32cpp::Frame(NULL,win32cpp::WindowPadding(4)); - this->mainFrame->SetLayoutFlags(win32cpp::LayoutFillFill); - - // Second a TabView for the settings - win32cpp::TabView *tabs = this->mainFrame->AddChild( new win32cpp::TabView() ); - tabs->SetPadding(0); - - // Syncpath tab - SyncpathView *synpathView = tabs->AddTab(uistring(_T("Sync paths")), new SyncpathView()); - synpathView->SetLayoutFlags(win32cpp::LayoutFillFill); - - this->syncpathController = new SyncpathController(*synpathView,&this->server->indexer); - - // Users tab - users::UsersView *usersView = tabs->AddTab(uistring(_T("Users")), new users::UsersView()); - usersView->SetLayoutFlags(win32cpp::LayoutFillFill); - this->usersController = new users::UsersController(*usersView,this->server.get()); - - // Settings tab - Frame *settingsView = tabs->AddTab(uistring(_T("Settings")), new Frame()); - settingsView->SetLayoutFlags(win32cpp::LayoutFillFill); - - this->mainWindow.AddChild(mainFrame); - - // Connect size and position signals - this->mainWindow.Resized.connect(this, &MainWindowController::OnResize); - this->mainWindow.Destroyed.connect(this, &MainWindowController::OnDestroyed); - - -} - -void MainWindowController::OnResize(Window* window, Size size) -{ - RedrawLock redrawLock(window); - this->mainFrame->Resize(this->mainWindow.ClientSize()); -} - -void MainWindowController::OnDestroyed(Window* window) -{ - Point location( window->Location() ); - Size size( window->WindowSize() ); - musik::core::Preferences windowPrefs("ServerSettingsWindow"); - windowPrefs.SetInt("x",location.x); - windowPrefs.SetInt("y",location.y); - windowPrefs.SetInt("width",size.width); - windowPrefs.SetInt("height",size.height); -} - diff --git a/src/server/MainWindowController.hpp b/src/server/MainWindowController.hpp deleted file mode 100644 index 75d3d73ad..000000000 --- a/src/server/MainWindowController.hpp +++ /dev/null @@ -1,87 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 team -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace win32cpp{ - class TopLevelWindow; - class Label; - class Frame; -} -namespace musik { namespace server { - class SyncpathController; - namespace users { - class UsersController; - } -} } -////////////////////////////////////////////////////////////////////////////// - -#include - -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace win32cpp; - -namespace musik { namespace server { - -////////////////////////////////////////////////////////////////////////////// - -class MainWindowController : public EventHandler -{ - public: - MainWindowController(TopLevelWindow& mainWindow,musik::core::ServerPtr server); - ~MainWindowController(); - - protected: - void OnMainWindowCreated(Window* window); - void OnResize(Window* window, Size size); - void OnDestroyed(Window* window); - - protected: - TopLevelWindow& mainWindow; - musik::core::ServerPtr server; - win32cpp::Frame *mainFrame; - SyncpathController *syncpathController; - users::UsersController *usersController; -}; - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::server diff --git a/src/server/SyncpathController.cpp b/src/server/SyncpathController.cpp deleted file mode 100644 index 7b5db98bf..000000000 --- a/src/server/SyncpathController.cpp +++ /dev/null @@ -1,98 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace win32cpp; -using namespace musik::server; - -////////////////////////////////////////////////////////////////////////////// - -SyncpathController::SyncpathController(SyncpathView& syncpathView,musik::core::Indexer *indexer) -: syncpathView(syncpathView) -, indexer(indexer) -{ - this->syncpathView.Handle() - ? this->OnViewCreated(&this->syncpathView) - : this->syncpathView.Created.connect(this, &SyncpathController::OnViewCreated); - - this->syncpathView.Resized.connect( - this, &SyncpathController::OnViewResized); -} - -void SyncpathController::OnViewCreated(Window* window) -{ - - this->syncpathView.addPathButton->Pressed.connect(this,&SyncpathController::OnAddPath); - this->syncpathView.removePathButton->Pressed.connect(this,&SyncpathController::OnRemovePath); - - this->syncpathListController.reset(new musik::server::SyncpathListController(*this->syncpathView.pathList,this)); - -} - -void SyncpathController::OnViewResized(Window* window, Size size) -{ -} - -void SyncpathController::OnAddPath(Button* button){ - win32cpp::FolderBrowseDialog addPath; - - if(addPath.Show(win32cpp::Application::Instance().MainWindow())==win32cpp::FolderBrowseDialog::ResultOK){ - if(this->indexer){ - this->indexer->AddPath(addPath.Directory()); - } - } -} - -void SyncpathController::OnRemovePath(Button* button){ - this->syncpathListController->RemoveSelectedPaths(); -} - - diff --git a/src/server/SyncpathController.hpp b/src/server/SyncpathController.hpp deleted file mode 100644 index 6eb4a3ffe..000000000 --- a/src/server/SyncpathController.hpp +++ /dev/null @@ -1,87 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace musik { namespace server { - class SyncpathView; - class SyncpathModel; - class SyncpathListController; -} } -namespace musik { namespace core { - class Indexer; -} } -namespace win32cpp{ - class Window; - class Button; -} -////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include - -namespace musik { namespace server{ - -////////////////////////////////////////////////////////////////////////////// - -class SyncpathController : public win32cpp::EventHandler -{ - public: - SyncpathController(SyncpathView& syncpathView,musik::core::Indexer *indexer); - - private: - void OnViewCreated(win32cpp::Window* window); - void OnViewResized(win32cpp::Window* window, win32cpp::Size size); - - SyncpathView& syncpathView; - - void OnAddPath(win32cpp::Button* button); - void OnRemovePath(win32cpp::Button* button); - - typedef boost::shared_ptr SyncpathListControllerRef; - SyncpathListControllerRef syncpathListController; - public: - musik::core::Indexer *indexer; -}; - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::server diff --git a/src/server/SyncpathListController.cpp b/src/server/SyncpathListController.cpp deleted file mode 100644 index 721553e1b..000000000 --- a/src/server/SyncpathListController.cpp +++ /dev/null @@ -1,103 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include - -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -SyncpathListController::SyncpathListController(win32cpp::ListView &listView,musik::server::SyncpathController *syncpathController) -: listView(listView) -, syncpathController(syncpathController) -{ - this->model.reset(new SyncpathListModel(this)); - this->listView.Handle() - ? this->OnViewCreated(&listView) - : this->listView.Created.connect(this, &SyncpathListController::OnViewCreated); -} - - -void SyncpathListController::OnViewCreated(Window* window){ - this->listView.SetScrollBarVisibility(HorizontalScrollBar, false); - - typedef ListView::Column Column; - - Size clientSize = this->listView.ClientSize(); - - this->mainColumn = Column::Create(_T("Path"), clientSize.width); - this->listView.AddColumn(this->mainColumn); - - this->listView.EnableColumnResizing(false); - this->listView.SetModel(this->model); - // - int itemHeight = this->listView.RowHeight(); - this->listView.SetRowHeight(max(itemHeight, 17)); - - this->listView.Resized.connect( - this, &SyncpathListController::OnResized); - -} - -void SyncpathListController::OnResized(Window* window, Size size) -{ - this->listView.SetColumnWidth(this->mainColumn, this->listView.ClientSize().width); -} - -void SyncpathListController::RemoveSelectedPaths(){ - - SyncpathListModel* model = (SyncpathListModel*)this->model.get(); - musik::core::Indexer *indexer = this->syncpathController->indexer; - if(indexer && model){ - - win32cpp::ListView::RowIndexList selectedRows(this->listView.SelectedRows()); - for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end();++row){ - indexer->RemovePath(model->paths[*row]); - } - - } - -} diff --git a/src/server/SyncpathListController.hpp b/src/server/SyncpathListController.hpp deleted file mode 100644 index 664f1323b..000000000 --- a/src/server/SyncpathListController.hpp +++ /dev/null @@ -1,78 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// - -#include - -////////////////////////////////////////////////////////////////////////////// -// Forward -namespace musik { namespace server { - class SyncpathController; - class SyncpathListModel; -} } - - - -namespace musik { namespace server { - -////////////////////////////////////////////////////////////////////////////// - -class SyncpathListController : public win32cpp::EventHandler{ - public: - SyncpathListController(win32cpp::ListView &listView,musik::server::SyncpathController *syncpathController); - void RemoveSelectedPaths(); - private: - void OnViewCreated(win32cpp::Window* window); - void OnResized(win32cpp::Window* window, win32cpp::Size size); - - win32cpp::ListView& listView; - win32cpp::ListView::ModelRef model; - win32cpp::ListView::ColumnRef mainColumn; - - friend class SyncpathListModel; - - musik::server::SyncpathController* syncpathController; -}; - - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::cube::settings diff --git a/src/server/SyncpathListModel.cpp b/src/server/SyncpathListModel.cpp deleted file mode 100644 index 79993905a..000000000 --- a/src/server/SyncpathListModel.cpp +++ /dev/null @@ -1,92 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -SyncpathListModel::SyncpathListModel(SyncpathListController *controller) -: controller(controller) -{ - musik::core::Indexer *indexer = this->controller->syncpathController->indexer; - if(indexer){ - indexer->PathsUpdated.connect(this,&SyncpathListModel::OnPathsUpdated); - } - this->UpdateSyncPaths(); - -} - - -uistring SyncpathListModel::CellValueToString(int rowIndex, ListView::ColumnRef column){ - if(rowIndexpaths.size() && rowIndex>=0){ - return this->paths[rowIndex]; - } - - return uistring(); -} - -void SyncpathListModel::UpdateSyncPaths(){ - musik::core::Indexer *indexer = this->controller->syncpathController->indexer; - if(indexer){ - this->paths = indexer->GetPaths(); - } - - this->SetRowCount(0); - this->SetRowCount((int)this->paths.size()); - -} - -void SyncpathListModel::OnPathsUpdated(){ - if(!win32cpp::ApplicationThread::InMainThread()){ - win32cpp::ApplicationThread::Call0(this,&SyncpathListModel::OnPathsUpdated); - return; - } - - this->UpdateSyncPaths(); - -} - diff --git a/src/server/SyncpathListModel.hpp b/src/server/SyncpathListModel.hpp deleted file mode 100644 index 5fbda55d1..000000000 --- a/src/server/SyncpathListModel.hpp +++ /dev/null @@ -1,72 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// - -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik { namespace server { - -////////////////////////////////////////////////////////////////////////////// - -class SyncpathListModel : public win32cpp::ListView::Model, public win32cpp::EventHandler{ - public: - SyncpathListModel(SyncpathListController *controller); - virtual win32cpp::uistring CellValueToString(int rowIndex, win32cpp::ListView::ColumnRef column); - void UpdateSyncPaths(); - private: - - void OnPathsUpdated(); - - SyncpathListController *controller; - - friend class SyncpathListController; - - typedef std::vector PathVector; - PathVector paths; -}; - - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::server diff --git a/src/server/SyncpathView.cpp b/src/server/SyncpathView.cpp deleted file mode 100644 index b19ad8ed7..000000000 --- a/src/server/SyncpathView.cpp +++ /dev/null @@ -1,83 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include - -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; - -////////////////////////////////////////////////////////////////////////////// - -SyncpathView::SyncpathView() -{ -} - -void SyncpathView::OnCreated() -{ - - LinearLayout* pathLayout = new LinearLayout(HorizontalLayout,win32cpp::LayoutFillFill); - LinearLayout* pathButtonsLayout = new LinearLayout(VerticalLayout); - - - // Path ListView - this->pathList = pathLayout->AddChild(new ListView()); - this->pathList->SetLayoutFlags(win32cpp::LayoutFillFill); - - - // pathButtons layout - this->addPathButton = pathButtonsLayout->AddChild(new Button(_T("Add path"))); - this->removePathButton = pathButtonsLayout->AddChild(new Button(_T("Remove path"))); - - this->addPathButton->Resize(90, 24); - this->removePathButton->Resize(90, 24); - - pathLayout->AddChild(pathButtonsLayout); - - // Add to the layout - win32cpp::Frame *paddingFrame = this->AddChild(new Frame(pathLayout,WindowPadding(20))); - paddingFrame->SetLayoutFlags(win32cpp::LayoutFillFill); - -} diff --git a/src/server/SyncpathView.hpp b/src/server/SyncpathView.hpp deleted file mode 100644 index a58df1af8..000000000 --- a/src/server/SyncpathView.hpp +++ /dev/null @@ -1,79 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace win32cpp{ - class Button; - class ListView; - class Label; -} -////////////////////////////////////////////////////////////////////////////// - -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace win32cpp; - -namespace musik { namespace server { - -////////////////////////////////////////////////////////////////////////////// -// forward -class SyncpathController; -////////////////////////////////////////////////////////////////////////////// - -class SyncpathView: public Frame -{ - - public: - SyncpathView(); - - protected: - virtual void OnCreated(); - - friend class SyncpathController; - Button *addPathButton,*removePathButton; - ListView *pathList; -}; - -////////////////////////////////////////////////////////////////////////////// - -} } // musik::server - diff --git a/src/server/main.cpp b/src/server/main.cpp deleted file mode 100644 index e84d8ba7f..000000000 --- a/src/server/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPTSTR commandLine, int showCommand) -{ - - musik::core::ServerPtr server(new musik::core::Server(10543,10544)); - server->Startup(); - - // Initialize the main application (mC2.exe) - Application::Initialize(instance, prevInstance, commandLine, showCommand); - - // Create the main window and its controller - TopLevelWindow mainWindow(_T("musikServer")); - ConnectedUsersController mainController(mainWindow,server); - - // Initialize and show the main window, and run the event loop. - Application::Instance().Run(mainWindow); - - return 0; -} diff --git a/src/server/musikServer.vcproj b/src/server/musikServer.vcproj deleted file mode 100644 index e04810e01..000000000 --- a/src/server/musikServer.vcproj +++ /dev/null @@ -1,371 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/server/pch.cpp b/src/server/pch.cpp deleted file mode 100644 index 5e0628a04..000000000 --- a/src/server/pch.cpp +++ /dev/null @@ -1,38 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once -#include "pch.hpp" diff --git a/src/server/pch.hpp b/src/server/pch.hpp deleted file mode 100644 index 5b67d1ec6..000000000 --- a/src/server/pch.hpp +++ /dev/null @@ -1,65 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, Daniel Önnerby -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#ifndef _DEBUG - // To be able to UPX the released executable - extern "C" void tss_cleanup_implemented(void){} -#endif - -////////////////////////////////////////////////////////////////////////////// -// dependencies -////////////////////////////////////////////////////////////////////////////// -#pragma warning (disable : 4996 4018 4482) - -//#include "vld/vld.h" - -#include - -////////////////////////////////////////////////////////////////////////////// -#include -/*#include -#include -#include -#include -#include -#include -#include -#include -#include -*/ -////////////////////////////////////////////////////////////////////////////// diff --git a/src/server/resources/musikServer.exe.manifest b/src/server/resources/musikServer.exe.manifest deleted file mode 100644 index f321e9526..000000000 --- a/src/server/resources/musikServer.exe.manifest +++ /dev/null @@ -1,22 +0,0 @@ - - - -Your app description here - - - - - - diff --git a/src/server/resources/musikServer.ico b/src/server/resources/musikServer.ico deleted file mode 100644 index 300ab8c3b..000000000 Binary files a/src/server/resources/musikServer.ico and /dev/null differ diff --git a/src/server/resources/resource.h b/src/server/resources/resource.h deleted file mode 100644 index d0b890a0f..000000000 --- a/src/server/resources/resource.h +++ /dev/null @@ -1,5 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDI_MAINFRAME 100 diff --git a/src/server/resources/resource.rc b/src/server/resources/resource.rc deleted file mode 100644 index 13b892640..000000000 --- a/src/server/resources/resource.rc +++ /dev/null @@ -1,105 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Swedish resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE) -#ifdef _WIN32 -LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_MAINFRAME ICON "musikServer.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.\0" -END - - -3 TEXTINCLUDE -BEGIN - "\r\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x3L -#else - FILEFLAGS 0x2L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "CompanyName", "mC2 development team" - VALUE "FileDescription", "resource" - VALUE "FileVersion", "mC2dm3" - VALUE "InternalName", "musikServer" - VALUE "LegalCopyright", "Copyright (C) 2009" - VALUE "OriginalFilename", "resource.rc" - VALUE "ProductName", "resource" - VALUE "ProductVersion", "r344" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - -#endif // Swedish resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/server/users/EditUserController.cpp b/src/server/users/EditUserController.cpp deleted file mode 100644 index bdcbad52b..000000000 --- a/src/server/users/EditUserController.cpp +++ /dev/null @@ -1,102 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include -#include - -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server::users; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -EditUserController::EditUserController(win32cpp::TopLevelWindow &mainWindow,musik::core::Server *server) -:mainWindow(mainWindow) -,view(NULL) -,server(server) -{ - this->view = new EditUserView(); - this->mainWindow.AddChild(this->view); - this->mainWindow.Resized.connect(this,&EditUserController::OnResize); - - this->view->Handle() - ? this->OnViewCreated(this->view) - : this->view->Created.connect(this, &EditUserController::OnViewCreated); - -} - -EditUserController::~EditUserController(){ -} - -void EditUserController::OnViewCreated(Window* window) -{ - this->view->cancelButton->Pressed.connect(this,&EditUserController::OnCancel); - this->view->okButton->Pressed.connect(this,&EditUserController::OnOK); -} - -void EditUserController::OnCancel(win32cpp::Button* button){ - this->mainWindow.Close(); -} - -void EditUserController::OnOK(win32cpp::Button* button){ - - // TODO: Save user - this->server->CreateUser( - this->view->username->Caption(), - this->view->password->Caption(), - this->view->nickname->Caption() - ); - - - this->mainWindow.Close(); -} - -void EditUserController::OnResize(win32cpp::Window* window, win32cpp::Size size){ - win32cpp::RedrawLock redrawLock(this->view); - this->view->Resize(this->mainWindow.ClientSize()); -} diff --git a/src/server/users/EditUserController.hpp b/src/server/users/EditUserController.hpp deleted file mode 100644 index f371e3fa3..000000000 --- a/src/server/users/EditUserController.hpp +++ /dev/null @@ -1,82 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace win32cpp{ - class Window; - class Button; -} -////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik { namespace server { namespace users{ - -class EditUserView; // forward -////////////////////////////////////////////////////////////////////////////// - -class EditUserController : public win32cpp::EventHandler{ - - public: - EditUserController(win32cpp::TopLevelWindow &mainWindow,musik::core::Server *server); - ~EditUserController(); - - private: - void OnViewCreated(win32cpp::Window* window); - void OnCancel(win32cpp::Button* button); - void OnOK(win32cpp::Button* button); - void OnResize(win32cpp::Window* window, win32cpp::Size size); - - EditUserView* view; - - win32cpp::TopLevelWindow &mainWindow; - - musik::core::Server *server; -}; - -////////////////////////////////////////////////////////////////////////////// - -} } } // musik::cube::dialog diff --git a/src/server/users/EditUserView.cpp b/src/server/users/EditUserView.cpp deleted file mode 100644 index 29ff19db4..000000000 --- a/src/server/users/EditUserView.cpp +++ /dev/null @@ -1,108 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" - -#include - -#include -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server::users; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -EditUserView::EditUserView() -: Frame(NULL,WindowPadding(6)) -{ -} - -void EditUserView::OnCreated() -{ - - Frame *frame = this->AddChild(new Frame(0,WindowPadding(4))); - frame->SetLayoutFlags(LayoutFillFill); - - FontRef boldFont(Font::Create()); - boldFont->SetBold(true); - - // Top Row layout - LinearLayout* topRowLayout = new LinearLayout(VerticalLayout,LayoutFillFill); -// topRowLayout->SetDefaultChildFill(false); -// topRowLayout->SetDefaultChildAlignment(win32cpp::ChildAlignMiddle); - - // First rows column layout -// LinearLayout* firstColumnLayout = new LinearLayout(HorizontalLayout); -// firstColumnLayout->SetDefaultChildFill(false); -// firstColumnLayout->SetDefaultChildAlignment(win32cpp::ChildAlignCenter); - - Label* title = topRowLayout->AddChild(new Label(_T("Add user"))); - title->SetFont(boldFont); - - // Username - Label* label = topRowLayout->AddChild(new Label(_T("Username:") )); - this->username = topRowLayout->AddChild(new EditView(160,20 )); - - // Password - label = topRowLayout->AddChild(new Label(_T("Password:") )); - this->password = topRowLayout->AddChild(new EditView(160,20 )); - - // Nickname - label = topRowLayout->AddChild(new Label(_T("Nickname:") )); - this->nickname = topRowLayout->AddChild(new EditView(160,20 )); - - // Last rows column layout - LinearLayout* bottomButtonLayout = new LinearLayout(HorizontalLayout); -// bottomButtonLayout->SetDefaultChildFill(false); - this->cancelButton = bottomButtonLayout->AddChild(new Button(_T("Cancel"))); - this->okButton = bottomButtonLayout->AddChild(new Button(_T("OK"))); - this->cancelButton->Resize(60,20); - this->okButton->Resize(60,20); - topRowLayout->AddChild(bottomButtonLayout); - // topRowLayout->SetChildAlignment(bottomButtonLayout,ChildAlignRight); - - - frame->AddChild(topRowLayout); - -} diff --git a/src/server/users/EditUserView.hpp b/src/server/users/EditUserView.hpp deleted file mode 100644 index b7d8e16af..000000000 --- a/src/server/users/EditUserView.hpp +++ /dev/null @@ -1,73 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace win32cpp{ - class Button; - class EditView; -} -////////////////////////////////////////////////////////////////////////////// - -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik { namespace server { namespace users { - -////////////////////////////////////////////////////////////////////////////// -// forward -class EditUserController; -////////////////////////////////////////////////////////////////////////////// - -class EditUserView: public win32cpp::Frame{ - public: - EditUserView(); - - virtual void OnCreated(); - win32cpp::Button *okButton, *cancelButton; - win32cpp::EditView *username, *nickname, *password; - private: - -}; - -////////////////////////////////////////////////////////////////////////////// - -} } } // musik::cube::dialog - diff --git a/src/server/users/UsersController.cpp b/src/server/users/UsersController.cpp deleted file mode 100644 index 150ac4913..000000000 --- a/src/server/users/UsersController.cpp +++ /dev/null @@ -1,96 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include -#include - -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace win32cpp; -using namespace musik::server::users; - -////////////////////////////////////////////////////////////////////////////// - -UsersController::UsersController(UsersView& usersView,musik::core::Server *server) - :usersView(usersView) - ,server(server) -{ - this->usersView.Handle() - ? this->OnViewCreated(&this->usersView) - : this->usersView.Created.connect(this, &UsersController::OnViewCreated); - - this->usersView.Resized.connect( - this, &UsersController::OnViewResized); -} - -void UsersController::OnViewCreated(Window* window) -{ - - this->usersView.addUserButton->Pressed.connect(this,&UsersController::OnAddUser); - this->usersView.removeUserButton->Pressed.connect(this,&UsersController::OnRemoveUser); - - this->usersListController.reset(new UsersListController(*this->usersView.usersList,this)); - -} - -void UsersController::OnViewResized(Window* window, Size size) -{ -} - -void UsersController::OnAddUser(Button* button){ - win32cpp::TopLevelWindow popupDialog(_T("Add user")); - popupDialog.SetMinimumSize(Size(250, 250)); - - EditUserController addUser(popupDialog,this->server); - - popupDialog.ShowModal(win32cpp::TopLevelWindow::FindFromAncestor(&this->usersView)); -} - -void UsersController::OnRemoveUser(Button* button){ - this->usersListController->RemoveSelectedUsers(); -} - - diff --git a/src/server/users/UsersController.hpp b/src/server/users/UsersController.hpp deleted file mode 100644 index 1cc29839c..000000000 --- a/src/server/users/UsersController.hpp +++ /dev/null @@ -1,85 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace musik { namespace server { namespace users { - class UsersView; - class UsersModel; - class UsersListController; -} } } -namespace win32cpp{ - class Window; - class Button; -} -////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include - -namespace musik { namespace server{ namespace users { - -////////////////////////////////////////////////////////////////////////////// - -class UsersController : public win32cpp::EventHandler -{ - public: - UsersController(UsersView& usersView,musik::core::Server *server); - - private: - void OnViewCreated(win32cpp::Window* window); - void OnViewResized(win32cpp::Window* window, win32cpp::Size size); - - UsersView& usersView; - - void OnAddUser(win32cpp::Button* button); - void OnRemoveUser(win32cpp::Button* button); - - typedef boost::shared_ptr UsersListControllerRef; - UsersListControllerRef usersListController; - public: - musik::core::Server *server; -}; - -////////////////////////////////////////////////////////////////////////////// - -} } } // musik::server diff --git a/src/server/users/UsersListController.cpp b/src/server/users/UsersListController.cpp deleted file mode 100644 index e5b6d1e2f..000000000 --- a/src/server/users/UsersListController.cpp +++ /dev/null @@ -1,101 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server::users; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -UsersListController::UsersListController(win32cpp::ListView &listView,UsersController *usersController) -: listView(listView) -, usersController(usersController) -{ - this->model.reset(new UsersListModel(this)); - this->listView.Handle() - ? this->OnViewCreated(&listView) - : this->listView.Created.connect(this, &UsersListController::OnViewCreated); -} - - -void UsersListController::OnViewCreated(Window* window){ - this->listView.SetScrollBarVisibility(HorizontalScrollBar, false); - - typedef ListView::Column Column; - - Size clientSize = this->listView.ClientSize(); - - this->mainColumn = Column::Create(_T("Username"), clientSize.width); - this->listView.AddColumn(this->mainColumn); - - this->listView.EnableColumnResizing(false); - this->listView.SetModel(this->model); - // - int itemHeight = this->listView.RowHeight(); - this->listView.SetRowHeight(max(itemHeight, 17)); - - this->listView.Resized.connect( - this, &UsersListController::OnResized); - -} - -void UsersListController::OnResized(Window* window, Size size) -{ - this->listView.SetColumnWidth(this->mainColumn, this->listView.ClientSize().width); -} - -void UsersListController::RemoveSelectedUsers(){ - - UsersListModel* model = (UsersListModel*)this->model.get(); - musik::core::Server *server = this->usersController->server; - if(server && model){ - - win32cpp::ListView::RowIndexList selectedRows(this->listView.SelectedRows()); - for(win32cpp::ListView::RowIndexList::iterator row=selectedRows.begin();row!=selectedRows.end();++row){ - server->DeleteUser(model->users[*row]->Username()); - } - - } - -} diff --git a/src/server/users/UsersListController.hpp b/src/server/users/UsersListController.hpp deleted file mode 100644 index 54c2b019a..000000000 --- a/src/server/users/UsersListController.hpp +++ /dev/null @@ -1,78 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// - -#include - -////////////////////////////////////////////////////////////////////////////// -// Forward -namespace musik { namespace server { namespace users { - class UsersController; - class UsersListModel; -} } } - - - -namespace musik { namespace server { namespace users { - -////////////////////////////////////////////////////////////////////////////// - -class UsersListController : public win32cpp::EventHandler{ - public: - UsersListController(win32cpp::ListView &listView,UsersController *usersController); - void RemoveSelectedUsers(); - private: - void OnViewCreated(win32cpp::Window* window); - void OnResized(win32cpp::Window* window, win32cpp::Size size); - - win32cpp::ListView& listView; - win32cpp::ListView::ModelRef model; - win32cpp::ListView::ColumnRef mainColumn; - - friend class UsersListModel; - - UsersController* usersController; -}; - - -////////////////////////////////////////////////////////////////////////////// - -} } } // musik::cube::settings diff --git a/src/server/users/UsersListModel.cpp b/src/server/users/UsersListModel.cpp deleted file mode 100644 index 7aedbad68..000000000 --- a/src/server/users/UsersListModel.cpp +++ /dev/null @@ -1,92 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server::users; -using namespace win32cpp; - -////////////////////////////////////////////////////////////////////////////// - -UsersListModel::UsersListModel(UsersListController *controller) -: controller(controller) -{ - musik::core::Server *server = this->controller->usersController->server; - if(server){ - server->UsersUpdated.connect(this,&UsersListModel::OnUsersUpdated); - } - this->UpdateUsersList(); - -} - - -uistring UsersListModel::CellValueToString(int rowIndex, ListView::ColumnRef column){ - if(rowIndexusers.size() && rowIndex>=0){ - return this->users[rowIndex]->Username(); - } - - return uistring(); -} - -void UsersListModel::UpdateUsersList(){ - musik::core::Server *server = this->controller->usersController->server; - if(server){ - this->users = server->AllUsers(); - } - - this->SetRowCount(0); - this->SetRowCount((int)this->users.size()); - -} - -void UsersListModel::OnUsersUpdated(){ - if(!win32cpp::ApplicationThread::InMainThread()){ - win32cpp::ApplicationThread::Call0(this,&UsersListModel::OnUsersUpdated); - return; - } - - this->UpdateUsersList(); - -} - diff --git a/src/server/users/UsersListModel.hpp b/src/server/users/UsersListModel.hpp deleted file mode 100644 index 7820b7c03..000000000 --- a/src/server/users/UsersListModel.hpp +++ /dev/null @@ -1,73 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2 -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#pragma once - -////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include - -////////////////////////////////////////////////////////////////////////////// - -namespace musik { namespace server { namespace users { - -////////////////////////////////////////////////////////////////////////////// - -class UsersListModel : public win32cpp::ListView::Model, public win32cpp::EventHandler{ - public: - UsersListModel(UsersListController *controller); - virtual win32cpp::uistring CellValueToString(int rowIndex, win32cpp::ListView::ColumnRef column); - - void UpdateUsersList(); - private: - - void OnUsersUpdated(); - - UsersListController *controller; - - friend class UsersListController; - - musik::core::server::UserVector users; -}; - - -////////////////////////////////////////////////////////////////////////////// - -} } } // musik::server diff --git a/src/server/users/UsersView.cpp b/src/server/users/UsersView.cpp deleted file mode 100644 index 422549a8a..000000000 --- a/src/server/users/UsersView.cpp +++ /dev/null @@ -1,82 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -#include "pch.hpp" -#include - -#include -#include -#include -#include - - -////////////////////////////////////////////////////////////////////////////// - -using namespace musik::server::users; - -////////////////////////////////////////////////////////////////////////////// - -UsersView::UsersView() -{ -} - -void UsersView::OnCreated() -{ - - LinearLayout* pathLayout = new LinearLayout(HorizontalLayout,win32cpp::LayoutFillFill); - LinearLayout* pathButtonsLayout = new LinearLayout(VerticalLayout); - - // Path ListView - this->usersList = pathLayout->AddChild(new ListView()); - this->usersList->SetLayoutFlags(win32cpp::LayoutFillFill); - - // pathButtons layout - this->addUserButton = pathButtonsLayout->AddChild(new Button(_T("Add user"))); - this->removeUserButton = pathButtonsLayout->AddChild(new Button(_T("Remove user"))); - - this->addUserButton->Resize(90, 24); - this->removeUserButton->Resize(90, 24); - - pathLayout->AddChild(pathButtonsLayout); - - - // Add to the layout - win32cpp::Frame *paddingFrame = this->AddChild(new Frame(pathLayout,WindowPadding(20))); - paddingFrame->SetLayoutFlags(win32cpp::LayoutFillFill); - -} diff --git a/src/server/users/UsersView.hpp b/src/server/users/UsersView.hpp deleted file mode 100644 index fb0941bae..000000000 --- a/src/server/users/UsersView.hpp +++ /dev/null @@ -1,79 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// License Agreement: -// -// The following are Copyright © 2007, mC2 Team -// -// Sources and Binaries of: mC2, win32cpp -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the author nor the names of other contributors may -// be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// -#pragma once - -////////////////////////////////////////////////////////////////////////////// -// Forward declare -namespace win32cpp{ - class Button; - class ListView; - class Label; -} -////////////////////////////////////////////////////////////////////////////// - -#include - -////////////////////////////////////////////////////////////////////////////// - -using namespace win32cpp; - -namespace musik { namespace server { namespace users { - -////////////////////////////////////////////////////////////////////////////// -// forward -class UsersController; -////////////////////////////////////////////////////////////////////////////// - -class UsersView: public Frame -{ - - public: - UsersView(); - - protected: - virtual void OnCreated(); - - friend class UsersController; - Button *addUserButton,*removeUserButton; - ListView *usersList; -}; - -////////////////////////////////////////////////////////////////////////////// - -} } } // musik::server -