- Fixed the SimpleScrollAdapter to have a max size, and do so

efficiently without a speed trade-off.
- Fixed a couple color-related things
- Removed a bunch of additional dead code, headers, libraries, projects
This commit is contained in:
casey 2016-05-09 00:27:55 -07:00
parent 4d279004c7
commit 32e5c2764e
90 changed files with 173 additions and 4025 deletions

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <windows.h>
/* 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 <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# ifdef VMS
# include <unixio.h> /* 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 */

Binary file not shown.

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- $Id -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable />
<assemblyIdentity type="win32" name="Microsoft.DTfW.DHL" version="6.6.7.5" processorArchitecture="x86" />
<file name="dbghelp.dll" />
</assembly>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright © 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<noInheritable/>
<assemblyIdentity
type="win32"
name="Microsoft.VC80.CRT"
version="8.0.50608.0"
processorArchitecture="x86"
publicKeyToken="1fc8b3b9a1e18e3b"
/>
<file name="msvcr80.dll"/>
<file name="msvcp80.dll"/>
<file name="msvcm80.dll"/>
</assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -71,6 +71,7 @@
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>../../3rdparty/lib;../../../../boost_1_60_0/lib32-msvc-14.0;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@ -71,6 +71,7 @@
<AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>../../3rdparty/lib;../../../../boost_1_60_0/lib32-msvc-14.0;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@ -73,6 +73,7 @@
<AdditionalLibraryDirectories>./lib;../../3rdparty/lib;../../../../boost_1_60_0/lib32-msvc-14.0;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@ -79,6 +79,7 @@
<MapExports>true</MapExports>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@ -73,6 +73,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@ -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);
}

View File

@ -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:

View File

@ -9,7 +9,6 @@
#include <core/sdk/IPlugin.h>
#include <core/plugin/PluginFactory.h>
#include <core/library/track/TrackFactory.h>
#include <core/library/LibraryFactory.h>
#include <core/library/Indexer.h>
#include <boost/algorithm/string.hpp>
@ -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") {

View File

@ -3,8 +3,11 @@
#include "curses_config.h"
#include "BorderedWindow.h"
#include "OutputWindow.h"
#include <core/playback/Transport.h>
#include <core/playback/Transport.h>
#include <core/library/LibraryFactory.h>
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;
};

View File

@ -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;
};

View File

@ -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();

View File

@ -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)) {
}

View File

@ -14,6 +14,7 @@ OutputWindow::OutputWindow()
this->adapter = new SimpleScrollAdapter();
this->adapter->SetDisplaySize(this->GetContentWidth(), this->GetContentHeight());
this->adapter->SetMaxEntries(500);
this->Create();
}

View File

@ -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);

View File

@ -4,8 +4,16 @@
#include <boost/algorithm/string.hpp>
#include <utf8/utf8/unchecked.h>
#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> 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<Entry> 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) {

View File

@ -2,6 +2,7 @@
#include "curses_config.h"
#include "IScrollAdapter.h";
#include <deque>
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<boost::shared_ptr<Entry>> EntryList;
typedef std::deque<boost::shared_ptr<Entry>> 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;
};

View File

@ -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;

View File

@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="square"
Name="musikbox"
ProjectGUID="{C7102EB1-7311-4B36-A7FF-89DD7F077FF9}"
RootNamespace="square"
RootNamespace="musikbox"
Keyword="Win32Proj"
>
<Platforms>

View File

