1
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

@ -30,15 +30,15 @@ Core::Conference::Conference(const QString& p_jid, const QString& p_account, boo
muc = true; muc = true;
name = p_name; name = p_name;
connect(room, SIGNAL(joined()), this, SLOT(onRoomJoined())); connect(room, &QXmppMucRoom::joined, this, &Conference::onRoomJoined);
connect(room, SIGNAL(left()), this, SLOT(onRoomLeft())); connect(room, &QXmppMucRoom::left, this, &Conference::onRoomLeft);
connect(room, SIGNAL(nameChanged(const QString&)), this, SLOT(onRoomNameChanged(const QString&))); connect(room, &QXmppMucRoom::nameChanged, this, &Conference::onRoomNameChanged);
connect(room, SIGNAL(subjectChanged(const QString&)), this, SLOT(onRoomSubjectChanged(const QString&))); connect(room, &QXmppMucRoom::subjectChanged, this, &Conference::onRoomSubjectChanged);
connect(room, SIGNAL(participantAdded(const QString&)), this, SLOT(onRoomParticipantAdded(const QString&))); connect(room, &QXmppMucRoom::participantAdded, this, &Conference::onRoomParticipantAdded);
connect(room, SIGNAL(participantChanged(const QString&)), this, SLOT(onRoomParticipantChanged(const QString&))); connect(room, &QXmppMucRoom::participantChanged, this, &Conference::onRoomParticipantChanged);
connect(room, SIGNAL(participantRemoved(const QString&)), this, SLOT(onRoomParticipantRemoved(const QString&))); connect(room, &QXmppMucRoom::participantRemoved, this, &Conference::onRoomParticipantRemoved);
connect(room, SIGNAL(nickNameChanged(const QString&)), this, SLOT(onRoomNickNameChanged(const QString&))); connect(room, &QXmppMucRoom::nickNameChanged, this, &Conference::onRoomNickNameChanged);
connect(room, SIGNAL(error(const QXmppStanza::Error&)), this, SLOT(onRoomError(const QXmppStanza::Error&))); connect(room, &QXmppMucRoom::error, this, &Conference::onRoomError);
room->setNickName(nick); room->setNickName(nick);
if (autoJoin) { if (autoJoin) {

View File

@ -323,9 +323,9 @@ void Core::NetworkAccess::startDownload(const QString& messageId, const QString&
Download* dwn = new Download({{messageId}, 0, 0, true}); Download* dwn = new Download({{messageId}, 0, 0, true});
QNetworkRequest req(url); QNetworkRequest req(url);
dwn->reply = manager->get(req); dwn->reply = manager->get(req);
connect(dwn->reply, SIGNAL(downloadProgress(qint64, qint64)), SLOT(onDownloadProgress(qint64, qint64))); connect(dwn->reply, &QNetworkReply::downloadProgress, this, &NetworkAccess::onDownloadProgress);
connect(dwn->reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onRequestError(QNetworkReply::NetworkError))); connect(dwn->reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this, &NetworkAccess::onRequestError);
connect(dwn->reply, SIGNAL(finished()), SLOT(onRequestFinished())); connect(dwn->reply, &QNetworkReply::finished, this, &NetworkAccess::onRequestFinished);
downloads.insert(std::make_pair(url, dwn)); downloads.insert(std::make_pair(url, dwn));
emit downloadFileProgress(messageId, 0); emit downloadFileProgress(messageId, 0);
} }

View File

@ -38,7 +38,7 @@ SignalCatcher::SignalCatcher(QCoreApplication *p_app, QObject *parent):
} }
snInt = new QSocketNotifier(sigintFd[1], QSocketNotifier::Read, this); snInt = new QSocketNotifier(sigintFd[1], QSocketNotifier::Read, this);
connect(snInt, SIGNAL(activated(int)), this, SLOT(handleSigInt())); connect(snInt, &QSocketNotifier::activated, this, &SignalCatcher::handleSigInt);
} }
SignalCatcher::~SignalCatcher() SignalCatcher::~SignalCatcher()

