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