Skip to content

Commit b8b53f8

Browse files
author
Meinhard Ritscher
committed
Merge branch 'master' of github.com:neundorf/CuteCom into feature/control-panel-ui-redesign
2 parents f39d99b + 968ca27 commit b8b53f8

File tree

6 files changed

+47
-52
lines changed

6 files changed

+47
-52
lines changed

counterplugin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
} else \
2929
qDebug()
3030

31-
static bool debug = true;
31+
static bool debug = false;
3232
static CounterPlugin *m_counter = NULL;
3333
static int processCmd(const QString *text, QString *new_text);
3434

@@ -46,8 +46,8 @@ CounterPlugin::CounterPlugin(QFrame *parent, Settings *settings)
4646
ui->m_lbl_mrx_value->setText("0");
4747
ui->m_lbl_mtx_value->setText("0");
4848

49-
connect(ui->m_bt_unload, SIGNAL(clicked(bool)), this, SLOT(removePlugin(bool)));
50-
connect(ui->m_bt_help, SIGNAL(clicked(bool)), this, SLOT(helpMsg()));
49+
connect(ui->m_bt_unload, &QPushButton::clicked, this, &CounterPlugin::removePlugin);
50+
connect(ui->m_bt_help, &QPushButton::clicked, this, &CounterPlugin::helpMsg);
5151
connect(ui->m_bt_clear, &QPushButton::clicked, this, [=]() {
5252
ui->m_lbl_rx_value->setText("0");
5353
ui->m_lbl_tx_value->setText("0");

macroplugin.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ MacroPlugin::MacroPlugin(QFrame *parent, Settings *settings)
5353
/* Load the macro settings file that is pointed in the current session */
5454
m_macroSettings->loadFile(m_settings->getCurrentSession().macroFile);
5555
/* event to show the macro dialog */
56-
connect(ui->m_bt_set_macros, SIGNAL(clicked(bool)), m_macroSettings, SLOT(show()));
56+
connect(ui->m_bt_set_macros, &QPushButton::clicked, m_macroSettings, &MacroSettings::show);
5757
/* event for when session changes and a new file needs to be loaded */
5858
connect(m_macroSettings, &MacroSettings::fileChanged, m_settings, [=]() {
5959
/* get the new macro settings file */
@@ -65,9 +65,9 @@ MacroPlugin::MacroPlugin(QFrame *parent, Settings *settings)
6565
// << ", sfname: " << m_settings->getCurrentSession().macroFile;
6666
});
6767
/* send serial string */
68-
connect(m_macroSettings, SIGNAL(sendCmd(QByteArray)), this, SIGNAL(sendCmd(QByteArray)));
68+
connect(m_macroSettings, &MacroSettings::sendCmd, this, &MacroPlugin::sendCmd);
6969
/* unload */
70-
connect(ui->m_bt_unload, SIGNAL(clicked(bool)), this, SLOT(removePlugin(bool)));
70+
connect(ui->m_bt_unload, &QPushButton::clicked, this, &MacroPlugin::removePlugin);
7171
}
7272

7373
MacroPlugin::~MacroPlugin()

macrosettings.cpp

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ MacroSettings::MacroSettings(QPushButton **mainButtons, QWidget *parent)
7878
/* Setup signal/slots */
7979
for (size_t i = 0; i < NUM_OF_BUTTONS; i++) {
8080
/* Click events from the panel in the main menu */
81-
connect(mainButtons[i], SIGNAL(clicked(bool)), this, SLOT(macroPress()));
81+
connect(mainButtons[i], &QPushButton::clicked, this, &MacroSettings::macroPress);
8282
/* events to change this dialog's buttons text */
8383
connect(m_macros[i]->name, &QLineEdit::textChanged, this,
8484
[=]() { m_macros[i]->button->setText(m_macros[i]->name->text()); });
@@ -179,8 +179,8 @@ void MacroSettings::loadFile(QString fname)
179179

180180
void MacroSettings::openFile()
181181
{
182-
QString fname = QFileDialog::getOpenFileName(this, tr("Open a bray's terminal macro settings file"), QDir::homePath(),
183-
"Macros (*.tmf)");
182+
QString fname = QFileDialog::getOpenFileName(this, tr("Open a bray's terminal macro settings file"),
183+
QDir::homePath(), "Macros (*.tmf)");
184184
if (!fname.isEmpty())
185185
loadFile(fname);
186186
}
@@ -214,8 +214,7 @@ bool MacroSettings::parseFile(QTextStream &in)
214214
void MacroSettings::saveFile()
215215
{
216216
QDir dir(QDir::homePath());
217-
QString fname = QFileDialog::getSaveFileName(this,
218-
tr("Open a bray's terminal macro settings file"),
217+
QString fname = QFileDialog::getSaveFileName(this, tr("Open a bray's terminal macro settings file"),
219218
dir.filePath(m_macroFilename), "Macros (*.tmf)");
220219
if (fname.isEmpty())
221220
return;
@@ -244,19 +243,19 @@ void MacroSettings::saveFile()
244243
void MacroSettings::helpMsg(void)
245244
{
246245
QString help_str = tr("In order to use macros you need to need to\n"
247-
"fill the serial command you want to send in\n"
248-
"the first column. Then you can name the macro\n"
249-
"in the second column. This name will also be\n"
250-
"applied on the button label.\n\n"
251-
"To trigger the macro you can press the button\n"
252-
"on this dialog or in the main interface.\n\n"
253-
"If you want to auto-trigger the macro on time\n"
254-
"intervals then you can set the (msec) timer\n"
255-
"interval and then enable/disable the macro timer\n"
256-
"using the checkbox. Note that each timer is\n"
257-
"autonomous.\n\n"
258-
"The macro format is compatible with the tmf\n"
259-
"format of Bray's terminal.");
246+
"fill the serial command you want to send in\n"
247+
"the first column. Then you can name the macro\n"
248+
"in the second column. This name will also be\n"
249+
"applied on the button label.\n\n"
250+
"To trigger the macro you can press the button\n"
251+
"on this dialog or in the main interface.\n\n"
252+
"If you want to auto-trigger the macro on time\n"
253+
"intervals then you can set the (msec) timer\n"
254+
"interval and then enable/disable the macro timer\n"
255+
"using the checkbox. Note that each timer is\n"
256+
"autonomous.\n\n"
257+
"The macro format is compatible with the tmf\n"
258+
"format of Bray's terminal.");
260259

261260
QMessageBox::information(this, tr("How to use"), help_str);
262261
}

netproxyplugin.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,18 @@ NetProxyPlugin::NetProxyPlugin(QFrame *parent, Settings *settings)
4848

4949
m_proxySettings = new NetProxySettings(settings, this);
5050
/* event to show the macro dialog */
51-
connect(ui->m_bt_settings, SIGNAL(clicked(bool)), m_proxySettings, SLOT(show()));
51+
connect(ui->m_bt_settings, &QPushButton::clicked, m_proxySettings, &NetProxySettings::show);
5252
/* unload */
53-
connect(ui->m_bt_unload, SIGNAL(clicked(bool)), this, SLOT(removePlugin(bool)));
53+
connect(ui->m_bt_unload, &QPushButton::clicked, this, &NetProxyPlugin::removePlugin);
5454
/* handle LEDs */
55-
connect(m_proxySettings, SIGNAL(ledSetValue(NetProxySettings::en_led, bool)), this,
56-
SLOT(ledSetValue(NetProxySettings::en_led, bool)));
55+
connect(m_proxySettings, &NetProxySettings::ledSetValue, this, &NetProxyPlugin::ledSetValue);
5756
/* data from netproxy -> plugin manager*/
58-
connect(m_proxySettings, SIGNAL(sendCmd(QByteArray)), this, SIGNAL(sendCmd(QByteArray)));
57+
connect(m_proxySettings, &NetProxySettings::sendCmd, this, &NetProxyPlugin::sendCmd);
5958
/* data from plugin manager -> netproxy */
60-
connect(this, SIGNAL(proxyCmd(QByteArray)), m_proxySettings, SLOT(proxyCmd(QByteArray)));
59+
connect(this, &NetProxyPlugin::proxyCmd, m_proxySettings, &NetProxySettings::proxyCmd);
6160
/* connect status labels */
62-
connect(m_proxySettings, SIGNAL(udpStatus(bool, QString)), this, SLOT(setUdpStatusText(bool, QString)));
63-
connect(m_proxySettings, SIGNAL(tcpStatus(bool, QString)), this, SLOT(setTcpStatusText(bool, QString)));
61+
connect(m_proxySettings, &NetProxySettings::udpStatus, this, &NetProxyPlugin::setUdpStatusText);
62+
connect(m_proxySettings, &NetProxySettings::tcpStatus, this, &NetProxyPlugin::setTcpStatusText);
6463
ui->m_lbl_udp_status->setText(tr("Not used"));
6564
ui->m_lbl_tcp_status->setText(tr("Not used"));
6665

@@ -78,7 +77,7 @@ NetProxyPlugin::NetProxyPlugin(QFrame *parent, Settings *settings)
7877
if ((m_leds[i]->m_index != NetProxySettings::en_led::LED_UDP_EN)
7978
&& (m_leds[i]->m_index != NetProxySettings::en_led::LED_TCP_EN)) {
8079
m_leds[i]->m_tmr = new QTimer(m_leds[i]);
81-
connect(m_leds[i]->m_tmr, SIGNAL(timeout()), this, SLOT(tmrInterrupt()));
80+
connect(m_leds[i]->m_tmr, &QTimer::timeout, this, &NetProxyPlugin::tmrInterrupt);
8281
}
8382
}
8483
/* Checkbox enable event for UDP */

netproxysettings.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ NetProxySettings::NetProxySettings(Settings *settings, QWidget *parent)
4444
});
4545
connect(ui->m_bt_udp_help, &QPushButton::clicked, this, &NetProxySettings::helpMsgUdp);
4646
connect(ui->m_bt_tcp_help, &QPushButton::clicked, this, &NetProxySettings::helpMsgTcp);
47-
connect(m_udp, SIGNAL(error(QAbstractSocket::SocketError)), this,
48-
SLOT(errorUdpSocket(QAbstractSocket::SocketError)));
47+
connect(m_udp, static_cast<void (QUdpSocket::*)(QAbstractSocket::SocketError)>(&QAbstractSocket::error), this,
48+
&NetProxySettings::errorUdpSocket);
4949

