Skip to content

Commit b3f515a

Browse files
committed
EdytorNC->GCodeWorkShop: rename the CommApp class
1 parent 5441237 commit b3f515a

File tree

7 files changed

+63
-54
lines changed

7 files changed

+63
-54
lines changed

sfs/commapp.cpp renamed to sfs/gcodefileserver.cpp

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@
4848
#include <serialtransmissiondialog.h> // for SerialTransmissionDialog
4949
#include <utils/medium.h> // for Medium
5050

51-
#include "commapp.h"
52-
#include "filechecker.h" // for FileChecker
53-
#include "ui_commapp.h"
51+
#include "gcodefileserver.h"
52+
#include "filechecker.h" // for FileChecker
53+
#include "ui_gcodefileserver.h" // for Ui::GCodeFileServer
5454

5555

56-
CommApp::CommApp(QWidget* parent) : QMainWindow(parent), ui(new Ui::CommApp)
56+
GCodeFileServer::GCodeFileServer(QWidget* parent) : QMainWindow(parent), ui(new Ui::GCodeFileServer)
5757
{
5858
setAttribute(Qt::WA_DeleteOnClose);
5959
ui->setupUi(this);
@@ -91,12 +91,12 @@ CommApp::CommApp(QWidget* parent) : QMainWindow(parent), ui(new Ui::CommApp)
9191
}
9292
}
9393

94-
CommApp::~CommApp()
94+
GCodeFileServer::~GCodeFileServer()
9595
{
9696
delete ui;
9797
}
9898

99-
void CommApp::closeEvent(QCloseEvent* event)
99+
void GCodeFileServer::closeEvent(QCloseEvent* event)
100100
{
101101
// QMessageBox::StandardButton result = QMessageBox::warning(this, tr("EdytorNC - Serial port file server"),
102102
// tr("You are trying to close a file server.\nAre you shure?"),
@@ -134,7 +134,7 @@ void CommApp::closeEvent(QCloseEvent* event)
134134
// event->accept();
135135
}
136136

137-
void CommApp::saveSettings()
137+
void GCodeFileServer::saveSettings()
138138
{
139139
QStringList activeConfigs;
140140

@@ -156,7 +156,7 @@ void CommApp::saveSettings()
156156
settings.endGroup();
157157
}
158158

159-
void CommApp::loadSettings()
159+
void GCodeFileServer::loadSettings()
160160
{
161161
QSettings& settings = *Medium::instance().settings();
162162
settings.beginGroup("CommApp");
@@ -179,7 +179,7 @@ void CommApp::loadSettings()
179179
}
180180
}
181181

182-
SerialTransmissionDialog* CommApp::createSerialPortServer(QString __config)
182+
SerialTransmissionDialog* GCodeFileServer::createSerialPortServer(QString __config)
183183
{
184184
SerialTransmissionDialog* spServer = new SerialTransmissionDialog(this, Qt::SubWindow,
185185
true); // Qt::Tool | Qt::CustomizeWindowHint | Qt::WindowTitleHint
@@ -191,7 +191,7 @@ SerialTransmissionDialog* CommApp::createSerialPortServer(QString __config)
191191
return spServer;
192192
}
193193

194-
void CommApp::startSerialPortServer()
194+
void GCodeFileServer::startSerialPortServer()
195195
{
196196
QString _config = configBox->currentText();
197197

@@ -206,7 +206,7 @@ void CommApp::startSerialPortServer()
206206
}
207207
}
208208

209-
void CommApp::stopSerialPortServer()
209+
void GCodeFileServer::stopSerialPortServer()
210210
{
211211
QString _config = configBox->currentText();
212212

@@ -220,7 +220,7 @@ void CommApp::stopSerialPortServer()
220220
changeActiveWindow();
221221
}
222222

223-
void CommApp::createActions()
223+
void GCodeFileServer::createActions()
224224
{
225225
configPortAct = new QAction(QIcon(":/images/serialconfig.png"), tr("Serial port configuration"),
226226
this);
@@ -320,7 +320,7 @@ void CommApp::createActions()
320320
//updateCurrentSerialConfig();
321321
}
322322

