Skip to content

Commit

Permalink
Adjust application class name to be more specific to qged
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Jun 29, 2023
1 parent b2dffd5 commit 55aaf5f
Show file tree
Hide file tree
Showing 13 changed files with 102 additions and 104 deletions.
4 changes: 2 additions & 2 deletions src/qged/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ BRLCAD_INCLUDE_DIRS(QG_DIRS)

set(qged_srcs
main_window.cpp
CADApp.cpp
QgEdApp.cpp
QgEdFilter.cpp
fbserv.cpp
QgEdPalette.cpp
)

set(qth_names
CADApp
QgEdApp
QgEdFilter
fbserv
main_window
Expand Down
46 changes: 23 additions & 23 deletions src/qged/CADApp.cpp → src/qged/QgEdApp.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* C A D A P P . C P P
/* Q G E D A P P . C P P
* BRL-CAD
*
* Copyright (c) 2014-2023 United States Government as represented by
Expand All @@ -17,7 +17,7 @@
* License along with this file; see the file named COPYING for more
* information.
*/
/** @file CADApp.cpp
/** @file QgEdApp.cpp
*
* Application level data and functionality implementations.
*
Expand All @@ -33,7 +33,7 @@
#include "bu/file.h"
#include "qtcad/QgGeomImport.h"
#include "qtcad/QgTreeSelectionModel.h"
#include "CADApp.h"
#include "QgEdApp.h"
#include "fbserv.h"
#include "QgEdFilter.h"

Expand All @@ -47,7 +47,7 @@ qt_create_io_handler(struct ged_subprocess *p, bu_process_io_t t, ged_io_func_t
if (fd < 0)
return;

CADApp *ca = (CADApp *)p->gedp->ged_io_data;
QgEdApp *ca = (QgEdApp *)p->gedp->ged_io_data;
QgConsole *c = ca->w->console;
c->listen(fd, p, t, callback, data);

Expand All @@ -69,7 +69,7 @@ qt_delete_io_handler(struct ged_subprocess *p, bu_process_io_t t)
{
if (!p) return;

CADApp *ca = (CADApp *)p->gedp->ged_io_data;
QgEdApp *ca = (QgEdApp *)p->gedp->ged_io_data;
QgConsole *c = ca->w->console;

// Since these callbacks are invoked from the listener, we can't call
Expand Down Expand Up @@ -114,7 +114,7 @@ qt_delete_io_handler(struct ged_subprocess *p, bu_process_io_t t)
}


CADApp::CADApp(int &argc, char *argv[], int swrast_mode, int quad_mode) :QApplication(argc, argv)
QgEdApp::QgEdApp(int &argc, char *argv[], int swrast_mode, int quad_mode) :QApplication(argc, argv)
{
setOrganizationName("BRL-CAD");
setOrganizationDomain("brlcad.org");
Expand Down Expand Up @@ -273,24 +273,24 @@ CADApp::CADApp(int &argc, char *argv[], int swrast_mode, int quad_mode) :QApplic
}
}

CADApp::~CADApp() {
QgEdApp::~QgEdApp() {
delete mdl;
// TODO - free RTG.rtg_vlfree?
}

void
CADApp::do_quad_view_change(QgView *cv)
QgEdApp::do_quad_view_change(QgView *cv)
{
QTCAD_SLOT("CADApp::do_quad_view_change", 1);
QTCAD_SLOT("QgEdApp::do_quad_view_change", 1);
mdl->gedp->ged_gvp = cv->view();
emit view_update(QTCAD_VIEW_REFRESH);
}

void
CADApp::do_view_changed(unsigned long long flags)
QgEdApp::do_view_changed(unsigned long long flags)
{
bv_log(1, "CADApp::do_view_changed");
QTCAD_SLOT("CADApp::do_view_changed", 1);
bv_log(1, "QgEdApp::do_view_changed");
QTCAD_SLOT("QgEdApp::do_view_changed", 1);

if (flags & QTCAD_VIEW_DRAWN) {
// For all associated view states, execute any necessary changes to
Expand All @@ -316,9 +316,9 @@ CADApp::do_view_changed(unsigned long long flags)
}

void
CADApp::open_file()
QgEdApp::open_file()
{
QTCAD_SLOT("CADApp::open_file", 1);
QTCAD_SLOT("QgEdApp::open_file", 1);

QgGeomImport importer((QWidget *)this->w);
QString fileName = importer.gfile();
Expand Down Expand Up @@ -361,19 +361,19 @@ qged_view_update(struct ged *gedp)
extern "C" void
raytrace_start(int val, void *ctx)
{
CADApp *ap = (CADApp *)ctx;
QgEdApp *ap = (QgEdApp *)ctx;
ap->w->IndicateRaytraceStart(val);
}

extern "C" void
raytrace_done(int val, void *ctx)
{
CADApp *ap = (CADApp *)ctx;
QgEdApp *ap = (QgEdApp *)ctx;
ap->w->IndicateRaytraceDone(val);
}

int
CADApp::run_cmd(struct bu_vls *msg, int argc, const char **argv)
QgEdApp::run_cmd(struct bu_vls *msg, int argc, const char **argv)
{
int ret = BRLCAD_OK;
int view_flags = 0;
Expand Down Expand Up @@ -489,9 +489,9 @@ CADApp::run_cmd(struct bu_vls *msg, int argc, const char **argv)
}

void
CADApp::run_qcmd(const QString &command)
QgEdApp::run_qcmd(const QString &command)
{
QTCAD_SLOT("CADApp::run_qcmd", 1);
QTCAD_SLOT("QgEdApp::run_qcmd", 1);
if (!w)
return;

Expand Down Expand Up @@ -557,9 +557,9 @@ CADApp::run_qcmd(const QString &command)
}

void
CADApp::element_selected(QgToolPaletteElement *el)
QgEdApp::element_selected(QgToolPaletteElement *el)
{
QTCAD_SLOT("CADApp::element_selected", 1);
QTCAD_SLOT("QgEdApp::element_selected", 1);
if (!el->controls->isVisible()) {
// Apparently this can happen when we have docked widgets
// closed and we click on the border between the view and
Expand All @@ -586,9 +586,9 @@ CADApp::element_selected(QgToolPaletteElement *el)
}

void
CADApp::write_settings()
QgEdApp::write_settings()
{
QTCAD_SLOT("CADApp::write_settings", 1);
QTCAD_SLOT("QgEdApp::write_settings", 1);
QSettings settings("BRL-CAD", "QGED");

// TODO - write user settings here. Window state saving is handled by
Expand Down
18 changes: 8 additions & 10 deletions src/qged/CADApp.h → src/qged/QgEdApp.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* C A D A P P . H
/* Q G E D A P P . H
* BRL-CAD
*
* Copyright (c) 2014-2023 United States Government as represented by
Expand All @@ -17,14 +17,14 @@
* License along with this file; see the file named COPYING for more
* information.
*/
/** @file CADApp.h
/** @file QgEdApp.h
*
* Specialization of QApplication that adds information specific
* to BRL-CAD's data and functionality
*/

#ifndef CADAPP_H
#define CADAPP_H
#ifndef QGEDAPP_H
#define QGEDAPP_H

#include <QApplication>
#include <QObject>
Expand All @@ -51,13 +51,13 @@
* application wide facilities like the current GED pointer and the ability
* to run commands are defined here. */

class CADApp : public QApplication
class QgEdApp : public QApplication
{
Q_OBJECT

public:
CADApp(int &argc, char *argv[], int swrast_mode = 0, int quad_mode = 0);
~CADApp();
QgEdApp(int &argc, char *argv[], int swrast_mode = 0, int quad_mode = 0);
~QgEdApp();

int run_cmd(struct bu_vls *msg, int argc, const char **argv);

Expand Down Expand Up @@ -106,9 +106,7 @@ class CADApp : public QApplication
long history_mark_end = -1;
};

QString convert_to_g(QString filename);

#endif // CADAPP_H
#endif // QGEDAPP_H

// Local Variables:
// mode: C++
Expand Down
4 changes: 2 additions & 2 deletions src/qged/QgEdFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
#include <QEvent>
#include <QMouseEvent>
#include <QtGlobal>
#include "CADApp.h"
#include "QgEdApp.h"
#include "QgEdFilter.h"
#include "qtcad/QgModel.h"

bool QgEdFilter::eventFilter(QObject *, QEvent *e)
{
CADApp *c = (CADApp *)qApp;
QgEdApp *c = (QgEdApp *)qApp;
if (!c || !c->w)
return false;

Expand Down
4 changes: 2 additions & 2 deletions src/qged/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "brlcad_version.h"

#include "main_window.h"
#include "CADApp.h"
#include "QgEdApp.h"
#include "fbserv.h"

static void
Expand Down Expand Up @@ -128,7 +128,7 @@ int main(int argc, char *argv[])
}

// We derive our own app type from QApplication
CADApp app(argc, argv, swrast_mode, quad_mode);
QgEdApp app(argc, argv, swrast_mode, quad_mode);

// Setup complete - time to enter the interactive event loop
return app.exec();
Expand Down
Loading

0 comments on commit 55aaf5f

Please sign in to comment.