Commit 4fcd7083 authored by Carsten Fuhrmann's avatar Carsten Fuhrmann

fixed adjust window bug,

disabled debug window,
double mute/unmute yourself when double klick,
using no focus instead of delegate => style file works, but icons are blue again,
parent c5144037
...@@ -15,7 +15,7 @@ ChannelTree::ChannelTree(ChannelListWidget * widget, QWidget *parent) ...@@ -15,7 +15,7 @@ ChannelTree::ChannelTree(ChannelListWidget * widget, QWidget *parent)
setExpandsOnDoubleClick(false); setExpandsOnDoubleClick(false);
m_delegate = new MyItemDelegate; m_delegate = new MyItemDelegate;
setItemDelegate(m_delegate); //setItemDelegate(m_delegate);
QFile styleSheet("plugins\\qtTsOverlay\\tree.styl"); QFile styleSheet("plugins\\qtTsOverlay\\tree.styl");
styleSheet.open(QIODevice::ReadOnly); styleSheet.open(QIODevice::ReadOnly);
...@@ -25,6 +25,9 @@ ChannelTree::ChannelTree(ChannelListWidget * widget, QWidget *parent) ...@@ -25,6 +25,9 @@ ChannelTree::ChannelTree(ChannelListWidget * widget, QWidget *parent)
setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setAttribute(Qt::WA_ShowWithoutActivating);
setFocusPolicy(Qt::NoFocus);
} }
ChannelTree::~ChannelTree() ChannelTree::~ChannelTree()
......
...@@ -27,9 +27,9 @@ public: ...@@ -27,9 +27,9 @@ public:
oStyleOpt.state ^= QStyle::State_Selected; oStyleOpt.state ^= QStyle::State_Selected;
} }
if (oStyleOpt.state & QStyle::State_HasFocus) { /*if (oStyleOpt.state & QStyle::State_HasFocus) {
oStyleOpt.state ^= QStyle::State_HasFocus; oStyleOpt.state ^= QStyle::State_HasFocus;
} }*/
// Paint // Paint
QItemDelegate::paint(painter, oStyleOpt, index); QItemDelegate::paint(painter, oStyleOpt, index);
......
...@@ -43,10 +43,10 @@ OverlayController::OverlayController(const struct TS3Functions funcs, quint64 se ...@@ -43,10 +43,10 @@ OverlayController::OverlayController(const struct TS3Functions funcs, quint64 se
m_speakerOffset = 0; m_speakerOffset = 0;
m_debugWindow = new QLabel; m_debugWindow = NULL; // = new QLabel;
m_debugWindow->setGeometry(320, 200, 750, 500); /*m_debugWindow->setGeometry(320, 200, 750, 500);
m_debugWindow->setAlignment(Qt::AlignTop | Qt::AlignLeft); m_debugWindow->setAlignment(Qt::AlignTop | Qt::AlignLeft);
m_debugWindow->show(); m_debugWindow->show();*/
m_SCHID = serverConnectionHandlerID; m_SCHID = serverConnectionHandlerID;
...@@ -73,13 +73,13 @@ OverlayController::~OverlayController() ...@@ -73,13 +73,13 @@ OverlayController::~OverlayController()
while (!m_clientList.isEmpty()) while (!m_clientList.isEmpty())
delete m_clientList.takeFirst(); delete m_clientList.takeFirst();
delete m_debugWindow; if (m_debugWindow != NULL)
delete m_debugWindow;
delete m_tree; delete m_tree;
} }
void OverlayController::deleteChatLine(QWidget * line, QTimer *timer) void OverlayController::deleteChatLine(QWidget * line, QTimer *timer)
{ {
//TODO: delete the given line instead of the last
int index = m_msgLines.indexOf(line); int index = m_msgLines.indexOf(line);
if (index != -1) if (index != -1)
{ {
...@@ -105,8 +105,42 @@ void OverlayController::treeItemClicked(QTreeWidgetItem * item, int column) ...@@ -105,8 +105,42 @@ void OverlayController::treeItemClicked(QTreeWidgetItem * item, int column)
} }
else if (type == client) else if (type == client)
{ {
anyID ownID;
m_ts3.getClientID(m_SCHID, &ownID);
anyID id = item->data(1, Qt::UserRole).value<anyID>(); anyID id = item->data(1, Qt::UserRole).value<anyID>();
m_ts3.requestClientPoke(m_SCHID, id, "", NULL);
debugPrint(QString("ownID: %1 id: %2").arg(ownID).arg(id));
if (id == ownID)
{
int value[3];
if (m_ts3.getClientSelfVariableAsInt(m_SCHID, CLIENT_INPUT_MUTED, &value[0]) != ERROR_ok)
value[0] = -1;
if (m_ts3.getClientSelfVariableAsInt(m_SCHID, CLIENT_OUTPUT_MUTED, &value[1]) != ERROR_ok)
value[1] = -1;
if (m_ts3.getClientSelfVariableAsInt(m_SCHID, CLIENT_INPUT_HARDWARE, &value[2]) != ERROR_ok)
value[2] = -1;
// we have all information, nothing is lost
if (value[0] != -1 && value[1] != -1 && value[3] != -1)
{
// something was disabled => enable everything
if (value[0] || value[1] || !value[2])
{
m_ts3.setClientSelfVariableAsInt(m_SCHID, CLIENT_INPUT_MUTED, 0);
m_ts3.setClientSelfVariableAsInt(m_SCHID, CLIENT_OUTPUT_MUTED, 0);
m_ts3.setClientSelfVariableAsInt(m_SCHID, CLIENT_INPUT_HARDWARE, 1);
}
// nothing was disabled => disable everything
else
{
m_ts3.setClientSelfVariableAsInt(m_SCHID, CLIENT_INPUT_MUTED, 1);
m_ts3.setClientSelfVariableAsInt(m_SCHID, CLIENT_OUTPUT_MUTED, 1);
}
}
}
else
m_ts3.requestClientPoke(m_SCHID, id, "", NULL);
} }
} }
...@@ -222,7 +256,8 @@ void OverlayController::removeSpeaker(QString name) ...@@ -222,7 +256,8 @@ void OverlayController::removeSpeaker(QString name)
void OverlayController::debugPrint(QString text) void OverlayController::debugPrint(QString text)
{ {
m_debugWindow->setText(text + "\n" + m_debugWindow->text()); if (m_debugWindow != NULL)
m_debugWindow->setText(text + "\n" + m_debugWindow->text());
} }
void OverlayController::reset() void OverlayController::reset()
...@@ -353,7 +388,7 @@ void OverlayController::updateClientList() ...@@ -353,7 +388,7 @@ void OverlayController::updateClientList()
if (m_treeState == minimum) if (m_treeState == minimum)
updateChannelList(); updateChannelList();
//TODO: remove all clients //remove all clients
while (!m_clientList.isEmpty()) while (!m_clientList.isEmpty())
delete m_clientList.takeFirst(); delete m_clientList.takeFirst();
...@@ -402,12 +437,13 @@ void OverlayController::updateClientList() ...@@ -402,12 +437,13 @@ void OverlayController::updateClientList()
} }
m_ts3.freeMemory(clientIDList); m_ts3.freeMemory(clientIDList);
} }
m_tree->getTree()->adjustSize();
m_tree->adjustSize();
} }
void OverlayController::displayChannelList() void OverlayController::displayChannelList()
{ {
m_tree->getTree()->adjustSize();
m_tree->adjustSize();
m_tree->show(); m_tree->show();
} }
......
...@@ -183,7 +183,7 @@ const char* ts3plugin_name() { ...@@ -183,7 +183,7 @@ const char* ts3plugin_name() {
/* Plugin version */ /* Plugin version */
const char* ts3plugin_version() { const char* ts3plugin_version() {
return "1.0"; return "1.1";
} }
/* Plugin API version. Must be the same as the clients API major version, else the plugin fails to load. */ /* Plugin API version. Must be the same as the clients API major version, else the plugin fails to load. */
......
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