forked from qt-creator/qt-creator
SerialTerminal: Hide plugin class in .cpp
Change-Id: I9d1a179a9de4f0e95fe60b62b91743c540534246 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -8,7 +8,7 @@ add_qtc_plugin(SerialTerminal
|
||||
serialdevicemodel.cpp serialdevicemodel.h
|
||||
serialoutputpane.cpp serialoutputpane.h
|
||||
serialterminalconstants.h
|
||||
serialterminalplugin.cpp serialterminalplugin.h
|
||||
serialterminalplugin.cpp
|
||||
serialterminalsettings.cpp serialterminalsettings.h
|
||||
serialterminaltr.h
|
||||
)
|
||||
|
@@ -20,7 +20,6 @@ QtcPlugin {
|
||||
"serialoutputpane.h",
|
||||
"serialterminalconstants.h",
|
||||
"serialterminalplugin.cpp",
|
||||
"serialterminalplugin.h",
|
||||
"serialterminalsettings.cpp",
|
||||
"serialterminalsettings.h",
|
||||
"serialterminaltr.h",
|
||||
|
@@ -1,16 +1,27 @@
|
||||
// Copyright (C) 2018 Benjamin Balga
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "serialterminalplugin.h"
|
||||
|
||||
#include "serialcontrol.h"
|
||||
#include "serialoutputpane.h"
|
||||
#include "serialterminalsettings.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
namespace SerialTerminal {
|
||||
namespace Internal {
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
void SerialTerminalPlugin::initialize()
|
||||
#include <memory>
|
||||
|
||||
namespace SerialTerminal::Internal {
|
||||
|
||||
class SerialTerminalPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "SerialTerminal.json")
|
||||
|
||||
public:
|
||||
explicit SerialTerminalPlugin() = default;
|
||||
|
||||
void initialize() final
|
||||
{
|
||||
m_settings.load(Core::ICore::settings());
|
||||
|
||||
@@ -23,14 +34,14 @@ void SerialTerminalPlugin::initialize()
|
||||
this, [this] { m_settings.save(Core::ICore::settings()); });
|
||||
}
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag SerialTerminalPlugin::aboutToShutdown()
|
||||
ShutdownFlag aboutToShutdown() final
|
||||
{
|
||||
m_serialOutputPane->closeTabs(SerialOutputPane::CloseTabNoPrompt);
|
||||
|
||||
return SynchronousShutdown;
|
||||
}
|
||||
|
||||
void SerialTerminalPlugin::settingsChanged(const Settings &settings)
|
||||
void settingsChanged(const Settings &settings)
|
||||
{
|
||||
m_settings = settings;
|
||||
m_settings.save(Core::ICore::settings());
|
||||
@@ -38,5 +49,10 @@ void SerialTerminalPlugin::settingsChanged(const Settings &settings)
|
||||
m_serialOutputPane->setSettings(m_settings);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace SerialTerminal
|
||||
Settings m_settings;
|
||||
std::unique_ptr<SerialOutputPane> m_serialOutputPane;
|
||||
};
|
||||
|
||||
} // SerialTerminal::Internal
|
||||
|
||||
#include "serialterminalplugin.moc"
|
||||
|
@@ -1,35 +0,0 @@
|
||||
// Copyright (C) 2018 Benjamin Balga
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "serialoutputpane.h"
|
||||
#include "serialterminalsettings.h"
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace SerialTerminal {
|
||||
namespace Internal {
|
||||
|
||||
class SerialTerminalPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "SerialTerminal.json")
|
||||
|
||||
public:
|
||||
explicit SerialTerminalPlugin() = default;
|
||||
|
||||
void initialize() final;
|
||||
ShutdownFlag aboutToShutdown() final;
|
||||
|
||||
private:
|
||||
void settingsChanged(const Settings &settings);
|
||||
|
||||
Settings m_settings;
|
||||
std::unique_ptr<SerialOutputPane> m_serialOutputPane;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace SerialTerminal
|
Reference in New Issue
Block a user