mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 15:37:23 +00:00
* fix building
* add clang build * more correct method types
This commit is contained in:
parent
880a986782
commit
4742617e3e
@ -8,7 +8,7 @@ ProjectRootRelative=./
|
||||
|
||||
[CMake][CMake Build Directory 0]
|
||||
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||
Build Type=Release
|
||||
Build Type=Debug
|
||||
CMake Binary=file:///usr/bin/cmake
|
||||
Environment Profile=
|
||||
Extra Arguments=
|
||||
|
@ -28,6 +28,14 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
# avoid newer gcc warnings
|
||||
add_definitions (-D_DEFAULT_SOURCE)
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set (CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
# linker flags
|
||||
set (CMAKE_EXE_LINKER_FLAGS "-lc++abi")
|
||||
set (CMAKE_MODULE_LINKER_FLAGS "-lc++abi")
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-lc++abi")
|
||||
else ()
|
||||
message (STATUS "Unknown compiler")
|
||||
endif ()
|
||||
|
@ -22,13 +22,14 @@ include_directories (${CMAKE_SOURCE_DIR}
|
||||
# task source is required by extscripts
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||
${PROJECT_TRDPARTY_DIR}/qreplytimeout/*.cpp
|
||||
../../extsysmon/abstractextitem.cpp
|
||||
../../extsysmon/extquotes.cpp
|
||||
../../extsysmon/extscript.cpp
|
||||
../../extsysmon/extupgrade.cpp
|
||||
../../extsysmon/extweather.cpp)
|
||||
../../extsysmon/extweather.cpp
|
||||
../../extsysmon/graphicalitem.cpp)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
set (SUBPROJECT_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER})
|
||||
@ -37,4 +38,3 @@ target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_DESKTOP} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
|
@ -34,6 +34,7 @@ file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
file (GLOB SUBPROJECT_CONF *.conf)
|
||||
set (SUBPROJECT_GRAPHITEMS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
set (SUBPROJECT_QUOTES ${CMAKE_CURRENT_SOURCE_DIR}/quotes)
|
||||
set (SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
||||
set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
||||
@ -54,6 +55,7 @@ kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPRO
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_GRAPHITEMS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
|
@ -45,7 +45,7 @@ AbstractExtItem::~AbstractExtItem()
|
||||
}
|
||||
|
||||
|
||||
int AbstractExtItem::apiVersion()
|
||||
int AbstractExtItem::apiVersion() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -53,7 +53,7 @@ int AbstractExtItem::apiVersion()
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::comment()
|
||||
QString AbstractExtItem::comment() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -61,7 +61,7 @@ QString AbstractExtItem::comment()
|
||||
}
|
||||
|
||||
|
||||
QStringList AbstractExtItem::directories()
|
||||
QStringList AbstractExtItem::directories() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -69,7 +69,7 @@ QStringList AbstractExtItem::directories()
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::fileName()
|
||||
QString AbstractExtItem::fileName() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -77,7 +77,7 @@ QString AbstractExtItem::fileName()
|
||||
}
|
||||
|
||||
|
||||
int AbstractExtItem::interval()
|
||||
int AbstractExtItem::interval() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -85,7 +85,7 @@ int AbstractExtItem::interval()
|
||||
}
|
||||
|
||||
|
||||
bool AbstractExtItem::isActive()
|
||||
bool AbstractExtItem::isActive() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -93,7 +93,7 @@ bool AbstractExtItem::isActive()
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::name()
|
||||
QString AbstractExtItem::name() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -101,7 +101,7 @@ QString AbstractExtItem::name()
|
||||
}
|
||||
|
||||
|
||||
int AbstractExtItem::number()
|
||||
int AbstractExtItem::number() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -109,7 +109,7 @@ int AbstractExtItem::number()
|
||||
}
|
||||
|
||||
|
||||
QString AbstractExtItem::tag(const QString _type)
|
||||
QString AbstractExtItem::tag(const QString _type) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Tag type" << _type;
|
||||
@ -145,6 +145,24 @@ void AbstractExtItem::setComment(const QString _comment)
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setDirectories(QStringList _directories)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Directories" << _directories;
|
||||
|
||||
m_dirs = _directories;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setFileName(const QString _fileName)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Filename" << _fileName;
|
||||
|
||||
m_fileName = _fileName;
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::setInterval(const int _interval)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -199,7 +217,7 @@ void AbstractExtItem::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
bool AbstractExtItem::tryDelete()
|
||||
bool AbstractExtItem::tryDelete() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -214,7 +232,7 @@ bool AbstractExtItem::tryDelete()
|
||||
}
|
||||
|
||||
|
||||
void AbstractExtItem::writeConfiguration()
|
||||
void AbstractExtItem::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
|
@ -28,7 +28,8 @@ class AbstractExtItem : public QDialog
|
||||
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||
Q_PROPERTY(QStringList directories READ directories)
|
||||
Q_PROPERTY(QStringList directories READ directories WRITE setDirectories)
|
||||
Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
|
||||
Q_PROPERTY(int interval READ interval WRITE setInterval)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(int number READ number WRITE setNumber)
|
||||
@ -40,19 +41,21 @@ public:
|
||||
const bool debugCmd = false);
|
||||
virtual ~AbstractExtItem();
|
||||
// get methods
|
||||
int apiVersion();
|
||||
QString comment();
|
||||
QStringList directories();
|
||||
QString fileName();
|
||||
int interval();
|
||||
bool isActive();
|
||||
QString name();
|
||||
int number();
|
||||
QString tag(const QString _type);
|
||||
int apiVersion() const;
|
||||
QString comment() const;
|
||||
QStringList directories() const;
|
||||
QString fileName() const;
|
||||
int interval() const;
|
||||
bool isActive() const;
|
||||
QString name() const;
|
||||
int number() const;
|
||||
QString tag(const QString _type) const;
|
||||
// set methods
|
||||
void setApiVersion(const int _apiVersion = 0);
|
||||
void setActive(const bool _state = true);
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setDirectories(const QStringList _directories);
|
||||
void setFileName(const QString _fileName);
|
||||
void setInterval(const int _interval = 1);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setNumber(int _number = -1);
|
||||
@ -60,9 +63,9 @@ public:
|
||||
public slots:
|
||||
virtual void readConfiguration();
|
||||
virtual QVariantMap run() = 0;
|
||||
virtual int showConfiguration() = 0;
|
||||
bool tryDelete();
|
||||
virtual void writeConfiguration();
|
||||
virtual int showConfiguration(const QVariant args = QVariant()) = 0;
|
||||
bool tryDelete() const;
|
||||
virtual void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
QString m_fileName;
|
||||
|
@ -68,7 +68,7 @@ ExtQuotes::~ExtQuotes()
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::ticker()
|
||||
QString ExtQuotes::ticker() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -88,6 +88,7 @@ void ExtQuotes::setTicker(const QString _ticker)
|
||||
void ExtQuotes::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories()[i]).entryList(QDir::Files).contains(fileName())) continue;
|
||||
@ -126,8 +127,9 @@ QVariantMap ExtQuotes::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtQuotes::showConfiguration()
|
||||
int ExtQuotes::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
@ -152,9 +154,10 @@ int ExtQuotes::showConfiguration()
|
||||
}
|
||||
|
||||
|
||||
void ExtQuotes::writeConfiguration()
|
||||
void ExtQuotes::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(directories()[0]).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
@ -208,7 +211,7 @@ void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
||||
}
|
||||
|
||||
|
||||
QString ExtQuotes::url()
|
||||
QString ExtQuotes::url() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
|
@ -40,15 +40,15 @@ public:
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
~ExtQuotes();
|
||||
// get methods
|
||||
QString ticker();
|
||||
QString ticker() const;
|
||||
// set methods
|
||||
void setTicker(const QString _ticker = QString("EURUSD=X"));
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantMap run();
|
||||
int showConfiguration();
|
||||
void writeConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void quotesReplyReceived(QNetworkReply *reply);
|
||||
@ -58,7 +58,7 @@ private:
|
||||
QNetworkAccessManager *manager;
|
||||
bool isRunning = false;
|
||||
Ui::ExtQuotes *ui;
|
||||
QString url();
|
||||
QString url() const;
|
||||
// properties
|
||||
QString m_ticker = QString("EURUSD=X");
|
||||
// values
|
||||
|
@ -41,7 +41,7 @@ ExtScript::ExtScript(QWidget *parent, const QString scriptName,
|
||||
readJsonFilters();
|
||||
ui->setupUi(this);
|
||||
|
||||
value[QString("value")] = QString();
|
||||
value[QString("value")] = QString("");
|
||||
|
||||
process = new QProcess(this);
|
||||
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
|
||||
@ -59,7 +59,7 @@ ExtScript::~ExtScript()
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::executable()
|
||||
QString ExtScript::executable() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -67,7 +67,7 @@ QString ExtScript::executable()
|
||||
}
|
||||
|
||||
|
||||
QStringList ExtScript::filters()
|
||||
QStringList ExtScript::filters() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -75,7 +75,7 @@ QStringList ExtScript::filters()
|
||||
}
|
||||
|
||||
|
||||
bool ExtScript::hasOutput()
|
||||
bool ExtScript::hasOutput() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -83,7 +83,7 @@ bool ExtScript::hasOutput()
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::prefix()
|
||||
QString ExtScript::prefix() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -91,7 +91,7 @@ QString ExtScript::prefix()
|
||||
}
|
||||
|
||||
|
||||
ExtScript::Redirect ExtScript::redirect()
|
||||
ExtScript::Redirect ExtScript::redirect() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -99,7 +99,7 @@ ExtScript::Redirect ExtScript::redirect()
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::strRedirect()
|
||||
QString ExtScript::strRedirect() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -181,7 +181,7 @@ void ExtScript::setStrRedirect(const QString _redirect)
|
||||
}
|
||||
|
||||
|
||||
QString ExtScript::applyFilters(QString _value)
|
||||
QString ExtScript::applyFilters(QString _value) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Value" << _value;
|
||||
@ -219,6 +219,7 @@ void ExtScript::updateFilter(const QString _filter, const bool _add)
|
||||
void ExtScript::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories()[i]).entryList(QDir::Files).contains(fileName())) continue;
|
||||
@ -289,8 +290,9 @@ QVariantMap ExtScript::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtScript::showConfiguration()
|
||||
int ExtScript::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
@ -329,9 +331,10 @@ int ExtScript::showConfiguration()
|
||||
}
|
||||
|
||||
|
||||
void ExtScript::writeConfiguration()
|
||||
void ExtScript::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(directories()[0]).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
@ -48,13 +48,13 @@ public:
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
~ExtScript();
|
||||
// get methods
|
||||
QString executable();
|
||||
QStringList filters();
|
||||
bool hasOutput();
|
||||
QString prefix();
|
||||
Redirect redirect();
|
||||
QString executable() const;
|
||||
QStringList filters() const;
|
||||
bool hasOutput() const;
|
||||
QString prefix() const;
|
||||
Redirect redirect() const;
|
||||
// derivatives
|
||||
QString strRedirect();
|
||||
QString strRedirect() const;
|
||||
// set methods
|
||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||
void setFilters(const QStringList _filters = QStringList());
|
||||
@ -63,15 +63,15 @@ public:
|
||||
void setRedirect(const Redirect _redirect = nothing);
|
||||
void setStrRedirect(const QString _redirect = QString("nothing"));
|
||||
// filters
|
||||
QString applyFilters(QString _value);
|
||||
QString applyFilters(QString _value) const;
|
||||
void updateFilter(const QString _filter, const bool _add = true);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
void readJsonFilters();
|
||||
QVariantMap run();
|
||||
int showConfiguration();
|
||||
void writeConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void updateValue();
|
||||
|
@ -55,7 +55,7 @@ ExtUpgrade::~ExtUpgrade()
|
||||
}
|
||||
|
||||
|
||||
QString ExtUpgrade::executable()
|
||||
QString ExtUpgrade::executable() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -63,7 +63,7 @@ QString ExtUpgrade::executable()
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::null()
|
||||
int ExtUpgrade::null() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -93,6 +93,7 @@ void ExtUpgrade::setNull(const int _null)
|
||||
void ExtUpgrade::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories()[i]).entryList(QDir::Files).contains(fileName())) continue;
|
||||
@ -127,8 +128,9 @@ QVariantMap ExtUpgrade::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtUpgrade::showConfiguration()
|
||||
int ExtUpgrade::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
@ -155,9 +157,10 @@ int ExtUpgrade::showConfiguration()
|
||||
}
|
||||
|
||||
|
||||
void ExtUpgrade::writeConfiguration()
|
||||
void ExtUpgrade::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(directories()[0]).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
@ -38,8 +38,8 @@ public:
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
~ExtUpgrade();
|
||||
// get methods
|
||||
QString executable();
|
||||
int null();
|
||||
QString executable() const;
|
||||
int null() const;
|
||||
// set methods
|
||||
void setExecutable(const QString _executable = QString("/usr/bin/true"));
|
||||
void setNull(const int _null = 0);
|
||||
@ -47,8 +47,8 @@ public:
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantMap run();
|
||||
int showConfiguration();
|
||||
void writeConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void updateValue();
|
||||
|
@ -65,7 +65,7 @@ ExtWeather::~ExtWeather()
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::weatherFromInt(const int _id)
|
||||
QString ExtWeather::weatherFromInt(const int _id) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "ID" << _id;
|
||||
@ -165,7 +165,7 @@ QString ExtWeather::weatherFromInt(const int _id)
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::city()
|
||||
QString ExtWeather::city() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -173,7 +173,7 @@ QString ExtWeather::city()
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::country()
|
||||
QString ExtWeather::country() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -181,7 +181,7 @@ QString ExtWeather::country()
|
||||
}
|
||||
|
||||
|
||||
int ExtWeather::ts()
|
||||
int ExtWeather::ts() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -219,6 +219,7 @@ void ExtWeather::setTs(const int _ts)
|
||||
void ExtWeather::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories()[i]).entryList(QDir::Files).contains(fileName())) continue;
|
||||
@ -259,8 +260,9 @@ QVariantMap ExtWeather::run()
|
||||
}
|
||||
|
||||
|
||||
int ExtWeather::showConfiguration()
|
||||
int ExtWeather::showConfiguration(const QVariant args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->lineEdit_name->setText(name());
|
||||
@ -289,9 +291,10 @@ int ExtWeather::showConfiguration()
|
||||
}
|
||||
|
||||
|
||||
void ExtWeather::writeConfiguration()
|
||||
void ExtWeather::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(directories()[0]).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
@ -341,7 +344,7 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
|
||||
}
|
||||
|
||||
|
||||
QVariantMap ExtWeather::parseSingleJson(const QVariantMap json)
|
||||
QVariantMap ExtWeather::parseSingleJson(const QVariantMap json) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -367,7 +370,7 @@ QVariantMap ExtWeather::parseSingleJson(const QVariantMap json)
|
||||
}
|
||||
|
||||
|
||||
QString ExtWeather::url(const bool isForecast)
|
||||
QString ExtWeather::url(const bool isForecast) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << "Is forecast" << isForecast;
|
||||
|
@ -42,11 +42,11 @@ public:
|
||||
explicit ExtWeather(QWidget *parent = nullptr, const QString weatherName = QString(),
|
||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||
~ExtWeather();
|
||||
QString weatherFromInt(const int _id);
|
||||
QString weatherFromInt(const int _id) const;
|
||||
// get methods
|
||||
QString city();
|
||||
QString country();
|
||||
int ts();
|
||||
QString city() const;
|
||||
QString country() const;
|
||||
int ts() const;
|
||||
// set methods
|
||||
void setCity(const QString _city = QString("London"));
|
||||
void setCountry(const QString _country = QString("uk"));
|
||||
@ -55,8 +55,8 @@ public:
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
QVariantMap run();
|
||||
int showConfiguration();
|
||||
void writeConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void weatherReplyReceived(QNetworkReply *reply);
|
||||
@ -66,8 +66,8 @@ private:
|
||||
QNetworkAccessManager *manager;
|
||||
bool isRunning = false;
|
||||
Ui::ExtWeather *ui;
|
||||
QVariantMap parseSingleJson(const QVariantMap json);
|
||||
QString url(const bool isForecast = false);
|
||||
QVariantMap parseSingleJson(const QVariantMap json) const;
|
||||
QString url(const bool isForecast = false) const;
|
||||
// properties
|
||||
QString m_city = QString("London");
|
||||
QString m_country = QString("uk");
|
||||
|
@ -18,8 +18,6 @@
|
||||
#include "graphicalitem.h"
|
||||
#include "ui_graphicalitem.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QColorDialog>
|
||||
#include <QDebug>
|
||||
@ -34,10 +32,9 @@
|
||||
#include "version.h"
|
||||
|
||||
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
m_fileName(desktopName),
|
||||
m_dirs(directories),
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
|
||||
const QStringList directories, const bool debugCmd)
|
||||
: AbstractExtItem(parent, desktopName, directories, debugCmd),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::GraphicalItem)
|
||||
{
|
||||
@ -57,7 +54,7 @@ GraphicalItem::~GraphicalItem()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::image(const float value)
|
||||
QString GraphicalItem::image(const float value) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
||||
@ -137,39 +134,7 @@ QString GraphicalItem::image(const float value)
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::fileName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::apiVersion()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_apiVersion;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::name()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::comment()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::bar()
|
||||
QString GraphicalItem::bar() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -177,7 +142,7 @@ QString GraphicalItem::bar()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::activeColor()
|
||||
QString GraphicalItem::activeColor() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -185,7 +150,7 @@ QString GraphicalItem::activeColor()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::inactiveColor()
|
||||
QString GraphicalItem::inactiveColor() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -193,7 +158,7 @@ QString GraphicalItem::inactiveColor()
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Type GraphicalItem::type()
|
||||
GraphicalItem::Type GraphicalItem::type() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -201,7 +166,7 @@ GraphicalItem::Type GraphicalItem::type()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::strType()
|
||||
QString GraphicalItem::strType() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -222,7 +187,7 @@ QString GraphicalItem::strType()
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Direction GraphicalItem::direction()
|
||||
GraphicalItem::Direction GraphicalItem::direction() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -230,7 +195,7 @@ GraphicalItem::Direction GraphicalItem::direction()
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::strDirection()
|
||||
QString GraphicalItem::strDirection() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -248,7 +213,7 @@ QString GraphicalItem::strDirection()
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::height()
|
||||
int GraphicalItem::height() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -256,7 +221,7 @@ int GraphicalItem::height()
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::width()
|
||||
int GraphicalItem::width() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
@ -264,33 +229,6 @@ int GraphicalItem::width()
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setApiVersion(const int _apiVersion)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||
|
||||
m_apiVersion = _apiVersion;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
m_comment = _comment;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setBar(const QString _bar)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
@ -393,15 +331,13 @@ void GraphicalItem::setWidth(const int _width)
|
||||
void GraphicalItem::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::readConfiguration();
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||
for (int i=directories().count()-1; i>=0; i--) {
|
||||
if (!QDir(directories()[i]).entryList(QDir::Files).contains(fileName())) continue;
|
||||
QSettings settings(QString("%1/%2").arg(directories()[i]).arg(fileName()), QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
setName(settings.value(QString("Name"), m_name).toString());
|
||||
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||
setApiVersion(settings.value(QString("X-AW-ApiVersion"), AWGIAPI).toInt());
|
||||
setBar(settings.value(QString("X-AW-Value"), m_bar).toString());
|
||||
setActiveColor(settings.value(QString("X-AW-ActiveColor"), m_activeColor).toString());
|
||||
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), m_inactiveColor).toString());
|
||||
@ -414,12 +350,22 @@ void GraphicalItem::readConfiguration()
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::showConfiguration(const QStringList tags)
|
||||
QVariantMap GraphicalItem::run()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
ui->label_nameValue->setText(m_name);
|
||||
ui->lineEdit_comment->setText(m_comment);
|
||||
// required by abstract class
|
||||
return QVariantMap();
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::showConfiguration(const QVariant args)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
QStringList tags = args.toStringList();
|
||||
|
||||
ui->label_nameValue->setText(name());
|
||||
ui->lineEdit_comment->setText(comment());
|
||||
ui->comboBox_value->addItems(tags);
|
||||
ui->comboBox_value->addItem(m_bar);
|
||||
ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1);
|
||||
@ -449,32 +395,15 @@ int GraphicalItem::showConfiguration(const QStringList tags)
|
||||
}
|
||||
|
||||
|
||||
bool GraphicalItem::tryDelete()
|
||||
void GraphicalItem::writeConfiguration() const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
AbstractExtItem::writeConfiguration();
|
||||
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||
|
||||
// check if exists
|
||||
for (int i=0; i<m_dirs.count(); i++)
|
||||
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::writeConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||
QSettings settings(QString("%1/%2").arg(directories()[0]).arg(fileName()), QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Desktop Entry"));
|
||||
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||
settings.setValue(QString("Name"), m_name);
|
||||
settings.setValue(QString("Comment"), m_comment);
|
||||
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||
settings.setValue(QString("X-AW-Value"), m_bar);
|
||||
settings.setValue(QString("X-AW-ActiveColor"), m_activeColor);
|
||||
@ -494,7 +423,7 @@ void GraphicalItem::changeColor()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QColor color = stringToColor((dynamic_cast<QPushButton *>(sender()))->text());
|
||||
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
||||
QColor newColor = QColorDialog::getColor(color, 0, tr("Select color"),
|
||||
QColorDialog::ShowAlphaChannel);
|
||||
if (!newColor.isValid()) return;
|
||||
|
||||
@ -507,7 +436,7 @@ void GraphicalItem::changeColor()
|
||||
}
|
||||
|
||||
|
||||
QColor GraphicalItem::stringToColor(const QString _color)
|
||||
QColor GraphicalItem::stringToColor(const QString _color) const
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
@ -19,19 +19,17 @@
|
||||
#define GRAPHICALITEM_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QDialog>
|
||||
|
||||
#include "abstractextitem.h"
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class GraphicalItem;
|
||||
}
|
||||
|
||||
class GraphicalItem : public QDialog
|
||||
class GraphicalItem : public AbstractExtItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||
Q_PROPERTY(QString name READ name WRITE setName)
|
||||
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||
Q_PROPERTY(QString bar READ bar WRITE setBar)
|
||||
Q_PROPERTY(QString activeColor READ activeColor WRITE setActiveColor)
|
||||
Q_PROPERTY(QString inactiveColor READ inactiveColor WRITE setInactiveColor)
|
||||
@ -55,25 +53,18 @@ public:
|
||||
const QStringList directories = QStringList(),
|
||||
const bool debugCmd = false);
|
||||
~GraphicalItem();
|
||||
QString fileName();
|
||||
QString image(const float value);
|
||||
QString image(const float value) const;
|
||||
// get methods
|
||||
int apiVersion();
|
||||
QString name();
|
||||
QString comment();
|
||||
QString bar();
|
||||
QString activeColor();
|
||||
QString inactiveColor();
|
||||
Type type();
|
||||
QString strType();
|
||||
Direction direction();
|
||||
QString strDirection();
|
||||
int height();
|
||||
int width();
|
||||
QString bar() const;
|
||||
QString activeColor() const;
|
||||
QString inactiveColor() const;
|
||||
Type type() const;
|
||||
QString strType() const;
|
||||
Direction direction() const;
|
||||
QString strDirection() const;
|
||||
int height() const;
|
||||
int width() const;
|
||||
// set methods
|
||||
void setApiVersion(const int _apiVersion = 0);
|
||||
void setName(const QString _name = QString("none"));
|
||||
void setComment(const QString _comment = QString("empty"));
|
||||
void setBar(const QString _bar = QString("cpu"));
|
||||
void setActiveColor(const QString _color = QString("0,0,0,130"));
|
||||
void setInactiveColor(const QString _color = QString("255,255,255,130"));
|
||||
@ -86,15 +77,15 @@ public:
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QStringList tags = QStringList());
|
||||
bool tryDelete();
|
||||
void writeConfiguration();
|
||||
QVariantMap run();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private slots:
|
||||
void changeColor();
|
||||
|
||||
private:
|
||||
QColor stringToColor(const QString _color);
|
||||
QColor stringToColor(const QString _color) const;
|
||||
QString m_fileName;
|
||||
QStringList m_dirs;
|
||||
bool debug;
|
11
sources/extsysmon/weather/london.desktop
Normal file
11
sources/extsysmon/weather/london.desktop
Normal file
@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Comment=London current weather
|
||||
Encoding=UTF-8
|
||||
Name=London current
|
||||
X-AW-Active=false
|
||||
X-AW-ApiVersion=1
|
||||
X-AW-City=London
|
||||
X-AW-Country=uk
|
||||
X-AW-Interval=3600
|
||||
X-AW-Number=0
|
||||
X-AW-TS=0
|
Loading…
Reference in New Issue
Block a user