Mapper  0.9.0
API documentation
Classes | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Protected Member Functions | Friends | List of all members
OpenOrienteering::MainWindow Class Reference

The MainWindow class provides the generic application window. More...

#include <main_window.h>

Inheritance diagram for OpenOrienteering::MainWindow:
Inheritance graph
[legend]
Collaboration diagram for OpenOrienteering::MainWindow:
Collaboration graph
[legend]

Classes

struct  FileInfo
 

Public Slots

void applicationStateChanged ()
 Reacts to application state changes. More...
 
void showNewMapWizard ()
 Show a wizard for creating new maps. More...
 
void showOpenDialog ()
 Show a file-open dialog and load the select file. More...
 
bool showSaveAsDialog ()
 Show a file-save dialog. More...
 
bool openPath (const QString &path)
 Open the file with the given path. More...
 
bool openPath (const QString &path, const OpenOrienteering::FileFormat *format)
 
void openRecentFile ()
 Open the file specified in the sending action's data. More...
 
void updateRecentFileActions ()
 Notify the main window of a change to the list of recent files. More...
 
bool save ()
 Save the current content to the current path. More...
 
Autosave::AutosaveResult autosave () override
 Save the current content to the current path. More...
 
bool closeFile ()
 Close the file currently opened. More...
 
void toggleFullscreenMode ()
 Toggle between normal window and fullscreen mode. More...
 
void showSettings ()
 Show the settings dialog. More...
 
void showAbout ()
 Show the about dialog. More...
 
void showHelp ()
 Show the index page of the manual in the help browser. More...
 
void linkClicked (const QString &link)
 Open a link. More...
 
void setHasUnsavedChanges (bool value)
 Notifies this window of unsaved changes. More...
 

Signals

void actualPathChanged (const QString &path)
 This signal is emitted when the actual path changes. More...
 
void autosaveConflictResolved ()
 This signal is emitted when an autosave conflict gets resolved. More...
 

Public Member Functions

 MainWindow (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags())
 Creates a new main window. More...
 
 ~MainWindow () override
 Destroys a main window. More...
 
QString appName () const
 Returns the application's localized name. More...
 
void setController (MainWindowController *new_controller)
 Changes the controller. More...
 
void setController (MainWindowController *new_controller, const QString &path, const FileFormat *format)
 Changes the controller. More...
 
MainWindowControllergetController () const
 Returns the current controller. More...
 
const QStringcurrentPath () const
 Returns the canonical path of the currently open file. More...
 
const FileFormatcurrentFormat () const
 Returns the file format of the currently open file. More...
 
bool hasOpenedFile () const
 Returns true if a file is opened in this main window. More...
 
bool hasUnsavedChanges () const
 Returns true if the opened file is marked as having unsaved changes. More...
 
void setStatusBarText (const QString &text)
 Sets the text in the status bar. More...
 
void showStatusBarMessage (const QString &text, int timeout=0)
 Shows a temporary message in the status bar. More...
 
void showStatusBarMessageImmediately (const QString &text, int timeout=0)
 Shows a temporary message in the status bar immediately. More...
 
void clearStatusBarMessage ()
 Clears temporary messages set in the status bar with showStatusBarMessage(). More...
 
void setShortcutsBlocked (bool blocked)
 Blocks shortcuts. More...
 
bool shortcutsBlocked () const
 Returns true if shortcuts are currently disabled. More...
 
QMenugetFileMenu () const
 Returns the main window's file menu so that it can be extended. More...
 
QActiongetFileMenuExtensionAct () const
 Returns an QAction which serves as extension point in the file menu. More...
 
QActiongetSaveAct () const
 Returns the save action. More...
 
QActiongetCloseAct () const
 Returns the close action. More...
 
QToolBargetGeneralToolBar () const
 Returns a general toolbar with standard file actions (new, open, save). More...
 
void openPathLater (const QString &path)
 Open the file with the given path after all events have been processed. More...
 
bool saveTo (const QString &path, const FileFormat &format)
 Save the content of the main window. More...
 
void setCentralWidget (QWidget *widget)
 Sets the MainWindow's effective central widget. More...
 
bool homeScreenDisabled () const
 Indicates whether the home screen is disabled. More...
 
void setHomeScreenDisabled (bool disabled)
 Sets whether to show the home screen after closing the last file. More...
 
- Public Member Functions inherited from QMainWindow
 QMainWindow (QWidget *parent, Qt::WindowFlags flags)
 
