Merge branch 'master' into moderation
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#include "widgets/Window.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "common/Credentials.hpp"
|
||||
#include "common/Modes.hpp"
|
||||
#include "common/Version.hpp"
|
||||
#include "controllers/accounts/AccountController.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/Updates.hpp"
|
||||
@@ -108,7 +109,7 @@ bool Window::event(QEvent *event)
|
||||
break;
|
||||
|
||||
default:;
|
||||
};
|
||||
}
|
||||
|
||||
return BaseWindow::event(event);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
#include "IrcConnectionEditor.hpp"
|
||||
#include "ui_IrcConnectionEditor.h"
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
IrcConnectionEditor::IrcConnectionEditor(const IrcServerData &data, bool isAdd,
|
||||
QWidget *parent)
|
||||
|
||||
: QDialog(parent, Qt::WindowStaysOnTopHint)
|
||||
, ui_(new Ui::IrcConnectionEditor)
|
||||
, data_(data)
|
||||
{
|
||||
this->ui_->setupUi(this);
|
||||
|
||||
this->setWindowTitle(QString(isAdd ? "Add " : "Edit ") + "Irc Connection");
|
||||
|
||||
QObject::connect(this->ui_->userNameLineEdit, &QLineEdit::textChanged, this,
|
||||
[this](const QString &text) {
|
||||
this->ui_->nickNameLineEdit->setPlaceholderText(text);
|
||||
this->ui_->realNameLineEdit->setPlaceholderText(text);
|
||||
});
|
||||
|
||||
this->ui_->serverLineEdit->setText(data.host);
|
||||
this->ui_->portSpinBox->setValue(data.port);
|
||||
this->ui_->securityCheckBox->setChecked(data.ssl);
|
||||
this->ui_->userNameLineEdit->setText(data.user);
|
||||
this->ui_->nickNameLineEdit->setText(data.nick);
|
||||
this->ui_->realNameLineEdit->setText(data.real);
|
||||
this->ui_->connectCommandsEditor->setPlainText(
|
||||
data.connectCommands.join('\n'));
|
||||
|
||||
data.getPassword(this, [this](const QString &password) {
|
||||
this->ui_->passwordLineEdit->setText(password);
|
||||
});
|
||||
|
||||
this->ui_->loginMethodComboBox->setCurrentIndex([&] {
|
||||
switch (data.authType)
|
||||
{
|
||||
case IrcAuthType::Custom:
|
||||
return 1;
|
||||
case IrcAuthType::Pass:
|
||||
return 2;
|
||||
case IrcAuthType::Sasl:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}());
|
||||
|
||||
QObject::connect(this->ui_->loginMethodComboBox,
|
||||
qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||
[this](int index) {
|
||||
if (index == 1) // Custom
|
||||
{
|
||||
this->ui_->connectCommandsEditor->setFocus();
|
||||
}
|
||||
});
|
||||
|
||||
QFont font("Monospace");
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
this->ui_->connectCommandsEditor->setFont(font);
|
||||
}
|
||||
|
||||
IrcConnectionEditor::~IrcConnectionEditor()
|
||||
{
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
IrcServerData IrcConnectionEditor::data()
|
||||
{
|
||||
auto data = this->data_;
|
||||
data.host = this->ui_->serverLineEdit->text();
|
||||
data.port = this->ui_->portSpinBox->value();
|
||||
data.ssl = this->ui_->securityCheckBox->isChecked();
|
||||
data.user = this->ui_->userNameLineEdit->text();
|
||||
data.nick = this->ui_->nickNameLineEdit->text();
|
||||
data.real = this->ui_->realNameLineEdit->text();
|
||||
data.connectCommands =
|
||||
this->ui_->connectCommandsEditor->toPlainText().split('\n');
|
||||
data.setPassword(this->ui_->passwordLineEdit->text());
|
||||
data.authType = [this] {
|
||||
switch (this->ui_->loginMethodComboBox->currentIndex())
|
||||
{
|
||||
case 1:
|
||||
return IrcAuthType::Custom;
|
||||
case 2:
|
||||
return IrcAuthType::Pass;
|
||||
case 3:
|
||||
return IrcAuthType::Sasl;
|
||||
default:
|
||||
return IrcAuthType::Anonymous;
|
||||
}
|
||||
}();
|
||||
return data;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include "providers/irc/Irc2.hpp"
|
||||
#include "widgets/BaseWindow.hpp"
|
||||
|
||||
namespace Ui {
|
||||
class IrcConnectionEditor;
|
||||
}
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
struct IrcServerData;
|
||||
|
||||
class IrcConnectionEditor : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit IrcConnectionEditor(const IrcServerData &data, bool isAdd = false,
|
||||
QWidget *parent = nullptr);
|
||||
~IrcConnectionEditor();
|
||||
|
||||
IrcServerData data();
|
||||
|
||||
private:
|
||||
Ui::IrcConnectionEditor *ui_;
|
||||
IrcServerData data_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
@@ -0,0 +1,261 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>IrcConnectionEditor</class>
|
||||
<widget class="QDialog" name="IrcConnectionEditor">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>329</width>
|
||||
<height>414</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="serverLabel">
|
||||
<property name="text">
|
||||
<string>Host:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="serverLineEdit">
|
||||
<property name="placeholderText">
|
||||
<string>irc.example.com</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="portLabel">
|
||||
<property name="text">
|
||||
<string>Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="portSpinBox">
|
||||
<property name="maximum">
|
||||
<number>65636</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6697</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="securityLabel">
|
||||
<property name="text">
|
||||
<string>SSL:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="securityCheckBox">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="userNameLabel">
|
||||
<property name="text">
|
||||
<string>User Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="userNameLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="nickNameLabel">
|
||||
<property name="text">
|
||||
<string>Nick Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="nickNameLineEdit"/>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="realNameLabel">
|
||||
<property name="text">
|
||||
<string>Real Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="realNameLineEdit"/>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="loginMethodLabel">
|
||||
<property name="text">
|
||||
<string>Login method:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLineEdit" name="passwordLineEdit">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="loginMethodComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Anonymous</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Server Password (/PASS $password)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>SASL</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="connectCommandsLabel">
|
||||
<property name="text">
|
||||
<string>Send IRC commands
|
||||
on connect:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QPlainTextEdit" name="connectCommandsEditor">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>serverLineEdit</tabstop>
|
||||
<tabstop>portSpinBox</tabstop>
|
||||
<tabstop>securityCheckBox</tabstop>
|
||||
<tabstop>userNameLineEdit</tabstop>
|
||||
<tabstop>nickNameLineEdit</tabstop>
|
||||
<tabstop>realNameLineEdit</tabstop>
|
||||
<tabstop>loginMethodComboBox</tabstop>
|
||||
<tabstop>passwordLineEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>IrcConnectionEditor</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>254</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>IrcConnectionEditor</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>254</x>
|
||||
<y>248</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "SelectChannelDialog.hpp"
|
||||
|
||||
#include "Application.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
#include "widgets/Notebook.hpp"
|
||||
#include "widgets/dialogs/IrcConnectionEditor.hpp"
|
||||
#include "widgets/helper/NotebookTab.hpp"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
@@ -14,7 +15,12 @@
|
||||
#include <QLineEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <QTableView>
|
||||
#include "providers/irc/Irc2.hpp"
|
||||
#include "widgets/helper/EditableModelView.hpp"
|
||||
|
||||
#define TAB_TWITCH 0
|
||||
#define TAB_IRC 1
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
@@ -122,21 +128,69 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
}
|
||||
|
||||
// irc
|
||||
/*
|
||||
{
|
||||
LayoutCreator<QWidget> obj(new QWidget());
|
||||
auto outerBox = obj.setLayoutType<QFormLayout>();
|
||||
|
||||
{
|
||||
LayoutCreator<QWidget> obj(new QWidget());
|
||||
auto vbox = obj.setLayoutType<QVBoxLayout>();
|
||||
auto form = vbox.emplace<QFormLayout>();
|
||||
auto view = this->ui_.irc.servers = new EditableModelView(
|
||||
Irc::getInstance().newConnectionModel(this));
|
||||
|
||||
form->addRow(new QLabel("User name:"), new QLineEdit());
|
||||
form->addRow(new QLabel("First nick choice:"), new QLineEdit());
|
||||
form->addRow(new QLabel("Second nick choice:"), new QLineEdit());
|
||||
form->addRow(new QLabel("Third nick choice:"), new QLineEdit());
|
||||
view->setTitles({"host", "port", "ssl", "user", "nick", "real",
|
||||
"password", "login command"});
|
||||
view->getTableView()->horizontalHeader()->resizeSection(0, 140);
|
||||
|
||||
auto tab = notebook->addPage(obj.getElement());
|
||||
tab->setCustomTitle("Irc");
|
||||
view->getTableView()->horizontalHeader()->setSectionHidden(1, true);
|
||||
view->getTableView()->horizontalHeader()->setSectionHidden(2, true);
|
||||
view->getTableView()->horizontalHeader()->setSectionHidden(4, true);
|
||||
view->getTableView()->horizontalHeader()->setSectionHidden(5, true);
|
||||
|
||||
view->addButtonPressed.connect([] {
|
||||
auto unique = IrcServerData{};
|
||||
unique.id = Irc::getInstance().uniqueId();
|
||||
|
||||
auto editor = new IrcConnectionEditor(unique);
|
||||
if (editor->exec() == QDialog::Accepted)
|
||||
{
|
||||
Irc::getInstance().connections.appendItem(editor->data());
|
||||
}
|
||||
});
|
||||
|
||||
QObject::connect(
|
||||
view->getTableView(), &QTableView::doubleClicked,
|
||||
[](const QModelIndex &index) {
|
||||
auto editor = new IrcConnectionEditor(
|
||||
Irc::getInstance()
|
||||
.connections.getVector()[size_t(index.row())]);
|
||||
|
||||
if (editor->exec() == QDialog::Accepted)
|
||||
{
|
||||
auto data = editor->data();
|
||||
auto &&conns =
|
||||
Irc::getInstance().connections.getVector();
|
||||
int i = 0;
|
||||
for (auto &&conn : conns)
|
||||
{
|
||||
if (conn.id == data.id)
|
||||
{
|
||||
Irc::getInstance().connections.removeItem(
|
||||
i, Irc::noEraseCredentialCaller);
|
||||
Irc::getInstance().connections.insertItem(data,
|
||||
i);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
outerBox->addRow("Server:", view);
|
||||
}
|
||||
*/
|
||||
|
||||
outerBox->addRow("Channel:", this->ui_.irc.channel = new QLineEdit);
|
||||
|
||||
auto tab = notebook->addPage(obj.getElement());
|
||||
tab->setCustomTitle("Irc (Beta)");
|
||||
}
|
||||
|
||||
layout->setStretchFactor(notebook.getElement(), 1);
|
||||
|
||||
@@ -151,7 +205,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
[=](bool) { this->close(); });
|
||||
}
|
||||
|
||||
this->setScaleIndependantSize(300, 310);
|
||||
this->setMinimumSize(300, 310);
|
||||
this->ui_.notebook->selectIndex(TAB_TWITCH);
|
||||
this->ui_.twitch.channel->setFocus();
|
||||
|
||||
@@ -161,10 +215,24 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||
auto *shortcut_cancel = new QShortcut(QKeySequence("Esc"), this);
|
||||
QObject::connect(shortcut_cancel, &QShortcut::activated,
|
||||
[=] { this->close(); });
|
||||
|
||||
// restore ui state
|
||||
this->ui_.notebook->selectIndex(getSettings()->lastSelectChannelTab);
|
||||
this->ui_.irc.servers->getTableView()->selectRow(
|
||||
getSettings()->lastSelectIrcConn);
|
||||
}
|
||||
|
||||
void SelectChannelDialog::ok()
|
||||
{
|
||||
// save ui state
|
||||
getSettings()->lastSelectChannelTab =
|
||||
this->ui_.notebook->getSelectedIndex();
|
||||
getSettings()->lastSelectIrcConn = this->ui_.irc.servers->getTableView()
|
||||
->selectionModel()
|
||||
->currentIndex()
|
||||
.row();
|
||||
|
||||
// accept and close
|
||||
this->hasSelectedChannel_ = true;
|
||||
this->close();
|
||||
}
|
||||
@@ -204,6 +272,32 @@ void SelectChannelDialog::setSelectedChannel(IndirectChannel _channel)
|
||||
this->ui_.twitch.whispers->setFocus();
|
||||
}
|
||||
break;
|
||||
case Channel::Type::Irc:
|
||||
{
|
||||
this->ui_.notebook->selectIndex(TAB_IRC);
|
||||
this->ui_.irc.channel->setText(_channel.get()->getName());
|
||||
|
||||
if (auto ircChannel =
|
||||
dynamic_cast<IrcChannel *>(_channel.get().get()))
|
||||
{
|
||||
if (auto server = ircChannel->server())
|
||||
{
|
||||
int i = 0;
|
||||
for (auto &&conn : Irc::getInstance().connections)
|
||||
{
|
||||
if (conn.id == server->id())
|
||||
{
|
||||
this->ui_.irc.servers->getTableView()->selectRow(i);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->ui_.irc.channel->setFocus();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
this->ui_.notebook->selectIndex(TAB_TWITCH);
|
||||
@@ -245,6 +339,27 @@ IndirectChannel SelectChannelDialog::getSelectedChannel() const
|
||||
return app->twitch.server->whispersChannel;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case TAB_IRC:
|
||||
{
|
||||
int row = this->ui_.irc.servers->getTableView()
|
||||
->selectionModel()
|
||||
->currentIndex()
|
||||
.row();
|
||||
|
||||
auto &&vector = Irc::getInstance().connections.getVector();
|
||||
|
||||
if (row >= 0 && row < int(vector.size()))
|
||||
{
|
||||
return Irc::getInstance().getOrAddChannel(
|
||||
vector[size_t(row)].id, this->ui_.irc.channel->text());
|
||||
}
|
||||
else
|
||||
{
|
||||
return Channel::getEmpty();
|
||||
}
|
||||
}
|
||||
//break;
|
||||
}
|
||||
|
||||
return this->selectedChannel_;
|
||||
@@ -258,7 +373,7 @@ bool SelectChannelDialog::hasSeletedChannel() const
|
||||
bool SelectChannelDialog::EventFilter::eventFilter(QObject *watched,
|
||||
QEvent *event)
|
||||
{
|
||||
auto *widget = (QWidget *)watched;
|
||||
auto *widget = static_cast<QWidget *>(watched);
|
||||
|
||||
if (event->type() == QEvent::FocusIn)
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
namespace chatterino {
|
||||
|
||||
class Notebook;
|
||||
class EditableModelView;
|
||||
|
||||
class SelectChannelDialog final : public BaseWindow
|
||||
{
|
||||
@@ -47,6 +48,10 @@ private:
|
||||
QRadioButton *mentions;
|
||||
QRadioButton *watching;
|
||||
} twitch;
|
||||
struct {
|
||||
QLineEdit *channel;
|
||||
EditableModelView *servers;
|
||||
} irc;
|
||||
} ui_;
|
||||
|
||||
EventFilter tabFilter_;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "messages/layouts/MessageLayout.hpp"
|
||||
#include "messages/layouts/MessageLayoutElement.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/TooltipPreviewImage.hpp"
|
||||
|
||||
@@ -98,6 +98,9 @@ AboutPage::AboutPage()
|
||||
addLicense(form.getElement(), "Websocketpp",
|
||||
"https://www.zaphoyd.com/websocketpp/",
|
||||
":/licenses/websocketpp.txt");
|
||||
addLicense(form.getElement(), "QtKeychain",
|
||||
"https://github.com/frankosterfeld/qtkeychain",
|
||||
":/licenses/qtkeychain.txt");
|
||||
}
|
||||
|
||||
auto attributions = layout.emplace<QGroupBox>("Attributions...");
|
||||
|
||||
@@ -451,6 +451,16 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
||||
layout.addCheckbox("Open links in incognito/private mode",
|
||||
s.openLinksIncognito);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
if (!getPaths()->isPortable())
|
||||
{
|
||||
layout.addCheckbox(
|
||||
"Use libsecret/KWallet/Gnome keychain to secure passwords",
|
||||
s.useKeyring);
|
||||
}
|
||||
#endif
|
||||
|
||||
layout.addCheckbox("Show moderation messages", s.hideModerationActions,
|
||||
true);
|
||||
layout.addCheckbox("Random username color for users who never set a color",
|
||||
@@ -486,6 +496,9 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
||||
layout.addCheckbox("Load message history on connect",
|
||||
s.loadTwitchMessageHistoryOnConnect);
|
||||
|
||||
layout.addCheckbox("Show unhandled irc messages",
|
||||
s.showUnhandledIrcMessages);
|
||||
|
||||
layout.addTitle("Cache");
|
||||
layout.addDescription(
|
||||
"Files that are used often (such as emotes) are saved to disk to "
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "providers/twitch/EmoteValue.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchMessageBuilder.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "singletons/WindowManager.hpp"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "controllers/notifications/NotificationController.hpp"
|
||||
#include "controllers/pings/PingController.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Resources.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
@@ -211,9 +211,12 @@ void SplitHeader::initializeLayout()
|
||||
}),
|
||||
// dropdown
|
||||
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
||||
auto menu = this->createMainMenu();
|
||||
this->mainMenu_ = menu.get();
|
||||
w->setMenu(std::move(menu));
|
||||
/// XXX: this never gets disconnected
|
||||
this->split_->channelChanged.connect([this] {
|
||||
auto menu = this->createMainMenu();
|
||||
this->mainMenu_ = menu.get();
|
||||
this->dropdownButton_->setMenu(std::move(menu));
|
||||
});
|
||||
}),
|
||||
// add split
|
||||
this->addButton_ = makeWidget<Button>([&](auto w) {
|
||||
@@ -275,13 +278,17 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
});
|
||||
#endif
|
||||
|
||||
menu->addAction(OPEN_IN_BROWSER, this->split_, &Split::openInBrowser);
|
||||
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||
{
|
||||
menu->addAction(OPEN_IN_BROWSER, this->split_, &Split::openInBrowser);
|
||||
#ifndef USEWEBENGINE
|
||||
menu->addAction(OPEN_PLAYER_IN_BROWSER, this->split_,
|
||||
&Split::openBrowserPlayer);
|
||||
menu->addAction(OPEN_PLAYER_IN_BROWSER, this->split_,
|
||||
&Split::openBrowserPlayer);
|
||||
#endif
|
||||
menu->addAction(OPEN_IN_STREAMLINK, this->split_, &Split::openInStreamlink);
|
||||
menu->addSeparator();
|
||||
menu->addAction(OPEN_IN_STREAMLINK, this->split_,
|
||||
&Split::openInStreamlink);
|
||||
menu->addSeparator();
|
||||
}
|
||||
|
||||
{
|
||||
// "How to..." sub menu
|
||||
@@ -294,30 +301,35 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
// sub menu
|
||||
auto moreMenu = new QMenu("More", this);
|
||||
|
||||
|
||||
moreMenu->addAction("Toggle moderation mode", this->split_, [this]() {
|
||||
this->split_->setModerationMode(!this->split_->getModerationMode());
|
||||
});
|
||||
|
||||
moreMenu->addAction("Show viewer list", this->split_,
|
||||
&Split::showViewerList);
|
||||
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||
{
|
||||
moreMenu->addAction("Show viewer list", this->split_,
|
||||
&Split::showViewerList);
|
||||
|
||||
moreMenu->addAction("Subscribe", this->split_, &Split::openSubPage);
|
||||
moreMenu->addAction("Subscribe", this->split_, &Split::openSubPage);
|
||||
|
||||
auto action = new QAction(this);
|
||||
action->setText("Notify when live");
|
||||
action->setCheckable(true);
|
||||
auto action = new QAction(this);
|
||||
action->setText("Notify when live");
|
||||
action->setCheckable(true);
|
||||
|
||||
QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() {
|
||||
action->setChecked(getApp()->notifications->isChannelNotified(
|
||||
this->split_->getChannel()->getName(), Platform::Twitch));
|
||||
});
|
||||
action->connect(action, &QAction::triggered, this, [this]() {
|
||||
getApp()->notifications->updateChannelNotification(
|
||||
this->split_->getChannel()->getName(), Platform::Twitch);
|
||||
});
|
||||
QObject::connect(moreMenu, &QMenu::aboutToShow, this, [action, this]() {
|
||||
action->setChecked(getApp()->notifications->isChannelNotified(
|
||||
this->split_->getChannel()->getName(), Platform::Twitch));
|
||||
});
|
||||
action->connect(action, &QAction::triggered, this, [this]() {
|
||||
getApp()->notifications->updateChannelNotification(
|
||||
this->split_->getChannel()->getName(), Platform::Twitch);
|
||||
});
|
||||
|
||||
moreMenu->addAction(action);
|
||||
moreMenu->addAction(action);
|
||||
}
|
||||
|
||||
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||
{
|
||||
auto action = new QAction(this);
|
||||
action->setText("Mute highlight sound");
|
||||
@@ -336,11 +348,16 @@ std::unique_ptr<QMenu> SplitHeader::createMainMenu()
|
||||
}
|
||||
|
||||
moreMenu->addSeparator();
|
||||
moreMenu->addAction("Reconnect", this, SLOT(reconnect()));
|
||||
moreMenu->addAction("Reload channel emotes", this,
|
||||
SLOT(reloadChannelEmotes()));
|
||||
moreMenu->addAction("Reload subscriber emotes", this,
|
||||
SLOT(reloadSubscriberEmotes()));
|
||||
if (this->split_->getChannel()->canReconnect())
|
||||
moreMenu->addAction("Reconnect", this, SLOT(reconnect()));
|
||||
|
||||
if (dynamic_cast<TwitchChannel *>(this->split_->getChannel().get()))
|
||||
{
|
||||
moreMenu->addAction("Reload channel emotes", this,
|
||||
SLOT(reloadChannelEmotes()));
|
||||
moreMenu->addAction("Reload subscriber emotes", this,
|
||||
SLOT(reloadSubscriberEmotes()));
|
||||
}
|
||||
moreMenu->addSeparator();
|
||||
moreMenu->addAction("Clear messages", this->split_, &Split::clear);
|
||||
// moreMenu->addSeparator();
|
||||
@@ -729,7 +746,7 @@ void SplitHeader::reloadSubscriberEmotes()
|
||||
|
||||
void SplitHeader::reconnect()
|
||||
{
|
||||
getApp()->twitch.server->connect();
|
||||
this->split_->getChannel()->reconnect();
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "controllers/commands/CommandController.hpp"
|
||||
#include "messages/Link.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "providers/twitch/TwitchIrcServer.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
#include "util/LayoutCreator.hpp"
|
||||
|
||||
Reference in New Issue
Block a user