View File

@ -89,7 +89,7 @@ void Models::Accounts::addAccount(Account* account)
} }
accs.insert(before, account); accs.insert(before, account);
connect(account, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onAccountChanged(Models::Item*, int, int))); connect(account, &Account::childChanged, this, &Accounts::onAccountChanged);
endInsertRows(); endInsertRows();
emit sizeChanged(accs.size()); emit sizeChanged(accs.size());
@ -143,7 +143,7 @@ void Models::Accounts::removeAccount(int index)
{ {
Account* account = accs[index]; Account* account = accs[index];
beginRemoveRows(QModelIndex(), index, index); beginRemoveRows(QModelIndex(), index, index);
disconnect(account, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onAccountChanged(Models::Item*, int, int))); disconnect(account, &Account::childChanged, this, &Accounts::onAccountChanged);
accs.erase(accs.begin() + index); accs.erase(accs.begin() + index);
endRemoveRows(); endRemoveRows();

View File

@ -229,7 +229,7 @@ void Models::Contact::refresh()
void Models::Contact::_removeChild(int index) void Models::Contact::_removeChild(int index)
{ {
Item* child = childItems[index]; Item* child = childItems[index];
disconnect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh())); disconnect(child, &Item::childChanged, this, &Contact::refresh);
Item::_removeChild(index); Item::_removeChild(index);
refresh(); refresh();
} }
@ -237,7 +237,7 @@ void Models::Contact::_removeChild(int index)
void Models::Contact::appendChild(Models::Item* child) void Models::Contact::appendChild(Models::Item* child)
{ {
Item::appendChild(child); Item::appendChild(child);
connect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh())); connect(child, &Item::childChanged, this, &Contact::refresh);
refresh(); refresh();
} }
@ -324,7 +324,7 @@ void Models::Contact::toOfflineState()
emit childIsAboutToBeRemoved(this, 0, childItems.size()); emit childIsAboutToBeRemoved(this, 0, childItems.size());
for (int i = 0; i < childItems.size(); ++i) { for (int i = 0; i < childItems.size(); ++i) {
Item* item = childItems[i]; Item* item = childItems[i];
disconnect(item, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh())); disconnect(item, &Item::childChanged, this, &Contact::refresh);
Item::_removeChild(i); Item::_removeChild(i);
item->deleteLater(); item->deleteLater();
} }
@ -363,7 +363,7 @@ Models::Contact::Contact(const Models::Contact& other):
Presence* pCopy = new Presence(*pres); Presence* pCopy = new Presence(*pres);
presences.insert(pCopy->getName(), pCopy); presences.insert(pCopy->getName(), pCopy);
Item::appendChild(pCopy); Item::appendChild(pCopy);
connect(pCopy, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh())); connect(pCopy, &Item::childChanged, this, &Contact::refresh);
} }
refresh(); refresh();

View File

@ -32,7 +32,7 @@ Models::Group::~Group()
void Models::Group::appendChild(Models::Item* child) void Models::Group::appendChild(Models::Item* child)
{ {
Item::appendChild(child); Item::appendChild(child);
connect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh())); connect(child, &Item::childChanged, this, &Group::refresh);
changed(1); changed(1);
refresh(); refresh();
} }
@ -59,7 +59,7 @@ QVariant Models::Group::data(int column) const
void Models::Group::_removeChild(int index) void Models::Group::_removeChild(int index)
{ {
Item* child = childItems[index]; Item* child = childItems[index];
disconnect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh())); disconnect(child, &Item::childChanged, this, &Group::refresh);
Item::_removeChild(index); Item::_removeChild(index);
changed(1); changed(1);
refresh(); refresh();

View File

