aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/channelsjoin/ChannelsJoinDialog.cpp
diff options
context:
space:
mode:
authorGravatar Alexey Sokolov2016-04-29 23:57:30 +0100
committerGravatar Alexey Sokolov2016-04-29 23:57:48 +0100
commit690dd7a33ddc90678367d73adf313533536e10f2 (patch)
tree2276fe7c384ebbc222b40a19c536d5c3c5606ce8 /src/modules/channelsjoin/ChannelsJoinDialog.cpp
parentAdd config for clang-format. (diff)
downloadKVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.gz
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.tar.bz2
KVIrc-690dd7a33ddc90678367d73adf313533536e10f2.zip
Apply clang-format
Diffstat (limited to 'src/modules/channelsjoin/ChannelsJoinDialog.cpp')
-rw-r--r--src/modules/channelsjoin/ChannelsJoinDialog.cpp134
1 files changed, 68 insertions, 66 deletions
diff --git a/src/modules/channelsjoin/ChannelsJoinDialog.cpp b/src/modules/channelsjoin/ChannelsJoinDialog.cpp
index c18e4aa1e..343c55c88 100644
--- a/src/modules/channelsjoin/ChannelsJoinDialog.cpp
+++ b/src/modules/channelsjoin/ChannelsJoinDialog.cpp
@@ -49,15 +49,13 @@
#include <QCheckBox>
#include <QDesktopWidget>
-
-extern ChannelsJoinDialog * g_pChannelsWindow;
-extern QRect g_rectChannelsJoinGeometry;
+extern ChannelsJoinDialog * g_pChannelsWindow;
+extern QRect g_rectChannelsJoinGeometry;
// KviApplication.cpp
extern KVIRC_API KviRegisteredChannelDataBase * g_pRegisteredChannelDataBase;
-
ChannelsJoinDialog::ChannelsJoinDialog(const char * name)
-: QDialog(g_pMainWindow)
+ : QDialog(g_pMainWindow)
{
setObjectName(name);
setWindowTitle(__tr2qs("Join Channels - KVIrc"));
@@ -71,58 +69,56 @@ ChannelsJoinDialog::ChannelsJoinDialog(const char * name)
m_pTreeWidget->setHeaderLabel(__tr2qs("Channel"));
m_pTreeWidget->setRootIsDecorated(true);
m_pTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
- g->addWidget(m_pTreeWidget,0,0,1,2);
+ g->addWidget(m_pTreeWidget, 0, 0, 1, 2);
//connect(m_pTreeWidget,SIGNAL(itemDoubleClicked(QTreeWidgetItem *,int)),this,SLOT(itemDoubleClicked(QTreeWidgetItem *,int)));
-
- m_pGroupBox = new KviTalGroupBox(Qt::Horizontal,__tr2qs("Channel"),this);
+ m_pGroupBox = new KviTalGroupBox(Qt::Horizontal, __tr2qs("Channel"), this);
QString szMsg = __tr2qs("Name");
szMsg.append(":");
- new QLabel(szMsg,m_pGroupBox);
+ new QLabel(szMsg, m_pGroupBox);
m_pChannelEdit = new QLineEdit(m_pGroupBox);
- connect(m_pChannelEdit,SIGNAL(returnPressed()),this,SLOT(editReturnPressed()));
- connect(m_pChannelEdit,SIGNAL(textChanged(const QString &)),this,SLOT(editTextChanged(const QString &)));
+ connect(m_pChannelEdit, SIGNAL(returnPressed()), this, SLOT(editReturnPressed()));
+ connect(m_pChannelEdit, SIGNAL(textChanged(const QString &)), this, SLOT(editTextChanged(const QString &)));
szMsg = __tr2qs("Password");
szMsg.append(":");
- new QLabel(szMsg,m_pGroupBox);
+ new QLabel(szMsg, m_pGroupBox);
m_pPass = new QLineEdit(m_pGroupBox);
m_pPass->setEchoMode(QLineEdit::Password);
- g->addWidget(m_pGroupBox,1,0,1,2);
+ g->addWidget(m_pGroupBox, 1, 0, 1, 2);
KviTalHBox * hb = new KviTalHBox(this);
hb->setSpacing(4);
- g->addWidget(hb,2,0,1,2);
+ g->addWidget(hb, 2, 0, 1, 2);
- m_pJoinButton = new QPushButton(__tr2qs("&Join"),hb);
+ m_pJoinButton = new QPushButton(__tr2qs("&Join"), hb);
// Join on return pressed
m_pJoinButton->setDefault(true);
- connect(m_pJoinButton,SIGNAL(clicked()),this,SLOT(joinClicked()));
+ connect(m_pJoinButton, SIGNAL(clicked()), this, SLOT(joinClicked()));
- m_pRegButton = new QPushButton(__tr2qs("&Register"),hb);
+ m_pRegButton = new QPushButton(__tr2qs("&Register"), hb);
// Join on return pressed
- connect(m_pRegButton,SIGNAL(clicked()),this,SLOT(regClicked()));
+ connect(m_pRegButton, SIGNAL(clicked()), this, SLOT(regClicked()));
- m_pClearButton = new QPushButton(__tr2qs("Clear Recent"),hb);
- connect(m_pClearButton,SIGNAL(clicked()),this,SLOT(clearClicked()));
+ m_pClearButton = new QPushButton(__tr2qs("Clear Recent"), hb);
+ connect(m_pClearButton, SIGNAL(clicked()), this, SLOT(clearClicked()));
- m_pShowAtStartupCheck = new QCheckBox(__tr2qs("Show this window after connecting"),this);
+ m_pShowAtStartupCheck = new QCheckBox(__tr2qs("Show this window after connecting"), this);
m_pShowAtStartupCheck->setChecked(KVI_OPTION_BOOL(KviOption_boolShowChannelsJoinOnIrc));
- g->addWidget(m_pShowAtStartupCheck,3,0);
+ g->addWidget(m_pShowAtStartupCheck, 3, 0);
+ QPushButton * cancelButton = new QPushButton(__tr2qs("Close"), this);
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelClicked()));
- QPushButton * cancelButton = new QPushButton(__tr2qs("Close"),this);
- connect(cancelButton,SIGNAL(clicked()),this,SLOT(cancelClicked()));
+ g->addWidget(cancelButton, 3, 1, Qt::AlignRight);
- g->addWidget(cancelButton,3,1,Qt::AlignRight);
-
-/*
+ /*
KviTalHBox * hb = new KviTalHBox(this);
hb->setSpacing(4);
@@ -134,19 +130,19 @@ ChannelsJoinDialog::ChannelsJoinDialog(const char * name)
g->addWidget(hb,2,0);
*/
- g->setRowStretch(0,1);
- g->setColumnStretch(0,1);
+ g->setRowStretch(0, 1);
+ g->setColumnStretch(0, 1);
fillListView();
if(g_rectChannelsJoinGeometry.y() < 5)
g_rectChannelsJoinGeometry.setY(5);
- resize(g_rectChannelsJoinGeometry.width(),g_rectChannelsJoinGeometry.height());
+ resize(g_rectChannelsJoinGeometry.width(), g_rectChannelsJoinGeometry.height());
//move(g_rectChannelsJoinGeometry.x(),g_rectChannelsJoinGeometry.y());
QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
- move(rect.x() + ((rect.width() - g_rectChannelsJoinGeometry.width())/2),rect.y() + ((rect.height() - g_rectChannelsJoinGeometry.height())/2));
+ move(rect.x() + ((rect.width() - g_rectChannelsJoinGeometry.width()) / 2), rect.y() + ((rect.height() - g_rectChannelsJoinGeometry.height()) / 2));
enableJoin();
}
@@ -155,11 +151,11 @@ ChannelsJoinDialog::~ChannelsJoinDialog()
{
KVI_OPTION_BOOL(KviOption_boolShowChannelsJoinOnIrc) = m_pShowAtStartupCheck->isChecked();
- g_rectChannelsJoinGeometry = QRect(pos().x(),pos().y(),size().width(),size().height());
+ g_rectChannelsJoinGeometry = QRect(pos().x(), pos().y(), size().width(), size().height());
g_pChannelsWindow = 0;
}
-void ChannelsJoinDialog::setConsole(KviConsoleWindow * pConsole)
+void ChannelsJoinDialog::setConsole(KviConsoleWindow * pConsole)
{
m_pConsole = pConsole;
fillListView();
@@ -174,24 +170,24 @@ void ChannelsJoinDialog::fillListView()
// Registered channels go first
QTreeWidgetItem * par = new QTreeWidgetItem(m_pTreeWidget, HeaderItem);
- par->setText(0,__tr2qs("Registered Channels"));
+ par->setText(0, __tr2qs("Registered Channels"));
par->setExpanded(true);
- QHash<QString,KviRegisteredChannelList *> * d = g_pRegisteredChannelDataBase->channelDict();
+ QHash<QString, KviRegisteredChannelList *> * d = g_pRegisteredChannelDataBase->channelDict();
if(d)
{
- for(QHash<QString,KviRegisteredChannelList *>::Iterator it = d->begin();it != d->end();++it)
+ for(QHash<QString, KviRegisteredChannelList *>::Iterator it = d->begin(); it != d->end(); ++it)
{
QTreeWidgetItem * chld = new QTreeWidgetItem(par, RegisteredChannelItem);
- chld->setText(0,it.key());
- chld->setIcon(0,*(g_pIconManager->getSmallIcon(KviIconManager::Channel)));
+ chld->setText(0, it.key());
+ chld->setIcon(0, *(g_pIconManager->getSmallIcon(KviIconManager::Channel)));
}
}
par->sortChildren(0, Qt::AscendingOrder);
par = new QTreeWidgetItem(m_pTreeWidget, HeaderItem);
- par->setText(0,__tr2qs("Recent Channels"));
+ par->setText(0, __tr2qs("Recent Channels"));
par->setExpanded(true);
QTreeWidgetItem * chld;
@@ -210,53 +206,53 @@ void ChannelsJoinDialog::fillListView()
bGotChanOnCurrentNetwork = true;
hdr = new QTreeWidgetItem(par, HeaderItem);
- hdr->setText(0,__tr2qs("Current Network"));
+ hdr->setText(0, __tr2qs("Current Network"));
hdr->setExpanded(true);
for(QStringList::Iterator it = pList->begin(); it != pList->end(); ++it)
{
chld = new QTreeWidgetItem(hdr, RecentChannelItem);
- chld->setText(0,*it);
- chld->setIcon(0,*(g_pIconManager->getSmallIcon(KviIconManager::Channel)));
+ chld->setText(0, *it);
+ chld->setIcon(0, *(g_pIconManager->getSmallIcon(KviIconManager::Channel)));
}
hdr->sortChildren(0, Qt::AscendingOrder);
}
}
}
- KviPointerHashTable<QString,QStringList> * pDict = g_pApp->recentChannels();
+ KviPointerHashTable<QString, QStringList> * pDict = g_pApp->recentChannels();
if(!pDict)
return;
hdr = new QTreeWidgetItem(par, HeaderItem);
- hdr->setText(0,__tr2qs("All Networks"));
+ hdr->setText(0, __tr2qs("All Networks"));
if(!bGotChanOnCurrentNetwork)
hdr->setExpanded(true); // expand this one instead
- QHash<QString,int> hNoDuplicates;
+ QHash<QString, int> hNoDuplicates;
- for(QStringList * pChans = pDict->first();pChans;pChans = pDict->next())
+ for(QStringList * pChans = pDict->first(); pChans; pChans = pDict->next())
{
for(QStringList::Iterator it = pChans->begin(); it != pChans->end(); ++it)
{
QString chan = *it;
if(hNoDuplicates.contains(chan.toLower()))
continue;
- hNoDuplicates.insert(chan.toLower(),1);
+ hNoDuplicates.insert(chan.toLower(), 1);
chld = new QTreeWidgetItem(hdr, RecentChannelItem);
- chld->setText(0,chan);
- chld->setIcon(0,*(g_pIconManager->getSmallIcon(KviIconManager::Channel)));
+ chld->setText(0, chan);
+ chld->setIcon(0, *(g_pIconManager->getSmallIcon(KviIconManager::Channel)));
}
}
hdr->sortChildren(0, Qt::AscendingOrder);
}
-void ChannelsJoinDialogTreeWidget::mousePressEvent(QMouseEvent *e)
+void ChannelsJoinDialogTreeWidget::mousePressEvent(QMouseEvent * e)
{
e->ignore();
QTreeWidgetItem * it = itemAt(e->pos());
- ChannelsJoinDialog *pDialog = (ChannelsJoinDialog*) parentWidget();
+ ChannelsJoinDialog * pDialog = (ChannelsJoinDialog *)parentWidget();
if(!it || !pDialog)
{
QTreeWidget::mousePressEvent(e);
@@ -277,20 +273,22 @@ void ChannelsJoinDialogTreeWidget::mousePressEvent(QMouseEvent *e)
if(!m_pJoinPopup)
{
m_pJoinPopup = new QMenu(this);
- m_pJoinPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Join)),__tr2qs("Join"),pDialog,SLOT(joinClicked()));
- m_pJoinPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)),__tr2qs("Delete"),pDialog,SLOT(deleteClicked()));
+ m_pJoinPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Join)), __tr2qs("Join"), pDialog, SLOT(joinClicked()));
+ m_pJoinPopup->addAction(*(g_pIconManager->getSmallIcon(KviIconManager::Discard)), __tr2qs("Delete"), pDialog, SLOT(deleteClicked()));
}
m_pJoinPopup->popup(QCursor::pos());
- } else {
+ }
+ else
+ {
pDialog->itemSelected();
}
}
-void ChannelsJoinDialogTreeWidget::mouseDoubleClickEvent(QMouseEvent *e)
+void ChannelsJoinDialogTreeWidget::mouseDoubleClickEvent(QMouseEvent * e)
{
QTreeWidgetItem * it = itemAt(e->pos());
- ChannelsJoinDialog *pDialog = (ChannelsJoinDialog*) parentWidget();
+ ChannelsJoinDialog * pDialog = (ChannelsJoinDialog *)parentWidget();
if(!it || !pDialog || !(e->button() & Qt::LeftButton))
return;
@@ -330,11 +328,15 @@ void ChannelsJoinDialog::enableJoin()
{
m_pJoinButton->setEnabled(false);
m_pRegButton->setEnabled(false);
- } else {
+ }
+ else
+ {
m_pJoinButton->setEnabled(true);
m_pRegButton->setEnabled(true);
}
- } else {
+ }
+ else
+ {
m_pTreeWidget->setEnabled(false);
m_pGroupBox->setEnabled(false);
m_pJoinButton->setEnabled(false);
@@ -361,7 +363,7 @@ void ChannelsJoinDialog::deleteClicked()
{
case RegisteredChannelItem:
{
- KviRegisteredChannel * ch = g_pRegisteredChannelDataBase->find(szChan,QString("*"));
+ KviRegisteredChannel * ch = g_pRegisteredChannelDataBase->find(szChan, QString("*"));
if(ch)
g_pRegisteredChannelDataBase->remove(ch);
delete it;
@@ -369,14 +371,14 @@ void ChannelsJoinDialog::deleteClicked()
}
case RecentChannelItem:
{
- KviPointerHashTable<QString,QStringList> * pDict = g_pApp->recentChannels();
+ KviPointerHashTable<QString, QStringList> * pDict = g_pApp->recentChannels();
if(!pDict)
return;
- for(QStringList * pChans = pDict->first();pChans;pChans = pDict->next())
+ for(QStringList * pChans = pDict->first(); pChans; pChans = pDict->next())
{
for(QStringList::Iterator item = pChans->begin(); item != pChans->end(); ++item)
{
- if(*item==szChan)
+ if(*item == szChan)
{
pChans->removeAll(szChan);
delete it;
@@ -413,7 +415,7 @@ void ChannelsJoinDialog::joinClicked()
if(w->console() != c)
w = c;
- KviKvsScript::run(szCmd,w);
+ KviKvsScript::run(szCmd, w);
m_pChannelEdit->setText("");
m_pPass->setText("");
@@ -438,11 +440,11 @@ void ChannelsJoinDialog::regClicked()
if(w->console() != c)
w = c;
- KviKvsScript::run(szCmd,w);
+ KviKvsScript::run(szCmd, w);
fillListView();
//focus the new item (in reality, the first matching one)
- QList<QTreeWidgetItem*> items = m_pTreeWidget->findItems(szTmp, Qt::MatchRecursive | Qt::MatchExactly);
+ QList<QTreeWidgetItem *> items = m_pTreeWidget->findItems(szTmp, Qt::MatchRecursive | Qt::MatchExactly);
if(!items.empty())
{
m_pTreeWidget->setCurrentItem(items.first());
@@ -462,7 +464,7 @@ void ChannelsJoinDialog::clearClicked()
if(w->console() != c)
w = c;
- KviKvsScript::run(szCmd,w);
+ KviKvsScript::run(szCmd, w);
fillListView();
}