now loads passwords for irc

This commit is contained in:
fourtf
2019-09-14 18:38:09 +02:00
parent b45a6eea22
commit d33a8b1b3a
11 changed files with 116 additions and 83 deletions
@@ -26,7 +26,13 @@ IrcConnectionEditor::IrcConnectionEditor(const IrcServerData &data, bool isAdd,
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'));
this->ui_->passwordLineEdit->setText(data.password);
QFont font("Monospace");
font.setStyleHint(QFont::TypeWriter);
this->ui_->connectCommandsEditor->setFont(font);
} // namespace chatterino
IrcConnectionEditor::~IrcConnectionEditor()
@@ -43,6 +49,8 @@ IrcServerData IrcConnectionEditor::data()
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.password = this->ui_->passwordLineEdit->text();
return data;
}
+31 -14
View File
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>264</width>
<height>350</height>
<height>414</height>
</rect>
</property>
<property name="windowTitle">
@@ -155,21 +155,38 @@
</item>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="connectCommandsLabel">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Send IRC commands&lt;/p&gt;&lt;p&gt;on connect:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</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>
<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>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
+4 -13
View File
@@ -130,7 +130,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
// irc
{
LayoutCreator<QWidget> obj(new QWidget());
auto outerBox = obj.setLayoutType<QVBoxLayout>();
auto outerBox = obj.setLayoutType<QFormLayout>();
// outerBox.emplace<QLabel>("Connection:");
{
@@ -140,16 +140,11 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
view->setTitles({"host", "port", "ssl", "user", "nick", "real",
"password", "login command"});
view->getTableView()->horizontalHeader()->resizeSection(0, 140);
view->getTableView()->horizontalHeader()->resizeSection(1, 40);
view->getTableView()->horizontalHeader()->resizeSection(2, 30);
//view->getTableView()->horizontalHeader()->setVisible(false);
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->getTableView()->horizontalHeader()->setSectionHidden(6, true);
view->getTableView()->horizontalHeader()->setSectionHidden(7, true);
view->addButtonPressed.connect([] {
auto unique = IrcServerData{};
@@ -158,7 +153,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
auto editor = new IrcConnectionEditor(unique);
if (editor->exec() == QDialog::Accepted)
{
Irc::getInstance().connections.appendItem(unique);
Irc::getInstance().connections.appendItem(editor->data());
}
});
@@ -188,14 +183,10 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
}
});
outerBox->addWidget(view);
outerBox->addRow("Server:", view);
}
{
auto box = outerBox.emplace<QHBoxLayout>().withoutMargin();
box.emplace<QLabel>("Channel:");
this->ui_.irc.channel = box.emplace<QLineEdit>().getElement();
}
outerBox->addRow("Channel:", this->ui_.irc.channel = new QLineEdit);
auto tab = notebook->addPage(obj.getElement());
tab->setCustomTitle("Irc");