@ -88,13 +88,13 @@ void Models::Item::appendChild(Models::Item* child)
childItems.insert(before, child); childItems.insert(before, child);
child->parent = this; child->parent = this;
QObject::connect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SIGNAL(childChanged(Models::Item*, int, int))); QObject::connect(child, &Item::childChanged, this, &Item::childChanged);
QObject::connect(child, SIGNAL(childIsAboutToBeInserted(Item*, int, int)), this, SIGNAL(childIsAboutToBeInserted(Item*, int, int))); QObject::connect(child, &Item::childIsAboutToBeInserted, this, &Item::childIsAboutToBeInserted);
QObject::connect(child, SIGNAL(childInserted()), this, SIGNAL(childInserted())); QObject::connect(child, &Item::childInserted, this, &Item::childInserted);
QObject::connect(child, SIGNAL(childIsAboutToBeRemoved(Item*, int, int)), this, SIGNAL(childIsAboutToBeRemoved(Item*, int, int))); QObject::connect(child, &Item::childIsAboutToBeRemoved, this, &Item::childIsAboutToBeRemoved);
QObject::connect(child, SIGNAL(childRemoved()), this, SIGNAL(childRemoved())); QObject::connect(child, &Item::childRemoved, this, &Item::childRemoved);
QObject::connect(child, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int)), this, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int))); QObject::connect(child, &Item::childIsAboutToBeMoved, this, &Item::childIsAboutToBeMoved);
QObject::connect(child, SIGNAL(childMoved()), this, SIGNAL(childMoved())); QObject::connect(child, &Item::childMoved, this, &Item::childMoved);
if (moving) { if (moving) {
emit childMoved(); emit childMoved();
@ -168,13 +168,13 @@ void Models::Item::_removeChild(int index)
{ {
Item* child = childItems[index]; Item* child = childItems[index];
QObject::disconnect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onChildChanged(Models::Item*, int, int))); QObject::disconnect(child, &Item::childChanged, this, &Item::childChanged);
QObject::disconnect(child, SIGNAL(childIsAboutToBeInserted(Item*, int, int)), this, SIGNAL(childIsAboutToBeInserted(Item*, int, int))); QObject::disconnect(child, &Item::childIsAboutToBeInserted, this, &Item::childIsAboutToBeInserted);
QObject::disconnect(child, SIGNAL(childInserted()), this, SIGNAL(childInserted())); QObject::disconnect(child, &Item::childInserted, this, &Item::childInserted);
QObject::disconnect(child, SIGNAL(childIsAboutToBeRemoved(Item*, int, int)), this, SIGNAL(childIsAboutToBeRemoved(Item*, int, int))); QObject::disconnect(child, &Item::childIsAboutToBeRemoved, this, &Item::childIsAboutToBeRemoved);
QObject::disconnect(child, SIGNAL(childRemoved()), this, SIGNAL(childRemoved())); QObject::disconnect(child, &Item::childRemoved, this, &Item::childRemoved);
QObject::disconnect(child, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int)), this, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int))); QObject::disconnect(child, &Item::childIsAboutToBeMoved, this, &Item::childIsAboutToBeMoved);
QObject::disconnect(child, SIGNAL(childMoved()), this, SIGNAL(childMoved())); QObject::disconnect(child, &Item::childMoved, this, &Item::childMoved);
childItems.erase(childItems.begin() + index); childItems.erase(childItems.begin() + index);
child->parent = 0; child->parent = 0;

View File

