Commit e8e71450 authored by LordTermor's avatar LordTermor

Fixed preferences

parent 99c06be3
......@@ -9,6 +9,6 @@ CheckBox {
id: checkBox
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
onClicked: {
settingsState["pamac"][settingName]=checked;
settingsState[settingName]=checked;
}
}
......@@ -20,15 +20,14 @@ Page{
property Transaction transaction
property var settingsState: {
"pamac":{},
"alpm":{}
}
property var settingsState: ({})
function applySettings(){
if(Object.entries(settingsState["pamac"]).length !== 0)
transaction.startWritePamacConfig(settingsState["pamac"]);
if(Object.entries(settingsState["alpm"]).length !== 0)
transaction.startWriteAlpmConfig(settingsState["alpm"])
for (const [key, value] of Object.entries(settingsState)) {
config[key] = value
}
config.save()
}
width: 600
......@@ -141,7 +140,7 @@ Page{
}
Components.PreferencesCheckBox {
settingName: "RemoveUnrequiredDeps"
settingName: "recurse"
checked: config.recurse
id: checkBox
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
......@@ -154,14 +153,11 @@ Page{
}
Components.PreferencesCheckBox {
settingName: "CheckSpace"
settingName: "checkspace"
checked: Database.checkspace
id: checkBox1
tristate: false
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
onClicked: {
settingsState["alpm"][settingName] = pref
}
}
......@@ -176,7 +172,7 @@ Page{
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
value: config.maxParallelDownloads
onValueModified: {
settingsState["pamac"]["MaxParallelDownloads"]=value;
settingsState["maxParallelDownloads"]=value;
}
}
......@@ -190,7 +186,7 @@ Page{
id: checkBoxDowngrade
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
settingName: "EnableDowngrade"
settingName: "enableDowngrade"
}
Label {
id: label2
......@@ -201,7 +197,7 @@ Page{
checked: config.downloadUpdates
id: checkBox2
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
settingName: "DownloadUpdates"
settingName: "downloadUpdates"
}
}
......@@ -233,7 +229,7 @@ Page{
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
value:config.refreshPeriod
onValueModified: {
settingsState["pamac"]["RefreshPeriod"]=value;
settingsState["refreshPeriod"]=value;
}
}
......@@ -248,7 +244,7 @@ Page{
anchors.topMargin: 6
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.fillWidth: true
settingName: "DownloadUpdates"
settingName: "downloadUpdates"
}
Components.PreferencesCheckBox {
......@@ -260,7 +256,7 @@ Page{
anchors.topMargin: 6
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
settingName: "NoUpdateHideIcon"
settingName: "noUpdateHideIcon"
}
Label {
......@@ -311,12 +307,7 @@ Page{
}
model:config.getIgnorePkgs()
Connections{
target: transaction
onWriteAlpmConfigFinished:{
listView.model=config.getIgnorePkgs();
}
}
}
Pane{
padding: 0
......@@ -339,7 +330,7 @@ Page{
var string = list.join(" ");
settingsState["alpm"]["IgnorePkg"]=string;
settingsState["ignorePkgs"]=string;
}
}
......@@ -365,7 +356,7 @@ Page{
var string = list.join(" ");
settingsState["alpm"]["IgnorePkg"]=string;
settingsState["ignorePkg"]=string;
}
}
}
......@@ -456,7 +447,7 @@ Page{
anchors.rightMargin: 6
anchors.top: label6.bottom
anchors.topMargin: 16
settingName: "EnableAUR"
settingName: "enableAur"
}
Components.PreferencesCheckBox {
......@@ -468,7 +459,7 @@ Page{
anchors.topMargin: 0
anchors.left: parent.left
anchors.leftMargin: 30
settingName: "CheckAURUpdates"
settingName: "checkAURUpdates"
}
Components.PreferencesCheckBox {
enabled: aurEnabledCheckBox.enabled
......@@ -479,7 +470,7 @@ Page{
anchors.topMargin: 0
anchors.left: parent.left
anchors.leftMargin: 30
settingName: "CheckAURVCSUpdates"
settingName: "checkAurVCSUpdates"
}
Label {
......@@ -496,7 +487,7 @@ Page{
TextArea {
text: Utils.isAccessible(settingsState["pamac"]["BuildDirectory"])?settingsState["pamac"]["BuildDirectory"]:config.aurBuildDirectory
text: Utils.isAccessible(settingsState["aurBuildDirectory"])?settingsState["aurBuildDirectory"]:config.aurBuildDirectory
enabled: false
id: aurBuildDirTextArea
......@@ -531,7 +522,7 @@ Page{
onAccepted: {
var path = Utils.urlToPath(aurBuildDirDialog.folder.toString());
settingsState["pamac"]["BuildDirectory"] = path;
settingsState["aurBuildDirectory"] = path;
settingsStateChanged();
}
}
......@@ -548,7 +539,7 @@ Page{
onClicked: {
var path = "/var/tmp"
settingsState["pamac"]["BuildDirectory"]=path;
settingsState["aurBuildDirectory"]=path;
}
}
Button{
......@@ -559,7 +550,7 @@ Page{
onClicked: {
var path = Utils.urlToPath(StandardPaths.standardLocations(StandardPaths.TempLocation)[0]);
settingsState["pamac"]["BuildDirectory"]=path;
settingsState["aurBuildDirectory"]=path;
}
}
}
......@@ -582,7 +573,7 @@ Page{
SpinBox {
onValueModified: {
settingsState["pamac"]["KeepNumPackages"]=value
settingsState["cleanKeepNumPkgs"]=value
}
value: config.cleanKeepNumPkgs
id: spinBox1
......@@ -601,7 +592,7 @@ Page{
anchors.topMargin: 6
anchors.left: parent.left
anchors.leftMargin: 30
settingName: "OnlyRmUninstalled"
settingName: "cleanRmOnlyUninstalled"
}
Button {
......
......@@ -53,7 +53,12 @@ public:
PAMAC_QT_STRING_PROPERTY_GET_SET(aurBuildDirectory,pamac_config_get_aur_build_dir(m_handle),
setAurBuildDirectory,pamac_config_set_aur_build_dir(m_handle,aurBuildDirectory.toUtf8()))
PAMAC_QT_BOOL_PROPERTY_GET_SET(checkspace, pamac_config_get_checkspace(m_handle),
setCheckspace, pamac_config_set_checkspace(m_handle,checkspace))
Q_INVOKABLE QStringList getIgnorePkgs();
Q_INVOKABLE void save();
Q_INVOKABLE void reload();
PamacConfig* handle(){
return m_handle;
......
......@@ -91,7 +91,6 @@ Q_SIGNALS:
void getUpdatesProgress(uint percent);
void checkspaceChanged(bool checkspace);
void configChanged(Config* config);
......
......@@ -63,8 +63,6 @@ public:
inline Q_INVOKABLE void getAuthorization(){
pamac_transaction_get_authorization(m_handle);
}
Q_INVOKABLE void startWritePamacConfig(const QVariantMap &map);
Q_INVOKABLE void startWriteAlpmConfig(const QVariantMap &map);
Q_INVOKABLE GenericQmlFuture getBuildFiles(const QString& pkgname);
......
......@@ -10,3 +10,13 @@ QStringList LibQPamac::Config::getIgnorePkgs()
return QPair(keyString,valueString);
}).values();
}
void LibQPamac::Config::save()
{
pamac_config_save(m_handle);
}
void LibQPamac::Config::reload()
{
pamac_config_reload(m_handle);
}
......@@ -4,47 +4,6 @@
#include <atomic>
#include <QVariant>
void LibQPamac::Transaction::startWritePamacConfig(const QVariantMap &map){
GHashTable* tabl = g_hash_table_new(g_str_hash,
g_str_equal);
auto keys = Utils::qStringListToCStringVector(map.keys());
for(auto& el :keys){
auto value = map[el];
if(value.type()==QVariant::Int){
value.convert(QVariant::ULongLong);
}
g_hash_table_insert(tabl,el,Utils::qVariantToGVariant(value));
}
// pamac_transaction_write_pamac_config(m_handle,tabl);
for(auto &el :keys){
delete el;
}
}
void LibQPamac::Transaction::startWriteAlpmConfig(const QVariantMap &map){
GHashTable* tabl = g_hash_table_new(g_str_hash,
g_str_equal);
auto keys = Utils::qStringListToCStringVector(map.keys());
for(auto& el :keys){
auto value = map[el];
if(value.type()==QVariant::Int){
value.convert(QVariant::ULongLong);
}
g_hash_table_insert(tabl,el,Utils::qVariantToGVariant(value));
}
// pamac_transaction_start_write_alpm_config(m_handle,tabl);
for(auto &el :keys){
delete el;
}
}
GenericQmlFuture LibQPamac::Transaction::getBuildFiles(const QString &pkgname){
auto future = new QmlFutureImpl;
// pamac_transaction_get_build_files(m_handle,pkgname.toUtf8(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment