Commit a2b51c4a authored by Roland Singer's avatar Roland Singer

first commit

parents
*~
*.pro.user
build
build-debug
Main developers:
Roland Singer <roland@manjaro.org>
This diff is collapsed.
qt4 or qt5
polkit-qt
pacman
keyboardctl
[Desktop Entry]
Name=Manjaro Settings Manager
Name[de]=Manjaro Einstellungen
Name[en_GB]=Manjaro Settings Manager
Name[fr]=Manjaro Gestionnaire de paramètres
Comment=Graphical Settings Manager for Manjaro
Comment[de]=Grafische Einstellungsverwaltung für Manjaro
Comment[en_GB]=Graphical Settings Manager for Manjaro
Comment[fr]=Gestionnaire graphique de paramètres pour Manjaro
Exec=manjaro-settings-manager
Icon=preferences-desktop
Terminal=false
Type=Application
Categories=Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings;
[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Manjaro Settings Manager Daemon
Comment=
Exec=manjaro-settings-manager-daemon
StartupNotify=false
Terminal=false
Hidden=false
\ No newline at end of file
#!/bin/sh
PROGRAM="/usr/bin/manjaro-settings-manager-gui"
if which gksu >/dev/null; then
gksu "$PROGRAM"
elif which kdesu >/dev/null; then
kdesu "$PROGRAM"
else
echo "error: no sudo/su frontend application found! Abording..." 1>&2
exit 1
fi
##
## Package : Language Package
##
## Examples how % will be replaced
##
## |-> firefox-i18n-en-US
## |-> firefox-i18n-en-us
## firefox-i18n-% -> |-> firefox-i18n-en_US
## |-> firefox-i18n-en_us
## |-> firefox-i18n-en
##
## Split language packages
##
firefox:firefox-i18n-%
thunderbird:thunderbird-i18n-%
aspell:aspell-%
calligra-words:calligra-l10n-%
gimp:gimp-help-%
hunspell:hunspell-%
hyphen:hyphen-%
kdebase-workspace:kde-l10n-%
libreoffice-common:libreoffice-%
man-pages:man-pages-%
libmythes:mythes-%
vim:vim-spell-%
##
## Global language packages
##
psi:psi-i18n
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONST_H
#define CONST_H
#define LANGUAGE_PACKAGES_FILE "/var/lib/manjaro-system-settings/language_packages.list"
#define LOCALE_GEN "/etc/locale.gen"
#endif // CONST_H
This diff is collapsed.
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLOBAL_H
#define GLOBAL_H
#include <QList>
#include <QString>
#include <QStringList>
#include <QProcess>
#include <QDebug>
#include <QFile>
#include <QTextStream>
#include <QRegExp>
#include "const.h"
class Global
{
public:
struct LanguagePackage {
QString languagePackage, parentPackage, locale;
};
static bool getLanguagePackages(QList<Global::LanguagePackage> *availablePackages, QList<Global::LanguagePackage> *installedPackages);
static bool isSystemUpToDate();
private:
struct Locale {
QString language, territory;
};
static QStringList getAllInstalledPackages(const QStringList & checkPackages);
static QStringList getAllAvailableRepoPackages(const QStringList & checkPackages);
static QList<Locale> getAllEnabledLocales();
};
#endif // GLOBAL_H
#-------------------------------------------------
#
# Project created by QtCreator 2013-03-14T19:23:46
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = global
TEMPLATE = lib
CONFIG += staticlib
SOURCES += global.cpp
HEADERS += global.h \
const.h
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "daemon.h"
Daemon::Daemon(QObject *parent) :
QTimer(parent)
{
// Set Interval to 30 minutes
setInterval(1800000);
connect(this, SIGNAL(timeout()) , this, SLOT(run()));
connect(&trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)) , this, SLOT(trayIcon_clicked()));
connect(&trayIcon, SIGNAL(messageClicked()) , this, SLOT(trayIcon_clicked()));
}
void Daemon::start() {
if (isActive())
return;
QTimer::singleShot(20000, this, SLOT(run()));
QTimer::start();
}
void Daemon::run() {
// Check if language packages are available
QList<Global::LanguagePackage> availablePackages, installedPackages;
if (Global::getLanguagePackages(&availablePackages, &installedPackages) && !availablePackages.isEmpty()) {
if (!trayIcon.isVisible()) {
trayIcon.setIcon(QIcon(":/images/resources/language.png"));
trayIcon.show();
showMessage(tr("Additional Language Packages"),
tr("%1 additional language packages available").arg(QString::number(availablePackages.size())));
}
}
else {
trayIcon.hide();
}
}
void Daemon::showMessage(QString messageTitel, QString messageText) {
this->messageTitel = messageTitel;
this->messageText = messageText;
QTimer::singleShot(2000, this, SLOT(trayIcon_showMessage()));
}
void Daemon::trayIcon_clicked() {
// Restart timer
stop();
QTimer::start();
// Hide tray icon
trayIcon.hide();
QProcess::startDetached("manjaro-settings-manager", QStringList() << "--page-language-packages");
}
void Daemon::trayIcon_showMessage() {
trayIcon.showMessage(messageTitel, messageText, QSystemTrayIcon::Information, 30000);
}
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DAEMON_H
#define DAEMON_H
#include <QTimer>
#include <QSystemTrayIcon>
#include <QIcon>
#include <QProcess>
#include <QStringList>
#include <global.h>
class Daemon : public QTimer
{
Q_OBJECT
public:
explicit Daemon(QObject *parent = 0);
void start();
private:
QSystemTrayIcon trayIcon;
QString messageTitel, messageText;
void showMessage(QString messageTitel, QString messageText);
protected slots:
void run();
void trayIcon_clicked();
void trayIcon_showMessage();
};
#endif // DAEMON_H
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QApplication>
#include "daemon.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Daemon daemon(&app);
daemon.start();
return app.exec();
}
#-------------------------------------------------
#
# Project created by QtCreator 2013-03-13T01:28:06
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = manjaro-settings-manager-daemon
TEMPLATE = app
SOURCES += main.cpp\
daemon.cpp
HEADERS += daemon.h
unix:!macx: LIBS += -L$$OUT_PWD/../global/ -lglobal
INCLUDEPATH += $$PWD/../global
DEPENDPATH += $$PWD/../global
unix:!macx: PRE_TARGETDEPS += $$OUT_PWD/../global/libglobal.a
RESOURCES += \
resources.qrc
target.path = /usr/bin
INSTALLS += target
<RCC>
<qresource prefix="/images">
<file>resources/language.png</file>
</qresource>
</RCC>
TEMPLATE = subdirs
SUBDIRS = global \
manjaro-settings-manager \
manjaro-settings-manager-daemon
OPTIONS += ordered
binfiles.path = /usr/bin/
binfiles.files = data/bin/*
varfiles.path = /var/lib/manjaro-system-settings/
varfiles.files = data/var/*
xdgautostart.path = /etc/xdg/autostart/
xdgautostart.files = data/autostart/*
appfiles.path = /usr/share/applications/
appfiles.files = data/applications/*
INSTALLS += binfiles varfiles xdgautostart appfiles
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "applydialog.h"
#include "ui_applydialog.h"
ApplyDialog::ApplyDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ApplyDialog)
{
ui->setupUi(this);
// Setup process
process.setProcessChannelMode(QProcess::MergedChannels);
connect(&process, SIGNAL(finished(int)) , this, SLOT(processFinished(int)));
connect(&process, SIGNAL(readyRead()) , this, SLOT(process_readyRead()));
connect(ui->buttonCancel, SIGNAL(clicked()) , this, SLOT(buttonCancel_clicked()));
connect(ui->buttonClose, SIGNAL(clicked()) , this, SLOT(close()));
connect(&closeTimer, SIGNAL(timeout()) , this, SLOT(closeTimer_timeout()));
}
ApplyDialog::~ApplyDialog()
{
delete ui;
}
int ApplyDialog::exec(QString cmd, QStringList arguments, QString infoText, bool skipCloseTimer) {
closeTimer.stop();
ui->textEdit->clear();
ui->buttonCancel->setEnabled(true);
ui->buttonClose->setVisible(false);
ui->buttonCancel->setVisible(true);
ui->buttonClose->setText(tr("Close"));
this->skipCloseTimer = skipCloseTimer;
if (!infoText.isEmpty())
ui->textEdit->append(infoText + "\n");
process.start(cmd, arguments);
return QDialog::exec();
}
bool ApplyDialog::processSuccess() {
if (process.exitStatus() == QProcess::QProcess::CrashExit)
return false;
return (process.exitCode() == 0);
}
//###
//### Private
//###
void ApplyDialog::buttonCancel_clicked() {
ui->buttonCancel->setEnabled(false);
if (process.state() != QProcess::NotRunning) {
process.terminate();
process.waitForFinished(3000);
}
close();
}
void ApplyDialog::processFinished(int exitCode) {
ui->buttonCancel->setVisible(false);
ui->buttonClose->setVisible(true);
if (exitCode == 0) {
ui->textEdit->append("\n-> " + tr("Process finished!"));
if (skipCloseTimer) {
close();
}
else {
closeSec = 3;
ui->buttonClose->setText(tr("Close (%1)").arg(QString::number(closeSec)));
closeTimer.start(1000);
}
}
else {
ui->textEdit->append("\n-> " + tr("Process failed!"));
}
}
void ApplyDialog::closeTimer_timeout() {
--closeSec;
ui->buttonClose->setText(tr("Close (%1)").arg(QString::number(closeSec)));
if (closeSec <= 0) {
closeTimer.stop();
close();
}
}
void ApplyDialog::process_readyRead() {
QString data = process.readAll().trimmed();
if (!data.isEmpty())
ui->textEdit->append(data);
}
/*
* Manjaro Settings Manager
* Roland Singer <roland@manjaro.org>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef APPLYDIALOG_H
#define APPLYDIALOG_H
#include <QDialog>
#include <QProcess>
#include <QString>
#include <QStringList>
#include <QPushButton>
#include <QTextEdit>
#include <QTimer>
namespace Ui {
class ApplyDialog;
}
class ApplyDialog : public QDialog
{
Q_OBJECT
public:
explicit ApplyDialog(QWidget *parent = 0);
~ApplyDialog();
int exec(QString cmd, QStringList arguments, QString infoText = "",bool skipCloseTimer = false);