mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
added stuff
This commit is contained in:
parent
1c076b803e
commit
ceded7ff96
|
@ -68,7 +68,8 @@ SOURCES += main.cpp\
|
|||
widgets/settingsdialog.cpp \
|
||||
widgets/settingsdialogtab.cpp \
|
||||
widgets/textinputdialog.cpp \
|
||||
windows.cpp
|
||||
windows.cpp \
|
||||
logging.cpp
|
||||
|
||||
HEADERS += account.h \
|
||||
asyncexec.h \
|
||||
|
@ -109,7 +110,8 @@ HEADERS += account.h \
|
|||
widgets/textinputdialog.h \
|
||||
windows.h \
|
||||
widgets/resizingtextedit.h \
|
||||
settingssnapshot.h
|
||||
settingssnapshot.h \
|
||||
logging.h
|
||||
|
||||
PRECOMPILED_HEADER =
|
||||
|
||||
|
|
|
@ -155,6 +155,14 @@ IrcManager::disconnect()
|
|||
IrcManager::connectionMutex.unlock();
|
||||
}
|
||||
|
||||
void
|
||||
IrcManager::send(QString raw)
|
||||
{
|
||||
IrcManager::connectionMutex.lock();
|
||||
IrcManager::connection->sendRaw(raw);
|
||||
IrcManager::connectionMutex.unlock();
|
||||
}
|
||||
|
||||
void
|
||||
IrcManager::joinChannel(const QString &channel)
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@ public:
|
|||
static void connect();
|
||||
static void disconnect();
|
||||
|
||||
static void send(QString raw);
|
||||
|
||||
static const QString defaultClientId;
|
||||
|
||||
bool isTwitchBlockedUser(QString const &username);
|
||||
|
|
6
logging.cpp
Normal file
6
logging.cpp
Normal file
|
@ -0,0 +1,6 @@
|
|||
#include "logging.h"
|
||||
|
||||
Logging::Logging()
|
||||
{
|
||||
|
||||
}
|
11
logging.h
Normal file
11
logging.h
Normal file
|
@ -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)
|
||||
, header(this)
|
||||
, view(this)
|
||||
, input()
|
||||
, input(this)
|
||||
{
|
||||
this->vbox.setSpacing(0);
|
||||
this->vbox.setMargin(1);
|
||||
|
|
|
@ -1,14 +1,18 @@
|
|||
#include "widgets/chatwidgetinput.h"
|
||||
#include "chatwidget.h"
|
||||
#include "colorscheme.h"
|
||||
#include "ircmanager.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
ChatWidgetInput::ChatWidgetInput()
|
||||
: hbox()
|
||||
ChatWidgetInput::ChatWidgetInput(ChatWidget *widget)
|
||||
: chatWidget(widget)
|
||||
, hbox()
|
||||
, vbox()
|
||||
, editContainer()
|
||||
, edit()
|
||||
|
@ -36,13 +40,28 @@ ChatWidgetInput::ChatWidgetInput()
|
|||
"<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->setMessageLengthVisisble(
|
||||
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
|
||||
QObject::connect(&Settings::getInstance().showMessageLength,
|
||||
&BoolSetting::valueChanged, this,
|
||||
|
@ -72,6 +91,21 @@ ChatWidgetInput::refreshTheme()
|
|||
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
|
||||
ChatWidgetInput::paintEvent(QPaintEvent *)
|
||||
{
|
||||
|
|
|
@ -15,12 +15,14 @@
|
|||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
class ChatWidget;
|
||||
|
||||
class ChatWidgetInput : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChatWidgetInput();
|
||||
ChatWidgetInput(ChatWidget *parent);
|
||||
~ChatWidgetInput();
|
||||
|
||||
protected:
|
||||
|
@ -29,6 +31,8 @@ protected:
|
|||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
private:
|
||||
ChatWidget *chatWidget;
|
||||
|
||||
QHBoxLayout hbox;
|
||||
QVBoxLayout vbox;
|
||||
QHBoxLayout editContainer;
|
||||
|
@ -43,6 +47,8 @@ private slots:
|
|||
{
|
||||
this->textLengthLabel.setHidden(!value);
|
||||
}
|
||||
void editTextChanged();
|
||||
// void editKeyPressed(QKeyEvent *event);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#ifndef RESIZINGTEXTEDIT_H
|
||||
#define RESIZINGTEXTEDIT_H
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QTextEdit>
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
class ResizingTextEdit : public QTextEdit
|
||||
{
|
||||
public:
|
||||
ResizingTextEdit()
|
||||
: keyPressed()
|
||||
{
|
||||
auto sizePolicy = this->sizePolicy();
|
||||
sizePolicy.setHeightForWidth(true);
|
||||
|
@ -29,6 +32,8 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
boost::signals2::signal<void(QKeyEvent *)> keyPressed;
|
||||
|
||||
protected:
|
||||
int
|
||||
heightForWidth(int) const override
|
||||
|
@ -38,6 +43,18 @@ protected:
|
|||
return margins.top() + document()->size().height() + margins.bottom() +
|
||||
5;
|
||||
}
|
||||
|
||||
void
|
||||
keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
|
||||
keyPressed(event);
|
||||
|
||||
if (!event->isAccepted()) {
|
||||
QTextEdit::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // RESIZINGTEXTEDIT_H
|
||||
|
|
|
@ -179,6 +179,11 @@ SettingsDialog::addTabs()
|
|||
vbox->addStretch(1);
|
||||
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
|
||||
vbox = new QVBoxLayout();
|
||||
vbox->addStretch(1);
|
||||
|
|
Loading…
Reference in a new issue