* move update interval to another tab

* some changes inside concurrent run
* update COPYING to vanila format
This commit is contained in:
arcan1s
2015-09-19 10:25:26 +03:00
parent 24eb548bb3
commit 120e201c5b
8 changed files with 53 additions and 52 deletions

View File

@ -1,4 +1,4 @@
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
awesome-widgets
Copyright (C) 2013-2014 Evgeniy Alekseev
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
awesome-widgets Copyright (C) 2013 Evgeniy Alekseev
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

View File

@ -25,7 +25,7 @@ message(STATUS "Project: ${PROJECT_NAME}")
message(STATUS "Version: ${PROJECT_VERSION}")
message(STATUS "Build date: ${CURRENT_DATE}")
option(BUILD_FUTURE "Build with the features which will be marked as stable later" ON)
option(BUILD_FUTURE "Build with the features which will be marked as stable later" OFF)
option(BUILD_PLASMOIDS "Build plasmoids" ON)
option(BUILD_DEB_PACKAGE "Build deb package" OFF)
option(BUILD_RPM_PACKAGE "Build rpm package" OFF)

View File

@ -35,6 +35,7 @@ Item {
property bool debug: awActions.isDebugEnabled()
property alias cfg_interval: update.value
property alias cfg_height: widgetHeight.value
property alias cfg_width: widgetWidth.value
property alias cfg_notify: notify.checked
@ -53,6 +54,26 @@ Item {
Column {
id: pageColumn
anchors.fill: parent
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width * 2 / 5
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Time interval")
}
QtControls.SpinBox {
id: update
width: parent.width * 3 / 5
minimumValue: 1000
maximumValue: 10000
stepSize: 500
value: plasmoid.configuration.interval
}
}
Row {
height: implicitHeight
width: parent.width

View File

@ -44,7 +44,6 @@ Item {
87: 5
}
property alias cfg_interval: update.value
property alias cfg_fontFamily: selectFont.text
property alias cfg_fontSize: fontSize.value
property string cfg_fontWeight: fontWeight.currentText
@ -55,26 +54,6 @@ Item {
Column {
id: pageColumn
anchors.fill: parent
Row {
height: implicitHeight
width: parent.width
QtControls.Label {
height: parent.height
width: parent.width / 3
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
text: i18n("Time interval")
}
QtControls.SpinBox {
id: update
width: parent.width * 2 / 3
minimumValue: 1000
maximumValue: 10000
stepSize: 500
value: plasmoid.configuration.interval
}
}
Row {
height: implicitHeight
width: parent.width

View File

@ -25,6 +25,8 @@
#include <QRegExp>
#include <QSettings>
#include <QStandardPaths>
#include <QThread>
#include <QThreadPool>
#include "awdebug.h"
#include "awkeysaggregator.h"
@ -34,6 +36,7 @@
#include "extupgrade.h"
#include "extweather.h"
#include "graphicalitem.h"
#include "version.h"
AWKeys::AWKeys(QObject *parent)
@ -50,6 +53,15 @@ AWKeys::AWKeys(QObject *parent)
// transfer signal from AWDataAggregator object to QML ui
connect(dataAggregator, SIGNAL(toolTipPainted(const QString)),
this, SIGNAL(needToolTipToBeUpdated(const QString)));
#ifdef BUILD_FUTURE
// queue limit. It may be configured by using QUEUE_LIMIT cmake limit flag.
// In other hand since I'm using global thread pool, it makes sense to limit
// queue by QThread::idealThreadCount() value
queueLimit = QUEUE_LIMIT == 0 ? QThread::idealThreadCount() : QUEUE_LIMIT;
// thread pool
threadPool = new QThreadPool(this);
threadPool->setMaxThreadCount(queueLimit);
#endif /* BUILD_FUTURE */
}
@ -63,6 +75,7 @@ AWKeys::~AWKeys()
if (extUpgrade != nullptr) delete extUpgrade;
if (extWeather != nullptr) delete extWeather;
delete threadPool;
delete aggregator;
delete dataAggregator;
}
@ -308,7 +321,7 @@ void AWKeys::dataUpdateReceived(const QString sourceName, const QVariantMap data
// run concurrent data update
#ifdef BUILD_FUTURE
QtConcurrent::run([this, sourceName, data]() {
QtConcurrent::run(threadPool, [this, sourceName, data]() {
return setDataBySource(sourceName, data);
});
#else /* BUILD_FUTURE */
@ -643,26 +656,20 @@ QString AWKeys::parsePattern(QString pattern) const
void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data)
{
#ifdef BUILD_FUTURE
// check if data stream is locked
// if ((lock = ((lock) && (queue > 0)))) return;
#endif /* BUILD_FUTURE */
qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Source" << sourceName;
qCDebug(LOG_AW) << "Data" << data;
// update
if (sourceName == QString("update")) return emit(needToBeUpdated());
#ifdef BUILD_FUTURE
// check if data stream is locked
if ((lock = ((lock) && (queue > 0)))) return;
// drop if limits are reached
// qDebug() << ++queue;
// if (queue > queueLimit) {
if (++queue > queueLimit) {
qCWarning(LOG_AW) << "Messages queue" << queue-- << "more than limits" << queueLimit;
// lock = true;
lock = true;
return;
}
#endif /* BUILD_FUTURE */
// first list init
QStringList tags = aggregator->keysFromSource(sourceName);
@ -670,7 +677,9 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data)
tags = aggregator->registerSource(sourceName, data[QString("units")].toString());
// update data or drop source if there are no matches
if (tags.isEmpty()) {
if (sourceName == QString("update")) {
emit(needToBeUpdated());
} else if (tags.isEmpty()) {
qCDebug(LOG_AW) << "Source" << sourceName << "not found";
emit(dropSourceFromDataengine(sourceName));
} else {
@ -681,9 +690,7 @@ void AWKeys::setDataBySource(const QString sourceName, const QVariantMap data)
});
}
// volatile float n = 1.0;
// for (volatile float i=1.0; i<100000.0; i++)
// n *= i;
// qDebug() << queue-- << queueLimit;
#ifdef BUILD_FUTURE
queue--;
#endif /* BUILD_FUTURE */
}

View File

@ -20,10 +20,8 @@
#define AWKEYS_H
#include <QObject>
#include <QThread>
#include "extitemaggregator.h"
#include "version.h"
class AWDataAggregator;
@ -33,6 +31,7 @@ class ExtScript;
class ExtUpgrade;
class ExtWeather;
class GraphicalItem;
class QThreadPool;
class AWKeys : public QObject
{
@ -91,11 +90,8 @@ private:
bool m_wrapNewLines = false;
// queue and stream lock properties
bool lock = false;
int queue = 0;
// queue limit. It may be configured by using QUEUE_LIMIT cmake limit flag.
// In other hand since I'm using global thread pool, it makes sense to limit
// queue by QThread::idealThreadCount() value
const int queueLimit = QUEUE_LIMIT == 0 ? QThread::idealThreadCount() : QUEUE_LIMIT;
QThreadPool *threadPool = nullptr;
int queueLimit, queue = 0;
};

View File

@ -19,7 +19,6 @@
#define ABSTRACTEXTITEM_H
#include <QDialog>
#include <QInputDialog>
#include <QVariant>

View File

@ -21,7 +21,6 @@
#include <QDialog>
#include <QDialogButtonBox>
#include <QListWidget>
#include <QObject>
#include <QPushButton>
#include <QWidget>