323-
void CommApp::serialConfig()
323+
void GCodeFileServer::serialConfig()
324324
{
325325
SerialPortConfigDialog* serialConfigDialog = new SerialPortConfigDialog(this,
326326
configBox->currentText());
@@ -330,7 +330,7 @@ void CommApp::serialConfig()
330330
}
331331
}
332332

333-
void CommApp::loadSerialConfignames()
333+
void GCodeFileServer::loadSerialConfignames()
334334
{
335335
int id;
336336
QStringList list;
@@ -378,7 +378,7 @@ void CommApp::loadSerialConfignames()
378378
// }
379379
//}
380380

381-
void CommApp::tileSubWindowsVertycally()
381+
void GCodeFileServer::tileSubWindowsVertycally()
382382
{
383383
// if(ui->mdiArea->subWindowList().isEmpty())
384384
// return;
@@ -394,7 +394,7 @@ void CommApp::tileSubWindowsVertycally()
394394
// }
395395
}
396396

397-
SerialTransmissionDialog* CommApp::findMdiChild(const QString __config)
397+
SerialTransmissionDialog* GCodeFileServer::findMdiChild(const QString __config)
398398
{
399399
foreach (QMdiSubWindow* window, ui->mdiArea->subWindowList()) {
400400
SerialTransmissionDialog* mdiChild = qobject_cast<SerialTransmissionDialog*>(window->widget());
@@ -408,7 +408,7 @@ SerialTransmissionDialog* CommApp::findMdiChild(const QString __config)
408408
return nullptr;
409409
}
410410

411-
void CommApp::setActiveSubWindow(QWidget* window)
411+
void GCodeFileServer::setActiveSubWindow(QWidget* window)
412412
{
413413
if (!window) {
414414
return;
@@ -417,7 +417,7 @@ void CommApp::setActiveSubWindow(QWidget* window)
417417
ui->mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow*>(window));
418418
}
419419

420-
SerialTransmissionDialog* CommApp::activeMdiChild()
420+
SerialTransmissionDialog* GCodeFileServer::activeMdiChild()
421421
{
422422
if (QMdiSubWindow* activeSubWindow = ui->mdiArea->activeSubWindow()) {
423423
return qobject_cast<SerialTransmissionDialog*>(activeSubWindow->widget());
@@ -426,7 +426,7 @@ SerialTransmissionDialog* CommApp::activeMdiChild()
426426
return nullptr;
427427
}
428428

429-
void CommApp::activeWindowChanged(QMdiSubWindow* window)
429+
void GCodeFileServer::activeWindowChanged(QMdiSubWindow* window)
430430
{
431431
if (!window) {
432432
return;
@@ -458,7 +458,7 @@ void CommApp::activeWindowChanged(QMdiSubWindow* window)
458458
}
459459
}
460460

461-
void CommApp::changeActiveWindow()
461+
void GCodeFileServer::changeActiveWindow()
462462
{
463463
SerialTransmissionDialog* mdiChild = findMdiChild(configBox->currentText());
464464

@@ -476,7 +476,7 @@ void CommApp::changeActiveWindow()
476476
}
477477
}
478478

479-
void CommApp::closeTab(int i)
479+
void GCodeFileServer::closeTab(int i)
480480
{
481481
QTabBar* tab = ui->mdiArea->findChild<QTabBar*>();
482482

@@ -485,7 +485,7 @@ void CommApp::closeTab(int i)
485485
}
486486
}
487487

488-
void CommApp::doPortReset()
488+
void GCodeFileServer::doPortReset()
489489
{
490490
SerialTransmissionDialog* mdiChild = activeMdiChild();
491491

@@ -494,7 +494,7 @@ void CommApp::doPortReset()
494494
}
495495
}
496496

497-
void CommApp::showNewFiles()
497+
void GCodeFileServer::showNewFiles()
498498
{
499499
SerialTransmissionDialog* mdiChild = activeMdiChild();
500500

@@ -511,7 +511,7 @@ void CommApp::showNewFiles()
511511
}
512512
}
513513

