aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/coco/cococommon.cpp
blob: 9d0b1d32072fc6002a7fc937b0218507a40124a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#include "cococommon.h"

#include "cocopluginconstants.h"

#include <coreplugin/messagemanager.h>

QString maybeQuote(const QString &str)
{
    if ((str.contains(' ') || str.contains('\t')) && !str.startsWith('"'))
        return '"' + str + '"';
    else
        return str;
}

void logSilently(const QString &msg)
{
    static const QString prefix = QString{"[%1] "}.arg(Coco::Constants::PROFILE_NAME);

    Core::MessageManager::writeSilently(prefix + msg);
}

void logFlashing(const QString &msg)
{
    static const QString prefix = QString{"[%1] "}.arg(Coco::Constants::PROFILE_NAME);

    Core::MessageManager::writeFlashing(prefix + msg);
}