Skip to content

Commit

Permalink
Rename the MainWindow class
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Jun 29, 2023
1 parent 55aaf5f commit d0e98ac
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 66 deletions.
6 changes: 3 additions & 3 deletions src/qged/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BRLCAD_INCLUDE_DIRS(QG_DIRS)
# want to run the automatic moc logic for all of them.

set(qged_srcs
main_window.cpp
QgEdMainWindow.cpp
QgEdApp.cpp
QgEdFilter.cpp
fbserv.cpp
Expand All @@ -35,7 +35,7 @@ set(qth_names
QgEdApp
QgEdFilter
fbserv
main_window
QgEdMainWindow
QgEdPalette
)
foreach(qh ${qth_names})
Expand All @@ -45,7 +45,7 @@ endforeach(qh ${qth_names})

if (BRLCAD_ENABLE_QT)

# Let main_window know what the platform's extension is so it knows
# Let the plugin lookup know what the platform's extension is so it knows
# what plugin filenames to look for
set_property(SOURCE QgEdPalette.cpp APPEND PROPERTY
COMPILE_DEFINITIONS "QGED_PLUGIN_SUFFIX=\"${CMAKE_SHARED_LIBRARY_SUFFIX}\"")
Expand Down
4 changes: 2 additions & 2 deletions src/qged/QgEdApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ QgEdApp::QgEdApp(int &argc, char *argv[], int swrast_mode, int quad_mode) :QAppl
setStyleSheet(stream.readAll());

// Create the windows
w = new BRLCAD_MainWindow(swrast_mode, quad_mode);
w = new QgEdMainWindow(swrast_mode, quad_mode);

/* GED needs some information and methods from QGED - make
* those assignment */
Expand Down Expand Up @@ -592,7 +592,7 @@ QgEdApp::write_settings()
QSettings settings("BRL-CAD", "QGED");

// TODO - write user settings here. Window state saving is handled by
// BRLCAD_MainWindow closeEvent
// QgEdMainWindow closeEvent
}

// Local Variables:
Expand Down
4 changes: 2 additions & 2 deletions src/qged/QgEdApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "qtcad/QgTreeView.h"
#include "qtcad/SignalFlags.h"

#include "main_window.h"
#include "QgEdMainWindow.h"

/* Command type for application level commands */

Expand Down Expand Up @@ -96,7 +96,7 @@ class QgEdApp : public QApplication
void element_selected(QgToolPaletteElement *el);

public:
BRLCAD_MainWindow *w = NULL;
QgEdMainWindow *w = NULL;
struct bu_vls init_msgs = BU_VLS_INIT_ZERO; // for plugin initialization reporting