virtual ~QMainWindow ()
 
QSize iconSize () const const
 
void setIconSize (const QSize &iconSize)
 
Qt::ToolButtonStyle toolButtonStyle () const const
 
void setToolButtonStyle (Qt::ToolButtonStyle toolButtonStyle)
 
bool isAnimated () const const
 
bool isDockNestingEnabled () const const
 
bool documentMode () const const
 
void setDocumentMode (bool enabled)
 
QTabWidget::TabShape tabShape () const const
 
void setTabShape (QTabWidget::TabShape tabShape)
 
QTabWidget::TabPosition tabPosition (Qt::DockWidgetArea area) const const
 
void setTabPosition (Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition)
 
void setDockOptions (QMainWindow::DockOptions options)
 
QMainWindow::DockOptions dockOptions () const const
 
QMenuBarmenuBar () const const
 
void setMenuBar (QMenuBar *menuBar)
 
QWidgetmenuWidget () const const
 
void setMenuWidget (QWidget *menuBar)
 
QStatusBarstatusBar () const const
 
void setStatusBar (QStatusBar *statusbar)
 
QWidgetcentralWidget () const const
 
void setCentralWidget (QWidget *widget)
 
QWidgettakeCentralWidget ()
 
void setCorner (Qt::Corner corner, Qt::DockWidgetArea area)
 
Qt::DockWidgetArea corner (Qt::Corner corner) const const
 
void addToolBarBreak (Qt::ToolBarArea area)
 
void insertToolBarBreak (QToolBar *before)
 
void addToolBar (Qt::ToolBarArea area, QToolBar *toolbar)
 
void addToolBar (QToolBar *toolbar)
 
QToolBaraddToolBar (const QString &title)
 
void insertToolBar (QToolBar *before, QToolBar *toolbar)
 
void removeToolBar (QToolBar *toolbar)
 
void removeToolBarBreak (QToolBar *before)
 
bool unifiedTitleAndToolBarOnMac () const const
 
Qt::ToolBarArea toolBarArea (QToolBar *toolbar) const const
 
bool toolBarBreak (QToolBar *toolbar) const const
 
void addDockWidget (Qt::DockWidgetArea area, QDockWidget *dockwidget)
 
void addDockWidget (Qt::DockWidgetArea area, QDockWidget *dockwidget, Qt::Orientation orientation)
 
void splitDockWidget (QDockWidget *first, QDockWidget *second, Qt::Orientation orientation)
 
void tabifyDockWidget (QDockWidget *first, QDockWidget *second)
 
QList< QDockWidget * > tabifiedDockWidgets (QDockWidget *dockwidget) const const
 
void removeDockWidget (QDockWidget *dockwidget)
 
bool restoreDockWidget (QDockWidget *dockwidget)
 
Qt::DockWidgetArea dockWidgetArea (QDockWidget *dockwidget) const const
 
void resizeDocks (const QList< QDockWidget * > &docks, const QList< int > &sizes, Qt::Orientation orientation)
 
QByteArray saveState (int version) const const
 
bool restoreState (const QByteArray &state, int version)
 
virtual QMenucreatePopupMenu ()
 
void setAnimated (bool enabled)
 
void setDockNestingEnabled (bool enabled)
 
void setUnifiedTitleAndToolBarOnMac (bool set)
 
void iconSizeChanged (const QSize &iconSize)
 
void toolButtonStyleChanged (Qt::ToolButtonStyle toolButtonStyle)
 
void tabifiedDockWidgetActivated (QDockWidget *dockWidget)
 
- Public Member Functions inherited from QWidget
 QWidget (QWidget *parent, Qt::WindowFlags f)
 
virtual ~QWidget ()
 
WId winId () const const
 
WId effectiveWinId () const const
 
QStylestyle () const const
 
void setStyle (QStyle *style)
 
bool isTopLevel () const const
 
bool isWindow () const const
 
bool isModal () const const
 
Qt::WindowModality windowModality () const const
 
void setWindowModality (Qt::WindowModality windowModality)
 
bool isEnabled () const const
 
bool isEnabledTo (const QWidget *ancestor) const const
 
bool isEnabledToTLW () const const
 
void setEnabled (bool)
 
void setDisabled (bool disable)
 
void setWindowModified (bool)
 
QRect frameGeometry () const const
 
const QRectgeometry () const const
 
QRect normalGeometry () const const
 
int x () const const
 
int y () const const
 
QPoint pos () const const
 
QSize frameSize () const const
 
