mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-11-04 06:43:41 +00:00 
			
		
		
		
	fixes in desktop-panel
This commit is contained in:
		
							
								
								
									
										2
									
								
								PKGBUILD
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								PKGBUILD
									
									
									
									
									
								
							@ -21,7 +21,7 @@ optdepends=("amarok: for music player monitor"
 | 
				
			|||||||
makedepends=('automoc4' 'cmake')
 | 
					makedepends=('automoc4' 'cmake')
 | 
				
			||||||
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
 | 
					source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
 | 
				
			||||||
install=${pkgname}.install
 | 
					install=${pkgname}.install
 | 
				
			||||||
md5sums=('1d970a31b4fee173a3a4803efd36b4b1')
 | 
					md5sums=('4a7d526fd418513bc329ff2676f636f5')
 | 
				
			||||||
backup=('usr/share/config/extsysmon.conf')
 | 
					backup=('usr/share/config/extsysmon.conf')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
prepare() {
 | 
					prepare() {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
--- README.md.orig	2014-07-08 12:10:47.217925504 +0400
 | 
					--- README.md.orig	2014-07-08 12:10:47.217925504 +0400
 | 
				
			||||||
+++ README.md	2014-07-09 18:54:32.749203368 +0400
 | 
					+++ README.md	2014-07-22 09:48:59.337749400 +0400
 | 
				
			||||||
@@ -60,6 +60,9 @@
 | 
					@@ -60,6 +60,9 @@
 | 
				
			||||||
 * tag `$ps` - list of running processes
 | 
					 * tag `$ps` - list of running processes
 | 
				
			||||||
 * tag `$pkgcountN` - number of packages, which available to upgrade for command N. For example, `$pkgcount0`
 | 
					 * tag `$pkgcountN` - number of packages, which available to upgrade for command N. For example, `$pkgcount0`
 | 
				
			||||||
 | 
				
			|||||||
@ -43,6 +43,7 @@ CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num)
 | 
				
			|||||||
        debug = false;
 | 
					        debug = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "Init label" << num;
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "Init label" << num;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    number = num;
 | 
					    number = num;
 | 
				
			||||||
    widget = wid;
 | 
					    widget = wid;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -56,6 +57,7 @@ CustomPlasmaLabel::~CustomPlasmaLabel()
 | 
				
			|||||||
int CustomPlasmaLabel::getNumber()
 | 
					int CustomPlasmaLabel::getNumber()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[getNumber]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[getNumber]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return number;
 | 
					    return number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -64,6 +66,7 @@ void CustomPlasmaLabel::mousePressEvent(QGraphicsSceneMouseEvent *event)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]";
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]" << "Get signal" << event->button();
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[" << number << "]" << "[mouseMoveEvent]" << "Get signal" << event->button();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (event->button() == Qt::LeftButton)
 | 
					    if (event->button() == Qt::LeftButton)
 | 
				
			||||||
        widget->setCurrentDesktop(number);
 | 
					        widget->setCurrentDesktop(number);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -101,6 +104,7 @@ DesktopPanel::~DesktopPanel()
 | 
				
			|||||||
