From 3a3287b8425c355dbb54fffe6b546367ce32c8ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C5=82=20D=C5=82ugo=C5=82=C4=99cki?= Date: Thu, 28 Jan 2016 21:45:12 +0100 Subject: [PATCH] Encapsulate some classes in namespaces --- src/edit/PreferencesDialog.cpp | 6 ++++++ src/edit/PreferencesDialog.h | 6 ++++++ src/edit/ProgramStructureDialog.cpp | 6 ++++++ src/edit/ProgramStructureDialog.h | 6 ++++++ src/edit/UnitStructureDialog.cpp | 6 ++++++ src/edit/UnitStructureDialog.h | 6 ++++++ src/edit/editor.cpp | 8 +++++++- src/edit/editor.h | 6 ++++++ src/kernel/connect_dialog.cpp | 6 ++++++ src/kernel/connect_dialog.h | 6 ++++++ src/kernel/kernel.cpp | 10 ++++++++-- src/kernel/kernel.h | 6 ++++++ src/kernel/kill_interpreter_dialog.cpp | 6 ++++++ src/kernel/kill_interpreter_dialog.h | 6 ++++++ src/kernel/lock.cpp | 6 ++++++ src/kernel/lock.h | 6 ++++++ src/kernel/options.cpp | 6 ++++++ src/kernel/options.h | 6 ++++++ 18 files changed, 111 insertions(+), 3 deletions(-) diff --git a/src/edit/PreferencesDialog.cpp b/src/edit/PreferencesDialog.cpp index 4e7d3a0..ff355ce 100644 --- a/src/edit/PreferencesDialog.cpp +++ b/src/edit/PreferencesDialog.cpp @@ -1,5 +1,8 @@ #include "PreferencesDialog.h" +namespace loglan { +namespace vlp { + PreferencesDialog::PreferencesDialog(QWidget * parent) : QDialog(parent) { @@ -42,3 +45,6 @@ void PreferencesDialog::setGenPath(QString path) { return genPath->setText(path); } + +} +} diff --git a/src/edit/PreferencesDialog.h b/src/edit/PreferencesDialog.h index 2cd02ba..7311c65 100644 --- a/src/edit/PreferencesDialog.h +++ b/src/edit/PreferencesDialog.h @@ -6,6 +6,9 @@ #include "ui/dialogs/PreferencesDialog.h" +namespace loglan { +namespace vlp { + /** * Program Unit Dialog class * Displays dialog for generating code template for unit structure @@ -65,4 +68,7 @@ public: void setGenPath(QString path); }; +} +} + #endif /* _VLP_EDITOR_PREFERENCESDIALOG_H */ diff --git a/src/edit/ProgramStructureDialog.cpp b/src/edit/ProgramStructureDialog.cpp index 25750c8..623c6ae 100644 --- a/src/edit/ProgramStructureDialog.cpp +++ b/src/edit/ProgramStructureDialog.cpp @@ -1,5 +1,8 @@ #include "ProgramStructureDialog.h" +namespace loglan { +namespace vlp { + ProgramStructureDialog::ProgramStructureDialog(QWidget * parent) : QDialog(parent) @@ -25,3 +28,6 @@ QString ProgramStructureDialog::getCode() code.sprintf("PROGRAM %s\n\nBEGIN\n\nEND", getProgramName().toStdString().c_str()); return code; } + +} +} diff --git a/src/edit/ProgramStructureDialog.h b/src/edit/ProgramStructureDialog.h index 35fbe04..854e3d9 100644 --- a/src/edit/ProgramStructureDialog.h +++ b/src/edit/ProgramStructureDialog.h @@ -7,6 +7,9 @@ #include "ui/dialogs/ProgramStructureDialog.h" +namespace loglan { +namespace vlp { + /** * Program Structure Dialog class * Displays dialog for generating code template for program structure @@ -38,4 +41,7 @@ public: QString getCode(); }; +} +} + #endif /* _VLP_EDITOR_PROGRAMSTRUCTUREDIALOG_H */ diff --git a/src/edit/UnitStructureDialog.cpp b/src/edit/UnitStructureDialog.cpp index a947a12..01db86b 100644 --- a/src/edit/UnitStructureDialog.cpp +++ b/src/edit/UnitStructureDialog.cpp @@ -1,5 +1,8 @@ #include "UnitStructureDialog.h" +namespace loglan { +namespace vlp { + #define TYPENUM 5 const char *UnitTypes[TYPENUM] = { @@ -45,3 +48,6 @@ QString UnitStructureDialog::getCode() ); return code; } + +} +} diff --git a/src/edit/UnitStructureDialog.h b/src/edit/UnitStructureDialog.h index 32fd7df..6dc5aac 100644 --- a/src/edit/UnitStructureDialog.h +++ b/src/edit/UnitStructureDialog.h @@ -6,6 +6,9 @@ #include "ui/dialogs/UnitStructureDialog.h" +namespace loglan { +namespace vlp { + /** * Program Unit Dialog class * Displays dialog for generating code template for unit structure @@ -37,4 +40,7 @@ public: QString getCode(); }; +} +} + #endif /* _VLP_EDITOR_PROGRAMSTRUCTUREDIALOG_H */ diff --git a/src/edit/editor.cpp b/src/edit/editor.cpp index b507a6f..563a3e6 100644 --- a/src/edit/editor.cpp +++ b/src/edit/editor.cpp @@ -20,6 +20,9 @@ #include "editor.h" +namespace loglan { +namespace vlp { + /** * Editor constructor. Initializes and sets variables of Loglan Editor. * @@ -366,6 +369,9 @@ void Editor::on_actionUnit_structure_triggered() } } +} +} + /** * Program main function. * argv[1] is mandatory and should be a path to the home directory of @@ -377,7 +383,7 @@ void Editor::on_actionUnit_structure_triggered() int main(int argc, char **argv) { QApplication app(argc, argv); - Editor * editor = new Editor(argc, argv); + loglan::vlp::Editor * editor = new loglan::vlp::Editor(argc, argv); editor->show(); return app.exec(); } diff --git a/src/edit/editor.h b/src/edit/editor.h index 42b2c2c..01e2e2a 100644 --- a/src/edit/editor.h +++ b/src/edit/editor.h @@ -9,6 +9,9 @@ #include "ui/editor.h" +namespace loglan { +namespace vlp { + #define COMP_MODE 1 #define GEN_MODE 2 #define ALL_MODE 3 @@ -70,4 +73,7 @@ private slots: void on_editor_cursorPositionChanged(); }; +} +} + #endif // QWERTY_H diff --git a/src/kernel/connect_dialog.cpp b/src/kernel/connect_dialog.cpp index 9df1a65..9484101 100644 --- a/src/kernel/connect_dialog.cpp +++ b/src/kernel/connect_dialog.cpp @@ -2,6 +2,9 @@ #include "connect_dialog.h" +namespace loglan { +namespace vlp { + ConnectDialog::ConnectDialog(QWidget * parent) : QDialog(parent, Qt::Dialog) { @@ -16,3 +19,6 @@ QString ConnectDialog::getAddress() { return address->text(); } + +} +} diff --git a/src/kernel/connect_dialog.h b/src/kernel/connect_dialog.h index 99d1ace..4219d33 100644 --- a/src/kernel/connect_dialog.h +++ b/src/kernel/connect_dialog.h @@ -6,6 +6,9 @@ #include "ui/connect_dialog.h" +namespace loglan { +namespace vlp { + /** * Kill Interpreter Dialog class */ @@ -17,4 +20,7 @@ public: QString getAddress(); }; +} +} + #endif /* _VLP_KERNEL_CONNECTDIALOG_H */ diff --git a/src/kernel/kernel.cpp b/src/kernel/kernel.cpp index c943c48..a37c894 100644 --- a/src/kernel/kernel.cpp +++ b/src/kernel/kernel.cpp @@ -77,6 +77,9 @@ #include "../../config.h" +namespace loglan { +namespace vlp { + char CharLine[25] = "________________________"; /** @@ -1110,6 +1113,9 @@ void QKernel::on_actionInfo_triggered() wait_for_info = TRUE; } +} +} + /** * Program main function * All program arguments but the first one (argv[0]: program name) are saved and @@ -1122,8 +1128,8 @@ int main(int argc, char **argv) XInitThreads(); QApplication * app = new QApplication(argc, argv); - QKernel kernel(argc, argv); + loglan::vlp::QKernel kernel(argc, argv); kernel.show(); return app->exec(); -} +} \ No newline at end of file diff --git a/src/kernel/kernel.h b/src/kernel/kernel.h index a07b55b..7213b46 100644 --- a/src/kernel/kernel.h +++ b/src/kernel/kernel.h @@ -55,6 +55,9 @@ #define NORM_COL 2 +namespace loglan { +namespace vlp { + /** * Interpreter slot */ @@ -187,4 +190,7 @@ private slots: void on_actionUnlock_console_triggered(); }; +} +} + #endif /* VLP_KERNEL_H */ diff --git a/src/kernel/kill_interpreter_dialog.cpp b/src/kernel/kill_interpreter_dialog.cpp index 6f97a76..409e191 100644 --- a/src/kernel/kill_interpreter_dialog.cpp +++ b/src/kernel/kill_interpreter_dialog.cpp @@ -2,6 +2,9 @@ #include "kill_interpreter_dialog.h" +namespace loglan { +namespace vlp { + KillInterpreterDialog::KillInterpreterDialog(QWidget * parent) : QDialog(parent, Qt::Dialog) { @@ -16,3 +19,6 @@ int KillInterpreterDialog::getInterpreterId() { return interpreterId->text().toInt(); } + +} +} diff --git a/src/kernel/kill_interpreter_dialog.h b/src/kernel/kill_interpreter_dialog.h index 5511d61..a7eabdf 100644 --- a/src/kernel/kill_interpreter_dialog.h +++ b/src/kernel/kill_interpreter_dialog.h @@ -5,6 +5,9 @@ #include "ui/kill_dialog.h" +namespace loglan { +namespace vlp { + /** * Kill Interpreter Dialog class */ @@ -16,4 +19,7 @@ public: int getInterpreterId(); }; +} +} + #endif /* _VLP_KERNEL_KILLINTERPRETERDIALOG_H */ diff --git a/src/kernel/lock.cpp b/src/kernel/lock.cpp index e4814e0..8f71c0a 100644 --- a/src/kernel/lock.cpp +++ b/src/kernel/lock.cpp @@ -2,6 +2,9 @@ #include "lock.h" +namespace loglan { +namespace vlp { + LockDialog::LockDialog(QWidget * parent) : QDialog(parent, Qt::Dialog) { @@ -22,3 +25,6 @@ void LockDialog::retype() label->setText("Retype"); lineEdit->setText(""); } + +} +} diff --git a/src/kernel/lock.h b/src/kernel/lock.h index 152137f..2c29f0a 100644 --- a/src/kernel/lock.h +++ b/src/kernel/lock.h @@ -5,6 +5,9 @@ #include "ui/lock_dialog.h" +namespace loglan { +namespace vlp { + /** * Lock Dialog class */ @@ -17,4 +20,7 @@ public: void retype(); }; +} +} + #endif /* _VLP_KERNEL_LOCKDIALOG_H */ diff --git a/src/kernel/options.cpp b/src/kernel/options.cpp index 5830ca0..dc11652 100644 --- a/src/kernel/options.cpp +++ b/src/kernel/options.cpp @@ -4,6 +4,9 @@ #include "vlp/config.h" #include "options.h" +namespace loglan { +namespace vlp { + OptionsDialog::OptionsDialog(QString configFilePath, QWidget * parent) : QDialog(parent) { @@ -130,3 +133,6 @@ void OptionsDialog::saveConfig(const char * fname) } config_destroy(&cfg); } + +} +} diff --git a/src/kernel/options.h b/src/kernel/options.h index ecb73e3..cc73b04 100644 --- a/src/kernel/options.h +++ b/src/kernel/options.h @@ -5,6 +5,9 @@ #include "ui/optionsdialog.h" +namespace loglan { +namespace vlp { + /** * Options Dialog class */ @@ -27,4 +30,7 @@ private slots: void on_delConnectionButton_clicked(); }; +} +} + #endif /* _VLP_KERNEL_OPTIONS_H */ -- 2.30.2