mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
renamed IrcConnection_ to IrcServerData
This commit is contained in:
parent
158564d0c2
commit
eadf5355ee
8 changed files with 24 additions and 24 deletions
|
@ -18,21 +18,21 @@ namespace {
|
||||||
return combinePath(getPaths()->settingsDirectory, "irc.json");
|
return combinePath(getPaths()->settingsDirectory, "irc.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
class Model : public SignalVectorModel<IrcConnection_>
|
class Model : public SignalVectorModel<IrcServerData>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Model(QObject *parent)
|
Model(QObject *parent)
|
||||||
: SignalVectorModel<IrcConnection_>(8, parent)
|
: SignalVectorModel<IrcServerData>(8, parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// turn a vector item into a model row
|
// turn a vector item into a model row
|
||||||
IrcConnection_ getItemFromRow(std::vector<QStandardItem *> &row,
|
IrcServerData getItemFromRow(std::vector<QStandardItem *> &row,
|
||||||
const IrcConnection_ &original)
|
const IrcServerData &original)
|
||||||
{
|
{
|
||||||
qDebug() << row[2]->data(Qt::CheckStateRole).toBool();
|
qDebug() << row[2]->data(Qt::CheckStateRole).toBool();
|
||||||
|
|
||||||
return IrcConnection_{
|
return IrcServerData{
|
||||||
row[0]->data(Qt::EditRole).toString(), // host
|
row[0]->data(Qt::EditRole).toString(), // host
|
||||||
row[1]->data(Qt::EditRole).toInt(), // port
|
row[1]->data(Qt::EditRole).toInt(), // port
|
||||||
row[2]->data(Qt::CheckStateRole).toBool(), // ssl
|
row[2]->data(Qt::CheckStateRole).toBool(), // ssl
|
||||||
|
@ -45,7 +45,7 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
// turns a row in the model into a vector item
|
// turns a row in the model into a vector item
|
||||||
void getRowFromItem(const IrcConnection_ &item,
|
void getRowFromItem(const IrcServerData &item,
|
||||||
std::vector<QStandardItem *> &row)
|
std::vector<QStandardItem *> &row)
|
||||||
{
|
{
|
||||||
setStringItem(row[0], item.host, false);
|
setStringItem(row[0], item.host, false);
|
||||||
|
@ -218,7 +218,7 @@ void Irc::load()
|
||||||
for (auto server : doc.object().value("servers").toArray())
|
for (auto server : doc.object().value("servers").toArray())
|
||||||
{
|
{
|
||||||
auto obj = server.toObject();
|
auto obj = server.toObject();
|
||||||
IrcConnection_ conn;
|
IrcServerData conn;
|
||||||
conn.host = obj.value("host").toString(conn.host);
|
conn.host = obj.value("host").toString(conn.host);
|
||||||
conn.port = obj.value("port").toInt(conn.port);
|
conn.port = obj.value("port").toInt(conn.port);
|
||||||
conn.ssl = obj.value("ssl").toBool(conn.ssl);
|
conn.ssl = obj.value("ssl").toBool(conn.ssl);
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace chatterino {
|
||||||
|
|
||||||
//enum IrcAuthType { Anonymous, /*Sals,*/ Pass, MsgNickServ, NickServ };
|
//enum IrcAuthType { Anonymous, /*Sals,*/ Pass, MsgNickServ, NickServ };
|
||||||
|
|
||||||
struct IrcConnection_ {
|
struct IrcServerData {
|
||||||
QString host;
|
QString host;
|
||||||
int port = 6667;
|
int port = 6667;
|
||||||
bool ssl = false;
|
bool ssl = false;
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
|
|
||||||
static Irc &getInstance();
|
static Irc &getInstance();
|
||||||
|
|
||||||
UnsortedSignalVector<IrcConnection_> connections;
|
UnsortedSignalVector<IrcServerData> connections;
|
||||||
QAbstractTableModel *newConnectionModel(QObject *parent);
|
QAbstractTableModel *newConnectionModel(QObject *parent);
|
||||||
|
|
||||||
ChannelPtr getOrAddChannel(int serverId, QString name);
|
ChannelPtr getOrAddChannel(int serverId, QString name);
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
IrcServer::IrcServer(const IrcConnection_ &data)
|
IrcServer::IrcServer(const IrcServerData &data)
|
||||||
: data_(new IrcConnection_(data))
|
: data_(new IrcServerData(data))
|
||||||
{
|
{
|
||||||
this->connect();
|
this->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
IrcServer::IrcServer(const IrcConnection_ &data,
|
IrcServer::IrcServer(const IrcServerData &data,
|
||||||
const std::vector<std::weak_ptr<Channel>> &restoreChannels)
|
const std::vector<std::weak_ptr<Channel>> &restoreChannels)
|
||||||
: IrcServer(data)
|
: IrcServer(data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
struct IrcConnection_;
|
struct IrcServerData;
|
||||||
|
|
||||||
class IrcServer : public AbstractIrcServer
|
class IrcServer : public AbstractIrcServer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit IrcServer(const IrcConnection_ &data);
|
explicit IrcServer(const IrcServerData &data);
|
||||||
IrcServer(const IrcConnection_ &data,
|
IrcServer(const IrcServerData &data,
|
||||||
const std::vector<std::weak_ptr<Channel>> &restoreChannels);
|
const std::vector<std::weak_ptr<Channel>> &restoreChannels);
|
||||||
~IrcServer() override;
|
~IrcServer() override;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// pointer so we don't have to circle include Irc2.hpp
|
// pointer so we don't have to circle include Irc2.hpp
|
||||||
IrcConnection_ *data_;
|
IrcServerData *data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
IrcConnectionEditor::IrcConnectionEditor(const IrcConnection_ &data, bool isAdd,
|
IrcConnectionEditor::IrcConnectionEditor(const IrcServerData &data, bool isAdd,
|
||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
|
|
||||||
: QDialog(parent, Qt::WindowStaysOnTopHint)
|
: QDialog(parent, Qt::WindowStaysOnTopHint)
|
||||||
|
@ -34,7 +34,7 @@ IrcConnectionEditor::~IrcConnectionEditor()
|
||||||
delete ui_;
|
delete ui_;
|
||||||
}
|
}
|
||||||
|
|
||||||
IrcConnection_ IrcConnectionEditor::data()
|
IrcServerData IrcConnectionEditor::data()
|
||||||
{
|
{
|
||||||
auto data = this->data_;
|
auto data = this->data_;
|
||||||
data.host = this->ui_->serverLineEdit->text();
|
data.host = this->ui_->serverLineEdit->text();
|
||||||
|
|
|
@ -11,22 +11,22 @@ class IrcConnectionEditor;
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
struct IrcConnection_;
|
struct IrcServerData;
|
||||||
|
|
||||||
class IrcConnectionEditor : public QDialog
|
class IrcConnectionEditor : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit IrcConnectionEditor(const IrcConnection_ &data, bool isAdd = false,
|
explicit IrcConnectionEditor(const IrcServerData &data, bool isAdd = false,
|
||||||
QWidget *parent = nullptr);
|
QWidget *parent = nullptr);
|
||||||
~IrcConnectionEditor();
|
~IrcConnectionEditor();
|
||||||
|
|
||||||
IrcConnection_ data();
|
IrcServerData data();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::IrcConnectionEditor *ui_;
|
Ui::IrcConnectionEditor *ui_;
|
||||||
IrcConnection_ data_;
|
IrcServerData data_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -26,7 +26,7 @@ IrcConnectionPopup::IrcConnectionPopup(QWidget *parent)
|
||||||
this->setScaleIndependantSize(800, 500);
|
this->setScaleIndependantSize(800, 500);
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
auto unique = IrcConnection_{};
|
auto unique = IrcServerData{};
|
||||||
unique.id = Irc::getInstance().uniqueId();
|
unique.id = Irc::getInstance().uniqueId();
|
||||||
Irc::getInstance().connections.appendItem(unique);
|
Irc::getInstance().connections.appendItem(unique);
|
||||||
});
|
});
|
||||||
|
|
|
@ -153,7 +153,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
view->getTableView()->horizontalHeader()->setSectionHidden(7, true);
|
view->getTableView()->horizontalHeader()->setSectionHidden(7, true);
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
auto unique = IrcConnection_{};
|
auto unique = IrcServerData{};
|
||||||
unique.id = Irc::getInstance().uniqueId();
|
unique.id = Irc::getInstance().uniqueId();
|
||||||
|
|
||||||
auto editor = new IrcConnectionEditor(unique);
|
auto editor = new IrcConnectionEditor(unique);
|
||||||
|
|
Loading…
Reference in a new issue