void DesktopPanel::init()
 | 
					void DesktopPanel::init()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[init]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[init]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    extsysmonEngine = dataEngine(QString("ext-sysmon"));
 | 
					    extsysmonEngine = dataEngine(QString("ext-sysmon"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    layout = new QGraphicsLinearLayout();
 | 
					    layout = new QGraphicsLinearLayout();
 | 
				
			||||||
@ -117,19 +121,21 @@ void DesktopPanel::init()
 | 
				
			|||||||
QStringList DesktopPanel::getDesktopNames()
 | 
					QStringList DesktopPanel::getDesktopNames()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QStringList list;
 | 
					    QStringList list;
 | 
				
			||||||
    QString fileName = KGlobal::dirs()->findResource("config", "kwinrc");
 | 
					    QString fileName = KGlobal::dirs()->findResource("config", "kwinrc");
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName;
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName;
 | 
				
			||||||
    QFile confFile(fileName);
 | 
					    QFile configFile(fileName);
 | 
				
			||||||
    if (!confFile.open(QIODevice::ReadOnly)) return list;
 | 
					    if (!configFile.open(QIODevice::ReadOnly)) return list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString fileStr;
 | 
					    QString fileStr;
 | 
				
			||||||
    QStringList value;
 | 
					    QStringList value;
 | 
				
			||||||
    bool desktopSection = false;
 | 
					    bool desktopSection = false;
 | 
				
			||||||
    while (true) {
 | 
					    while (true) {
 | 
				
			||||||
        fileStr = QString(confFile.readLine()).trimmed();
 | 
					        fileStr = QString(configFile.readLine()).trimmed();
 | 
				
			||||||
        if (fileStr[0] == QChar('#')) continue;
 | 
					        if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
 | 
				
			||||||
        if (fileStr[0] == QChar(';')) continue;
 | 
					        if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
 | 
				
			||||||
 | 
					        if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
 | 
				
			||||||
        if (fileStr[0] == QChar('[')) desktopSection = false;
 | 
					        if (fileStr[0] == QChar('[')) desktopSection = false;
 | 
				
			||||||
        if (fileStr == QString("[Desktops]")) desktopSection = true;
 | 
					        if (fileStr == QString("[Desktops]")) desktopSection = true;
 | 
				
			||||||
        if (desktopSection) {
 | 
					        if (desktopSection) {
 | 
				
			||||||
@ -141,10 +147,10 @@ QStringList DesktopPanel::getDesktopNames()
 | 
				
			|||||||
                    list.append(value.join(QChar('=')));
 | 
					                    list.append(value.join(QChar('=')));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (confFile.atEnd())
 | 
					        if (configFile.atEnd()) break;
 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    confFile.close();
 | 
					    configFile.close();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return list;
 | 
					    return list;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -177,6 +183,7 @@ QString DesktopPanel::parsePattern(const QString rawLine, const int num)
 | 
				
			|||||||
        if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Found total";
 | 
					        if (debug) qDebug() << "[PTM-DP]" << "[parsePattern]" << "Found total";
 | 
				
			||||||
        line = line.split(QString("$total"))[0] + QString::number(desktopNames.count()) + line.split(QString("$total"))[1];
 | 
					        line = line.split(QString("$total"))[0] + QString::number(desktopNames.count()) + line.split(QString("$total"))[1];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return line;
 | 
					    return line;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -206,7 +213,7 @@ void DesktopPanel::reinit()
 | 
				
			|||||||
    if (configuration[QString("layout")].toInt() == 0)
 | 
					    if (configuration[QString("layout")].toInt() == 0)
 | 
				
			||||||
        layout->setOrientation(Qt::Horizontal);
 | 
					        layout->setOrientation(Qt::Horizontal);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        layout->setOrientation(Qt::Horizontal);
 | 
					        layout->setOrientation(Qt::Vertical);
 | 
				
			||||||
    // left stretch
 | 
					    // left stretch
 | 
				
			||||||
    if (configuration[QString("leftStretch")].toInt() == 2)
 | 
					    if (configuration[QString("leftStretch")].toInt() == 2)
 | 
				
			||||||
        layout->addStretch(1);
 | 
					        layout->addStretch(1);
 | 
				
			||||||
@ -236,6 +243,7 @@ int DesktopPanel::setCurrentDesktop(const int number)
 | 
				
			|||||||
    command.waitForFinished(-1);
 | 
					    command.waitForFinished(-1);
 | 
				
			||||||
    int status = command.exitCode();
 | 
					    int status = command.exitCode();
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[setCurrentDesktop]" << "Cmd returns " << status;
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[setCurrentDesktop]" << "Cmd returns " << status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return status;
 | 
					    return status;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -243,6 +251,7 @@ int DesktopPanel::setCurrentDesktop(const int number)
 | 
				
			|||||||
void DesktopPanel::updateText()
 | 
					void DesktopPanel::updateText()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[updateText]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[updateText]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (labels.isEmpty()) return;
 | 
					    if (labels.isEmpty()) return;
 | 
				
			||||||
    QString line, text;
 | 
					    QString line, text;
 | 
				
			||||||
    for (int i=0; i<labels.count(); i++) {
 | 
					    for (int i=0; i<labels.count(); i++) {
 | 
				
			||||||
@ -263,6 +272,7 @@ void DesktopPanel::dataUpdated(const QString &sourceName, const Plasma::DataEngi
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[dataUpdated]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[dataUpdated]";
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[dataUpdated]" << ":" << "Run function with source name" << sourceName;
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[dataUpdated]" << ":" << "Run function with source name" << sourceName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (data.keys().count() == 0)
 | 
					    if (data.keys().count() == 0)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    if (sourceName == QString("desktop")) {
 | 
					    if (sourceName == QString("desktop")) {
 | 
				
			||||||
@ -276,6 +286,7 @@ void DesktopPanel::dataUpdated(const QString &sourceName, const Plasma::DataEngi
 | 
				
			|||||||
void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
 | 
					void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[createConfigurationInterface]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[createConfigurationInterface]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QWidget *appWidget = new QWidget;
 | 
					    QWidget *appWidget = new QWidget;
 | 
				
			||||||
    uiAppConfig.setupUi(appWidget);
 | 
					    uiAppConfig.setupUi(appWidget);
 | 
				
			||||||
    QWidget *configWidget = new QWidget;
 | 
					    QWidget *configWidget = new QWidget;
 | 
				
			||||||
@ -345,6 +356,7 @@ void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
 | 
				
			|||||||
void DesktopPanel::configAccepted()
 | 
					void DesktopPanel::configAccepted()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[configAccepted]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[configAccepted]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    extsysmonEngine->disconnectSource(QString("desktop"), this);
 | 
					    extsysmonEngine->disconnectSource(QString("desktop"), this);
 | 
				
			||||||
    KConfigGroup cg = config();
 | 
					    KConfigGroup cg = config();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -374,9 +386,10 @@ void DesktopPanel::configAccepted()
 | 
				
			|||||||
void DesktopPanel::configChanged()
 | 
					void DesktopPanel::configChanged()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (debug) qDebug() << "[PTM-DP]" << "[configChanged]";
 | 
					    if (debug) qDebug() << "[PTM-DP]" << "[configChanged]";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    KConfigGroup cg = config();
 | 
					    KConfigGroup cg = config();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    configuration[QString("background")] = cg.readEntry("background", "0");
 | 
					    configuration[QString("background")] = cg.readEntry("background", "2");
 | 
				
			||||||
    configuration[QString("desktopcmd")] = cg.readEntry("desktopcmd", "qdbus org.kde.kwin /KWin setCurrentDesktop $number");
 | 
					    configuration[QString("desktopcmd")] = cg.readEntry("desktopcmd", "qdbus org.kde.kwin /KWin setCurrentDesktop $number");
 | 
				
			||||||
    configuration[QString("interval")] = cg.readEntry("interval", "1000");
 | 
					    configuration[QString("interval")] = cg.readEntry("interval", "1000");
 | 
				
			||||||
    configuration[QString("layout")] = cg.readEntry("layout", "0");
 | 
					    configuration[QString("layout")] = cg.readEntry("layout", "0");
 | 
				
			||||||
@ -394,26 +407,26 @@ void DesktopPanel::configChanged()
 | 
				
			|||||||
    QString fontColor = cg.readEntry("currentFontColor", "#ff0000");
 | 
					    QString fontColor = cg.readEntry("currentFontColor", "#ff0000");
 | 
				
			||||||
    int fontWeight = cg.readEntry("currentFontWeight", 400);
 | 
					    int fontWeight = cg.readEntry("currentFontWeight", 400);
 | 
				
			||||||
    QString fontStyle = cg.readEntry("currentFontStyle", "normal");
 | 
					    QString fontStyle = cg.readEntry("currentFontStyle", "normal");
 | 
				
			||||||
    currentFormatLine[0] = ("<p align=\"center\"><span style=\" font-family:'" + fontFamily + \
 | 
					    currentFormatLine[0] = ("<pre><p align=\"center\"><span style=\" font-family:'" + fontFamily + \
 | 
				
			||||||
                     "'; font-style:" + fontStyle + \
 | 
					                     "'; font-style:" + fontStyle + \
 | 
				
			||||||
                     "; font-size:" + QString::number(fontSize) + \
 | 
					                     "; font-size:" + QString::number(fontSize) + \
 | 
				
			||||||
                     "pt; font-weight:" + QString::number(fontWeight) + \
 | 
					                     "pt; font-weight:" + QString::number(fontWeight) + \
 | 
				
			||||||
                     "; color:" + fontColor + \
 | 
					                     "; color:" + fontColor + \
 | 
				
			||||||
                     ";\"><pre>");
 | 
					                     ";\">");
 | 
				
			||||||
    currentFormatLine[1] = ("</pre></span></p>");
 | 
					    currentFormatLine[1] = ("</span></p></pre>");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fontFamily = cg.readEntry("fontFamily", "Terminus");
 | 
					    fontFamily = cg.readEntry("fontFamily", "Terminus");
 | 
				
			||||||
    fontSize = cg.readEntry("fontSize", 10);
 | 
					    fontSize = cg.readEntry("fontSize", 10);
 | 
				
			||||||
    fontColor = cg.readEntry("fontColor", "#000000");
 | 
					    fontColor = cg.readEntry("fontColor", "#000000");
 | 
				
			||||||
    fontWeight = cg.readEntry("fontWeight", 400);
 | 
					    fontWeight = cg.readEntry("fontWeight", 400);
 | 
				
			||||||
    fontStyle = cg.readEntry("fontStyle", "normal");
 | 
					    fontStyle = cg.readEntry("fontStyle", "normal");
 | 
				
			||||||
    formatLine[0] = ("<p align=\"center\"><span style=\" font-family:'" + fontFamily + \
 | 
					    formatLine[0] = ("<pre><p align=\"center\"><span style=\" font-family:'" + fontFamily + \
 | 
				
			||||||
                     "'; font-style:" + fontStyle + \
 | 
					                     "'; font-style:" + fontStyle + \
 | 
				
			||||||
                     "; font-size:" + QString::number(fontSize) + \
 | 
					                     "; font-size:" + QString::number(fontSize) + \
 | 
				
			||||||
                     "pt; font-weight:" + QString::number(fontWeight) + \
 | 
					                     "pt; font-weight:" + QString::number(fontWeight) + \
 | 
				
			||||||
                     "; color:" + fontColor + \
 | 
					                     "; color:" + fontColor + \
 | 
				
			||||||
                     ";\"><pre>");
 | 
					                     ";\">");
 | 
				
			||||||
    formatLine[1] = ("</pre></span></p>");
 | 
					    formatLine[1] = ("</span></p></pre>");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    reinit();
 | 
					    reinit();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -95,16 +95,17 @@ QStringList ExtendedSysMon::getDesktopNames()
 | 
				
			|||||||
    QStringList list;
 | 
					    QStringList list;
 | 
				
			||||||
    QString fileName = KGlobal::dirs()->findResource("config", "kwinrc");
 | 
					    QString fileName = KGlobal::dirs()->findResource("config", "kwinrc");
 | 
				
			||||||
    if (debug) qDebug() << "[DE]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName;
 | 
					    if (debug) qDebug() << "[DE]" << "[getDesktopNames]" << ":" << "Configuration file" << fileName;
 | 
				
			||||||
    QFile confFile(fileName);
 | 
					    QFile configFile(fileName);
 | 
				
			||||||
    if (!confFile.open(QIODevice::ReadOnly)) return list;
 | 
					    if (!configFile.open(QIODevice::ReadOnly)) return list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QString fileStr;
 | 
					    QString fileStr;
 | 
				
			||||||
    QStringList value;
 | 
					    QStringList value;
 | 
				
			||||||
    bool desktopSection = false;
 | 
					    bool desktopSection = false;
 | 
				
			||||||
    while (true) {
 | 
					    while (true) {
 | 
				
			||||||
        fileStr = QString(confFile.readLine()).trimmed();
 | 
					        fileStr = QString(configFile.readLine()).trimmed();
 | 
				
			||||||
        if (fileStr[0] == QChar('#')) continue;
 | 
					        if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
 | 
				
			||||||
        if (fileStr[0] == QChar(';')) continue;
 | 
					        if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
 | 
				
			||||||
 | 
					        if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
 | 
				
			||||||
        if (fileStr[0] == QChar('[')) desktopSection = false;
 | 
					        if (fileStr[0] == QChar('[')) desktopSection = false;
 | 
				
			||||||
        if (fileStr == QString("[Desktops]")) desktopSection = true;
 | 
					        if (fileStr == QString("[Desktops]")) desktopSection = true;
 | 
				
			||||||
        if (desktopSection) {
 | 
					        if (desktopSection) {
 | 
				
			||||||
@ -116,10 +117,9 @@ QStringList ExtendedSysMon::getDesktopNames()
 | 
				
			|||||||
                    list.append(value.join(QChar('=')));
 | 
					                    list.append(value.join(QChar('=')));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (confFile.atEnd())
 | 
					        if (configFile.atEnd()) break;
 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    confFile.close();
 | 
					    configFile.close();
 | 
				
			||||||
    return list;
 | 
					    return list;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -169,27 +169,27 @@ void ExtendedSysMon::readConfiguration()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf");
 | 
					    QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf");
 | 
				
			||||||
    if (debug) qDebug() << "[DE]" << "[readConfiguration]" << ":" << "Configuration file" << fileName;
 | 
					    if (debug) qDebug() << "[DE]" << "[readConfiguration]" << ":" << "Configuration file" << fileName;
 | 
				
			||||||
    QFile confFile(fileName);
 | 
					    QFile configFile(fileName);
 | 
				
			||||||
    if (!confFile.open(QIODevice::ReadOnly)) {
 | 
					    if (!configFile.open(QIODevice::ReadOnly)) {
 | 
				
			||||||
        configuration = updateConfiguration(rawConfig);
 | 
					        configuration = updateConfiguration(rawConfig);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    QString fileStr;
 | 
					    QString fileStr;
 | 
				
			||||||
    QStringList value;
 | 
					    QStringList value;
 | 
				
			||||||
    while (true) {
 | 
					    while (true) {
 | 
				
			||||||
        fileStr = QString(confFile.readLine()).trimmed();
 | 
					        fileStr = QString(configFile.readLine()).trimmed();
 | 
				
			||||||
        if (fileStr[0] == QChar('#')) continue;
 | 
					        if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue;
 | 
				
			||||||
        if (fileStr[0] == QChar(';')) continue;
 | 
					        if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue;
 | 
				
			||||||
 | 
					        if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue;
 | 
				
			||||||
        if (fileStr.contains(QChar('='))) {
 | 
					        if (fileStr.contains(QChar('='))) {
 | 
				
			||||||
            value.clear();
 | 
					            value.clear();
 | 
				
			||||||
            for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
 | 
					            for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
 | 
				
			||||||
                value.append(fileStr.split(QChar('='))[i]);
 | 
					                value.append(fileStr.split(QChar('='))[i]);
 | 
				
			||||||
            rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
 | 
					            rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if (confFile.atEnd())
 | 
					        if (configFile.atEnd()) break;
 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    confFile.close();
 | 
					    configFile.close();
 | 
				
			||||||
    configuration = updateConfiguration(rawConfig);
 | 
					    configuration = updateConfiguration(rawConfig);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user