Commit 873429b5 authored by Carsten Fuhrmann's avatar Carsten Fuhrmann
Browse files

chatlines and speakers are no longer windows in the taskleiste,

colored chat, different size depending on the importance,
show all names in the channel when moving to it.

next:
- game overlay,
- display the server in as tree structure,
- allow switching the channel,
...
- handle different servers,
- maybe add wake up function,
- maybe add chat function,
parent dc873479
......@@ -54,10 +54,10 @@ void OverlayController::addChatLine(QString message)
w->setAttribute(Qt::WA_TranslucentBackground);
w->setAttribute(Qt::WA_ShowWithoutActivating);
w->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WindowTransparentForInput);
w->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WindowTransparentForInput | Qt::SplashScreen);
newChatLine->setText(message);
newChatLine->setStyleSheet("padding:2px;border-radius:5px;border-style:solid;border-width:1px;border-color:rgb(100,100,100);font:bold; font-size:20px;background-color:rgba(50,50,50,150); color:rgb(255,255,255);");
newChatLine->setStyleSheet("padding:2px;border-radius:5px;border-style:solid;border-width:1px;border-color:rgb(100,100,100);font:bold; font-size:15px;background-color:rgba(50,50,50,150); color:rgb(255,255,255);");
newChatLine->adjustSize();
newChatLine->setAttribute(Qt::WA_ShowWithoutActivating);
......@@ -93,11 +93,11 @@ void OverlayController::addSpeaker(QString name)
w->setAttribute(Qt::WA_TranslucentBackground);
w->setAttribute(Qt::WA_ShowWithoutActivating);
w->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WindowTransparentForInput);
w->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::WindowTransparentForInput | Qt::SplashScreen);
w->setObjectName(name);
newSpeaker->setText(name);
newSpeaker->setStyleSheet("padding:2px;border-radius:5px;border-style:solid;border-width:1px;border-color:rgb(100,100,100);font:bold; font-size:20px;background-color:rgba(50,50,50,150); color:rgb(255,255,255);");
newSpeaker->setStyleSheet("padding:2px;border-radius:5px;border-style:solid;border-width:1px;border-color:rgb(100,100,100);font:bold; font-size:15px;background-color:rgba(50,50,50,150); color:rgb(255,255,255);");
newSpeaker->adjustSize();
newSpeaker->setAttribute(Qt::WA_ShowWithoutActivating);
......@@ -158,4 +158,17 @@ void OverlayController::reset()
m_msgLines.clear();
m_speakerOffset = 0;
m_currentChannel = 0;
}
void OverlayController::setCurrentChannel(quint64 id)
{
m_currentChannel = id;
}
quint64 OverlayController::getCurrentChannel() const
{
return m_currentChannel;
}
......@@ -10,7 +10,7 @@
#define MAXLINES 5
#define BORDEROFFSET 5
#define SPACING 10
#define SPACING 2
#define TIMEOUT 5000
......@@ -27,6 +27,8 @@ private:
int m_screenHeight;
int m_speakerOffset;
quint64 m_currentChannel = 0;
QLabel* m_debugWindow;
QVector<QWidget*> m_speakers;
QVector<QWidget*> m_msgLines;
......@@ -40,4 +42,6 @@ public:
void removeSpeaker(QString name);
void debugPrint(QString text);
void reset();
void setCurrentChannel(quint64 id);
quint64 getCurrentChannel() const;
};
......@@ -222,6 +222,50 @@ int ts3plugin_requestAutoload() {
#pragma endregion
/****************************** Helper functions ********************************/
/*
* Following functions are helper for the callbacks.
*/
QString clientID2Name(uint64 serverConnectionHandlerID, anyID clientID)
{
char* tmp = NULL;
ts3Functions.getClientVariableAsString(serverConnectionHandlerID, clientID, CLIENT_NICKNAME, &tmp);
if (tmp == NULL)
return QString();
QString name(tmp);
ts3plugin_freeMemory(tmp);
return name;
}
QString channelID2Name(uint64 serverConnectionHandlerID, uint64 channelID)
{
char* tmp = NULL;
ts3Functions.getChannelVariableAsString(serverConnectionHandlerID, channelID, CHANNEL_NAME, &tmp);
if (tmp == NULL)
return QString();
QString name(tmp);
ts3plugin_freeMemory(tmp);
return name;
}
void updateChannelList(uint64 serverConnectionHandlerID)
{
anyID* idList;
ts3Functions.getChannelClientList(serverConnectionHandlerID, controller->getCurrentChannel(), &idList);
int i(0);
while (idList[i] != NULL)
controller->debugPrint(clientID2Name(serverConnectionHandlerID, idList[i++]));
}
/************************** TeamSpeak callbacks ***************************/
/*
* Following functions are optional, feel free to remove unused callbacks.
......@@ -270,6 +314,35 @@ void ts3plugin_onUpdateClientEvent(uint64 serverConnectionHandlerID, anyID clien
}
void ts3plugin_onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage) {
QString name = clientID2Name(serverConnectionHandlerID, clientID);
QString oldChannel = channelID2Name(serverConnectionHandlerID, oldChannelID);
QString newChannel = channelID2Name(serverConnectionHandlerID, newChannelID);
anyID myID;
ts3Functions.getClientID(serverConnectionHandlerID, &myID);
if (clientID == myID)
{
controller->setCurrentChannel(newChannelID);
updateChannelList(serverConnectionHandlerID);
}
if (!name.isEmpty() && !oldChannel.isEmpty() && !newChannel.isEmpty())
{
// joined my channel
if (newChannelID == controller->getCurrentChannel())
controller->addChatLine(QString("<font color=\"#00FF00\">%1 <font size=\"-5\">entered from</font> %2</font>").arg(name).arg(oldChannel));
// quit my channel
else if (oldChannelID == controller->getCurrentChannel())
controller->addChatLine(QString("<font color=\"#FF0000\">%1 <font size=\"-5\">left to</font> %2</font>").arg(name).arg(newChannel));
// somewhere else
else
controller->addChatLine(QString("<font size=\"-5\">%1 moved from %2 to %3</font>").arg(name).arg(oldChannel).arg(newChannel));
}
}
void ts3plugin_onClientMoveSubscriptionEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility) {
......@@ -308,7 +381,7 @@ void ts3plugin_onServerStopEvent(uint64 serverConnectionHandlerID, const char* s
int ts3plugin_onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID, const char* fromName, const char* fromUniqueIdentifier, const char* message, int ffIgnored) {
controller->addChatLine(QString("<%1> %2").arg(fromName).arg(message));
controller->addChatLine(QString("<font size=\"-5\">%1</font> %2").arg(fromName).arg(message));
return 0; /* 0 = handle normally, 1 = client will ignore the text message */
}
......@@ -388,7 +461,7 @@ void ts3plugin_onClientBanFromServerEvent(uint64 serverConnectionHandlerID, anyI
int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char* pokerName, const char* pokerUniqueIdentity, const char* message, int ffIgnored) {
controller->addChatLine(QString("<%1> 'Wake up!' %2").arg(pokerName).arg(message));
controller->addChatLine(QString("<font color=\"#00FFFF\"><font size=\"-5\">%1</font> Wake up! %2</font>").arg(pokerName).arg(message));
return 0; /* 0 = handle normally, 1 = client will ignore the poke */
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment