mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-10 04:15:51 +00:00
port library
This commit is contained in:
@ -7,7 +7,7 @@ include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
${Kf6_INCLUDE}
|
||||
)
|
||||
|
||||
file(GLOB SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp ${CMAKE_SOURCE_DIR}/*.cpp)
|
||||
@ -30,7 +30,7 @@ configure_file(${SUBPROJECT_WEATHER_JSON_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPR
|
||||
|
||||
qt6_wrap_ui(SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library(${SUBPROJECT} STATIC ${SUBPROJECT_SOURCE} ${SUBPROJECT_HEADER} ${SUBPROJECT_UI_HEADER})
|
||||
target_link_libraries(${SUBPROJECT} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
target_link_libraries(${SUBPROJECT} ${Qt_LIBRARIES} ${Kf6_LIBRARIES})
|
||||
|
||||
# install
|
||||
install(DIRECTORY ${SUBPROJECT_CONFIGS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
@ -41,5 +41,5 @@ install(DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJEC
|
||||
install(DIRECTORY ${SUBPROJECT_REQUESTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(DIRECTORY ${SUBPROJECT_WEATHER} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install(FILES ${SUBPROJECT_INI} DESTINATION ${KDE_INSTALL_FULL_CONFDIR})
|
||||
install(FILES ${SUBPROJECT_INI} DESTINATION ${KDE_INSTALL_CONFDIR})
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_WEATHER_JSON} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME}/weather)
|
||||
|
@ -99,7 +99,7 @@ QString AbstractExtItem::writtableConfig() const
|
||||
{
|
||||
QString path = m_fileName;
|
||||
QString name = QFileInfo(path).fileName();
|
||||
path.remove(path.count() - name.count() - 1, name.count() + 1);
|
||||
path.remove(path.length() - name.length() - 1, name.length() + 1);
|
||||
QString dir = QFileInfo(path).fileName();
|
||||
|
||||
return QString("%1/awesomewidgets/%2/%3")
|
||||
|
@ -18,6 +18,8 @@
|
||||
#ifndef AWABSTRACTFORMATTER_H
|
||||
#define AWABSTRACTFORMATTER_H
|
||||
|
||||
#include <QRegularExpression>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@ QString AWJsonFormatter::convert(const QVariant &_value) const
|
||||
qCDebug(LOG_LIB) << "Convert value" << _value;
|
||||
|
||||
// check if _value is string and parse first if required
|
||||
QJsonDocument json = _value.type() == QVariant::String ? QJsonDocument::fromJson(_value.toString().toUtf8())
|
||||
QJsonDocument json = _value.userType() == QMetaType::QString ? QJsonDocument::fromJson(_value.toString().toUtf8())
|
||||
: QJsonDocument::fromVariant(_value);
|
||||
QVariant converted = json.toVariant();
|
||||
for (auto &element : m_splittedPath)
|
||||
@ -147,9 +147,9 @@ QVariant AWJsonFormatter::getFromJson(const QVariant &_value, const QVariant &_e
|
||||
{
|
||||
qCDebug(LOG_LIB) << "Looking for element" << _element << "in" << _value;
|
||||
|
||||
if (_element.type() == QVariant::String) {
|
||||
if (_element.userType() == QMetaType::QString) {
|
||||
return getFromMap(_value, _element.toString());
|
||||
} else if (_element.type() == QVariant::Int) {
|
||||
} else if (_element.userType() == QMetaType::Int) {
|
||||
return getFromList(_value, _element.toInt());
|
||||
} else {
|
||||
qCWarning(LOG_LIB) << "Unknown type" << _element.typeName();
|
||||
|
@ -97,7 +97,7 @@ void AWListFormatter::setFilter(const QString &_filter)
|
||||
qCDebug(LOG_LIB) << "Filter" << _filter;
|
||||
|
||||
m_filter = _filter;
|
||||
m_regex = QRegExp(m_filter);
|
||||
m_regex = QRegularExpression(m_filter);
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ private:
|
||||
QString m_filter = "";
|
||||
QString m_separator = "";
|
||||
bool m_sorted = false;
|
||||
QRegExp m_regex;
|
||||
QRegularExpression m_regex;
|
||||
};
|
||||
|
||||
|
||||
|
@ -20,9 +20,7 @@
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include <qreplytimeout/qreplytimeout.h>
|
||||
|
||||
@ -174,7 +172,7 @@ void ExtNetworkRequest::networkReplyReceived(QNetworkReply *_reply)
|
||||
}
|
||||
|
||||
m_isRunning = false;
|
||||
m_values[tag("response")] = QTextCodec::codecForMib(106)->toUnicode(_reply->readAll()).trimmed();
|
||||
m_values[tag("response")] = QString::fromUtf8(_reply->readAll()).trimmed();
|
||||
|
||||
emit(dataReceived(m_values));
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -325,9 +324,9 @@ void ExtScript::startProcess()
|
||||
void ExtScript::updateValue()
|
||||
{
|
||||
qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode();
|
||||
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardError()).trimmed();
|
||||
QString qdebug = QString::fromUtf8(m_process->readAllStandardError()).trimmed();
|
||||
qCInfo(LOG_LIB) << "Error" << qdebug;
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
|
||||
QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed();
|
||||
qCInfo(LOG_LIB) << "Output" << qoutput;
|
||||
QString strValue;
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -214,10 +213,10 @@ void ExtUpgrade::updateValue()
|
||||
qCInfo(LOG_LIB) << "Cmd returns" << m_process->exitCode();
|
||||
qCInfo(LOG_LIB) << "Error" << m_process->readAllStandardError();
|
||||
|
||||
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(m_process->readAllStandardOutput()).trimmed();
|
||||
QString qoutput = QString::fromUtf8(m_process->readAllStandardOutput()).trimmed();
|
||||
m_values[tag("pkgcount")] = [this](const QString &output) {
|
||||
return filter().isEmpty() ? output.split('\n', Qt::SkipEmptyParts).count() - null()
|
||||
: output.split('\n', Qt::SkipEmptyParts).filter(QRegExp(filter())).count();
|
||||
: output.split('\n', Qt::SkipEmptyParts).filter(QRegularExpression(filter())).count();
|
||||
}(qoutput);
|
||||
|
||||
emit(dataReceived(m_values));
|
||||
|
@ -99,7 +99,7 @@ QVariantHash OWMWeatherProvider::parseSingleJson(const QVariantMap &_json) const
|
||||
}
|
||||
|
||||
// timestamp
|
||||
output[tag("timestamp")] = QDateTime::fromTime_t(_json["dt"].toUInt()).toUTC();
|
||||
output[tag("timestamp")] = QDateTime::fromSecsSinceEpoch(_json["dt"].toUInt()).toUTC();
|
||||
|
||||
return output;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include "stooqquotesprovider.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
#include <QUrlQuery>
|
||||
|
||||
#include "awdebug.h"
|
||||
@ -55,7 +54,7 @@ QVariantHash StooqQuotesProvider::parse(const QByteArray &_source, const QVarian
|
||||
|
||||
QVariantHash values;
|
||||
|
||||
QStringList sourceValues = QTextCodec::codecForMib(106)->toUnicode(_source).trimmed().split(',');
|
||||
QStringList sourceValues = QString::fromUtf8(_source).trimmed().split(',');
|
||||
if (sourceValues.count() != 2) {
|
||||
qCWarning(LOG_LIB) << "Parse error" << sourceValues;
|
||||
return values;
|
||||
|
Reference in New Issue
Block a user