changed notation

This commit is contained in:
fourtf
2017-01-18 04:33:30 +01:00
parent 552e4c957a
commit 10e4a0f785
61 changed files with 1214 additions and 1051 deletions
+57 -53
View File
@@ -10,61 +10,64 @@
ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
: QWidget()
, m_chatWidget(parent)
, m_dragStart()
, m_dragging(false)
, m_leftLabel()
, m_middleLabel()
, m_rightLabel()
, m_leftMenu(this)
, m_rightMenu(this)
, chatWidget(parent)
, dragStart()
, dragging(false)
, leftLabel()
, middleLabel()
, rightLabel()
, leftMenu(this)
, rightMenu(this)
{
setFixedHeight(32);
updateColors();
updateChannelText();
setLayout(&m_hbox);
m_hbox.setMargin(0);
m_hbox.addWidget(&m_leftLabel);
m_hbox.addWidget(&m_middleLabel, 1);
m_hbox.addWidget(&m_rightLabel);
setLayout(&this->hbox);
this->hbox.setMargin(0);
this->hbox.addWidget(&this->leftLabel);
this->hbox.addWidget(&this->middleLabel, 1);
this->hbox.addWidget(&this->rightLabel);
// left
m_leftLabel.label().setTextFormat(Qt::RichText);
m_leftLabel.label().setText(
this->leftLabel.getLabel().setTextFormat(Qt::RichText);
this->leftLabel.getLabel().setText(
"<img src=':/images/tool_moreCollapser_off16.png' />");
QObject::connect(&m_leftLabel, &ChatWidgetHeaderButton::clicked, this,
QObject::connect(&this->leftLabel, &ChatWidgetHeaderButton::clicked, this,
&ChatWidgetHeader::leftButtonClicked);
m_leftMenu.addAction("Add new split", this, SLOT(menuAddSplit()),
QKeySequence(tr("Ctrl+T")));
m_leftMenu.addAction("Close split", this, SLOT(menuCloseSplit()),
QKeySequence(tr("Ctrl+W")));
m_leftMenu.addAction("Move split", this, SLOT(menuMoveSplit()));
m_leftMenu.addSeparator();
m_leftMenu.addAction("Change channel", this, SLOT(menuChangeChannel()),
QKeySequence(tr("Ctrl+R")));
m_leftMenu.addAction("Clear chat", this, SLOT(menuClearChat()));
m_leftMenu.addAction("Open channel", this, SLOT(menuOpenChannel()));
m_leftMenu.addAction("Open pop-out player", this, SLOT(menuPopupPlayer()));
m_leftMenu.addSeparator();
m_leftMenu.addAction("Reload channel emotes", this,
SLOT(menuReloadChannelEmotes()));
m_leftMenu.addAction("Manual reconnect", this, SLOT(menuManualReconnect()));
m_leftMenu.addSeparator();
m_leftMenu.addAction("Show changelog", this, SLOT(menuShowChangelog()));
this->leftMenu.addAction("Add new split", this, SLOT(menuAddSplit()),
QKeySequence(tr("Ctrl+T")));
this->leftMenu.addAction("Close split", this, SLOT(menuCloseSplit()),
QKeySequence(tr("Ctrl+W")));
this->leftMenu.addAction("Move split", this, SLOT(menuMoveSplit()));
this->leftMenu.addSeparator();
this->leftMenu.addAction("Change channel", this, SLOT(menuChangeChannel()),
QKeySequence(tr("Ctrl+R")));
this->leftMenu.addAction("Clear chat", this, SLOT(menuClearChat()));
this->leftMenu.addAction("Open channel", this, SLOT(menuOpenChannel()));
this->leftMenu.addAction("Open pop-out player", this,
SLOT(menuPopupPlayer()));
this->leftMenu.addSeparator();
this->leftMenu.addAction("Reload channel emotes", this,
SLOT(menuReloadChannelEmotes()));
this->leftMenu.addAction("Manual reconnect", this,
SLOT(menuManualReconnect()));
this->leftMenu.addSeparator();
this->leftMenu.addAction("Show changelog", this, SLOT(menuShowChangelog()));
// middle
m_middleLabel.setAlignment(Qt::AlignCenter);
QObject::connect(&m_middleLabel, SIGNAL(mouseDoubleClickEvent(QMouseEvent)), this,
this->middleLabel.setAlignment(Qt::AlignCenter);
QObject::connect(&this->middleLabel,
SIGNAL(mouseDoubleClickEvent(QMouseEvent)), this,
SLOT(mouseDoubleClickEvent));
// right
m_rightLabel.setMinimumWidth(height());
m_rightLabel.label().setTextFormat(Qt::RichText);
m_rightLabel.label().setText("ayy");
this->rightLabel.setMinimumWidth(height());
this->rightLabel.getLabel().setTextFormat(Qt::RichText);
this->rightLabel.getLabel().setText("ayy");
}
void
@@ -73,17 +76,17 @@ ChatWidgetHeader::updateColors()
QPalette palette;
palette.setColor(QPalette::Foreground, ColorScheme::instance().Text);
m_leftLabel.setPalette(palette);
m_middleLabel.setPalette(palette);
m_rightLabel.setPalette(palette);
this->leftLabel.setPalette(palette);
this->middleLabel.setPalette(palette);
this->rightLabel.setPalette(palette);
}
void
ChatWidgetHeader::updateChannelText()
{
const QString &c = m_chatWidget->channelName();
const QString &c = this->chatWidget->getChannelName();
m_middleLabel.setText(c.isEmpty() ? "<no channel>" : c);
this->middleLabel.setText(c.isEmpty() ? "<no channel>" : c);
}
void
@@ -99,18 +102,18 @@ ChatWidgetHeader::paintEvent(QPaintEvent *)
void
ChatWidgetHeader::mousePressEvent(QMouseEvent *event)
{
m_dragging = true;
this->dragging = true;
m_dragStart = event->pos();
this->dragStart = event->pos();
}
void
ChatWidgetHeader::mouseMoveEvent(QMouseEvent *event)
{
if (m_dragging) {
if (std::abs(m_dragStart.x() - event->pos().x()) > 12 ||
std::abs(m_dragStart.y() - event->pos().y()) > 12) {
auto chatWidget = m_chatWidget;
if (this->dragging) {
if (std::abs(this->dragStart.x() - event->pos().x()) > 12 ||
std::abs(this->dragStart.y() - event->pos().y()) > 12) {
auto chatWidget = this->chatWidget;
auto page = static_cast<NotebookPage *>(chatWidget->parentWidget());
if (page != NULL) {
@@ -144,15 +147,16 @@ void
ChatWidgetHeader::mouseDoubleClickEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
chatWidget()->showChangeChannelPopup();
this->chatWidget->showChangeChannelPopup();
}
}
void
ChatWidgetHeader::leftButtonClicked()
{
m_leftMenu.move(m_leftLabel.mapToGlobal(QPoint(0, m_leftLabel.height())));
m_leftMenu.show();
this->leftMenu.move(
this->leftLabel.mapToGlobal(QPoint(0, this->leftLabel.height())));
this->leftMenu.show();
}
void
@@ -175,7 +179,7 @@ ChatWidgetHeader::menuMoveSplit()
void
ChatWidgetHeader::menuChangeChannel()
{
m_chatWidget->showChangeChannelPopup();
this->chatWidget->showChangeChannelPopup();
}
void
ChatWidgetHeader::menuClearChat()