2019-06-15 15:29:15 +00:00
|
|
|
/*
|
2019-08-14 14:54:46 +00:00
|
|
|
* Squawk messenger.
|
|
|
|
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
2019-09-04 16:38:52 +00:00
|
|
|
*
|
2019-06-15 15:29:15 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2019-09-04 16:38:52 +00:00
|
|
|
*
|
2019-06-15 15:29:15 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2019-09-04 16:38:52 +00:00
|
|
|
*
|
2019-06-15 15:29:15 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-09-04 16:38:52 +00:00
|
|
|
#include "joinconference.h"
|
|
|
|
#include "ui_joinconference.h"
|
|
|
|
|
2019-06-15 15:29:15 +00:00
|
|
|
#include <QDebug>
|
|
|
|
|
2019-09-04 16:38:52 +00:00
|
|
|
JoinConference::JoinConference(const Models::Accounts* accounts, QWidget* parent):
|
2019-06-15 15:29:15 +00:00
|
|
|
QDialog(parent),
|
2019-09-04 16:38:52 +00:00
|
|
|
m_ui(new Ui::JoinConference())
|
2019-06-15 15:29:15 +00:00
|
|
|
{
|
|
|
|
m_ui->setupUi ( this );
|
2022-06-03 06:44:48 +00:00
|
|
|
std::deque<QString> names = accounts->getActiveNames();
|
2019-06-15 15:29:15 +00:00
|
|
|
|
2022-06-03 06:44:48 +00:00
|
|
|
for (const QString& name : names) {
|
|
|
|
m_ui->account->addItem(name);
|
2019-06-15 15:29:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_ui->account->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
|
2019-09-04 16:38:52 +00:00
|
|
|
JoinConference::JoinConference(const QString& acc, const Models::Accounts* accounts, QWidget* parent):
|
2019-06-15 15:29:15 +00:00
|
|
|
QDialog(parent),
|
2019-09-04 16:38:52 +00:00
|
|
|
m_ui(new Ui::JoinConference())
|
2019-06-15 15:29:15 +00:00
|
|
|
{
|
|
|
|
m_ui->setupUi ( this );
|
2022-06-03 06:44:48 +00:00
|
|
|
std::deque<QString> names = accounts->getActiveNames();
|
2019-06-15 15:29:15 +00:00
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
bool found = false;
|
2022-06-03 06:44:48 +00:00
|
|
|
for (const QString& name : names) {
|
2019-06-15 15:29:15 +00:00
|
|
|
m_ui->account->addItem(name);
|
|
|
|
if (!found) {
|
|
|
|
if (name == acc) {
|
|
|
|
found = true;
|
|
|
|
} else {
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
2019-09-04 16:38:52 +00:00
|
|
|
qDebug() << "Couldn't find a correct account among available accounts creating JoinConference dialog, setting to 0";
|
2019-06-15 15:29:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_ui->account->setCurrentIndex(index);
|
|
|
|
}
|
|
|
|
|
2019-09-04 16:38:52 +00:00
|
|
|
JoinConference::~JoinConference()
|
2019-06-15 15:29:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-09-04 16:38:52 +00:00
|
|
|
JoinConference::Data JoinConference::value() const
|
2019-06-15 15:29:15 +00:00
|
|
|
{
|
|
|
|
return {
|
|
|
|
m_ui->jid->text(),
|
2019-09-04 16:38:52 +00:00
|
|
|
m_ui->nick->text(),
|
2019-06-15 15:29:15 +00:00
|
|
|
m_ui->account->currentText(),
|
2019-09-04 16:38:52 +00:00
|
|
|
m_ui->autoJoin->isChecked(),
|
|
|
|
""
|
2019-06-15 15:29:15 +00:00
|
|
|
};
|
|
|
|
}
|