Fixed cube and server taskbar/systray icon.

This commit is contained in:
Daniel Önnerby 2008-09-03 12:53:42 +00:00
parent 62b8340ccd
commit 8212d9ee41
7 changed files with 42 additions and 20 deletions

View File

@ -9,8 +9,8 @@ SetCompressor /SOLID lzma
!define MUI_BGCOLOR "FFFFFF"
!define PROJECT_NAME "musikCube 2"
!define SUB_NAME "developers milestone 1"
!define INSTALLER_NAME "mC2_dev_m1"
!define SUB_NAME "developers milestone 2"
!define INSTALLER_NAME "mC2dm2"
!define INSTALL_DIR "musikCube 2"
;----------------------------------------------------------------
@ -42,6 +42,7 @@ Section "mC2installation" main
SetOutPath "$INSTDIR"
File /r "..\bin\release\mC2.exe"
File /r "..\bin\release\musikServer.exe"
File /r "..\LICENSE.txt"
SetOutPath "$INSTDIR\plugins"
@ -52,6 +53,7 @@ Section "mC2installation" main
CreateDirectory "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}"
CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\${PROJECT_NAME}.lnk" "$INSTDIR\mC2.exe"
CreateShortCut "$SMPROGRAMS\${PROJECT_NAME} ${SUB_NAME}\musikServer.lnk" "$INSTDIR\musikServer.exe"
SectionEnd

View File

@ -44,7 +44,7 @@
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <atlbase.h>
using namespace musik::core;
@ -99,6 +99,7 @@ utfstring Library::Remote::GetInfo(){
//////////////////////////////////////////
bool Library::Remote::Startup(){
ATLTRACE2("Library::Remote::Startup\n");
// Lets start the ReadThread first, it will startup the connection and
// then start the WriteThread
this->threads.create_thread(boost::bind(&Library::Remote::ReadThread,this));
@ -113,6 +114,7 @@ bool Library::Remote::Startup(){
//////////////////////////////////////////
void Library::Remote::ReadThread(){
ATLTRACE2("Library::Remote::ReadThread\n");
{
Preferences prefs("Connection",this->Identifier().c_str());
@ -124,27 +126,42 @@ void Library::Remote::ReadThread(){
boost::asio::ip::tcp::resolver::query resolverQuery(this->address,this->port);
try{
boost::asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve(resolverQuery);
ATLTRACE2("Library::Remote::ReadThread 1\n");
boost::system::error_code resolverError;
boost::asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve(resolverQuery,resolverError);
boost::asio::ip::tcp::resolver::iterator end;
ATLTRACE2("Library::Remote::ReadThread 1.1\n");
if(resolverError){
ATLTRACE2("Library::Remote::ReadThread ERROR 1.1\n");
this->Exit();
return;
}
boost::system::error_code error = boost::asio::error::host_not_found;
while (error && endpointIterator!=end){
ATLTRACE2("Library::Remote::ReadThread 1.2\n");
this->socket.close();
ATLTRACE2("Library::Remote::ReadThread 1.3\n");
this->socket.connect(*endpointIterator, error);
ATLTRACE2("Library::Remote::ReadThread 1.4\n");
if(error){
endpointIterator++;
}
}
if (error || endpointIterator==end){
ATLTRACE2("Library::Remote::ReadThread 1.5\n");
this->Exit();
return;
}
ATLTRACE2("Library::Remote::ReadThread 1.6\n");
}
catch(...){
this->Exit();
return;
}
ATLTRACE2("Library::Remote::ReadThread 2\n");
// Successfully connected to server
// Start the WriteThread
try{
@ -155,11 +172,15 @@ void Library::Remote::ReadThread(){
return;
}
ATLTRACE2("Library::Remote::ReadThread 3\n");
try{
// Lets start recieving queries
xml::Parser parser(&this->socket);
ATLTRACE2("Library::Remote::ReadThread 4\n");
if( xml::ParserNode rootNode=parser.ChildNode("musik")){
while(xml::ParserNode node=rootNode.ChildNode()){
ATLTRACE2("Library::Remote::ReadThread 5\n");
if(node.Name()=="queryresults"){
unsigned int queryId = boost::lexical_cast<unsigned int>(node.Attributes()["id"]);
@ -204,6 +225,7 @@ void Library::Remote::ReadThread(){
///Thread for writing to the socket
//////////////////////////////////////////
void Library::Remote::WriteThread(){
ATLTRACE2("Library::Remote::WriteThread\n");
xml::Writer writer(&this->socket);

View File

@ -230,7 +230,7 @@ int Connection::Execute(const wchar_t* sql){
void Connection::Analyze(){
boost::mutex::scoped_lock lock(Connection::globalMutex);
this->Execute("ANALYZE");
// this->Execute("ANALYZE");
}

View File

@ -87,12 +87,11 @@ void MainWindowController::OnMainWindowCreated(Window* window)
{
// Start by setting the icon
HICON icon = LoadIcon(Application::Instance(), MAKEINTRESOURCE( IDI_MAINFRAME ) );
if ( icon ){
SendMessage( window->Handle(), WM_SETICON, WPARAM( ICON_SMALL ), LPARAM( icon ) );
SendMessage( window->Handle(), WM_SETICON, WPARAM( ICON_BIG ), LPARAM( 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();
@ -105,8 +104,8 @@ void MainWindowController::OnMainWindowCreated(Window* window)
// Bind Exit to handler
trayExit->Activated.connect(this, &MainWindowController::OnFileExit);
UINT uidTrayIcon = Application::Instance().SysTrayManager()->AddIcon(Application::Instance().MainWindow(), icon);
Application::Instance().SysTrayManager()->SetTooltip(uidTrayIcon, _T("And another test..."));
UINT uidTrayIcon = Application::Instance().SysTrayManager()->AddIcon(Application::Instance().MainWindow(), icon16);
Application::Instance().SysTrayManager()->SetTooltip(uidTrayIcon, _T("musikCube"));
Application::Instance().SysTrayManager()->SetPopupMenu(uidTrayIcon, myMenu);
Application::Instance().SysTrayManager()->ShowBalloon(uidTrayIcon, _T("musikCube 2"), _T("Welcome to musikCube!"), 2);
Application::Instance().SysTrayManager()->EnableMinimizeToTray(uidTrayIcon);

View File

@ -83,11 +83,10 @@ void MainWindowController::OnMainWindowCreated(Window* window)
{
// Start by setting the icon
HICON icon = LoadIcon(Application::Instance(), MAKEINTRESOURCE( IDI_MAINFRAME ) );
if ( icon ){
SendMessage( window->Handle(), WM_SETICON, WPARAM( ICON_SMALL ), LPARAM( icon ) );
SendMessage( window->Handle(), WM_SETICON, WPARAM( ICON_BIG ), LPARAM( 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
@ -99,7 +98,7 @@ void MainWindowController::OnMainWindowCreated(Window* window)
// Bind Exit to handler
trayExit->Activated.connect(this, &MainWindowController::OnFileExit);
UINT uidTrayIcon = Application::Instance().SysTrayManager()->AddIcon(Application::Instance().MainWindow(), icon);
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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View File

@ -9,7 +9,7 @@
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_MAINFRAME ICON "../../cube/resources/mC2.ico"
IDI_MAINFRAME ICON "musikServer.ico"
/////////////////////////////////////////////////////////////////////////////