5050
/* Initialise TCP socket */
5151
m_tcp = new QTcpServer(this);
@@ -57,16 +57,15 @@ NetProxySettings::NetProxySettings(Settings *settings, QWidget *parent)
5757
startTcpServer();
5858
}
5959
});
60-
connect(m_tcp, SIGNAL(newConnection()), this, SLOT(addTcpClient()));
61-
connect(m_tcp, SIGNAL(acceptError(QAbstractSocket::SocketError)), this,
62-
SLOT(errorTcpSocket(QAbstractSocket::SocketError)));
60+
connect(m_tcp, &QTcpServer::newConnection, this, &NetProxySettings::addTcpClient);
61+
connect(m_tcp, &QTcpServer::acceptError, this, &NetProxySettings::errorTcpSocket);
6362

6463
/* update controls with the saved settings */
6564
ui->m_sb_udp_port_local->setValue(m_settings->getCurrentSession().udpLocalPort);
6665
ui->m_le_udp_remote_host->setText(m_settings->getCurrentSession().udpRemoteHost);
6766
ui->m_sb_udp_port_remote->setValue(m_settings->getCurrentSession().udpRemotePort);
6867
ui->m_sb_tcp_port_local->setValue(m_settings->getCurrentSession().tcpLocalPort);
69-
connect(this, SIGNAL(rejected()), this, SLOT(formClose()));
68+
connect(this, &NetProxySettings::rejected, this, &NetProxySettings::formClose);
7069
}
7170