QSize size () const const
 
int width () const const
 
int height () const const
 
QRect rect () const const
 
QRect childrenRect () const const
 
QRegion childrenRegion () const const
 
QSize minimumSize () const const
 
QSize maximumSize () const const
 
int minimumWidth () const const
 
int minimumHeight () const const
 
int maximumWidth () const const
 
int maximumHeight () const const
 
void setMinimumSize (const QSize &)
 
void setMinimumSize (int minw, int minh)
 
void setMaximumSize (const QSize &)
 
void setMaximumSize (int maxw, int maxh)
 
void setMinimumWidth (int minw)
 
void setMinimumHeight (int minh)
 
void setMaximumWidth (int maxw)
 
void setMaximumHeight (int maxh)
 
void setupUi (QWidget *widget)
 
QSize sizeIncrement () const const
 
void setSizeIncrement (const QSize &)
 
void setSizeIncrement (int w, int h)
 
QSize baseSize () const const
 
void setBaseSize (const QSize &)
 
void setBaseSize (int basew, int baseh)
 
void setFixedSize (const QSize &s)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFixedHeight (int h)
 
QPoint mapToGlobal (const QPoint &pos) const const
 
QPoint mapFromGlobal (const QPoint &pos) const const
 
QPoint mapToParent (const QPoint &pos) const const
 
QPoint mapFromParent (const QPoint &pos) const const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const const
 
QWidgetwindow () const const
 
QWidgetnativeParentWidget () const const
 
QWidgettopLevelWidget () const const
 
const QPalettepalette () const const
 
void setPalette (const QPalette &)
 
void setBackgroundRole (QPalette::ColorRole role)
 
QPalette::ColorRole backgroundRole () const const
 
void setForegroundRole (QPalette::ColorRole role)
 
QPalette::ColorRole foregroundRole () const const
 
const QFontfont () const const
 
void setFont (const QFont &)
 
QFontMetrics fontMetrics () const const
 
QFontInfo fontInfo () const const
 
QCursor cursor () const const
 
void setCursor (const QCursor &)
 
void unsetCursor ()
 
void setMouseTracking (bool enable)
 
bool hasMouseTracking () const const
 
bool underMouse () const const
 
void setTabletTracking (bool enable)
 
bool hasTabletTracking () const const
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
QRegion mask () const const
 
void clearMask ()
 
void render (QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
void render (QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags)
 
QPixmap grab (const QRect &rectangle)
 
QGraphicsEffectgraphicsEffect () const const
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void grabGesture (Qt::GestureType gesture, Qt::GestureFlags flags)
 
void ungrabGesture (Qt::GestureType gesture)
 
void setWindowTitle (const QString &)
 
void setStyleSheet (const QString &styleSheet)
 
QString styleSheet () const const
 
QString windowTitle () const const
 
void setWindowIcon (const QIcon &icon)
 
QIcon windowIcon () const const
 
void setWindowIconText (const QString &)
 
QString windowIconText () const const
 
void setWindowRole (const QString &role)
 
QString windowRole () const const
 
void setWindowFilePath (const QString &filePath)
 
QString windowFilePath () const const
 
void setWindowOpacity (qreal level)
 
qreal windowOpacity () const const
 
bool isWindowModified () const const
 
void setToolTip (const QString &)
 
QString toolTip () const const
 
void setToolTipDuration (int msec)
 
int toolTipDuration () const const
 
void setStatusTip (const QString &)
 
QString statusTip () const const
 
void setWhatsThis (const QString &)
 
QString whatsThis () const const
 
QString accessibleName () const const
 
void setAccessibleName (const QString &name)
 
QString accessibleDescription () const const
 
void setAccessibleDescription (const QString &description)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
Qt::LayoutDirection layoutDirection () const const
 
void unsetLayoutDirection ()
 
void setLocale (const QLocale &locale)
 
QLocale locale () const const
 
void unsetLocale ()
 
void setFocus ()
 
bool isActiveWindow () const const
 
void activateWindow ()
 
void clearFocus ()
 
void setFocus (Qt::FocusReason reason)
 
Qt::FocusPolicy focusPolicy () const const
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
bool hasFocus () const const
 
void setFocusProxy (QWidget *w)
 
QWidgetfocusProxy () const const
 
Qt::ContextMenuPolicy contextMenuPolicy () const const
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
void releaseMouse ()
 
void grabKeyboard ()
 
void releaseKeyboard ()
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context)
 
void releaseShortcut (int id)
 