514-
void CommApp::browseSaveFolder()
514+
void GCodeFileServer::browseSaveFolder()
515515
{
516516
SerialTransmissionDialog* mdiChild = activeMdiChild();
517517

@@ -521,7 +521,7 @@ void CommApp::browseSaveFolder()
521521
}
522522
}
523523

524-
void CommApp::createTrayIcon()
524+
void GCodeFileServer::createTrayIcon()
525525
{
526526
trayIconMenu = new QMenu(this);
527527
trayIconMenu->addAction(minimizeAction);
@@ -541,7 +541,7 @@ void CommApp::createTrayIcon()
541541
trayIcon->show();
542542
}
543543

544-
void CommApp::iconActivated(QSystemTrayIcon::ActivationReason reason)
544+
void GCodeFileServer::iconActivated(QSystemTrayIcon::ActivationReason reason)
545545
{
546546
switch (reason) {
547547
case QSystemTrayIcon::Trigger:
@@ -564,7 +564,7 @@ void CommApp::iconActivated(QSystemTrayIcon::ActivationReason reason)
564564
}
565565
}
566566

567-
void CommApp::quitApp()
567+
void GCodeFileServer::quitApp()
568568
{
569569
saveSettings();
570570

@@ -578,7 +578,7 @@ void CommApp::quitApp()
578578
close();
579579
}
580580