@ -13,7 +13,7 @@
<PropertyGroup Label="Globals">
<ProjectName>musikbox</ProjectName>
<ProjectGuid>{C7102EB1-7311-4B36-A7FF-89DD7F077FF9}</ProjectGuid>
<RootNamespace>square</RootNamespace>
<RootNamespace>musikbox</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
@ -82,7 +82,8 @@
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\src\3rdparty\vld\*.*" "$(TargetDir)" </Command>
<Command>
</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="TransportEvents.cpp" />
<ClCompile Include="Main.cpp" />
<ClCompile Include="stdafx.cpp" />
<ClCompile Include="BorderedWindow.cpp">
<Filter>curses</Filter>
</ClCompile>
<ClCompile Include="Colors.cpp">
<Filter>curses</Filter>
</ClCompile>
<ClCompile Include="IScrollAdapter.h">
<Filter>curses</Filter>
</ClCompile>
<ClCompile Include="CommandWindow.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="LogWindow.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="OutputWindow.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="ResourcesWindow.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="Screen.cpp">
<Filter>curses</Filter>
</ClCompile>
<ClCompile Include="ScrollableWindow.cpp">
<Filter>curses</Filter>
</ClCompile>
<ClCompile Include="SimpleScrollAdapter.cpp">
<Filter>curses</Filter>
</ClCompile>
<ClCompile Include="SystemInfo.cpp">
<Filter>windows</Filter>
</ClCompile>
<ClCompile Include="TransportWindow.cpp">
<Filter>windows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="TransportEvents.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="BorderedWindow.h">
<Filter>curses</Filter>
</ClInclude>
<ClInclude Include="Colors.h">
<Filter>curses</Filter>
</ClInclude>
<ClInclude Include="curses_config.h">
<Filter>curses</Filter>
</ClInclude>
<ClInclude Include="CommandWindow.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="LogWindow.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="OutputWindow.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="ResourcesWindow.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="Screen.h">
<Filter>curses</Filter>
</ClInclude>
<ClInclude Include="ScrollableWindow.h">
<Filter>curses</Filter>
</ClInclude>
<ClInclude Include="SimpleScrollAdapter.h">
<Filter>curses</Filter>
</ClInclude>
<ClInclude Include="SystemInfo.h">
<Filter>windows</Filter>
</ClInclude>
<ClInclude Include="TransportWindow.h">
<Filter>windows</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="curses">
<UniqueIdentifier>{04a2cf62-168c-4f1b-ac33-a55f7cbecff0}</UniqueIdentifier>
</Filter>
<Filter Include="windows">
<UniqueIdentifier>{c1ada983-8f4e-4ac4-86be-fa6fdffec375}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>

View File

@ -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)

View File

@ -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 <server/ConnectedUsersController.hpp>
#include <server/ConnectedUsersListController.hpp>
#include <server/MainWindowController.hpp>
#include <server/resources/resource.h>
#include <core/Preferences.h>
#include <win32cpp/Types.hpp> // uichar, uistring
#include <win32cpp/TopLevelWindow.hpp>
#include <win32cpp/Application.hpp>
#include <win32cpp/ApplicationThread.hpp>
#include <win32cpp/ListView.hpp>
#include <win32cpp/RedrawLock.hpp>
#include <win32cpp/LinearLayout.hpp>
#include <win32cpp/Label.hpp>
#include <win32cpp/Frame.hpp>
#include <win32cpp/TrayIconManager.hpp>
//////////////////////////////////////////////////////////////////////////////
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() );
}

View File

@ -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 <core/Server.h>
#include <win32cpp/Timer.hpp>
#include <boost/shared_ptr.hpp>
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -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 <server/ConnectedUsersListController.hpp>
#include <server/ConnectedUsersListModel.hpp>
#include <server/ConnectedUsersController.hpp>
#include <core/Indexer.h>
//////////////////////////////////////////////////////////////////////////////
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);
}

View File

@ -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 <win32cpp/ListView.hpp>
//////////////////////////////////////////////////////////////////////////////
// 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

View File

@ -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 <server/ConnectedUsersListModel.hpp>
#include <server/ConnectedUsersController.hpp>
#include <win32cpp/ApplicationThread.hpp>
#include <core/Server.h>
#include <core/Common.h>
//////////////////////////////////////////////////////////////////////////////
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(rowIndex<this->users.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();
}

View File