private:
Expand Down
75 changes: 37 additions & 38 deletions src/qged/main_window.cpp → src/qged/QgEdMainWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* M A I N _ W I N D O W . C P P
/* Q G E D M A I N W I N D O W . 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 main_window.cpp
/** @file QgEdMainWindow.cpp
*
* Implementation code for toplevel window for BRL-CAD GUI.
*
Expand All @@ -27,10 +27,10 @@
#include <QMessageBox>
#include "qtcad/QgViewCtrl.h"
#include "qtcad/QgTreeSelectionModel.h"
#include "main_window.h"
#include "QgEdMainWindow.h"
#include "QgEdApp.h"

BRLCAD_MainWindow::BRLCAD_MainWindow(int canvas_type, int quad_view)
QgEdMainWindow::QgEdMainWindow(int canvas_type, int quad_view)
{
QgEdApp *ap = (QgEdApp *)qApp;
ap->w = this;
Expand Down Expand Up @@ -74,7 +74,7 @@ BRLCAD_MainWindow::BRLCAD_MainWindow(int canvas_type, int quad_view)
}

void
BRLCAD_MainWindow::CreateWidgets(int canvas_type)
QgEdMainWindow::CreateWidgets(int canvas_type)
{
QgEdApp *ap = (QgEdApp *)qApp;
QgModel *m = ap->mdl;
Expand Down Expand Up @@ -155,7 +155,7 @@ BRLCAD_MainWindow::CreateWidgets(int canvas_type)
}

void
BRLCAD_MainWindow::LocateWidgets()
QgEdMainWindow::LocateWidgets()
{
// Central widget will hold the 3D display widget + Icon toolbar.
// Create a layout to organize them
Expand Down Expand Up @@ -206,7 +206,7 @@ BRLCAD_MainWindow::LocateWidgets()
}

void
BRLCAD_MainWindow::ConnectWidgets()
QgEdMainWindow::ConnectWidgets()
{
QgEdApp *ap = (QgEdApp *)qApp;
QgModel *m = ap->mdl;
Expand All @@ -227,7 +227,7 @@ BRLCAD_MainWindow::ConnectWidgets()
QObject::connect(c4, &QgQuadView::changed, ap, &QgEdApp::do_quad_view_change);
// Some of the dm initialization has to be delayed - make the connections so we can
// do the work after widget initialization is complete.
QObject::connect(c4, &QgQuadView::init_done, this, &BRLCAD_MainWindow::do_dm_init);
QObject::connect(c4, &QgQuadView::init_done, this, &QgEdMainWindow::do_dm_init);


// Graphical toolbar
Expand Down Expand Up @@ -296,7 +296,7 @@ BRLCAD_MainWindow::ConnectWidgets()
}

void
BRLCAD_MainWindow::SetupMenu()
QgEdMainWindow::SetupMenu()
{
QMenu *file_menu = menuBar()->addMenu("File");
cad_open = new QAction("Open", this);
Expand All @@ -309,20 +309,20 @@ BRLCAD_MainWindow::SetupMenu()

#if 0
cad_save_image = new QAction("Save Image", this);
connect(cad_save_image, &QAction::triggered, this, &BRLCAD_MainWindow::save_image);
connect(cad_save_image, &QAction::triggered, this, &QgEdMainWindow::save_image);
file_menu->addAction(cad_save_image);
#endif

cad_single_view = new QAction("Single View", this);
connect(cad_single_view, &QAction::triggered, this, &BRLCAD_MainWindow::SingleDisplay);
connect(cad_single_view, &QAction::triggered, this, &QgEdMainWindow::SingleDisplay);
file_menu->addAction(cad_single_view);

cad_quad_view = new QAction("Quad View", this);
connect(cad_quad_view, &QAction::triggered, this, &BRLCAD_MainWindow::QuadDisplay);
connect(cad_quad_view, &QAction::triggered, this, &QgEdMainWindow::QuadDisplay);
file_menu->addAction(cad_quad_view);

cad_exit = new QAction("Exit", this);
QObject::connect(cad_exit, &QAction::triggered, this, &BRLCAD_MainWindow::close);
QObject::connect(cad_exit, &QAction::triggered, this, &QgEdMainWindow::close);
file_menu->addAction(cad_exit);

QMenu *view_menu = menuBar()->addMenu("View");
Expand All @@ -341,9 +341,9 @@ BRLCAD_MainWindow::SetupMenu()
// initialization is *fully* complete. Consequently, these steps are separated
// out from the main constructor.
void
BRLCAD_MainWindow::do_dm_init()
QgEdMainWindow::do_dm_init()
{
QTCAD_SLOT("BRLCAD_MainWindow::do_dm_init", 1);
QTCAD_SLOT("QgEdMainWindow::do_dm_init", 1);
QgEdApp *ap = (QgEdApp *)qApp;
QgModel *m = ap->mdl;
struct ged *gedp = m->gedp;
Expand Down Expand Up @@ -374,20 +374,20 @@ BRLCAD_MainWindow::do_dm_init()


bool
BRLCAD_MainWindow::isValid3D()
QgEdMainWindow::isValid3D()
{
return c4->isValid();
}

void
BRLCAD_MainWindow::close()
QgEdMainWindow::close()
{
closeEvent(NULL);
QMainWindow::close();
}

void
BRLCAD_MainWindow::closeEvent(QCloseEvent* e)
QgEdMainWindow::closeEvent(QCloseEvent* e)
{
QSettings settings("BRL-CAD", "QGED");
// https://bugreports.qt.io/browse/QTBUG-16252?focusedCommentId=250562&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-250562
Expand Down Expand Up @@ -417,61 +417,61 @@ widget_active(QWidget *w)
}

bool
BRLCAD_MainWindow::isDisplayActive()
QgEdMainWindow::isDisplayActive()
{
return widget_active(c4);
}

QgView *
BRLCAD_MainWindow::CurrentDisplay()
QgEdMainWindow::CurrentDisplay()
{
return c4->get();
}

struct bview *
BRLCAD_MainWindow::CurrentView()
QgEdMainWindow::CurrentView()
{
return c4->view();
}

void
BRLCAD_MainWindow::DisplayCheckpoint()
QgEdMainWindow::DisplayCheckpoint()
{
c4->stash_hashes();
}

bool
BRLCAD_MainWindow::DisplayDiff()
QgEdMainWindow::DisplayDiff()
{
return c4->diff_hashes();
}

void
BRLCAD_MainWindow::QuadDisplay()
QgEdMainWindow::QuadDisplay()
{
c4->changeToQuadFrame();
}

void
BRLCAD_MainWindow::SingleDisplay()
QgEdMainWindow::SingleDisplay()
{
c4->changeToSingleFrame();
}

void
BRLCAD_MainWindow::IndicateRaytraceStart(int val)
QgEdMainWindow::IndicateRaytraceStart(int val)
{
vcw->raytrace_start(val);
}

void
BRLCAD_MainWindow::IndicateRaytraceDone(int val)
QgEdMainWindow::IndicateRaytraceDone(int val)
{
vcw->raytrace_done(val);
}

int
BRLCAD_MainWindow::InteractionMode(QPoint &gpos)
QgEdMainWindow::InteractionMode(QPoint &gpos)
{
if (vc) {
QWidget *vcp = vc;
Expand All @@ -494,13 +494,12 @@ BRLCAD_MainWindow::InteractionMode(QPoint &gpos)
return -1;
}

/*
* Local Variables:
* mode: C++
* tab-width: 8
* c-basic-offset: 4
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
// Local Variables:
// mode: C++
// tab-width: 8
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8

41 changes: 21 additions & 20 deletions src/qged/main_window.h → src/qged/QgEdMainWindow.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* M A I N _ W I N D O W . H
/* Q G E D M A I N W I N D O W . H
* BRL-CAD
*
* Copyright (c) 2014-2023 United States Government as represented by
Expand All @@ -17,15 +17,18 @@
* License along with this file; see the file named COPYING for more
* information.
*/
/** @file main_window.h
/** @file QgEdMainWindow.h
*
* Defines the toplevel window for the BRL-CAD GUI, into which other
* windows are docked.
* Defines the toplevel window for the BRL-CAD GUI, into which other windows
* are docked.
*
* This widget is also responsible for connections between widgets - typically
* this takes the form of Qt signals/slots that pass information to/from
* widgets and keep the graphically displayed information in sync.
*/

