1
0
Fork 0
forked from blue/squawk

Refactoring of signal/slots connection to new qt syntax

This commit is contained in:
Blue 2019-11-03 21:46:40 +03:00
parent 9d491e9e93
commit 0b57e6a77f
16 changed files with 81 additions and 83 deletions

View file

@ -29,14 +29,13 @@ Accounts::Accounts(Models::Accounts* p_model, QWidget *parent) :
{
m_ui->setupUi(this);
connect(m_ui->addButton, SIGNAL(clicked(bool)), this, SLOT(onAddButton(bool)));
connect(m_ui->editButton, SIGNAL(clicked(bool)), this, SLOT(onEditButton(bool)));
connect(m_ui->connectButton, SIGNAL(clicked(bool)), this, SLOT(onConnectButton(bool)));
connect(m_ui->deleteButton, SIGNAL(clicked(bool)), this, SLOT(onDeleteButton(bool)));
connect(m_ui->addButton, &QPushButton::clicked, this, &Accounts::onAddButton);
connect(m_ui->editButton, &QPushButton::clicked, this, &Accounts::onEditButton);
connect(m_ui->connectButton, &QPushButton::clicked, this, &Accounts::onConnectButton);
connect(m_ui->deleteButton, &QPushButton::clicked, this, &Accounts::onDeleteButton);
m_ui->tableView->setModel(model);
connect(m_ui->tableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
connect(p_model, SIGNAL(changed()), this, SLOT(updateConnectButton()));
connect(m_ui->tableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &Accounts::onSelectionChanged);
connect(p_model, &Models::Accounts::changed, this, &Accounts::updateConnectButton);
}
Accounts::~Accounts() = default;
@ -44,8 +43,8 @@ Accounts::~Accounts() = default;
void Accounts::onAddButton(bool clicked)
{
Account* acc = new Account();
connect(acc, SIGNAL(accepted()), this, SLOT(onAccountAccepted()));
connect(acc, SIGNAL(rejected()), this, SLOT(onAccountRejected()));
connect(acc, &Account::accepted, this, &Accounts::onAccountAccepted);
connect(acc, &Account::rejected, this, &Accounts::onAccountRejected);
acc->exec();
}
@ -84,8 +83,8 @@ void Accounts::onEditButton(bool clicked)
{"resource", mAcc->getResource()}
});
acc->lockId();
connect(acc, SIGNAL(accepted()), this, SLOT(onAccountAccepted()));
connect(acc, SIGNAL(rejected()), this, SLOT(onAccountRejected()));
connect(acc, &Account::accepted, this, &Accounts::onAccountAccepted);
connect(acc, &Account::rejected, this, &Accounts::onAccountRejected);
editing = true;
acc->exec();
}

View file

@ -26,7 +26,7 @@ Chat::Chat(Models::Contact* p_contact, QWidget* parent):
updateState();
setStatus(p_contact->getStatus());
connect(contact, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onContactChanged(Models::Item*, int, int)));
connect(contact, &Models::Contact::childChanged, this, &Chat::onContactChanged);
line->setMyName(p_contact->getAccountName());
}

View file

@ -59,15 +59,15 @@ Conversation::Conversation(bool muc, const QString& mJid, const QString mRes, co
statusIcon = m_ui->statusIcon;
statusLabel = m_ui->statusLabel;
connect(&ker, SIGNAL(enterPressed()), this, SLOT(onEnterPressed()));
connect(&res, SIGNAL(resized()), this, SLOT(onScrollResize()));
connect(&vis, SIGNAL(shown()), this, SLOT(onScrollResize()));
connect(&vis, SIGNAL(hidden()), this, SLOT(onScrollResize()));
connect(m_ui->sendButton, SIGNAL(clicked(bool)), this, SLOT(onEnterPressed()));
connect(line, SIGNAL(resize(int)), this, SLOT(onMessagesResize(int)));
connect(line, SIGNAL(downloadFile(const QString&, const QString&)), this, SIGNAL(downloadFile(const QString&, const QString&)));
connect(line, SIGNAL(requestLocalFile(const QString&, const QString&)), this, SIGNAL(requestLocalFile(const QString&, const QString&)));
connect(m_ui->attachButton, SIGNAL(clicked(bool)), this, SLOT(onAttach()));
connect(&ker, &KeyEnterReceiver::enterPressed, this, &Conversation::onEnterPressed);
connect(&res, &Resizer::resized, this, &Conversation::onScrollResize);
connect(&vis, &VisibilityCatcher::shown, this, &Conversation::onScrollResize);
connect(&vis, &VisibilityCatcher::hidden, this, &Conversation::onScrollResize);
connect(m_ui->sendButton, &QPushButton::clicked, this, &Conversation::onEnterPressed);
connect(line, &MessageLine::resize, this, &Conversation::onMessagesResize);
connect(line, &MessageLine::downloadFile, this, &Conversation::downloadFile);
connect(line, &MessageLine::requestLocalFile, this, &Conversation::requestLocalFile);
connect(m_ui->attachButton, &QPushButton::clicked, this, &Conversation::onAttach);
m_ui->messageEditor->installEventFilter(&ker);
@ -76,7 +76,7 @@ Conversation::Conversation(bool muc, const QString& mJid, const QString mRes, co
vs->installEventFilter(&vis);
vs->setBackgroundRole(QPalette::Base);
vs->setAutoFillBackground(true);
connect(vs, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
connect(vs, &QScrollBar::valueChanged, this, &Conversation::onSliderValueChanged);
m_ui->scrollArea->installEventFilter(&res);
applyVisualEffects();
@ -317,7 +317,7 @@ void Conversation::addAttachedFile(const QString& path)
Badge* badge = new Badge(path, info.fileName(), QIcon::fromTheme(type.iconName()));
connect(badge, SIGNAL(close()), this, SLOT(onBadgeClose()));
connect(badge, &Badge::close, this, &Conversation::onBadgeClose);
filesToAttach.push_back(badge); //TODO neet to check if there are any duplicated ids
filesLayout->addWidget(badge);
if (filesLayout->count() == 1) {

View file

@ -26,7 +26,7 @@ Room::Room(Models::Room* p_room, QWidget* parent):
line->setMyName(room->getNick());
setStatus(room->getSubject());
connect(room, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onRoomChanged(Models::Item*, int, int)));
connect(room, &Models::Room::childChanged, this, &Room::onRoomChanged);
}
Room::~Room()