@ -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 <server/ConnectedUsersListController.hpp>
#include <win32cpp/ListView.hpp>
#include <core/server/UserSession.h>
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -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 <server/MainWindowController.hpp>
#include <server/resources/resource.h>
#include <server/SyncpathController.hpp>
#include <server/SyncpathView.hpp>
#include <server/users/UsersController.hpp>
#include <server/users/UsersView.hpp>
#include <core/Preferences.h>
#include <win32cpp/Types.hpp> // uichar, uistring
#include <win32cpp/TopLevelWindow.hpp>
#include <win32cpp/Application.hpp>
#include <win32cpp/TabView.hpp>
#include <win32cpp/RedrawLock.hpp>
#include <win32cpp/LinearLayout.hpp>
#include <win32cpp/Label.hpp>
#include <win32cpp/Frame.hpp>
#include <win32cpp/TrayIconManager.hpp>
//////////////////////////////////////////////////////////////////////////////
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);
}

View File

@ -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 <win32cpp/Timer.hpp>
#include <core/Server.h>
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -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 <server/SyncpathController.hpp>
#include <server/SyncpathView.hpp>
#include <server/SyncpathListController.hpp>
#include <core/Indexer.h>
#include <win32cpp/FolderBrowseDialog.hpp>
#include <win32cpp/Button.hpp>
#include <win32cpp/Label.hpp>
#include <win32cpp/Window.hpp>
#include <win32cpp/Application.hpp>
//////////////////////////////////////////////////////////////////////////////
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();
}

View File

@ -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 <win32cpp/Types.hpp>
#include <win32cpp/WindowGeometry.hpp>
#include <boost/shared_ptr.hpp>
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<SyncpathListController> SyncpathListControllerRef;
SyncpathListControllerRef syncpathListController;
public:
musik::core::Indexer *indexer;
};
//////////////////////////////////////////////////////////////////////////////
} } // musik::server

View File

@ -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 <server/SyncpathListController.hpp>
#include <server/SyncpathListModel.hpp>
#include <server/SyncpathController.hpp>
#include <core/Indexer.h>
//////////////////////////////////////////////////////////////////////////////
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]);
}
}
}

View File

@ -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 <win32cpp/ListView.hpp>
//////////////////////////////////////////////////////////////////////////////
// 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

View File

@ -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 <server/SyncpathListModel.hpp>
#include <server/SyncpathController.hpp>
#include <win32cpp/ApplicationThread.hpp>
#include <core/Indexer.h>
//////////////////////////////////////////////////////////////////////////////
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(rowIndex<this->paths.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();
}

View File

@ -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 <server/SyncpathListController.hpp>
#include <win32cpp/ListView.hpp>
//////////////////////////////////////////////////////////////////////////////
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<win32cpp::uistring> PathVector;
PathVector paths;
};
//////////////////////////////////////////////////////////////////////////////
} } // musik::server

View File

@ -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 <server/SyncpathView.hpp>
#include <win32cpp/LinearLayout.hpp>
#include <win32cpp/Button.hpp>
#include <win32cpp/ListView.hpp>
#include <win32cpp/Label.hpp>
//////////////////////////////////////////////////////////////////////////////
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);
}

View File

@ -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 <win32cpp/Frame.hpp>
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -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 <win32cpp/Application.hpp>
#include <win32cpp/TopLevelWindow.hpp>
#include <core/config.h>
#include <core/Server.h>
#include <server/ConnectedUsersController.hpp>
#include <server/MainWindowController.hpp>
//////////////////////////////////////////////////////////////////////////////
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;
}

View File