void setShortcutEnabled (int id, bool enable)
 
void setShortcutAutoRepeat (int id, bool enable)
 
bool updatesEnabled () const const
 
void setUpdatesEnabled (bool enable)
 
QGraphicsProxyWidgetgraphicsProxyWidget () const const
 
void update ()
 
void repaint ()
 
void update (int x, int y, int w, int h)
 
void update (const QRect &rect)
 
void update (const QRegion &rgn)
 
void repaint (int x, int y, int w, int h)
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &rgn)
 
virtual void setVisible (bool visible)
 
void setHidden (bool hidden)
 
void show ()
 
void hide ()
 
void showMinimized ()
 
void showMaximized ()
 
void showFullScreen ()
 
void showNormal ()
 
bool close ()
 
void raise ()
 
void lower ()
 
void stackUnder (QWidget *w)
 
void move (int x, int y)
 
void move (const QPoint &)
 
void resize (int w, int h)
 
void resize (const QSize &)
 
void setGeometry (int x, int y, int w, int h)
 
void setGeometry (const QRect &)
 
QByteArray saveGeometry () const const
 
bool restoreGeometry (const QByteArray &geometry)
 
void adjustSize ()
 
bool isVisible () const const
 
bool isVisibleTo (const QWidget *ancestor) const const
 
bool isHidden () const const
 
bool isMinimized () const const
 
bool isMaximized () const const
 
bool isFullScreen () const const
 
Qt::WindowStates windowState () const const
 
void setWindowState (Qt::WindowStates windowState)
 
virtual QSize sizeHint () const const
 
virtual QSize minimumSizeHint () const const
 
QSizePolicy sizePolicy () const const
 
void setSizePolicy (QSizePolicy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
virtual int heightForWidth (int w) const const
 
virtual bool hasHeightForWidth () const const
 
QRegion visibleRegion () const const
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContentsMargins (const QMargins &margins)
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const const
 
QMargins contentsMargins () const const
 
QRect contentsRect () const const
 
QLayoutlayout () const const
 
void setLayout (QLayout *layout)
 
void updateGeometry ()
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags f)
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &r)
 
QWidgetfocusWidget () const const
 
QWidgetnextInFocusChain () const const
 
QWidgetpreviousInFocusChain () const const
 
bool acceptDrops () const const
 
void setAcceptDrops (bool on)
 
void addAction (QAction *action)
 
void addActions (QList< QAction * > actions)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
void insertAction (QAction *before, QAction *action)
 
void removeAction (QAction *action)
 
QList< QAction * > actions () const const
 
QWidgetparentWidget () const const
 
void setWindowFlags (Qt::WindowFlags type)
 
Qt::WindowFlags windowFlags () const const
 
void setWindowFlag (Qt::WindowType flag, bool on)
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
Qt::WindowType windowType () const const
 
QWidgetchildAt (int x, int y) const const
 
QWidgetchildAt (const QPoint &p) const const
 
void setAttribute (Qt::WidgetAttribute attribute, bool on)
 
bool testAttribute (Qt::WidgetAttribute attribute) const const
 
virtual QPaintEnginepaintEngine () const const override
 
void ensurePolished () const const
 
bool isAncestorOf (const QWidget *child) const const
 
bool hasEditFocus () const const
 
void setEditFocus (bool enable)
 
bool autoFillBackground () const const
 
void setAutoFillBackground (bool enabled)
 
QBackingStorebackingStore () const const
 
QWindowwindowHandle () const const
 
void windowTitleChanged (const QString &title)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void customContextMenuRequested (const QPoint &pos)
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const const
 
Qt::InputMethodHints inputMethodHints () const const
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
 QWIDGETSIZE_MAX QWIDGETSIZE_MAX
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual ~QObject ()
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
- Public Member Functions inherited from QPaintDevice
virtual ~QPaintDevice ()
 
bool paintingActive () const const
 
int width () const const
 
int height () const const
 
int widthMM () const const
 
int heightMM () const const
 
int logicalDpiX () const const
 
int logicalDpiY () const const
 
int physicalDpiX () const const
 
int physicalDpiY () const const
 
int devicePixelRatio () const const
 
qreal devicePixelRatioF () const const
 
int colorCount () const const
 
int depth () const const
 

Static Public Member Functions

static void setMostRecentlyUsedFile (const QString &path)
 Registers the given path as most recently used file. More...
 
