From 4fb149e6c6e2d3137ac03b7b3a9d7579cdf70814 Mon Sep 17 00:00:00 2001 From: Theodore Cooper <63190431+theodorecooper@users.noreply.github.com> Date: Wed, 13 Jan 2021 10:30:27 +0000 Subject: [PATCH] Finished The Bingbg-Qt has been finished all the function. Soon the first release will follow. --- bingbg.pro | 12 ++-- form/about.ui | 4 +- form/bingbg.ui | 172 ++++++++++++++++++++++++++++++++---------------- form/de.ui | 136 ++++++++++++++++++++++++++++++-------- form/lang.ui | 4 +- include/de.h | 23 +++++-- include/setbg.h | 20 ++++++ src/bingbg.cpp | 26 +++++++- src/de.cpp | 61 ++++++++++++++++- src/main.cpp | 2 +- src/setbg.cpp | 155 +++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 510 insertions(+), 105 deletions(-) create mode 100644 include/setbg.h create mode 100644 src/setbg.cpp diff --git a/bingbg.pro b/bingbg.pro index e083bdf..62c9b3f 100644 --- a/bingbg.pro +++ b/bingbg.pro @@ -16,9 +16,9 @@ DEFINES += QT_DEPRECATED_WARNINGS #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ - src/de.cpp \ src/author.cpp \ src/about.cpp \ + src/de.cpp \ src/geTime.cpp \ src/lang.cpp \ src/loadLanguage.cpp \ @@ -26,22 +26,24 @@ SOURCES += \ src/bingbg.cpp \ src/makeDir.cpp \ src/parseXml.cpp \ + src/setbg.cpp HEADERS += \ - include/de.h \ include/author.h \ include/about.h \ include/bingbg.h \ include/proc.h \ - include/lang.h + include/lang.h \ + include/setbg.h \ + include/de.h FORMS += \ - form/de.ui \ form/author.ui \ form/about.ui \ form/bingbg.ui \ - form/lang.ui + form/lang.ui \ + form/de.ui TRANSLATIONS += \ lang/lang_en_US.ts \ diff --git a/form/about.ui b/form/about.ui index 20e12fe..599efce 100644 --- a/form/about.ui +++ b/form/about.ui @@ -30,9 +30,9 @@ p, li { white-space: pre-wrap; } <h3 style=" margin-top:14px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a name="write"></a><span style=" font-size:large; font-weight:600;">B</span><span style=" font-size:large; font-weight:600;">ing Backgrounds Getter(Qt)</span></h3> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Based on QT 4.12.2 (GCC version 9.3.0 (Debian 9.3.0-15), 64 bit)</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Built on </p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version 1.1 Beta</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Version 1.1.2 Beta</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright 2020 Theodore Cooper. All rights reserved.</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> </p></body></html> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> </p></body></html> diff --git a/form/bingbg.ui b/form/bingbg.ui index 0722f3e..5b91ec0 100644 --- a/form/bingbg.ui +++ b/form/bingbg.ui @@ -44,35 +44,25 @@ Get Wallpaper - - - - - - Linux Libertine Display O - true - - - - QCheckBox -{ - spacing: 5px; - color: black; -} -QCheckBox::indicator -{ - width: 17px; - height: 17px; -} - - - Set as Background - - - - - - + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 3 + @@ -105,15 +95,72 @@ QCheckBox::indicator - - + + + + + 0 + 0 + + + + Image URL + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 8 + + + + 10 + + + No URL... + + + Qt::AutoText + + + true + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + - Qt::Horizontal + Qt::Vertical - 40 - 20 + 20 + 40 @@ -144,38 +191,47 @@ QCheckBox::indicator - - + + + + + Linux Libertine Display O + true + + + + QCheckBox +{ + spacing: 5px; + color: black; +} +QCheckBox::indicator +{ + width: 17px; + height: 17px; +} + + + Set as Background + + + + + + + + - Qt::Vertical + Qt::Horizontal - 20 - 40 + 40 + 20 - - - - Image URL - - - - - - No URL... - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - diff --git a/form/de.ui b/form/de.ui index d13adea..42785a8 100644 --- a/form/de.ui +++ b/form/de.ui @@ -1,7 +1,7 @@ DE - + 0 @@ -11,32 +11,116 @@ - Form + Desktop Environment - - - - 0 - 0 - 411 - 311 - - - - true - - - - - 0 - 0 - 409 - 309 - - - - + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + Linux Libertine Display O + true + + + + Choose Desktop Environment + + + + + + true + + + + + 0 + 0 + 356 + 202 + + + + + + + MATE + + + + + + + Xfce + + + + + + + Gnome + + + + + + + Cinnamon + + + + + + + + + + + - + + + buttonBox + accepted() + DE + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DE + reject() + + + 316 + 260 + + + 286 + 274 + + + + diff --git a/form/lang.ui b/form/lang.ui index 83d7f2e..addbc07 100644 --- a/form/lang.ui +++ b/form/lang.ui @@ -94,14 +94,14 @@ - German + Deutsch - Russian + русский diff --git a/include/de.h b/include/de.h index 536f051..7bd41a1 100644 --- a/include/de.h +++ b/include/de.h @@ -1,13 +1,20 @@ -#ifndef SETTINGS_H -#define SETTINGS_H +#ifndef DE_H +#define DE_H -#include +#include +#include +#include +#include +#include +#include +#include +#include namespace Ui { class DE; } -class DE : public QWidget +class DE : public QDialog { Q_OBJECT @@ -15,8 +22,14 @@ class DE : public QWidget explicit DE(QWidget *parent = nullptr); ~DE(); + void checkDE(); + +private slots: + void on_buttonBox_clicked(QAbstractButton *button); + private: Ui::DE *ui; + QButtonGroup *groupButton; }; -#endif // SETTINGS_H +#endif // DE_H diff --git a/include/setbg.h b/include/setbg.h new file mode 100644 index 0000000..ec861c3 --- /dev/null +++ b/include/setbg.h @@ -0,0 +1,20 @@ +#ifndef SETBG_H +#define SETBG_H + + +class setBG +{ + +public: + setBG(); + + static void setBG_MATE(char *TIME, char *USRNAME); + + static void setBG_GNOME(char *TIME, char *USRNAME); + + static void setBG_XFCE(char *TIME, char *USRNAME); + + static void setBG_CINNAMON(char *TIME, char *USRNAME); +}; + +#endif // SETBG_H diff --git a/src/bingbg.cpp b/src/bingbg.cpp index b08ebc3..1c4cbaf 100644 --- a/src/bingbg.cpp +++ b/src/bingbg.cpp @@ -1,6 +1,7 @@ #include "include/bingbg.h" -#include "ui_bingbg.h" #include "include/proc.h" +#include "include/setbg.h" +#include "ui_bingbg.h" BingBG::BingBG(QWidget *parent) : QMainWindow(parent) @@ -126,14 +127,14 @@ void BingBG::openAuthor() void BingBG::openDE() { - qDebug()<<"open Settings"< show(); } void BingBG::openLANG() { - qDebug()<<"open lang"< show(); } @@ -277,6 +278,25 @@ void BingBG::downloadImg() void BingBG::setBG() { qDebug()<<"set backgrounds!!!"<setupUi(this); + groupButton=new QButtonGroup(this); + groupButton -> addButton(ui -> rbtn_mate, 0); + groupButton -> addButton(ui -> rbtn_xfce, 1); + groupButton -> addButton(ui -> rbtn_gnome, 2); + groupButton -> addButton(ui -> rbtn_cinn, 3); + + //groupButton->button(settings.value("DesktopEnvironment/default").toInt())->setChecked(1); } DE::~DE() { delete ui; } + +void DE::checkDE() +{ + char *time = geTime(); + char *user = getlogin(); + QString qtime(time); + QString quser(user); + QString qconfPath = "/home/" + quser + "/.bingbg/qt-config.ini"; + QSettings settings(qconfPath, QSettings::IniFormat); + switch(groupButton->checkedId()) + { + case 0: + settings.setValue("DesktopEnvironment/default", 0); + break; + case 1: + settings.setValue("DesktopEnvironment/default", 1); + break; + case 2: + settings.setValue("DesktopEnvironment/default", 2); + break; + case 3: + settings.setValue("DesktopEnvironment/default", 3); + break; + default: + break; + } +} + +void DE::on_buttonBox_clicked(QAbstractButton *button) +{ + if(ui->buttonBox->button(QDialogButtonBox::Ok) == button) + { + qDebug()<<"set de"<