@ -238,7 +238,6 @@ void Models::Room::toOfflineState()
emit childIsAboutToBeRemoved(this, 0, childItems.size()); emit childIsAboutToBeRemoved(this, 0, childItems.size());
for (int i = 0; i < childItems.size(); ++i) { for (int i = 0; i < childItems.size(); ++i) {
Item* item = childItems[i]; Item* item = childItems[i];
disconnect(item, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
Item::_removeChild(i); Item::_removeChild(i);
item->deleteLater(); item->deleteLater();
} }

View File

@ -69,12 +69,12 @@ void Squawk::onAccounts()
if (accounts == 0) { if (accounts == 0) {
accounts = new Accounts(rosterModel.accountsModel, this); accounts = new Accounts(rosterModel.accountsModel, this);
accounts->setAttribute(Qt::WA_DeleteOnClose); accounts->setAttribute(Qt::WA_DeleteOnClose);
connect(accounts, SIGNAL(destroyed(QObject*)), this, SLOT(onAccountsClosed(QObject*))); connect(accounts, &Accounts::destroyed, this, &Squawk::onAccountsClosed);
connect(accounts, SIGNAL(newAccount(const QMap<QString, QVariant>&)), this, SIGNAL(newAccountRequest(const QMap<QString, QVariant>&))); connect(accounts, &Accounts::newAccount, this, &Squawk::newAccountRequest);
connect(accounts, SIGNAL(changeAccount(const QString&, const QMap<QString, QVariant>&)), this, SIGNAL(modifyAccountRequest(const QString&, const QMap<QString, QVariant>&))); connect(accounts, &Accounts::changeAccount, this, &Squawk::modifyAccountRequest);
connect(accounts, SIGNAL(connectAccount(const QString&)), this, SIGNAL(connectAccount(const QString&))); connect(accounts, &Accounts::connectAccount, this, &Squawk::connectAccount);
connect(accounts, SIGNAL(disconnectAccount(const QString&)), this, SIGNAL(disconnectAccount(const QString&))); connect(accounts, &Accounts::disconnectAccount, this, &Squawk::disconnectAccount);
connect(accounts, SIGNAL(removeAccount(const QString&)), this, SIGNAL(removeAccountRequest(const QString&))); connect(accounts, &Accounts::removeAccount, this, &Squawk::removeAccountRequest);
accounts->show(); accounts->show();
} else { } else {
@ -99,8 +99,8 @@ void Squawk::onNewContact()
{ {
NewContact* nc = new NewContact(rosterModel.accountsModel, this); NewContact* nc = new NewContact(rosterModel.accountsModel, this);
connect(nc, SIGNAL(accepted()), this, SLOT(onNewContactAccepted())); connect(nc, &NewContact::accepted, this, &Squawk::onNewContactAccepted);
connect(nc, SIGNAL(rejected()), nc, SLOT(deleteLater())); connect(nc, &NewContact::rejected, nc, &NewContact::deleteLater);
nc->exec(); nc->exec();
} }
@ -109,8 +109,8 @@ void Squawk::onNewConference()
{ {
JoinConference* jc = new JoinConference(rosterModel.accountsModel, this); JoinConference* jc = new JoinConference(rosterModel.accountsModel, this);
connect(jc, SIGNAL(accepted()), this, SLOT(onJoinConferenceAccepted())); connect(jc, &JoinConference::accepted, this, &Squawk::onJoinConferenceAccepted);
connect(jc, SIGNAL(rejected()), jc, SLOT(deleteLater())); connect(jc, &JoinConference::rejected, jc, &JoinConference::deleteLater);
jc->exec(); jc->exec();
} }
@ -299,12 +299,12 @@ void Squawk::onRosterItemDoubleClicked(const QModelIndex& item)
if (created) { if (created) {
conv->setAttribute(Qt::WA_DeleteOnClose); conv->setAttribute(Qt::WA_DeleteOnClose);
connect(conv, SIGNAL(destroyed(QObject*)), this, SLOT(onConversationClosed(QObject*))); connect(conv, &Conversation::destroyed, this, &Squawk::onConversationClosed);
connect(conv, SIGNAL(sendMessage(const Shared::Message&)), this, SLOT(onConversationMessage(const Shared::Message&))); connect(conv, &Conversation::sendMessage, this, &Squawk::onConversationMessage);
connect(conv, SIGNAL(requestArchive(const QString&)), this, SLOT(onConversationRequestArchive(const QString&))); connect(conv, &Conversation::requestArchive, this, &Squawk::onConversationRequestArchive);
connect(conv, SIGNAL(requestLocalFile(const QString&, const QString&)), this, SLOT(onConversationRequestLocalFile(const QString&, const QString&))); connect(conv, &Conversation::requestLocalFile, this, &Squawk::onConversationRequestLocalFile);
connect(conv, SIGNAL(downloadFile(const QString&, const QString&)), this, SLOT(onConversationDownloadFile(const QString&, const QString&))); connect(conv, &Conversation::downloadFile, this, &Squawk::onConversationDownloadFile);
connect(conv, SIGNAL(shown()), this, SLOT(onConversationShown())); connect(conv, &Conversation::shown, this, &Squawk::onConversationShown);
conversations.insert(std::make_pair(*id, conv)); conversations.insert(std::make_pair(*id, conv));
@ -517,10 +517,10 @@ void Squawk::removeAccount(const QString& account)
Conversations::const_iterator lItr = itr; Conversations::const_iterator lItr = itr;
++itr; ++itr;
Conversation* conv = lItr->second; Conversation* conv = lItr->second;
disconnect(conv, SIGNAL(destroyed(QObject*)), this, SLOT(onConversationClosed(QObject*))); disconnect(conv, &Conversation::destroyed, this, &Squawk::onConversationClosed);
disconnect(conv, SIGNAL(sendMessage(const Shared::Message&)), this, SLOT(onConversationMessage(const Shared::Message&))); disconnect(conv, &Conversation::sendMessage, this, &Squawk::onConversationMessage);
disconnect(conv, SIGNAL(requestArchive(const QString&)), this, SLOT(onConversationRequestArchive(const QString&))); disconnect(conv, &Conversation::requestArchive, this, &Squawk::onConversationRequestArchive);
disconnect(conv, SIGNAL(shown()), this, SLOT(onConversationShown())); disconnect(conv, &Conversation::shown, this, &Squawk::onConversationShown);
conv->close(); conv->close();
conversations.erase(lItr); conversations.erase(lItr);
} else { } else {

View File

@ -42,7 +42,7 @@ Badge::Badge(const QString& p_id, const QString& p_text, const QIcon& icon, QWid
layout->setContentsMargins(2, 2, 2, 2); layout->setContentsMargins(2, 2, 2, 2);
connect(closeButton, SIGNAL(clicked()), this, SIGNAL(close())); connect(closeButton, &QPushButton::clicked, this, &Badge::close);
} }
Badge::~Badge() Badge::~Badge()

View File

@ -125,7 +125,7 @@ void Message::addDownloadDialog()
fileComment->setText(tr("%1 is offering you to download a file").arg(sender->text())); fileComment->setText(tr("%1 is offering you to download a file").arg(sender->text()));
} }
fileComment->show(); fileComment->show();
connect(downloadButton, SIGNAL(clicked()), this, SLOT(onDownload())); connect(downloadButton, &QPushButton::clicked, this, &Message::onDownload);
bodyLayout->insertWidget(2, fileComment); bodyLayout->insertWidget(2, fileComment);
bodyLayout->insertWidget(3, downloadButton); bodyLayout->insertWidget(3, downloadButton);
hasDownloadButton = true; hasDownloadButton = true;

View File

@ -127,7 +127,7 @@ MessageLine::Position MessageLine::message(const Shared::Message& msg)
if (msg.hasOutOfBandUrl()) {\ if (msg.hasOutOfBandUrl()) {\
emit requestLocalFile(msg.getId(), msg.getOutOfBandUrl()); emit requestLocalFile(msg.getId(), msg.getOutOfBandUrl());
connect(message, SIGNAL(downloadFile(const QString&, const QString&)), this, SIGNAL(downloadFile(const QString&, const QString&))); connect(message, &Message::downloadFile, this, &MessageLine::downloadFile);
} }
return res; return res;

View File

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

View File

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

View File

@ -26,7 +26,7 @@ Room::Room(Models::Room* p_room, QWidget* parent):
line->setMyName(room->getNick()); line->setMyName(room->getNick());
setStatus(room->getSubject()); 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() Room::~Room()