static MainWindow::FileInfo getOpenFileName (QWidget *parent, const QString &title, FileFormat::FileTypes types)
 Shows the open file dialog for the given file type(s) and returns the chosen file or an empty string if the dialog is aborted. More...
 
static void showMessageBox (QWidget *parent, const QString &title, const QString &headline, const std::vector< QString > &messages)
 Shows a message box for a list of unformatted messages. More...
 
- Static Public Member Functions inherited from QWidget
void setTabOrder (QWidget *first, QWidget *second)
 
QWidgetmouseGrabber ()
 
QWidgetkeyboardGrabber ()
 
QWidgetfind (WId id)
 
QWidgetcreateWindowContainer (QWindow *window, QWidget *parent, Qt::WindowFlags flags)
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 

Protected Slots

void switchActualPath (const QString &path)
 Switches to a different controller and loads the given path. More...
 
void openPathBacklog ()
 Open the files which have been registered by openPathLater(). More...
 
void settingsChanged ()
 Listens to configuration changes. More...
 

Protected Member Functions

void setCurrentFile (const QString &path, const FileFormat *format)
 Sets the path of the file edited by this windows' controller. More...
 
void setHasAutosaveConflict (bool value)
 Notifies the windows of autosave conflicts. More...
 
bool removeAutosaveFile () const
 Removes the autosave file if it exists. More...
 
bool event (QEvent *event) override
 