581-
void CommApp::about()
581+
void GCodeFileServer::about()
582582
{
583583
QMessageBox::about(this, tr("About EdytorNC - Serial port file server"),
584584
tr("The <b>EdytorNC</b> is text editor for CNC programmers."

sfs/commapp.h renamed to sfs/gcodefileserver.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
2121
***************************************************************************/
2222

23-
#ifndef COMMAPP_H
24-
#define COMMAPP_H
23+
#ifndef GCODEFILESERVER_H
24+
#define GCODEFILESERVER_H
2525

2626
#include <QMainWindow> // for QMainWindow
2727
#include <QObject> // for Q_OBJECT, slots
@@ -40,17 +40,17 @@ class QWidget;
4040
class SerialTransmissionDialog;
4141

4242
namespace Ui {
43-
class CommApp;
43+
class GCodeFileServer;
4444
}
4545

4646

47-
class CommApp : public QMainWindow
47+
class GCodeFileServer : public QMainWindow
4848
{
4949
Q_OBJECT
5050

5151
public:
52-
explicit CommApp(QWidget* parent = 0);
53-
~CommApp();
52+
explicit GCodeFileServer(QWidget* parent = 0);
53+
~GCodeFileServer();
5454

5555
protected:
5656
void closeEvent(QCloseEvent* event);
@@ -72,7 +72,7 @@ private slots:
7272
void about();
7373

7474
private:
75-
Ui::CommApp* ui;
75+
Ui::GCodeFileServer* ui;
7676
QSignalMapper* windowMapper;
7777

7878
QAction* configPortAct;
@@ -106,4 +106,4 @@ private slots:
106106
void createTrayIcon();
107107
};
108108

109-
#endif // COMMAPP_H
109+
#endif // GCODEFILESERVER_H

sfs/commapp.ui renamed to sfs/gcodefileserver.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<ui version="4.0">
3-
<class>CommApp</class>
4-
<widget class="QMainWindow" name="CommApp">
3+
<class>GCodeFileServer</class>
4+
<widget class="QMainWindow" name="GCodeFileServer">
55
<property name="geometry">
66
<rect>
77
<x>0</x>

sfs/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
#include <QtSingleApplication> // QtSingleApplication
2929
#include <utils/medium.h> // Medium
3030

31-
#include "commapp.h" // CommApp
31+
#include "gcodefileserver.h" // for GCodeFileServer
3232

3333

3434
int main(int argc, char* argv[])
3535
{
3636
Q_INIT_RESOURCE(application);
37-
QtSingleApplication app("CommApp", argc, argv);
37+
QtSingleApplication app("GCodeFileServer", argc, argv);
3838

3939
QString txMessage;
4040

@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
5252

5353
Medium& medium = Medium::instance();
5454
medium.updateTranslation();
55-
CommApp* mw = new CommApp();
55+
GCodeFileServer* mw = new GCodeFileServer();
5656
mw->show();
5757

5858
app.setActivationWindow(mw, false);

sfs/sfs.pro

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# GCoderFileServer
12

23
VERSION = 0.1.0.0
34
TEMPLATE = app
@@ -10,11 +11,19 @@ MODULES *= kdiff3 qtsingleapplication edytornc-common
1011

1112
include(../common.pri)
1213

13-
#EdytorNC - SFS
1414

15-
SOURCES = main.cpp commapp.cpp filechecker.cpp
16-
HEADERS = commapp.h filechecker.h
17-
FORMS = commapp.ui filechecker.ui
15+
SOURCES = \
16+
filechecker.cpp \
17+
gcodefileserver.cpp \
18+
main.cpp
19+
20+
HEADERS = \
21+
filechecker.h \
22+
gcodefileserver.h
23+
24+
FORMS = \
25+
filechecker.ui \
26+
gcodefileserver.ui
1827

1928

2029
# target platforms dependencies

src/gcodeworkshop.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@
103103
#include <QtGlobal> // for QFlags, QT_VERSION, QT_VERSION_CHECK, qMakeForeachContainer, Q_OS_LINUX
104104

105105
#include <addons-actions.h> // for Addons::Actions
106-
#include <commapp.h> // for CommApp
107106
#include <document.h> // for Document
108107
#include <documentinfo.h> // for DocumentInfo::Ptr, DocumentInfo
109108
#include <documentmanager.h> // for DocumentManager
110109
#include <documentstyle.h> // for DocumentStyle::Ptr, DocumentStyle
111110
#include <documentwidgetproperties.h> // for DocumentWidgetProperties::Ptr, DocumentWidgetProperties
111+
#include <gcodefileserver.h> // for GCodeFileServer
112112
#include <gcoderdocument.h> // for GCoderDocument
113113
#include <gcoderstyle.h> // for GCoderStyle
114114
#include <gcoderwidgetproperties.h> // for GCoderWidgetProperties
@@ -164,7 +164,7 @@ GCodeWorkShop::GCodeWorkShop(Medium* medium)
164164
findFiles = nullptr;
165165
dirModel = nullptr;
166166
openExampleAct = nullptr;
167-
commApp = nullptr;
167+
m_fileServer = nullptr;
168168

169169
m_MdiWidgetsMaximized = true;
170170
m_defaultReadOnly = false;
@@ -262,8 +262,8 @@ GCodeWorkShop::~GCodeWorkShop()
262262
delete (proc);
263263
}
264264

265-
if (commApp) {
266-
commApp->close();
265+
if (m_fileServer) {
266+
m_fileServer->close();
267267
}
268268

269269
delete ui;
@@ -327,7 +327,7 @@ void GCodeWorkShop::closeAllMdiWindows()
327327

328328
void GCodeWorkShop::closeEvent(QCloseEvent* event)
329329
{
330-
if (commApp) {
330+
if (m_fileServer) {
331331
QMessageBox::StandardButton result = QMessageBox::warning(this,
332332
tr("EdytorNC - Serial port file server"),
333333
tr("Serial port file server is running.\nClose anyway?"),
@@ -3562,9 +3562,9 @@ void GCodeWorkShop::startSerialPortServer()
35623562
QString fileName;
35633563

35643564
#ifdef Q_OS_WIN32
3565-
fileName = "sfs.exe";
3565+
fileName = "gcodefileserver.exe";
35663566
#else
3567-
fileName = "sfs";
3567+
fileName = "gcodefileserver";
35683568
#endif
35693569

35703570
QProcess::startDetached(path + fileName, QStringList(), path);

0 commit comments

Comments
 (0)