#ifndef BRLCAD_MAINWINDOW_H
#define BRLCAD_MAINWINDOW_H
#ifndef QGEDMAINWINDOW_H
#define QGEDMAINWINDOW_H
#include <QAction>
#include <QDockWidget>
#include <QFileDialog>
Expand All @@ -52,11 +55,11 @@
#include "plugins/plugin.h"
#include "QgEdPalette.h"

class BRLCAD_MainWindow : public QMainWindow
class QgEdMainWindow : public QMainWindow
{
Q_OBJECT
public:
BRLCAD_MainWindow(int canvas_type = 0, int quad_view = 0);
QgEdMainWindow(int canvas_type = 0, int quad_view = 0);

QgConsole *console;

Expand Down Expand Up @@ -139,16 +142,14 @@ class BRLCAD_MainWindow : public QMainWindow
QgDockWidget *tree_dock = NULL;
};

#endif /* BRLCAD_MAINWINDOW_H */

/*
* Local Variables:
* mode: C++
* tab-width: 8
* c-basic-offset: 4
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
#endif /* QGEDMAINWINDOW_H */

// Local Variables:
// mode: C++
// tab-width: 8
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8

1 change: 0 additions & 1 deletion src/qged/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "bu/opt.h"
#include "brlcad_version.h"

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

Expand Down

0 comments on commit d0e98ac

Please sign in to comment.