@ -1,371 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="musikServer"
ProjectGUID="{1A81F4B3-303D-4591-9029-5F3368EE15D7}"
RootNamespace="musikServer"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../bin/$(ConfigurationName)"
IntermediateDirectory="obj/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="./;../;../3rdparty/include/"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;XML_STATIC"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pch.hpp"
PrecompiledHeaderFile="obj/$(ConfigurationName)/$(TargetName).pch"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdiplus.lib comctl32.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="../3rdparty/lib"
IgnoreDefaultLibraryNames=""
ModuleDefinitionFile=""
GenerateDebugInformation="true"
GenerateMapFile="true"
MapFileName="$(TargetDir)$(TargetName).map"
MapExports="true"
SubSystem="2"
EntryPointSymbol="wWinMainCRTStartup"
ImportLibrary=""
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="$(ProjectDir)\resources\musikServer.exe.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy &quot;$(SolutionDir)\src\3rdparty\vld\*.*&quot; &quot;$(TargetDir)&quot;"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../bin/$(ConfigurationName)"
IntermediateDirectory="obj/$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="./;../;../3rdparty/include/"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_SCL_SECURE_NO_WARNINGS;XML_STATIC"
RuntimeLibrary="0"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pch.hpp"
PrecompiledHeaderFile="obj/$(ConfigurationName)/$(TargetName).pch"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdiplus.lib comctl32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="../3rdparty/lib"
ModuleDefinitionFile=""
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
EntryPointSymbol="wWinMainCRTStartup"
ImportLibrary=""
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="$(ProjectDir)\resources\musikServer.exe.manifest"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="src"
>
<File
RelativePath=".\MainWindowController.cpp"
>
</File>
<File
RelativePath=".\MainWindowController.hpp"
>
</File>
<Filter
Name="Syncpath settings"
>
<File
RelativePath=".\SyncpathController.cpp"
>
</File>
<File
RelativePath=".\SyncpathController.hpp"
>
</File>
<File
RelativePath=".\SyncpathListController.cpp"
>
</File>
<File
RelativePath=".\SyncpathListController.hpp"
>
</File>
<File
RelativePath=".\SyncpathListModel.cpp"
>
</File>
<File
RelativePath=".\SyncpathListModel.hpp"
>
</File>
<File
RelativePath=".\SyncpathView.cpp"
>
</File>
<File
RelativePath=".\SyncpathView.hpp"
>
</File>
</Filter>
<Filter
Name="User settings"
>
<File
RelativePath=".\users\UsersController.cpp"
>
</File>
<File
RelativePath=".\users\UsersController.hpp"
>
</File>
<File
RelativePath=".\users\UsersListController.cpp"
>
</File>
<File
RelativePath=".\users\UsersListController.hpp"
>
</File>
<File
RelativePath=".\users\UsersListModel.cpp"
>
</File>
<File
RelativePath=".\users\UsersListModel.hpp"
>
</File>
<File
RelativePath=".\users\UsersView.cpp"
>
</File>
<File
RelativePath=".\users\UsersView.hpp"
>
</File>
<Filter
Name="dialog"
>
<File
RelativePath=".\users\EditUserController.cpp"
>
</File>
<File
RelativePath=".\users\EditUserController.hpp"
>
</File>
<File
RelativePath=".\users\EditUserView.cpp"
>
</File>
<File
RelativePath=".\users\EditUserView.hpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Connected users"
>
<File
RelativePath=".\ConnectedUsersController.cpp"
>
</File>
<File
RelativePath=".\ConnectedUsersController.hpp"
>
</File>
<File
RelativePath=".\ConnectedUsersListController.cpp"
>
</File>
<File
RelativePath=".\ConnectedUsersListController.hpp"
>
</File>
<File
RelativePath=".\ConnectedUsersListModel.cpp"
>
</File>
<File
RelativePath=".\ConnectedUsersListModel.hpp"
>
</File>
</Filter>
</Filter>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\resources\musikServer.ico"
>
</File>
<File
RelativePath=".\pch.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pch.hpp"
>
</File>
<File
RelativePath=".\resources\resource.rc"
>
</File>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value=".\resources\resource.rc"
/>
</Globals>
</VisualStudioProject>

View File

@ -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"

View File

