-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
21248cf
commit 4179029
Showing
22 changed files
with
6,360 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleExecutable</key> | ||
<string>OSCRouter</string> | ||
<key>CFBundleGetInfoString</key> | ||
<string>Created by Chris Mizerak</string> | ||
<key>CFBundleIconFile</key> | ||
<string>eos.icns</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.etc.OSCRouter</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) 2015 Electronic Theatre Controls, Inc., http://www.etcconnect.com | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
// Copyright (c) 2015 Electronic Theatre Controls, Inc., http://www.etcconnect.com | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#include "ItemState.h" | ||
#include "QtInclude.h" | ||
|
||
// must be last include | ||
#include "LeakWatcher.h" | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
const ItemStateTable::ID ItemStateTable::sm_Invalid_Id = static_cast<ItemStateTable::ID>(0xffffffff); | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
bool ItemState::operator==(const ItemState &other) const | ||
{ | ||
return (state==other.state && activity==other.activity); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
bool ItemState::operator!=(const ItemState &other) const | ||
{ | ||
return (state!=other.state || activity!=other.activity); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void ItemState::GetStateName(EnumState state, QString &name) | ||
{ | ||
switch( state ) | ||
{ | ||
case STATE_UNINITIALIZED: name=qApp->tr("..."); return; | ||
case STATE_CONNECTING: name=qApp->tr("Connecting..."); return; | ||
case STATE_CONNECTED: name=qApp->tr("Running"); return; | ||
case STATE_NOT_CONNECTED: name=qApp->tr("Not Running"); return; | ||
} | ||
|
||
name = QString(); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void ItemState::GetStateColor(EnumState state, QColor &color) | ||
{ | ||
switch( state ) | ||
{ | ||
case STATE_CONNECTING: color=WARNING_COLOR; return; | ||
case STATE_CONNECTED: color=SUCCESS_COLOR; return; | ||
case STATE_NOT_CONNECTED: color=ERROR_COLOR; return; | ||
} | ||
|
||
color = MUTED_COLOR; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
ItemStateTable::ItemStateTable() | ||
: m_Dirty(false) | ||
{ | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void ItemStateTable::Clear() | ||
{ | ||
m_List.clear(); | ||
m_Dirty = false; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void ItemStateTable::Reset() | ||
{ | ||
for(LIST::iterator i=m_List.begin(); i!=m_List.end(); i++) | ||
i->activity = i->dirty = false; | ||
m_Dirty = false; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void ItemStateTable::Deactivate() | ||
{ | ||
ItemState deactivated; | ||
for(ID i=0; i<m_List.size(); i++) | ||
Update(i, deactivated); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void ItemStateTable::Flush(ItemStateTable &other) | ||
{ | ||
if( other.m_Dirty ) | ||
{ | ||
for(ID i=0; i<other.m_List.size(); i++) | ||
{ | ||
ItemState &otherItemState = other.m_List[i]; | ||
Update(i, otherItemState); | ||
otherItemState.dirty = false; | ||
otherItemState.activity = false; | ||
} | ||
|
||
other.m_Dirty = false; | ||
} | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
ItemStateTable::ID ItemStateTable::Register() | ||
{ | ||
m_List.push_back( ItemState() ); | ||
return (m_List.size() - 1); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
void ItemStateTable::Update(ID id, const ItemState &state) | ||
{ | ||
if(id < m_List.size()) | ||
{ | ||
ItemState &itemState = m_List[id]; | ||
if(itemState != state) | ||
{ | ||
itemState = state; | ||
itemState.dirty = true; | ||
m_Dirty = true; | ||
} | ||
} | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
const ItemState* ItemStateTable::GetItemState(ID id) const | ||
{ | ||
return ((id<m_List.size()) | ||
? (&(m_List[id])) | ||
: 0); | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright (c) 2015 Electronic Theatre Controls, Inc., http://www.etcconnect.com | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#pragma once | ||
#ifndef ITEM_STATE_H | ||
#define ITEM_STATE_H | ||
|
||
#include <vector> | ||
|
||
class QColor; | ||
class QString; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
class ItemState | ||
{ | ||
public: | ||
enum EnumState | ||
{ | ||
STATE_UNINITIALIZED = 0, | ||
STATE_CONNECTING, | ||
STATE_CONNECTED, | ||
STATE_NOT_CONNECTED, | ||
|
||
STATE_COUNT | ||
}; | ||
|
||
ItemState() | ||
: state(STATE_UNINITIALIZED) | ||
, activity(false) | ||
, dirty(false) | ||
{} | ||
|
||
bool operator==(const ItemState &other) const; | ||
bool operator!=(const ItemState &other) const; | ||
|
||
EnumState state; | ||
bool activity; | ||
bool dirty; | ||
|
||
static void GetStateName(EnumState state, QString &name); | ||
static void GetStateColor(EnumState state, QColor &color); | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
class ItemStateTable | ||
{ | ||
public: | ||
typedef size_t ID; | ||
typedef std::vector<ItemState> LIST; | ||
|
||
ItemStateTable(); | ||
|
||
virtual void Clear(); | ||
virtual void Reset(); | ||
virtual void Deactivate(); | ||
virtual void Flush(ItemStateTable &other); | ||
virtual bool GetDirty() const {return m_Dirty;} | ||
virtual ID Register(); | ||
virtual void Update(ID id, const ItemState &state); | ||
virtual const ItemState* GetItemState(ID id) const; | ||
virtual const LIST& GetList() const {return m_List;} | ||
|
||
static const ID sm_Invalid_Id; | ||
|
||
private: | ||
bool m_Dirty; | ||
LIST m_List; | ||
}; | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) 2015 Electronic Theatre Controls, Inc., http://www.etcconnect.com | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
#pragma once | ||
#ifndef LEAK_WATCHER_H | ||
#define LEAK_WATCHER_H | ||
|
||
#ifdef WIN32 | ||
|
||
#ifdef _DEBUG | ||
#include <crtdbg.h> | ||
#define DEBUG_NEW new(_NORMAL_BLOCK ,__FILE__, __LINE__) | ||
#else | ||
#define DEBUG_NEW new | ||
#endif | ||
|
||
#define new DEBUG_NEW | ||
|
||
#endif | ||
|
||
#endif |
Oops, something went wrong.