added stuff
This commit is contained in:
+4
-2
@@ -68,7 +68,8 @@ SOURCES += main.cpp\
|
|||||||
widgets/settingsdialog.cpp \
|
widgets/settingsdialog.cpp \
|
||||||
widgets/settingsdialogtab.cpp \
|
widgets/settingsdialogtab.cpp \
|
||||||
widgets/textinputdialog.cpp \
|
widgets/textinputdialog.cpp \
|
||||||
windows.cpp
|
windows.cpp \
|
||||||
|
logging.cpp
|
||||||
|
|
||||||
HEADERS += account.h \
|
HEADERS += account.h \
|
||||||
asyncexec.h \
|
asyncexec.h \
|
||||||
@@ -109,7 +110,8 @@ HEADERS += account.h \
|
|||||||
widgets/textinputdialog.h \
|
widgets/textinputdialog.h \
|
||||||
windows.h \
|
windows.h \
|
||||||
widgets/resizingtextedit.h \
|
widgets/resizingtextedit.h \
|
||||||
settingssnapshot.h
|
settingssnapshot.h \
|
||||||
|
logging.h
|
||||||
|
|
||||||
PRECOMPILED_HEADER =
|
PRECOMPILED_HEADER =
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,14 @@ IrcManager::disconnect()
|
|||||||
IrcManager::connectionMutex.unlock();
|
IrcManager::connectionMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
IrcManager::send(QString raw)
|
||||||
|
{
|
||||||
|
IrcManager::connectionMutex.lock();
|
||||||
|
IrcManager::connection->sendRaw(raw);
|
||||||
|
IrcManager::connectionMutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
IrcManager::joinChannel(const QString &channel)
|
IrcManager::joinChannel(const QString &channel)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public:
|
|||||||
static void connect();
|
static void connect();
|
||||||
static void disconnect();
|
static void disconnect();
|
||||||
|
|
||||||
|
static void send(QString raw);
|
||||||
|
|
||||||
static const QString defaultClientId;
|
static const QString defaultClientId;
|
||||||
|
|
||||||
bool isTwitchBlockedUser(QString const &username);
|
bool isTwitchBlockedUser(QString const &username);
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#include "logging.h"
|
||||||
|
|
||||||
|
Logging::Logging()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#ifndef LOGGING_H
|
||||||
|
#define LOGGING_H
|
||||||
|
|
||||||
|
class Logging
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
private:
|
||||||
|
Logging();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LOGGING_H
|
||||||
@@ -19,7 +19,7 @@ ChatWidget::ChatWidget(QWidget *parent)
|
|||||||
, vbox(this)
|
, vbox(this)
|
||||||
, header(this)
|
, header(this)
|
||||||
, view(this)
|
, view(this)
|
||||||
, input()
|
, input(this)
|
||||||
{
|
{
|
||||||
this->vbox.setSpacing(0);
|
this->vbox.setSpacing(0);
|
||||||
this->vbox.setMargin(1);
|
this->vbox.setMargin(1);
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
#include "widgets/chatwidgetinput.h"
|
#include "widgets/chatwidgetinput.h"
|
||||||
|
#include "chatwidget.h"
|
||||||
#include "colorscheme.h"
|
#include "colorscheme.h"
|
||||||
|
#include "ircmanager.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <boost/signals2.hpp>
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
ChatWidgetInput::ChatWidgetInput()
|
ChatWidgetInput::ChatWidgetInput(ChatWidget *widget)
|
||||||
: hbox()
|
: chatWidget(widget)
|
||||||
|
, hbox()
|
||||||
, vbox()
|
, vbox()
|
||||||
, editContainer()
|
, editContainer()
|
||||||
, edit()
|
, edit()
|
||||||
@@ -36,13 +40,28 @@ ChatWidgetInput::ChatWidgetInput()
|
|||||||
"<img src=':/images/Emoji_Color_1F60A_19.png' width='12' height='12' "
|
"<img src=':/images/Emoji_Color_1F60A_19.png' width='12' height='12' "
|
||||||
"/>");
|
"/>");
|
||||||
|
|
||||||
// this->emotesLabel.setMaximumSize(12, 12);
|
QObject::connect(&edit, &ResizingTextEdit::textChanged, this,
|
||||||
|
&ChatWidgetInput::editTextChanged);
|
||||||
|
|
||||||
|
// QObject::connect(&edit, &ResizingTextEdit::keyPressEvent, this,
|
||||||
|
// &ChatWidgetInput::editKeyPressed);
|
||||||
|
|
||||||
this->refreshTheme();
|
this->refreshTheme();
|
||||||
|
|
||||||
this->setMessageLengthVisisble(
|
this->setMessageLengthVisisble(
|
||||||
Settings::getInstance().showMessageLength.get());
|
Settings::getInstance().showMessageLength.get());
|
||||||
|
|
||||||
|
this->edit.keyPressed.connect([this](QKeyEvent *event) {
|
||||||
|
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) {
|
||||||
|
Channel *c = this->chatWidget->getChannel();
|
||||||
|
if (c != nullptr) {
|
||||||
|
IrcManager::send("PRIVMSG #" + c->getName() + ": " +
|
||||||
|
this->edit.toPlainText());
|
||||||
|
event->accept();
|
||||||
|
this->edit.setText(QString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/* XXX(pajlada): FIX THIS
|
/* XXX(pajlada): FIX THIS
|
||||||
QObject::connect(&Settings::getInstance().showMessageLength,
|
QObject::connect(&Settings::getInstance().showMessageLength,
|
||||||
&BoolSetting::valueChanged, this,
|
&BoolSetting::valueChanged, this,
|
||||||
@@ -72,6 +91,21 @@ ChatWidgetInput::refreshTheme()
|
|||||||
edit.setStyleSheet(ColorScheme::getInstance().InputStyleSheet);
|
edit.setStyleSheet(ColorScheme::getInstance().InputStyleSheet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ChatWidgetInput::editTextChanged()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// void
|
||||||
|
// ChatWidgetInput::editKeyPressed(QKeyEvent *event)
|
||||||
|
//{
|
||||||
|
// if (event->key() == Qt::Key_Enter) {
|
||||||
|
// event->accept();
|
||||||
|
// IrcManager::send("PRIVMSG #" + edit.toPlainText();
|
||||||
|
// edit.setText(QString());
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
void
|
void
|
||||||
ChatWidgetInput::paintEvent(QPaintEvent *)
|
ChatWidgetInput::paintEvent(QPaintEvent *)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,12 +15,14 @@
|
|||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
namespace widgets {
|
namespace widgets {
|
||||||
|
|
||||||
|
class ChatWidget;
|
||||||
|
|
||||||
class ChatWidgetInput : public QWidget
|
class ChatWidgetInput : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatWidgetInput();
|
ChatWidgetInput(ChatWidget *parent);
|
||||||
~ChatWidgetInput();
|
~ChatWidgetInput();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -29,6 +31,8 @@ protected:
|
|||||||
void resizeEvent(QResizeEvent *);
|
void resizeEvent(QResizeEvent *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
ChatWidget *chatWidget;
|
||||||
|
|
||||||
QHBoxLayout hbox;
|
QHBoxLayout hbox;
|
||||||
QVBoxLayout vbox;
|
QVBoxLayout vbox;
|
||||||
QHBoxLayout editContainer;
|
QHBoxLayout editContainer;
|
||||||
@@ -43,6 +47,8 @@ private slots:
|
|||||||
{
|
{
|
||||||
this->textLengthLabel.setHidden(!value);
|
this->textLengthLabel.setHidden(!value);
|
||||||
}
|
}
|
||||||
|
void editTextChanged();
|
||||||
|
// void editKeyPressed(QKeyEvent *event);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
#ifndef RESIZINGTEXTEDIT_H
|
#ifndef RESIZINGTEXTEDIT_H
|
||||||
#define RESIZINGTEXTEDIT_H
|
#define RESIZINGTEXTEDIT_H
|
||||||
|
|
||||||
|
#include <QKeyEvent>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
|
#include <boost/signals2.hpp>
|
||||||
|
|
||||||
class ResizingTextEdit : public QTextEdit
|
class ResizingTextEdit : public QTextEdit
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ResizingTextEdit()
|
ResizingTextEdit()
|
||||||
|
: keyPressed()
|
||||||
{
|
{
|
||||||
auto sizePolicy = this->sizePolicy();
|
auto sizePolicy = this->sizePolicy();
|
||||||
sizePolicy.setHeightForWidth(true);
|
sizePolicy.setHeightForWidth(true);
|
||||||
@@ -29,6 +32,8 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::signals2::signal<void(QKeyEvent *)> keyPressed;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int
|
int
|
||||||
heightForWidth(int) const override
|
heightForWidth(int) const override
|
||||||
@@ -38,6 +43,18 @@ protected:
|
|||||||
return margins.top() + document()->size().height() + margins.bottom() +
|
return margins.top() + document()->size().height() + margins.bottom() +
|
||||||
5;
|
5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
event->ignore();
|
||||||
|
|
||||||
|
keyPressed(event);
|
||||||
|
|
||||||
|
if (!event->isAccepted()) {
|
||||||
|
QTextEdit::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RESIZINGTEXTEDIT_H
|
#endif // RESIZINGTEXTEDIT_H
|
||||||
|
|||||||
@@ -179,6 +179,11 @@ SettingsDialog::addTabs()
|
|||||||
vbox->addStretch(1);
|
vbox->addStretch(1);
|
||||||
addTab(vbox, "Links", ":/images/VSO_Link_blue_16x.png");
|
addTab(vbox, "Links", ":/images/VSO_Link_blue_16x.png");
|
||||||
|
|
||||||
|
// Logging
|
||||||
|
vbox = new QVBoxLayout();
|
||||||
|
vbox->addStretch(1);
|
||||||
|
addTab(vbox, "Logs", ":/images/VSO_Link_blue_16x.png");
|
||||||
|
|
||||||
// Highlighting
|
// Highlighting
|
||||||
vbox = new QVBoxLayout();
|
vbox = new QVBoxLayout();
|
||||||
vbox->addStretch(1);
|
vbox->addStretch(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user