Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jun 15, 2020
1 parent 33c6cd5 commit 71c0acb
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/mainwindow.cpp
Expand Up @@ -400,17 +400,6 @@ void MainWindow::closeEvent(QCloseEvent *pEvent)

qApp->setProperty("OpenCOR::aboutToQuit()", true);

// Delete any Web inspector window (which may have been created through
// our use of QtWebKit)

static const QString QWebInspectorClassWindow = "QWebInspectorClassWindow";

for (auto window : QGuiApplication::topLevelWindows()) {
if (window->objectName() == QWebInspectorClassWindow) {
window->close();
}
}

// Keep track of our default settings
// Note: it must be done here, as opposed to the destructor, otherwise
// some settings (e.g. docked windows) won't be properly saved...
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/widget/WebViewerWidget/CMakeLists.txt
Expand Up @@ -4,8 +4,8 @@ project(WebViewerWidgetPlugin)

add_plugin(WebViewerWidget
SOURCES
../../i18ninterface.cpp
../../plugininfo.cpp
../../plugininterface.cpp

src/webviewerwidget.cpp
src/webviewerwidgetplugin.cpp
Expand Down
87 changes: 87 additions & 0 deletions src/plugins/widget/WebViewerWidget/src/webviewerwidgetplugin.cpp
Expand Up @@ -25,6 +25,11 @@ along with this program. If not, see <https://gnu.org/licenses>.

//==============================================================================

#include <QApplication>
#include <QWindow>

//==============================================================================

namespace OpenCOR {
namespace WebViewerWidget {

Expand All @@ -42,6 +47,88 @@ PLUGININFO_FUNC WebViewerWidgetPluginInfo()
descriptions);
}

//==============================================================================
// Plugin interface
//==============================================================================

bool WebViewerWidgetPlugin::definesPluginInterfaces()
{
// We don't handle this interface...

return false;
}

//==============================================================================

bool WebViewerWidgetPlugin::pluginInterfacesOk(const QString &pFileName,
QObject *pInstance)
{
Q_UNUSED(pFileName)
Q_UNUSED(pInstance)

// We don't handle this interface...

return false;
}

//==============================================================================

void WebViewerWidgetPlugin::initializePlugin()
{
// We don't handle this interface...
}

//==============================================================================

void WebViewerWidgetPlugin::finalizePlugin()
{
// We don't handle this interface...
}

//==============================================================================

void WebViewerWidgetPlugin::pluginsInitialized(const Plugins &pLoadedPlugins)
{
Q_UNUSED(pLoadedPlugins)

// We don't handle this interface...
}

//==============================================================================

void WebViewerWidgetPlugin::loadSettings(QSettings &pSettings)
{
Q_UNUSED(pSettings)

// We don't handle this interface...
}

//==============================================================================

void WebViewerWidgetPlugin::saveSettings(QSettings &pSettings) const
{
Q_UNUSED(pSettings)

// Delete any Web inspector window, if any

static const QString QWebInspectorClassWindow = "QWebInspectorClassWindow";

for (auto window : QGuiApplication::topLevelWindows()) {
if (window->objectName() == QWebInspectorClassWindow) {
window->close();
}
}
}

//==============================================================================

void WebViewerWidgetPlugin::handleUrl(const QUrl &pUrl)
{
Q_UNUSED(pUrl)

// We don't handle this interface...
}

//==============================================================================

} // namespace WebViewerWidget
Expand Down
Expand Up @@ -26,6 +26,7 @@ along with this program. If not, see <https://gnu.org/licenses>.
//==============================================================================

#include "plugininfo.h"
#include "plugininterface.h"

//==============================================================================

Expand All @@ -38,11 +39,16 @@ PLUGININFO_FUNC WebViewerWidgetPluginInfo();

//==============================================================================

class WebViewerWidgetPlugin : public QObject
class WebViewerWidgetPlugin : public QObject, public PluginInterface
{
Q_OBJECT

Q_PLUGIN_METADATA(IID "OpenCOR.WebViewerWidgetPlugin" FILE "webviewerwidgetplugin.json")

Q_INTERFACES(OpenCOR::PluginInterface)

public:
#include "plugininterface.inl"
};

//==============================================================================
Expand Down

0 comments on commit 71c0acb

Please sign in to comment.