MessageManager: Allow more control when showing Pane

Change-Id: I7169473818cf726545a85cdc686655b0d4dbf3e7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tobias Hunger
2017-08-29 12:46:53 +02:00
parent 139792ee25
commit a5e447b4f8
2 changed files with 16 additions and 16 deletions

View File

@@ -38,6 +38,19 @@ MessageManager *MessageManager::instance()
return m_instance;
}
void MessageManager::showOutputPane(Core::MessageManager::PrintToOutputPaneFlags flags)
{
if (!m_messageOutputWindow)
return;
if (flags & Flash) {
m_messageOutputWindow->flash();
} else if (flags & Silent) {
// Do nothing
} else {
m_messageOutputWindow->popup(IOutputPane::Flag(int(flags)));
}
}
MessageManager::MessageManager()
{
m_instance = this;
@@ -60,24 +73,11 @@ void MessageManager::init()
ExtensionSystem::PluginManager::addObject(m_messageOutputWindow);
}
void MessageManager::showOutputPane()
{
if (m_messageOutputWindow)
m_messageOutputWindow->popup(IOutputPane::ModeSwitch);
}
void MessageManager::write(const QString &text, PrintToOutputPaneFlags flags)
{
if (!m_messageOutputWindow)
return;
if (flags & Flash) {
m_messageOutputWindow->flash();
} else if (flags & Silent) {
// Do nothing
} else {
m_messageOutputWindow->popup(IOutputPane::Flag(int(flags)));
}
showOutputPane(flags);
m_messageOutputWindow->append(text + QLatin1Char('\n'));
}

View File

@@ -42,8 +42,6 @@ class CORE_EXPORT MessageManager : public QObject
public:
static MessageManager *instance();
static void showOutputPane();
enum PrintToOutputPaneFlag {
NoModeSwitch = IOutputPane::NoModeSwitch,
ModeSwitch = IOutputPane::ModeSwitch,
@@ -55,6 +53,8 @@ public:
Q_DECLARE_FLAGS(PrintToOutputPaneFlags, PrintToOutputPaneFlag)
static void showOutputPane(Core::MessageManager::PrintToOutputPaneFlags flags = NoModeSwitch);
public slots:
static void write(const QString &text,
Core::MessageManager::PrintToOutputPaneFlags flags = NoModeSwitch);