7271
NetProxySettings::~NetProxySettings() { delete ui; }
@@ -161,9 +160,7 @@ void NetProxySettings::bindUdp()
161160
}
162161

163162
if (m_udp->bind(l_addr, l_port)) {
164-
connect(m_udp, SIGNAL(readyRead()), this, SLOT(recvUDP()));
165-
connect(m_udp, SIGNAL(error(QAbstractSocket::SocketError)), this,
166-
SLOT(errorUdpSocket(QAbstractSocket::SocketError)));
163+
connect(m_udp, &QUdpSocket::readyRead, this, &NetProxySettings::recvUDP);
167164
ui->m_btn_udp->setText("Close");
168165
/* store udp details */
169166
m_udp_remote_addr = r_addr;
@@ -247,8 +244,8 @@ void NetProxySettings::stopTcpServer()
247244
void NetProxySettings::addTcpClient()
248245
{
249246
QTcpSocket *client = m_tcp->nextPendingConnection();
250-
connect(client, SIGNAL(disconnected()), this, SLOT(removeTcpClient()));
251-
connect(client, SIGNAL(readyRead()), this, SLOT(recvTCP()));
247+
connect(client, &QTcpSocket::disconnected, this, &NetProxySettings::removeTcpClient);
248+
connect(client, &QTcpSocket::readyRead, this, &NetProxySettings::recvTCP);
252249
/* add client to the list */
253250
m_tcpClients.append(client);
254251
TRACE << "Connected: " << client->localAddress();

pluginmanager.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
if (!debug) { \
2626
} else \
2727
qDebug()
28-
static bool debug = true;
28+
static bool debug = false;
2929

3030
PluginManager::PluginManager(QFrame *parent, QVBoxLayout *layout, Settings *settings)
3131
: m_parent(parent)
@@ -54,21 +54,21 @@ void PluginManager::addPluginType(en_plugin_type type)
5454
if (type == en_plugin_type::PLUGIN_TYPE_MACROS) {
5555
/* specific plugin initialization */
5656
MacroPlugin *macro = new MacroPlugin(m_parent, m_settings);
57-
connect(macro, SIGNAL(unload(Plugin *)), this, SLOT(removePlugin(Plugin *)));
58-
connect(macro, SIGNAL(sendCmd(QByteArray)), this, SIGNAL(sendCmd(QByteArray)));
57+
connect(macro, &MacroPlugin::unload, this, &PluginManager::removePlugin);
58+
connect(macro, &MacroPlugin::sendCmd, this, &PluginManager::sendCmd);
5959
/* common plugin initialization */
6060
addPlugin((Plugin *)macro->plugin());
6161
} else if (type == en_plugin_type::PLUGIN_TYPE_NET_PROXY) {
6262
NetProxyPlugin *proxy = new NetProxyPlugin(m_parent, m_settings);
63-
connect(proxy, SIGNAL(unload(Plugin *)), this, SLOT(removePlugin(Plugin *)));
64-
connect(proxy, SIGNAL(sendCmd(QByteArray)), this, SIGNAL(sendCmd(QByteArray)));
65-
connect(this, SIGNAL(recvCmd(QByteArray)), proxy, SIGNAL(proxyCmd(QByteArray)));
63+
connect(proxy, &NetProxyPlugin::unload, this, &PluginManager::removePlugin);
64+
connect(proxy, &NetProxyPlugin::sendCmd, this, &PluginManager::sendCmd);
65+
connect(this, &PluginManager::recvCmd, proxy, &NetProxyPlugin::proxyCmd);
6666
/* common plugin initialization */
6767
addPlugin((Plugin *)proxy->plugin());
6868
} else if (type == en_plugin_type::PLUGIN_TYPE_BYTE_COUNTER) {
6969
CounterPlugin *counter = new CounterPlugin(m_parent, m_settings);
70-
connect(counter, SIGNAL(unload(Plugin *)), this, SLOT(removePlugin(Plugin *)));
71-
connect(this, SIGNAL(recvCmd(QByteArray)), counter, SLOT(rxBytes(QByteArray)));
70+
connect(counter, &CounterPlugin::unload, this, &PluginManager::removePlugin);
71+
connect(this, &PluginManager::recvCmd, counter, &CounterPlugin::rxBytes);
7272
/* common plugin initialization */
7373
addPlugin((Plugin *)counter->plugin());
7474
}

0 commit comments

Comments
 (0)