@ -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 <core/config.h>
//////////////////////////////////////////////////////////////////////////////
#include <win32cpp/Win32Config.hpp>
/*#include <win32cpp/Types.hpp>
#include <win32cpp/WindowGeometry.hpp>
#include <win32cpp/Exception.hpp>
#include <win32cpp/Container.hpp>
#include <win32cpp/Font.hpp>
#include <win32cpp/Menu.hpp>
#include <win32cpp/Window.hpp>
#include <win32cpp/Application.hpp>
#include <win32cpp/TopLevelWindow.hpp>
*/
//////////////////////////////////////////////////////////////////////////////

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="Microsoft.Windows.mC2"
type="win32"
/>
<description>Your app description here</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

View File

@ -1,5 +0,0 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by resource.rc
//
#define IDI_MAINFRAME 100

View File

@ -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

View File

@ -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 <server/users/EditUserController.hpp>
#include <server/users/EditUserView.hpp>
#include <core/Crypt.h>
#include <core/Common.h>
#include <win32cpp/Window.hpp>
#include <win32cpp/Button.hpp>
#include <win32cpp/EditView.hpp>
#include <win32cpp/RedrawLock.hpp>
//////////////////////////////////////////////////////////////////////////////
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());
}

View File

@ -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 <core/Server.h>
#include <win32cpp/Types.hpp>
#include <win32cpp/TopLevelWindow.hpp>
#include <boost/shared_ptr.hpp>
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -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 <server/users/EditUserView.hpp>
#include <win32cpp/Frame.hpp>
#include <win32cpp/Label.hpp>
#include <win32cpp/Button.hpp>
#include <win32cpp/LinearLayout.hpp>
#include <win32cpp/EditView.hpp>
//////////////////////////////////////////////////////////////////////////////
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);
}

View File

@ -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 <win32cpp/Frame.hpp>
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -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 <server/users/UsersController.hpp>
#include <server/users/UsersView.hpp>
#include <server/users/UsersListController.hpp>
#include <server/users/EditUserController.hpp>
#include <win32cpp/Button.hpp>
#include <win32cpp/Label.hpp>
#include <win32cpp/Window.hpp>
#include <win32cpp/Application.hpp>
//////////////////////////////////////////////////////////////////////////////
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();
}

View File

@ -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 <core/Server.h>
#include <win32cpp/Types.hpp>
#include <win32cpp/WindowGeometry.hpp>
#include <boost/shared_ptr.hpp>
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<UsersListController> UsersListControllerRef;
UsersListControllerRef usersListController;
public:
musik::core::Server *server;
};
//////////////////////////////////////////////////////////////////////////////
} } } // musik::server

View File

@ -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 <server/users/UsersListController.hpp>
#include <server/users/UsersListModel.hpp>
#include <server/users/UsersController.hpp>
//////////////////////////////////////////////////////////////////////////////
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());
}
}
}

View File

@ -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 <win32cpp/ListView.hpp>
//////////////////////////////////////////////////////////////////////////////
// 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

View File

@ -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 <server/users/UsersListModel.hpp>
#include <server/users/UsersController.hpp>
#include <win32cpp/ApplicationThread.hpp>
#include <core/Server.h>
//////////////////////////////////////////////////////////////////////////////
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(rowIndex<this->users.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();
}

View File

@ -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 <core/server/User.h>
#include <server/users/UsersListController.hpp>
#include <win32cpp/ListView.hpp>
//////////////////////////////////////////////////////////////////////////////
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

View File

@ -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 <server/users/UsersView.hpp>
#include <win32cpp/LinearLayout.hpp>
#include <win32cpp/Button.hpp>
#include <win32cpp/ListView.hpp>
#include <win32cpp/Label.hpp>
//////////////////////////////////////////////////////////////////////////////
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);
}

View File

@ -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 <win32cpp/Frame.hpp>
//////////////////////////////////////////////////////////////////////////////
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