Example #1
0
/*!
  Reads the settings stored in the file \a logger.ini.
*/
void TLogger::readSettings()
{
    // Sets the codec
    QSettings &settings = Tf::app()->loggerSettings();
    QByteArray codecName = settings.value(DEFAULT_TEXT_ENCODING).toByteArray().trimmed();
    if (!codecName.isEmpty()) {
        QTextCodec *c = QTextCodec::codecForName(codecName);
        if (c) {
            if (c->name() != QTextCodec::codecForLocale()->name()) {
                codec_ = c;
            }
            //tSystemDebug("set log text codec: %s", c->name().data());
        } else {
            tSystemError("log text codec matching the name could be not found: %s", codecName.data());
        }
    }

    layout_ = settingsValue("Layout", "%m%n").toByteArray();
    dateTimeFormat_ = settingsValue("DateTimeFormat").toByteArray();

    QByteArray pri = settingsValue("Threshold", "trace").toByteArray().toUpper().trimmed();
    threshold_ = priorityHash()->key(pri, TLogger::Trace);

    QFileInfo fi(settingsValue("Target", "log/app.log").toString());
    target_ = (fi.isAbsolute()) ? fi.absoluteFilePath() : Tf::app()->webRootPath() + fi.filePath();

    QDir dir = QFileInfo(target_).dir();
    if (!dir.exists()) {
        // Created a directory
        dir.mkpath(".");
    }
}
Example #2
0
void Util::bellAlert()
{
    if(!iWindow)
        return;

    if( settingsValue("general/visualBell", true).toBool() ) {
        emit visualBell();
    }
}
Example #3
0
void Util::keyPressFeedback()
{
    if( !settingsValue("ui/keyPressFeedback", true).toBool() )
        return;

#ifdef HAVE_FEEDBACK
    QFeedbackEffect::playThemeEffect(QFeedbackEffect::PressWeak);
#endif
}
Example #4
0
void Util::keyReleaseFeedback()
{
    if( !settingsValue("ui/keyPressFeedback", true).toBool() )
        return;

    // TODO: check what's more comfortable, only press, or press and release
#ifdef HAVE_FEEDBACK
    QFeedbackEffect::playThemeEffect(QFeedbackEffect::ReleaseWeak);
#endif
}
Example #5
0
int Util::keyboardMode()
{
    QString mode = settingsValue("ui/vkbShowMethod", "move").toString();

    if (mode == "fade") {
        return KeyboardFade;
    } else if (mode == "move") {
        return KeyboardMove;
    } else {
        return KeyboardOff;
    }
}
Example #6
0
int Util::orientationMode()
{
    QString mode = settingsValue("ui/orientationLockMode", "auto").toString();

    if (mode == "auto") {
        return OrientationAuto;
    } else if (mode == "landscape") {
        return OrientationLandscape;
    } else {
        return OrientationPortrait;
    }
}
Example #7
0
int Util::dragMode()
{
    QString mode = settingsValue("ui/dragMode", "scroll").toString();

    if (mode == "gestures") {
        return DragGestures;
    } else if (mode == "scroll") {
        return DragScroll;
    } else if (mode == "select") {
        return DragSelect;
    } else {
        return DragOff;
    }
}
Example #8
0
void Toasty::slotNotify(Snore::Notification notification)
{
    QString key = settingsValue(ToastyConstants::DeviceID).toString();
    if (key.isEmpty()) {
        return;
    }
    QNetworkRequest request(QUrl::fromUserInput(QLatin1String("http://api.supertoasty.com/notify/") + key));
    QHttpMultiPart *mp = new QHttpMultiPart(QHttpMultiPart::FormDataType);

    QHttpPart title;
    title.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"title\"")));
    title.setBody(notification.title().toUtf8().constData());
    mp->append(title);

    QHttpPart text;
    text.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"text\"")));
    text.setBody(notification.text().toUtf8().constData());
    mp->append(text);

    QHttpPart app;
    app.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"sender\"")));
    app.setBody(notification.application().name().toUtf8().constData());
    mp->append(app);

    QHttpPart icon;

    icon.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QLatin1String("form-data; name=\"image\"; filename=\"") + notification.icon().localUrl(QSize(128, 128)) + QLatin1Char('"')));
    icon.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(QLatin1String("image/png")));
    QFile *file = new QFile(notification.icon().localUrl(QSize(128, 128)));
    file->open(QIODevice::ReadOnly);
    icon.setBodyDevice(file);
    mp->append(icon);

    QNetworkReply *reply =  m_manager.post(request, mp);
    mp->setParent(reply);
    file->setParent(reply);

    connect(reply, &QNetworkReply::finished, [reply]() {
        qCDebug(SNORE) << reply->error();
        qCDebug(SNORE) << reply->readAll();
        reply->close();
        reply->deleteLater();
    });

}
Example #9
0
void PushoverSettings::load()
{
    m_deviceLineEdit->setText(settingsValue(PushoverConstants::Devices).toString());
}
Example #10
0
bool Util::showWelcomeScreen()
{
    return settingsValue("state/showWelcomeScreen", true).toBool();
}
Example #11
0
int Util::keyboardMargins()
{
    return settingsValue("ui/keyboardMargins", 10).toInt();
}
Example #12
0
QString Util::charset()
{
    return settingsValue("terminal/charset", "UTF-8").toString();
}
Example #13
0
int Util::extraLinesFromCursor()
{
    return settingsValue("ui/showExtraLinesFromCursor", 1).toInt();
}
Example #14
0
void SnoreSettings::load()
{
    m_comboBox->setCurrentIndex(settingsValue(SnoreBackendConstants::Position).toInt());
}
Example #15
0
/*!
    Get filter wildcards, which using for filtering out some files, which should be removed
    from view (object files, temporary files, ...)
    \return StringList of wildcards, which should be removed from tree
*/
QStringList FileBrowser::filters() const
{ return settingsValue( "Wildcards", QStringList() << "*~" << "*.o" << "*.pyc" << "*.bak" ).toStringList(); }
Example #16
0
QStringList FileBrowser::bookmarks() const
{
    return settingsValue( "Bookmarks", QStringList() << QDir::homePath() << pMonkeyStudio::defaultProjectsDirectory() ).toStringList();
}
Example #17
0
QString Util::fontFamily()
{
    return settingsValue("ui/fontFamily", DEFAULT_FONTFAMILY).toString();
}
Example #18
0
int Util::fontSize()
{
    return settingsValue("ui/fontSize", 11).toInt();
}
Example #19
0
/*!
    Get current file path from the settings
    \return Directory/File path
*/
QString FileBrowser::filePath() const
{ return settingsValue( "FilePath" ).toString(); }
Example #20
0
int Util::keyboardFadeOutDelay()
{
    return settingsValue("ui/keyboardFadeOutDelay", 4000).toInt();
}
void ToastySettings::load()
{
    m_lineEdit->setText(settingsValue(QLatin1String("DeviceID")).toString());
}
Example #22
0
QString Util::keyboardLayout()
{
    return settingsValue("ui/keyboardLayout", "english").toString();
}