adapt to context menu handler change
parent
c986cdebf9
commit
eb51fa8228
|
@ -84,12 +84,6 @@ const QPoint DEFAULT_MAIN_WINDOW_POSITION(20, 20);
|
||||||
// new dockables or toolbars are added.
|
// new dockables or toolbars are added.
|
||||||
static const int CELESTIA_MAIN_WINDOW_VERSION = 12;
|
static const int CELESTIA_MAIN_WINDOW_VERSION = 12;
|
||||||
|
|
||||||
|
|
||||||
// Terrible hack required because context menu callback doesn't retain
|
|
||||||
// any state.
|
|
||||||
static CelestiaAppWindow* MainWindowInstance = nullptr;
|
|
||||||
static void ContextMenu(float x, float y, Selection sel);
|
|
||||||
|
|
||||||
static int fps_to_ms(int fps) { return fps > 0 ? 1000 / fps : 0; }
|
static int fps_to_ms(int fps) { return fps > 0 ? 1000 / fps : 0; }
|
||||||
static int ms_to_fps(int ms) { return ms > 0? 1000 / ms : 0; }
|
static int ms_to_fps(int ms) { return ms > 0? 1000 / ms : 0; }
|
||||||
|
|
||||||
|
@ -182,7 +176,8 @@ void FPSActionGroup::updateFPS(int fps)
|
||||||
}
|
}
|
||||||
|
|
||||||
CelestiaAppWindow::CelestiaAppWindow(QWidget* parent) :
|
CelestiaAppWindow::CelestiaAppWindow(QWidget* parent) :
|
||||||
QMainWindow(parent)
|
QMainWindow(parent),
|
||||||
|
CelestiaCore::ContextMenuHandler()
|
||||||
{
|
{
|
||||||
setObjectName("celestia-mainwin");
|
setObjectName("celestia-mainwin");
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
|
@ -268,8 +263,7 @@ void CelestiaAppWindow::init(const QString& qConfigFileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
m_appCore->setCursorHandler(glWidget);
|
m_appCore->setCursorHandler(glWidget);
|
||||||
m_appCore->setContextMenuCallback(ContextMenu);
|
m_appCore->setContextMenuHandler(this);
|
||||||
MainWindowInstance = this; // TODO: Fix context menu callback
|
|
||||||
|
|
||||||
setCentralWidget(glWidget);
|
setCentralWidget(glWidget);
|
||||||
|
|
||||||
|
@ -1494,7 +1488,7 @@ void CelestiaAppWindow::setCustomFPS()
|
||||||
fpsActions->updateFPS(fpsActions->lastFPS());
|
fpsActions->updateFPS(fpsActions->lastFPS());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CelestiaAppWindow::contextMenu(float x, float y, Selection sel)
|
void CelestiaAppWindow::requestContextMenu(float x, float y, Selection sel)
|
||||||
{
|
{
|
||||||
SelectionPopup* menu = new SelectionPopup(sel, m_appCore, this);
|
SelectionPopup* menu = new SelectionPopup(sel, m_appCore, this);
|
||||||
connect(menu, SIGNAL(selectionInfoRequested(Selection&)),
|
connect(menu, SIGNAL(selectionInfoRequested(Selection&)),
|
||||||
|
@ -1529,12 +1523,6 @@ QMenu* CelestiaAppWindow::buildScriptsMenu()
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ContextMenu(float x, float y, Selection sel)
|
|
||||||
{
|
|
||||||
MainWindowInstance->contextMenu(x, y, sel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CelestiaAppWindow::pasteText()
|
void CelestiaAppWindow::pasteText()
|
||||||
{
|
{
|
||||||
QString text = QGuiApplication::clipboard()->text();
|
QString text = QGuiApplication::clipboard()->text();
|
||||||
|
|
|
@ -32,7 +32,7 @@ class BookmarkManager;
|
||||||
class BookmarkToolBar;
|
class BookmarkToolBar;
|
||||||
class QUrl;
|
class QUrl;
|
||||||
|
|
||||||
class CelestiaAppWindow : public QMainWindow
|
class CelestiaAppWindow : public QMainWindow, public CelestiaCore::ContextMenuHandler
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class CelestiaAppWindow : public QMainWindow
|
||||||
bool loadBookmarks();
|
bool loadBookmarks();
|
||||||
void saveBookmarks();
|
void saveBookmarks();
|
||||||
|
|
||||||
void contextMenu(float x, float y, Selection sel);
|
void requestContextMenu(float x, float y, Selection sel);
|
||||||
|
|
||||||
void loadingProgressUpdate(const QString& s);
|
void loadingProgressUpdate(const QString& s);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue