mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
qml improvements
* move functions to plugin part * move model to general.qml
This commit is contained in:
parent
80767c9dbf
commit
d74cd645fd
@ -20,6 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
|||||||
import QtQuick.Dialogs 1.2 as QtDialogs
|
import QtQuick.Dialogs 1.2 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.private.awesomewidget 1.0
|
||||||
|
import "."
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -72,64 +73,7 @@ Item {
|
|||||||
backend: awKeys
|
backend: awKeys
|
||||||
notifyBackend: awActions
|
notifyBackend: awActions
|
||||||
textArea: textPattern
|
textArea: textPattern
|
||||||
groups: [
|
groups: general.awTagRegexp
|
||||||
{
|
|
||||||
'label': i18n("AC"),
|
|
||||||
'regexp': "^(ac|bat).*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Bars"),
|
|
||||||
'regexp': "^bar.*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("CPU"),
|
|
||||||
'regexp': "^(cpu|gpu|la|ps|temp(?!erature)).*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Desktops"),
|
|
||||||
'regexp': "^(n|t)?desktop(s)?"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("HDD"),
|
|
||||||
'regexp': "^hdd.*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Memory"),
|
|
||||||
'regexp': "^(mem|swap).*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Network"),
|
|
||||||
'regexp': "^(netdev|(down|up(?!time)).*)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Music player"),
|
|
||||||
'regexp': "(^|d|s)(album|artist|duration|progress|title)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Scripts"),
|
|
||||||
'regexp': "^custom.*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Time"),
|
|
||||||
'regexp': ".*time$"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Quotes"),
|
|
||||||
'regexp': "^(perc)?(ask|bid|price)(chg)?.*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Upgrades"),
|
|
||||||
'regexp': "^pkgcount.*"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Weathers"),
|
|
||||||
'regexp': "^(weather(Id)?|humidity|pressure|temperature|timestamp)"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'label': i18n("Functions"),
|
|
||||||
'regexp': "functions"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
@ -144,6 +144,10 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
|
|||||||
qCDebug(LOG_AW) << "Should be sorted" << sorted << "and filter applied"
|
qCDebug(LOG_AW) << "Should be sorted" << sorted << "and filter applied"
|
||||||
<< regexp;
|
<< regexp;
|
||||||
|
|
||||||
|
// check if functions asked
|
||||||
|
if (regexp == QString("functions"))
|
||||||
|
return QString(STATIC_FUNCTIONS).split(QChar(','));
|
||||||
|
|
||||||
QStringList allKeys = m_keyOperator->dictKeys();
|
QStringList allKeys = m_keyOperator->dictKeys();
|
||||||
// sort if required
|
// sort if required
|
||||||
if (sorted)
|
if (sorted)
|
||||||
|
@ -36,12 +36,7 @@ Row {
|
|||||||
textRole: "label"
|
textRole: "label"
|
||||||
|
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
if (model[currentIndex]["regexp"] == "functions")
|
tags.model = backend.dictKeys(true, model[currentIndex]["regexp"])
|
||||||
tags.model = ["{{\n\n}}", "template{{\n\n}}",
|
|
||||||
"aw_all<>{{}}", "aw_count<>{{}}", "aw_keys<>{{}}",
|
|
||||||
"aw_macro<>{{}}", "aw_names<>{{}}"]
|
|
||||||
else
|
|
||||||
tags.model = backend.dictKeys(true, model[currentIndex]["regexp"])
|
|
||||||
tags.currentIndex = -1
|
tags.currentIndex = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,54 +41,112 @@ QtObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// models
|
// models
|
||||||
property variant fontStyleModel: [
|
property variant awTagRegexp: [
|
||||||
{
|
{
|
||||||
'label': i18n("normal"),
|
"label": i18n("AC"),
|
||||||
'name': "normal"
|
"regexp": "^(ac|bat).*"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("italic"),
|
"label": i18n("Bars"),
|
||||||
'name': "italic"
|
"regexp": "^bar.*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("CPU"),
|
||||||
|
"regexp": "^(cpu|gpu|la|ps|temp(?!erature)).*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Desktops"),
|
||||||
|
"regexp": "^(n|t)?desktop(s)?"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("HDD"),
|
||||||
|
"regexp": "^hdd.*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Memory"),
|
||||||
|
"regexp": "^(mem|swap).*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Network"),
|
||||||
|
"regexp": "^(netdev|(down|up(?!time)).*)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Music player"),
|
||||||
|
"regexp": "(^|d|s)(album|artist|duration|progress|title)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Scripts"),
|
||||||
|
"regexp": "^custom.*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Time"),
|
||||||
|
"regexp": ".*time$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Quotes"),
|
||||||
|
"regexp": "^(perc)?(ask|bid|price)(chg)?.*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Upgrades"),
|
||||||
|
"regexp": "^pkgcount.*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Weathers"),
|
||||||
|
"regexp": "^(weather(Id)?|humidity|pressure|temperature|timestamp)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("Functions"),
|
||||||
|
"regexp": "functions"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
property variant fontStyleModel: [
|
||||||
|
{
|
||||||
|
"label": i18n("normal"),
|
||||||
|
"name": "normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": i18n("italic"),
|
||||||
|
"name": "italic"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
property variant fontWeightModel: [
|
property variant fontWeightModel: [
|
||||||
{
|
{
|
||||||
'label': i18n("light"),
|
"label": i18n("light"),
|
||||||
'name': "light"
|
"name": "light"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("normal"),
|
"label": i18n("normal"),
|
||||||
'name': "normal"
|
"name": "normal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("demi bold"),
|
"label": i18n("demi bold"),
|
||||||
'name': "demibold"
|
"name": "demibold"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("bold"),
|
"label": i18n("bold"),
|
||||||
'name': "bold"
|
"name": "bold"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("black"),
|
"label": i18n("black"),
|
||||||
'name': "black"
|
"name": "black"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
property variant textStyleModel: [
|
property variant textStyleModel: [
|
||||||
{
|
{
|
||||||
'label': i18n("normal"),
|
"label": i18n("normal"),
|
||||||
'name': "normal"
|
"name": "normal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("outline"),
|
"label": i18n("outline"),
|
||||||
'name': "outline"
|
"name": "outline"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("raised"),
|
"label": i18n("raised"),
|
||||||
'name': "raised"
|
"name": "raised"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'label': i18n("sunken"),
|
"label": i18n("sunken"),
|
||||||
'name': "sunken"
|
"name": "sunken"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,9 @@ const int REQUEST_TIMEOUT = 3000;
|
|||||||
const char TIME_KEYS[]
|
const char TIME_KEYS[]
|
||||||
= "d,dd,ddd,dddd,M,MM,MMM,MMMM,yy,yyyy,h,hh,H,HH,m,mm,s,ss,t,a,ap,A,AP";
|
= "d,dd,ddd,dddd,M,MM,MMM,MMMM,yy,yyyy,h,hh,H,HH,m,mm,s,ss,t,a,ap,A,AP";
|
||||||
// static keys
|
// static keys
|
||||||
|
const char STATIC_FUNCTIONS[] = "{{\n\n}},template{{\n\n}},aw_all<>{{}},aw_"
|
||||||
|
"count<>{{}},aw_keys<>{{}},aw_macro<>{{}},aw_"
|
||||||
|
"names<>{{}}";
|
||||||
const char STATIC_KEYS[]
|
const char STATIC_KEYS[]
|
||||||
= "time,isotime,shorttime,longtime,tstime,ctime,uptime,cuptime,cpucl,cpu,"
|
= "time,isotime,shorttime,longtime,tstime,ctime,uptime,cuptime,cpucl,cpu,"
|
||||||
"gputemp,gpu,memmb,memgb,memfreemb,memfreegb,memtotmb,memtotgb,memusedmb,"
|
"gputemp,gpu,memmb,memgb,memfreemb,memfreegb,memtotmb,memtotgb,memusedmb,"
|
||||||
|
Loading…
Reference in New Issue
Block a user