code style
This commit is contained in:
parent
2dcde7b37a
commit
282f51da87
|
@ -31,7 +31,8 @@ static int debugLevel = 0;
|
|||
static std::unique_ptr<QTextStream> logFile = std::unique_ptr<QTextStream>();
|
||||
static std::unique_ptr<QFile> file = std::unique_ptr<QFile>();
|
||||
|
||||
static void init(){
|
||||
static void init()
|
||||
{
|
||||
debugLevel = qgetenv("LIBSNORE_DEBUG_LVL").toInt();
|
||||
if (qgetenv("LIBSNORE_LOG_TO_FILE").toInt() == 1) {
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ using namespace Snore;
|
|||
SnorePlugin::SnorePlugin(const QString &name) :
|
||||
m_name(name)
|
||||
{
|
||||
Q_ASSERT_X(thread() != qApp->thread(),Q_FUNC_INFO,"Plugin initialized in wrong thread");
|
||||
Q_ASSERT_X(thread() != qApp->thread(), Q_FUNC_INFO, "Plugin initialized in wrong thread");
|
||||
if (thread() != qApp->thread()) {
|
||||
snoreDebug(SNORE_WARNING) << "Plugin initialized in wrong thread.";
|
||||
snoreDebug(SNORE_WARNING) << "Plugin initialized in wrong thread.";
|
||||
}
|
||||
setDefaultValue("Enabled", false, LOCAL_SETTING);
|
||||
}
|
||||
|
|
|
@ -112,5 +112,4 @@ private:
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
#endif // SNORECOREPRIVATE_H
|
||||
|
|
|
@ -59,7 +59,7 @@ void Utils::raiseWindowToFront(qlonglong wid)
|
|||
// Looks like qt is handling it on linux.
|
||||
#ifdef Q_OS_WIN
|
||||
int active = attatchToActiveProcess();
|
||||
SetWindowPos((HWND)wid, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
|
||||
SetWindowPos((HWND)wid, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
detatchActiveProcess(active);
|
||||
#else
|
||||
Q_UNUSED(wid);
|
||||
|
@ -75,7 +75,7 @@ int Utils::attatchToActiveProcess()
|
|||
|
||||
void Utils::detatchActiveProcess(int idActive)
|
||||
{
|
||||
if (idActive!= -1) {
|
||||
if (idActive != -1) {
|
||||
AttachThreadInput(GetCurrentThreadId(), idActive, FALSE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,10 @@
|
|||
#include <QTextDocument>
|
||||
#include <QTextDocumentFragment>
|
||||
|
||||
namespace Snore {
|
||||
class SNORE_EXPORT Utils : public QObject {
|
||||
namespace Snore
|
||||
{
|
||||
class SNORE_EXPORT Utils : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Utils(QObject *parent = nullptr);
|
||||
|
@ -83,8 +85,8 @@ public:
|
|||
|
||||
private:
|
||||
#ifdef Q_OS_WIN
|
||||
static int attatchToActiveProcess();
|
||||
static void detatchActiveProcess(int idActive);
|
||||
static int attatchToActiveProcess();
|
||||
static void detatchActiveProcess(int idActive);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
|
|
@ -49,12 +49,12 @@ void NotifyMyAndroid::slotNotify(Notification notification)
|
|||
|
||||
// TODO: use toHTML?
|
||||
QString data(QString("apikey=%1&application=%2&event=%3&description=%4&content-type=text/html")
|
||||
.arg(key,
|
||||
notification.application().name(),
|
||||
Utils::toPlainText(notification.title()),
|
||||
Utils::toPlainText(notification.text())));
|
||||
.arg(key,
|
||||
notification.application().name(),
|
||||
Utils::toPlainText(notification.title()),
|
||||
Utils::toPlainText(notification.text())));
|
||||
|
||||
QNetworkReply *reply = m_manager.post(request,data.toUtf8().constData());
|
||||
QNetworkReply *reply = m_manager.post(request, data.toUtf8().constData());
|
||||
connect(reply, &QNetworkReply::finished, [reply]() {
|
||||
snoreDebug(SNORE_DEBUG) << reply->error();
|
||||
snoreDebug(SNORE_DEBUG) << reply->readAll();
|
||||
|
|
|
@ -27,7 +27,7 @@ Sound::Sound():
|
|||
SnoreSecondaryBackend("Sound", false),
|
||||
m_player(new QMediaPlayer(this))
|
||||
{
|
||||
setDefaultValue("Volume",50);
|
||||
setDefaultValue("Volume", 50);
|
||||
m_player->setVolume(value("Volume").toInt());
|
||||
// connect(m_player,QMediaPlayer::positionChanged,[](qint64 pos){
|
||||
// snoreDebug(SNORE_DEBUG) << "Player: " << pos;
|
||||
|
@ -65,9 +65,9 @@ void Sound::slotNotify(Snore::Notification notification)
|
|||
QTimer *timeout = new QTimer(this);
|
||||
timeout->setSingleShot(true);
|
||||
timeout->setInterval(notification.timeout() * 1000);
|
||||
connect(timeout, &QTimer::timeout, [this,timeout]{
|
||||
m_player->stop();
|
||||
timeout->deleteLater();
|
||||
connect(timeout, &QTimer::timeout, [this, timeout] {
|
||||
m_player->stop();
|
||||
timeout->deleteLater();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ SoundSettings::SoundSettings(SnorePlugin *snorePlugin, QWidget *parent) :
|
|||
m_lineEditFileName(new QLineEdit),
|
||||
m_spinBoxVolume(new QSpinBox)
|
||||
{
|
||||
m_spinBoxVolume->setRange(0,100);
|
||||
m_spinBoxVolume->setRange(0, 100);
|
||||
addRow(tr("Volume:"), m_spinBoxVolume);
|
||||
|
||||
addRow(tr("Audio file:"), m_lineEditFileName);
|
||||
|
|
Loading…
Reference in New Issue