void closeEvent (QCloseEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void keyReleaseEvent (QKeyEvent *event) override
 
bool eventFilter (QObject *object, QEvent *event) override
 
- Protected Member Functions inherited from QMainWindow
virtual void contextMenuEvent (QContextMenuEvent *event) override
 
- Protected Member Functions inherited from QWidget
virtual void mousePressEvent (QMouseEvent *event)
 
virtual void mouseReleaseEvent (QMouseEvent *event)
 
virtual void mouseDoubleClickEvent (QMouseEvent *event)
 
virtual void mouseMoveEvent (QMouseEvent *event)
 
virtual void wheelEvent (QWheelEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void enterEvent (QEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
virtual void paintEvent (QPaintEvent *event)
 
virtual void moveEvent (QMoveEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 
virtual void tabletEvent (QTabletEvent *event)
 
virtual void actionEvent (QActionEvent *event)
 
virtual void dragEnterEvent (QDragEnterEvent *event)
 
virtual void dragMoveEvent (QDragMoveEvent *event)
 
virtual void dragLeaveEvent (QDragLeaveEvent *event)
 
virtual void dropEvent (QDropEvent *event)
 
virtual void showEvent (QShowEvent *event)
 
virtual void hideEvent (QHideEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void changeEvent (QEvent *event)
 
virtual int metric (QPaintDevice::PaintDeviceMetric m) const const override
 
virtual void initPainter (QPainter *painter) const const override
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
void updateMicroFocus ()
 
void create (WId window, bool initializeWindow, bool destroyOldWindow)
 
void destroy (bool destroyWindow, bool destroySubWindows)
 
virtual bool focusNextPrevChild (bool next)
 
bool focusNextChild ()
 
bool focusPreviousChild ()
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Protected Member Functions inherited from QPaintDevice
 QPaintDevice ()
 

Friends

class SymbolSettingDialog
 

Additional Inherited Members

- Public Attributes inherited from QMainWindow
typedef DockOptions
 
- Public Attributes inherited from QWidget
typedef RenderFlags
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Properties inherited from QMainWindow
 iconSize
 
 toolButtonStyle
 
 animated
 
 documentMode
 
 tabShape
 
 dockNestingEnabled
 
 dockOptions
 
 unifiedTitleAndToolBarOnMac
 
- Properties inherited from QWidget
 modal
 
 windowModality
 
 enabled
 
 geometry
 
 frameGeometry
 
 normalGeometry
 
 x
 
 y
 
 pos
 
 frameSize
 
 size
 
 width
 
 height
 
 rect
 
 childrenRect
 
 childrenRegion
 
 sizePolicy
 
 minimumSize
 
 maximumSize
 
 minimumWidth
 
 minimumHeight
 
 maximumWidth
 
 maximumHeight
 
 sizeIncrement
 
 baseSize
 
 palette
 
 font
 
 cursor
 
 mouseTracking
 
 tabletTracking
 
 isActiveWindow
 
 focusPolicy
 
 focus
 
 contextMenuPolicy
 
 updatesEnabled
 
 visible
 
 minimized
 
 maximized
 
 fullScreen
 
 sizeHint
 
 minimumSizeHint
 
 acceptDrops
 
 windowTitle
 
 windowIcon
 
 windowIconText
 
 windowOpacity
 
 windowModified
 
 toolTip
 
 toolTipDuration
 
 statusTip
 
 whatsThis
 
 accessibleName
 
 accessibleDescription
 
 layoutDirection
 
 windowFlags
 
 autoFillBackground
 
 styleSheet
 
 locale
 
 windowFilePath
 
 inputMethodHints
 
- Properties inherited from QObject
 objectName
 

Detailed Description

The MainWindow class provides the generic application window.

It always has an active controller (class MainWindowController) which provides the specific window content and behaviours. The controller can be exchanged while the window is visible.

Constructor & Destructor Documentation

◆ MainWindow()

OpenOrienteering::MainWindow::MainWindow ( QWidget parent = nullptr,
Qt::WindowFlags  flags = Qt::WindowFlags() 
)
explicit

Creates a new main window.

◆ ~MainWindow()

OpenOrienteering::MainWindow::~MainWindow ( )
override

Destroys a main window.

Member Function Documentation

◆ actualPathChanged

void OpenOrienteering::MainWindow::actualPathChanged ( const QString path)
signal

This signal is emitted when the actual path changes.

See also
switchActualPath()

◆ applicationStateChanged

void OpenOrienteering::MainWindow::applicationStateChanged ( )
slot

Reacts to application state changes.

On Android, when the application state becomes Qt::ApplicationActive, this method looks for the Android activity's current intent and triggers the loading of a given file (if there is not already another file loaded).

In general, when called for the first time after application start, it opens the most recently used file, unless this feature is disabled in the settings, and unless other files are registered for opening (i.e. files given as command line parameters.)

◆ appName()

QString OpenOrienteering::MainWindow::appName ( ) const

Returns the application's localized name.

◆ autosave

Autosave::AutosaveResult OpenOrienteering::MainWindow::autosave ( )
overrideslot

Save the current content to the current path.

◆ autosaveConflictResolved

void OpenOrienteering::MainWindow::autosaveConflictResolved ( )
signal

This signal is emitted when an autosave conflict gets resolved.

See also
setHasAutosaveConflict()

◆ clearStatusBarMessage()

void OpenOrienteering::MainWindow::clearStatusBarMessage ( )

Clears temporary messages set in the status bar with showStatusBarMessage().

◆ closeEvent()

void OpenOrienteering::MainWindow::closeEvent ( QCloseEvent event)
overrideprotectedvirtual

Reimplemented from QWidget.

◆ closeFile

bool OpenOrienteering::MainWindow::closeFile ( )
slot

Close the file currently opened.

If there are changes to the current file, the user will be asked if he wants to save it - the user may even cancel the closing of the file.

This will close the window unless this is the last window.

Returns
True if the file was actually closed, false otherwise.

◆ currentFormat()

const FileFormat* OpenOrienteering::MainWindow::currentFormat ( ) const
inline

Returns the file format of the currently open file.

It no file is open or the format is unknown, returns nullptr.

◆ currentPath()

const QString& OpenOrienteering::MainWindow::currentPath ( ) const
inline

Returns the canonical path of the currently open file.

It no file is open, returns an empty string.

◆ event()

bool OpenOrienteering::MainWindow::event ( QEvent event)
overrideprotectedvirtual

Reimplemented from QMainWindow.

◆ eventFilter()

bool OpenOrienteering::MainWindow::eventFilter ( QObject object,
QEvent event 
)
overrideprotectedvirtual

Reimplemented from QObject.

◆ getCloseAct()

QAction * OpenOrienteering::MainWindow::getCloseAct ( ) const
inline

Returns the close action.

◆ getController()

MainWindowController * OpenOrienteering::MainWindow::getController ( ) const
inline

Returns the current controller.

◆ getFileMenu()

QMenu * OpenOrienteering::MainWindow::getFileMenu ( ) const
inline

Returns the main window's file menu so that it can be extended.

◆ getFileMenuExtensionAct()

QAction * OpenOrienteering::MainWindow::getFileMenuExtensionAct ( ) const
inline

Returns an QAction which serves as extension point in the file menu.

◆ getGeneralToolBar()

QToolBar * OpenOrienteering::MainWindow::getGeneralToolBar ( ) const
inline

Returns a general toolbar with standard file actions (new, open, save).

The MainWindowController is responsible to add it to the main window. It will be destroyed (and recreated) when the controller changes.

◆ getOpenFileName()

MainWindow::FileInfo OpenOrienteering::MainWindow::getOpenFileName ( QWidget parent,
const QString title,
FileFormat::FileTypes  types 
)
static

Shows the open file dialog for the given file type(s) and returns the chosen file or an empty string if the dialog is aborted.

◆ getSaveAct()

QAction * OpenOrienteering::MainWindow::getSaveAct ( ) const
inline

Returns the save action.

◆ hasOpenedFile()

bool OpenOrienteering::MainWindow::hasOpenedFile ( ) const
inline

Returns true if a file is opened in this main window.

◆ hasUnsavedChanges()

bool OpenOrienteering::MainWindow::hasUnsavedChanges ( ) const
inline

Returns true if the opened file is marked as having unsaved changes.

◆ homeScreenDisabled()

bool OpenOrienteering::MainWindow::homeScreenDisabled ( ) const
inline

Indicates whether the home screen is disabled.

Normally the last main window will return to the home screen when a file is closed. When the home screen is disabled, the last window will be closed instead.

◆ keyPressEvent()

void OpenOrienteering::MainWindow::keyPressEvent ( QKeyEvent event)
overrideprotectedvirtual

Reimplemented from QWidget.

◆ keyReleaseEvent()

void OpenOrienteering::MainWindow::keyReleaseEvent ( QKeyEvent event)
overrideprotectedvirtual

Reimplemented from QWidget.

◆ linkClicked

void OpenOrienteering::MainWindow::linkClicked ( const QString link)
slot

Open a link.

This is called when the user clicks on a link in the UI, e.g. in the tip of the day.

Parameters
linkthe target URI

◆ openPath [1/2]

bool OpenOrienteering::MainWindow::openPath ( const QString path)
slot

Open the file with the given path.

May open a new main window. If loading is successful, the selected path will become the [new] window's current path.

Returns
true if loading was successful, false otherwise

◆ openPath [2/2]

bool OpenOrienteering::MainWindow::openPath ( const QString path,
const OpenOrienteering::FileFormat format 
)
slot

◆ openPathBacklog

void OpenOrienteering::MainWindow::openPathBacklog ( )
protectedslot

Open the files which have been registered by openPathLater().

◆ openPathLater()

void OpenOrienteering::MainWindow::openPathLater ( const QString path)

Open the file with the given path after all events have been processed.

May open a new main window. If loading is successful, the selected path will become the [new] window's current path.

◆ openRecentFile

void OpenOrienteering::MainWindow::openRecentFile ( )
slot

Open the file specified in the sending action's data.

This is intended for opening recent files.

◆ removeAutosaveFile()

bool OpenOrienteering::MainWindow::removeAutosaveFile ( ) const
protected

Removes the autosave file if it exists.

Returns true if the file was removed or didn't exist, false otherwise.

◆ save

bool OpenOrienteering::MainWindow::save ( )
slot

Save the current content to the current path.

This will trigger a file-save dialog if the current path is not set (i.e. empty).

◆ saveTo()

bool OpenOrienteering::MainWindow::saveTo ( const QString path,
const FileFormat format 
)

Save the content of the main window.

◆ setCentralWidget()

void OpenOrienteering::MainWindow::setCentralWidget ( QWidget widget)

Sets the MainWindow's effective central widget.

Any previously set widget will be hidden and scheduled for deletion.

Hides an implementation in QMainWindow which causes problems with dock widgets when switching from home screen widget to map widget. NEVER call QMainWindow::setCentralWidget(...) on a MainWindow.

◆ setController() [1/2]

void OpenOrienteering::MainWindow::setController ( MainWindowController new_controller)

Changes the controller.

The new controller does not edit a file.

◆ setController() [2/2]

void OpenOrienteering::MainWindow::setController ( MainWindowController new_controller,
const QString path,
const FileFormat format 
)

Changes the controller.

The new controller edits the file with the given path. The path may be empty for a new (unnamed) file.

◆ setCurrentFile()

void OpenOrienteering::MainWindow::setCurrentFile ( const QString path,
const FileFormat format 
)
protected

Sets the path of the file edited by this windows' controller.

This will update the window title via QWidget::setWindowFilePath().

If the controller was not set as having an opened file, the path must be empty.

◆ setHasAutosaveConflict()

void OpenOrienteering::MainWindow::setHasAutosaveConflict ( bool  value)
protected

Notifies the windows of autosave conflicts.

An autosave conflict is the situation where a autosaved file exists when the original file is opened. This autosaved file indicates that the original file was not properly closed, i.e. the software crashed before closing.

◆ setHasUnsavedChanges

void OpenOrienteering::MainWindow::setHasUnsavedChanges ( bool  value)
slot

Notifies this window of unsaved changes.

If the controller was set as having an opened file, setting this value to true will start the autosave countdown if the previous value was false.

This will update the window title via QWidget::setWindowModified().

◆ setHomeScreenDisabled()

void OpenOrienteering::MainWindow::setHomeScreenDisabled ( bool  disabled)

Sets whether to show the home screen after closing the last file.

See also
homeScreenDisabled()

◆ setMostRecentlyUsedFile()

void OpenOrienteering::MainWindow::setMostRecentlyUsedFile ( const QString path)
static

Registers the given path as most recently used file.

The path is added at (or moved to) the top of the list of most recently used files, and the directory is saved as most recently used directory.

◆ setShortcutsBlocked()

void OpenOrienteering::MainWindow::setShortcutsBlocked ( bool  blocked)

Blocks shortcuts.

During text input, it may be necessary to disable shortcuts.

Parameters
blockedtrue for blocking shortcuts, false for normal behaviour.

◆ setStatusBarText()

void OpenOrienteering::MainWindow::setStatusBarText ( const QString text)

Sets the text in the status bar.

◆ settingsChanged

void OpenOrienteering::MainWindow::settingsChanged ( )
protectedslot

Listens to configuration changes.

◆ shortcutsBlocked()

bool OpenOrienteering::MainWindow::shortcutsBlocked ( ) const
inline

Returns true if shortcuts are currently disabled.

◆ showAbout

void OpenOrienteering::MainWindow::showAbout ( )
slot

Show the about dialog.

◆ showHelp

void OpenOrienteering::MainWindow::showHelp ( )
slot

Show the index page of the manual in the help browser.

◆ showMessageBox()

void OpenOrienteering::MainWindow::showMessageBox ( QWidget parent,
const QString title,
const QString headline,
const std::vector< QString > &  messages 
)
static

Shows a message box for a list of unformatted messages.

◆ showNewMapWizard

void OpenOrienteering::MainWindow::showNewMapWizard ( )
slot

Show a wizard for creating new maps.

May open a new main window.

Todo:
error message, cleanup

◆ showOpenDialog

void OpenOrienteering::MainWindow::showOpenDialog ( )
slot

Show a file-open dialog and load the select file.

May open a new main window. If loading is successful, the selected path will become the [new] window's current path.

◆ showSaveAsDialog

bool OpenOrienteering::MainWindow::showSaveAsDialog ( )
slot

Show a file-save dialog.

If saving is successful, the selected path will become this window's current path.

Returns
true if saving was successful, false otherwise

◆ showSettings

void OpenOrienteering::MainWindow::showSettings ( )
slot

Show the settings dialog.

◆ showStatusBarMessage()

void OpenOrienteering::MainWindow::showStatusBarMessage ( const QString text,
int  timeout = 0 
)

Shows a temporary message in the status bar.

Normally, the message won't become visible before control returns to the event loop where the GUI update events are processed. For messages indicating a potentially long-running operation, use showStatusBarMessageImmediately() instead.

◆ showStatusBarMessageImmediately()

void OpenOrienteering::MainWindow::showStatusBarMessageImmediately ( const QString text,
int  timeout = 0 
)

Shows a temporary message in the status bar immediately.

Use this function instead of showStatusBarMessage() when indicating the start of potentially long-running operations to ensure that GUI update events are processed immediately.

◆ switchActualPath

void OpenOrienteering::MainWindow::switchActualPath ( const QString path)
protectedslot

Switches to a different controller and loads the given path.

This method is meant for switching between an original file and autosaved versions. It does not touch current_path. The class of the new controller is determined from the current_path (i.e. original file).

If the given path is the current actual_path, no change is made.

If the currently loaded file was modified, the user is asked whether he really wants to switch to another file which means losing the changes he had made.

◆ toggleFullscreenMode

void OpenOrienteering::MainWindow::toggleFullscreenMode ( )
slot

Toggle between normal window and fullscreen mode.

◆ updateRecentFileActions

void OpenOrienteering::MainWindow::updateRecentFileActions ( )
slot

Notify the main window of a change to the list of recent files.

Friends And Related Function Documentation

◆ SymbolSettingDialog

friend class SymbolSettingDialog
friend

The documentation for this class was generated from the following files: