Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • akiraohgaki/ocs-url
  • ab3875o/ocs-url
  • dembego3/ocs-url
  • arakun/ocs-url
  • longviauroy/ocs-url
  • rolfen/ocs-url
  • hemm/ocs-url
  • simonsvw0000/ocs-url
  • dfn2/ocs-url
  • rws77/ocs-url
  • bitwalk/ocs-url
  • visdom/ocs-url
  • ricatfarker/ocs-url
  • mussah/ocs-url
  • tigefa/ocs-url
  • cobalt2727/ocs-url
  • ammark226/ocs-url
  • violethaze74/ocs-url
  • armedssault/ocs-url
  • billflick/ocs-url
  • kimblejeremy/ocs-url
  • yuvrajsm/ocs-url
  • wawmart/ocs-url
  • jhefry/ocs-url
  • robcdntruckin/ocs-url
  • bigmake2266/ocs-url
  • kamil-chbeir/ocs-url
  • jocker73/ocs-url
  • laboties/ocs-url
  • smekke61279-522014/ocs-url
  • coolduck/ocs-url
  • zulfikar-lahiya/ocs-url
  • faz-83/ocs-url
  • dado105/ocs-url
34 results
Show changes
Commits on Source (546)
Showing
with 844 additions and 308 deletions
*.pro.user
build_*/
lib/qtil/
stages:
- build
ubuntu_deb:
stage: build
image: ubuntu:14.04
only:
- master
- /^release\-.+/
script:
- ./scripts/package ubuntu_deb
artifacts:
paths:
- build_*/ocs-url*.deb
expire_in: 2 days
fedora_rpm:
stage: build
image: fedora:20
only:
- master
- /^release\-.+/
script:
- ./scripts/package fedora_rpm
artifacts:
paths:
- build_*/RPMS/x86_64/ocs-url*.rpm
expire_in: 2 days
opensuse_rpm:
stage: build
image: opensuse:42.3
only:
- master
- /^release\-.+/
script:
- ./scripts/package opensuse_rpm
artifacts:
paths:
- build_*/RPMS/x86_64/ocs-url*.rpm
expire_in: 2 days
archlinux_pkg:
stage: build
image: archlinux/base:latest
only:
- master
- /^release\-.+/
script:
- ./scripts/package archlinux_pkg
artifacts:
paths:
- build_*/ocs-url*.pkg.tar.xz
expire_in: 2 days
# Install-type mapping
## https://www.app-addons.org/
Category | Install-type
---------|-------------
GnoMenu Skins | -
VLC Skins | -
XMMS Skins | -
Krita Resources | -
Amarok Themes | -
Knights Themes | -
Yakuake Skins | yakuake_skins
Kdenlive FX | -
ODF Templates | -
MPlayer Themes | -
## https://www.compiz-themes.org/
Category | Install-type
---------|-------------
Compiz Themes | emerald_themes / compiz_themes
Skydomes | -
Cubecaps | -
## https://www.e17-stuff.org/
Category | Install-type
---------|-------------
Enlightenment Themes | enlightenment_themes
E17 Entrance Themes | -
E17 Enlightenment Backgrounds | enlightenment_backgrounds
E17 Animated Backgrounds | enlightenment_backgrounds
## https://www.free-artwork.org/
Category | Install-type
---------|-------------
3D Renderings | -
Stock Images | -
Animations | -
Drawings | -
Cliparts | -
Paintings | -
Artwork Contest | -
Inkscape Templates | -
Scribus Templates | -
Logos | -
## https://www.box-look.org/
Category | Install-type
---------|-------------
Beryl/Emerald Themes | emerald_themes / beryl_themes
Metacity Window Decorations | themes / metacity_themes
Fluxbox Themes | fluxbox_styles
Openbox Themes | themes / openbox_themes
Pek-WM Themes | pekwm_themes
Ice-WM Themes | icewm_themes
FVWM Themes | -
Window-Maker Themes | -
## https://www.beryl-themes.org/
Category | Install-type
---------|-------------
Beryl/Emerald Themes | emerald_themes / beryl_themes
## https://www.cinnamon-look.org/
Category | Install-type
---------|-------------
Cinnamon Themes | themes / cinnamon_themes
GTK3 Themes | themes / gtk3_themes
MDM Themes | -
GNOME Icon Themes | icons
Cinnamon Applets | cinnamon_applets
Cinnamon Desklets | cinnamon_desklets
Cinnamon Extensions | cinnamon_extensions
## https://www.trinity-look.org/
Category | Install-type
---------|-------------
Wallpapers | wallpapers
KDE 3.x Window Decorations | -
KDE 3.x Themes | -
Kbfx Menu Themes | -
Karamba | -
KDM3 Themes | -
KDE 3 Splash Screens | -
## https://www.gnome-look.org/
Category | Install-type
---------|-------------
Wallpapers | wallpapers
Fonts | fonts
Mouse Themes | cursors
Metacity Window Decorations | themes / metacity_themes
Nautilus Scripts | nautilus_scripts
GnoMenu Skins | -
GDM Themes | -
GNOME 3.x Shell Themes | themes / gnome_shell_themes
GTK3 Themes | themes / gtk3_themes
GTK2 Themes | themes / gtk2_themes
Icon Themes | icons
Gnome Extensions | gnome_shell_extensions
Gnome Color Schemes | -
Gnome Other | -
Cairo Clock Themes | cairo_clock_themes
## https://www.mate-look.org/
Category | Install-type
---------|-------------
Mouse Themes | cursors
Metacity Window Decorations | themes / metacity_themes
GDM Themes | -
GNOME Icon Themes | icons
GTK2 Themes | themes / gtk2_themes
## https://www.xfce-look.org/
Category | Install-type
---------|-------------
Wallpapers | wallpapers
Mouse Themes | cursors
Compiz Themes | emerald_themes / compiz_themes
Beryl/Emerald Themes | emerald_themes / beryl_themes
GTK2 Themes | themes / gtk2_themes
XFCE Icon Themes | icons
XFCE/XFWM Themes | themes / xfwm4_themes
## https://www.kde-look.org/
Category | Install-type
---------|-------------
Plasma Look'n'Feel | plasma_look_and_feel / plasma5_look_and_feel
Plasma 5 Themes | plasma_desktopthemes / plasma5_desktopthemes
Plasma Widget Styles | -
Aurorae Themes | aurorae_themes
deKorator Themes | dekorator_themes
Kvantum Styles | themes / kvantum_themes
QtCurve Styles | qtcurve
Bespin Themes | -
Plasma Splash Screens | -
SDDM Themes | -
Plasma 5 Widgets | plasma_plasmoids / plasma5_plasmoids
Plasma Color Schemes | color_schemes / plasma_color_schemes
Mouse Cursors | cursors
Emoticons | emoticons
Conky Screenlets | -
Kwin Scripts | kwin_scripts
Kwin Switching Layouts | kwin_tabbox
Dolphin Service Menus | -
Amarok 2.x Scripts | amarok_scripts
Plasma Improvements | -
Plasma Comics | -
Yakuake Skins | yakuake_skins
Wallpapers | wallpapers
# xdgurl
# ocs-url
An install helper program for desktop stuff.
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
An install helper program for items served via OpenCollaborationServices (ocs://).
## How to install
Copyright: 2016-2019, Opendesktop.org
For Ubuntu/Debian system,
you can use "install.sh" in the project to install the program.
License: GPL-3+
$ sh install.sh
Download Linux package from:
And you can use "uninstall.sh" to uninstall the program.
https://www.opendesktop.org/p/1136805/
$ sh uninstall.sh
## How to use
#### From web browser
Open XDG-URL by click a links, or type XDG-URL in browser's address bar.
In firefox,
you can get a program selection window when first time to open XDG-URL,
and you can choose "xdgurl" as custom URL handler.
If you can not get a program selection window,
you need set the xdgurl program as custom URL handler for xdg:// scheme in browser's settings.
#### From command-line terminal
Execute xdgurl program with argument XDG-URL.
$ xdgurl "XDG-URL"
## XDG-URL
XDG-URL is a custom URL that represent the installation method for desktop stuff.
[scheme]://[command]?[query string]
For example:
xdg://install?url=http%3A%2F%2Fexample.com%2Ficons.tar.gz&type=icons
#### Scheme
* xdg
* xdgs
"xdgs" scheme is the same of the xdg scheme for now,
it's a reserved name for secure protocol in the future.
#### Command
* download
* install
Command "download" will download the file from specified URL to local destination of specified install-type.
Command "install" will make file downloading and trigger installation process.
#### Query string
XDG-URL's query string is an option of command.
*All query string values should be urlencoded.*
**url** = File URL of desktop stuff
Must be set.
**type** = Install-type
Optional.
Default is "downloads".
Available install-type:
Install-type | Local destination
-------------|------------------
downloads | ~/Downloads
documents | ~/Documents
pictures | ~/Pictures
music | ~/Music
videos | ~/Videos
wallpapers | ~/.local/share/wallpapers
fonts | ~/.fonts
cursors | ~/.icons
icons | ~/.local/share/icons
emoticons | ~/.local/share/emoticons
themes | ~/.themes
emerald_themes | ~/.emerald/themes
enlightenment_themes | ~/.e/e/themes
enlightenment_backgrounds | ~/.e/e/backgrounds
fluxbox_styles | ~/.fluxbox/styles
pekwm_themes | ~/.pekwm/themes
icewm_themes | ~/.icewm/themes
plasma_plasmoids | ~/.local/share/plasma/plasmoids
plasma_look_and_feel | ~/.local/share/plasma/look-and-feel
plasma_desktopthemes | ~/.local/share/plasma/desktoptheme
kwin_effects | ~/.local/share/kwin/effects
kwin_scripts | ~/.local/share/kwin/scripts
kwin_tabbox | ~/.local/share/kwin/tabbox
aurorae_themes | ~/.local/share/aurorae/themes
dekorator_themes | ~/.local/share/deKorator/themes
qtcurve | ~/.local/share/QtCurve
color_schemes | ~/.local/share/color-schemes
gnome_shell_extensions | ~/.local/share/gnome-shell/extensions
cinnamon_applets | ~/.local/share/cinnamon/applets
cinnamon_desklets | ~/.local/share/cinnamon/desklets
cinnamon_extensions | ~/.local/share/cinnamon/extensions
nautilus_scripts | ~/.local/share/nautilus/scripts
amarok_scripts | ~/.kde/share/apps/amarok/scripts
yakuake_skins | ~/.kde/share/apps/yakuake/skins
cairo_clock_themes | ~/.cairo-clock/themes
Available alias name of the install-type:
Alias | Install-type
------|-------------
gnome_shell_themes | themes
cinnamon_themes | themes
gtk2_themes | themes
gtk3_themes | themes
metacity_themes | themes
xfwm4_themes | themes
openbox_themes | themes
kvantum_themes | themes
compiz_themes | emerald_themes
beryl_themes | emerald_themes
plasma4_plasmoids | plasma_plasmoids
plasma5_plasmoids | plasma_plasmoids
plasma5_look_and_feel | plasma_look_and_feel
plasma5_desktopthemes | plasma_desktopthemes
plasma_color_schemes | color_schemes
**filename** = Alternative file name
Optional.
This option is useful if the download URL does not represent the file name.
And please see docs/* for more information.
CONFIG += c++11
QT += \
core \
gui \
widgets \
qml \
quick \
svg
HEADERS += \
$${PWD}/src/handlers/confighandler.h \
$${PWD}/src/handlers/ocsurlhandler.h
SOURCES += \
$${PWD}/src/main.cpp \
$${PWD}/src/handlers/confighandler.cpp \
$${PWD}/src/handlers/ocsurlhandler.cpp
RESOURCES += \
$${PWD}/configs/configs.qrc \
$${PWD}/images/images.qrc \
$${PWD}/qml/qml.qrc
INCLUDEPATH += $${PWD}/src
{
"id": "ocs-url",
"name": "ocs-url",
"version": "3.1.0",
"organization": "Opendesktop.org",
"domain": "org.opendesktop.ocs-url",
"icon": ":/desktop/ocs-url.svg",
"description": "An install helper program for items served via OpenCollaborationServices (ocs://).",
"license": "GPL-3+",
"author": "Opendesktop.org",
"contact": "contact@opendesktop.org",
"homepage": "https://git.opendesktop.org/akiraohgaki/ocs-url"
}
<RCC>
<qresource prefix="/configs">
<file>application.json</file>
<file>install_types.json</file>
<file>install_types_alias.json</file>
</qresource>
</RCC>
{
"bin": {
"name": "Software",
"destination": "$HOME/.local/bin",
"generic_destination": "$APP_DATA/bin"
},
"downloads": {
"name": "Downloads",
"destination": "$XDG_DOWNLOAD_DIR",
"generic_destination": "$APP_DATA/downloads"
},
"documents": {
"name": "Documents",
"destination": "$XDG_DOCUMENTS_DIR",
"generic_destination": "$APP_DATA/documents"
},
"pictures": {
"name": "Pictures",
"destination": "$XDG_PICTURES_DIR",
"generic_destination": "$APP_DATA/pictures"
},
"music": {
"name": "Music",
"destination": "$XDG_MUSIC_DIR",
"generic_destination": "$APP_DATA/music"
},
"videos": {
"name": "Videos",
"destination": "$XDG_VIDEOS_DIR",
"generic_destination": "$APP_DATA/videos"
},
"wallpapers": {
"name": "Wallpapers",
"destination": "$XDG_DATA_HOME/wallpapers",
"generic_destination": "$APP_DATA/wallpapers"
},
"fonts": {
"name": "Fonts",
"destination": "$HOME/.fonts",
"generic_destination": "$APP_DATA/fonts"
},
"cursors": {
"name": "Cursors",
"destination": "$HOME/.icons",
"generic_destination": "$APP_DATA/cursors"
},
"icons": {
"name": "Icons",
"destination": "$XDG_DATA_HOME/icons",
"generic_destination": "$APP_DATA/icons"
},
"emoticons": {
"name": "Emoticons",
"destination": "$XDG_DATA_HOME/emoticons",
"generic_destination": "$APP_DATA/emoticons"
},
"themes": {
"name": "Desktop Themes",
"destination": "$HOME/.themes",
"generic_destination": "$APP_DATA/themes"
},
"emerald_themes": {
"name": "Emerald Themes",
"destination": "$HOME/.emerald/themes",
"generic_destination": "$APP_DATA/emerald_themes"
},
"enlightenment_themes": {
"name": "Enlightenment Themes",
"destination": "$HOME/.e/e/themes",
"generic_destination": "$APP_DATA/enlightenment_themes"
},
"enlightenment_backgrounds": {
"name": "Enlightenment Backgrounds",
"destination": "$HOME/.e/e/backgrounds",
"generic_destination": "$APP_DATA/enlightenment_backgrounds"
},
"fluxbox_styles": {
"name": "Fluxbox Styles",
"destination": "$HOME/.fluxbox/styles",
"generic_destination": "$APP_DATA/fluxbox_styles"
},
"pekwm_themes": {
"name": "PekWM Themes",
"destination": "$HOME/.pekwm/themes",
"generic_destination": "$APP_DATA/pekwm_themes"
},
"icewm_themes": {
"name": "IceWM Themes",
"destination": "$HOME/.icewm/themes",
"generic_destination": "$APP_DATA/icewm_themes"
},
"plasma_plasmoids": {
"name": "Plasma Plasmoids",
"destination": "$XDG_DATA_HOME/plasma/plasmoids",
"generic_destination": "$APP_DATA/plasma_plasmoids"
},
"plasma_look_and_feel": {
"name": "Plasma Look and Feel",
"destination": "$XDG_DATA_HOME/plasma/look-and-feel",
"generic_destination": "$APP_DATA/plasma_look_and_feel"
},
"plasma_desktopthemes": {
"name": "Plasma Desktop Themes",
"destination": "$XDG_DATA_HOME/plasma/desktoptheme",
"generic_destination": "$APP_DATA/plasma_desktopthemes"
},
"kwin_effects": {
"name": "KWin Effects",
"destination": "$XDG_DATA_HOME/kwin/effects",
"generic_destination": "$APP_DATA/kwin_effects"
},
"kwin_scripts": {
"name": "KWin Scripts",
"destination": "$XDG_DATA_HOME/kwin/scripts",
"generic_destination": "$APP_DATA/kwin_scripts"
},
"kwin_tabbox": {
"name": "KWin Window Switcher",
"destination": "$XDG_DATA_HOME/kwin/tabbox",
"generic_destination": "$APP_DATA/kwin_tabbox"
},
"aurorae_themes": {
"name": "Aurorae Themes",
"destination": "$XDG_DATA_HOME/aurorae/themes",
"generic_destination": "$APP_DATA/aurorae_themes"
},
"dekorator_themes": {
"name": "deKorator Themes",
"destination": "$XDG_DATA_HOME/deKorator/themes",
"generic_destination": "$APP_DATA/dekorator_themes"
},
"qtcurve": {
"name": "QtCurve Themes",
"destination": "$XDG_DATA_HOME/QtCurve",
"generic_destination": "$APP_DATA/qtcurve"
},
"color_schemes": {
"name": "KDE Color Schemes",
"destination": "$XDG_DATA_HOME/color-schemes",
"generic_destination": "$APP_DATA/color_schemes"
},
"gnome_shell_extensions": {
"name": "Gnome Shell Extensions",
"destination": "$XDG_DATA_HOME/gnome-shell/extensions",
"generic_destination": "$APP_DATA/gnome_shell_extensions"
},
"cinnamon_applets": {
"name": "Cinnamon Applets",
"destination": "$XDG_DATA_HOME/cinnamon/applets",
"generic_destination": "$APP_DATA/cinnamon_applets"
},
"cinnamon_desklets": {
"name": "Cinnamon Desklets",
"destination": "$XDG_DATA_HOME/cinnamon/desklets",
"generic_destination": "$APP_DATA/cinnamon_desklets"
},
"cinnamon_extensions": {
"name": "Cinnamon Extensions",
"destination": "$XDG_DATA_HOME/cinnamon/extensions",
"generic_destination": "$APP_DATA/cinnamon_extensions"
},
"nautilus_scripts": {
"name": "Nautilus Scripts",
"destination": "$XDG_DATA_HOME/nautilus/scripts",
"generic_destination": "$APP_DATA/nautilus_scripts"
},
"amarok_scripts": {
"name": "Amarok Scripts",
"destination": "$KDEHOME/share/apps/amarok/scripts",
"generic_destination": "$APP_DATA/amarok_scripts"
},
"yakuake_skins": {
"name": "Yakuake Skins",
"destination": "$KDEHOME/share/apps/yakuake/skins",
"generic_destination": "$APP_DATA/yakuake_skins"
},
"cairo_clock_themes": {
"name": "Cairo-Clock Themes",
"destination": "$HOME/.cairo-clock/themes",
"generic_destination": "$APP_DATA/cairo_clock_themes"
},
"books": {
"name": "Books",
"destination": "$APP_DATA/books",
"generic_destination": "$APP_DATA/books"
},
"comics": {
"name": "Comics",
"destination": "$APP_DATA/comics",
"generic_destination": "$APP_DATA/comics"
}
}
{
"gnome_shell_themes": {
"base": "themes",
"name": "Gnome Shell Themes"
},
"cinnamon_themes": {
"base": "themes",
"name": "Cinnamon Themes"
},
"gtk2_themes": {
"base": "themes",
"name": "GTK2 Themes"
},
"gtk3_themes": {
"base": "themes",
"name": "GTK3 Themes"
},
"metacity_themes": {
"base": "themes",
"name": "Metacity Themes"
},
"xfwm4_themes": {
"base": "themes",
"name": "XFWM4 Themes"
},
"openbox_themes": {
"base": "themes",
"name": "Openbox Themes"
},
"kvantum_themes": {
"base": "themes",
"name": "Kvantum Themes"
},
"compiz_themes": {
"base": "emerald_themes",
"name": "Compiz Themes"
},
"beryl_themes": {
"base": "emerald_themes",
"name": "Beryl Themes"
},
"plasma4_plasmoids": {
"base": "plasma_plasmoids",
"name": "Plasma4 Plasmoids"
},
"plasma5_plasmoids": {
"base": "plasma_plasmoids",
"name": "Plasma5 Plasmoids"
},
"plasma5_look_and_feel": {
"base": "plasma_look_and_feel",
"name": "Plasma5 Look and Feel"
},
"plasma5_desktopthemes": {
"base": "plasma_desktopthemes",
"name": "Plasma5 Desktop Themes"
},
"plasma_color_schemes": {
"base": "color_schemes",
"name": "Plasma Color Schemes"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
<g id="icon">
<path d="M64,8 C33.072,8 8,33.072 8,64 C8,94.928 33.072,120 64,120 C94.928,120 120,94.928 120,64 C120,33.072 94.928,8 64,8 z M64,24 C68.418,24 72,27.582 72,32 C72,36.418 68.418,40 64,40 C59.582,40 56,36.418 56,32 C56,27.582 59.582,24 64,24 z M48,48 L72,48 L72,96 L80,96 L80,104 L48,104 L48,96 L56,96 L56,56 L48,56 L48,48 z" fill="#000000" id="dialog-information"/>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
<g id="icon">
<path d="M64,16 L8,112 L120,112 L64,16 z M56,48 L72,48 L72,80 L56,80 L56,48 z M64,88 C68.418,88 72,91.582 72,96 C72,100.418 68.418,104 64,104 C59.582,104 56,100.418 56,96 C56,91.582 59.582,88 64,88 z" fill="#000000" id="dialog-warning"/>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
<g id="icon">
<path d="M64,8 C33.072,8 8,33.072 8,64 C8,94.928 33.072,120 64,120 C94.928,120 120,94.928 120,64 C120,33.072 94.928,8 64,8 z M80,32 L104,32 L56,104 L32,80 L32,56 L56,80 L80,32 z" fill="#000000" id="emblem-default"/>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="128" height="128" viewBox="0, 0, 128, 128">
<g id="icon">
<path d="M40,8 L40,48 L16,48 L64,96 L112,48 L88,48 L88,8 L40,8 z M8,72 L8,120 L120,120 L120,72 L104,72 L104,104 L24,104 L24,72 L8,72 z" fill="#000000" id="emblem-downloads"/>
</g>
</svg>
<RCC>
<qresource prefix="/images">
<file>icons/dialog-information.svg</file>
<file>icons/dialog-warning.svg</file>
<file>icons/emblem-default.svg</file>
<file>icons/emblem-downloads.svg</file>
</qresource>
</RCC>
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import "ui" as Ui
import "scripts/Utility.js" as Utility
ApplicationWindow {
id: app
title: configHandler.getAppConfigApplication().name
visible: true
width: 400
minimumWidth: width
maximumWidth: width
height: 200
minimumHeight: height
maximumHeight: height
function init() {
var metadata = ocsUrlHandler.metadata();
var primaryMessages = {
"success_download": qsTr("Download successful"),
"success_install": qsTr("Installation successful"),
"error_validation": qsTr("Validation error"),
"error_network": qsTr("Network error"),
"error_save": qsTr("Saving file failed"),
"error_install": qsTr("Installation failed")
};
ocsUrlHandler.started.connect(function() {
confirmDialog.close();
progressDialog.open();
});
ocsUrlHandler.finishedWithSuccess.connect(function(result) {
progressDialog.close();
infoDialog.primaryText = primaryMessages[result.status];
infoDialog.informativeText = metadata.filename;
infoDialog.detailedText = result.message;
infoDialog.open();
});
ocsUrlHandler.finishedWithError.connect(function(result) {
progressDialog.close();
errorDialog.primaryText = primaryMessages[result.status];
errorDialog.informativeText = metadata.filename;
errorDialog.detailedText = result.message;
errorDialog.open();
});
ocsUrlHandler.downloadProgress.connect(function(id, bytesReceived, bytesTotal) {
progressDialog.primaryText = qsTr("Downloading");
progressDialog.informativeText = metadata.filename;
progressDialog.detailedContentLoader.item.progressBar = bytesReceived / bytesTotal;
progressDialog.detailedContentLoader.item.progressText
= Utility.convertByteToHumanReadable(bytesReceived)
+ " / " + Utility.convertByteToHumanReadable(bytesTotal);
});
if (ocsUrlHandler.isValid()) {
if (metadata.command === "download") {
confirmDialog.primaryText = qsTr("Do you want to download?");
}
else if (metadata.command === "install") {
confirmDialog.primaryText = qsTr("Do you want to install?");
}
confirmDialog.informativeText = metadata.filename;
confirmDialog.detailedText
= qsTr("URL") + ": " + metadata.url + "\n"
+ qsTr("File") + ": " + metadata.filename + "\n"
+ qsTr("Type") + ": " + configHandler.getAppConfigInstallTypes()[metadata.type].name;
confirmDialog.open();
}
else {
errorDialog.primaryText = primaryMessages["error_validation"];
errorDialog.detailedText = qsTr("Invalid OCS-URL");
errorDialog.open();
}
}
function fixWindowSize(dialog) {
if (dialog.visible) {
app.height = dialog.implicitHeight + (dialog.anchors.margins * 2);
app.minimumHeight = app.height;
app.maximumHeight = app.height;
}
}
Ui.Dialog {
id: confirmDialog
icon: "qrc:/images/icons/dialog-information.svg"
actionButton.text: qsTr("Details")
actionButton.onClicked: toggleDetails()
acceptButton.text: qsTr("OK")
acceptButton.onClicked: ocsUrlHandler.process()
rejectButton.text: qsTr("Cancel")
rejectButton.onClicked: Qt.quit()
onVisibleChanged: app.fixWindowSize(confirmDialog)
onImplicitHeightChanged: app.fixWindowSize(confirmDialog)
}
Ui.Dialog {
id: infoDialog
icon: "qrc:/images/icons/emblem-default.svg"
actionButton.text: qsTr("Details")
actionButton.onClicked: toggleDetails()
acceptButton.text: qsTr("Open")
acceptButton.onClicked: {
ocsUrlHandler.openDestination();
Qt.quit();
}
rejectButton.text: qsTr("Close")
rejectButton.onClicked: Qt.quit()
onVisibleChanged: app.fixWindowSize(infoDialog)
onImplicitHeightChanged: app.fixWindowSize(infoDialog)
}
Ui.Dialog {
id: errorDialog
icon: "qrc:/images/icons/dialog-warning.svg"
actionButton.text: qsTr("Details")
actionButton.onClicked: toggleDetails()
rejectButton.text: qsTr("Close")
rejectButton.onClicked: Qt.quit()
onVisibleChanged: app.fixWindowSize(errorDialog)
onImplicitHeightChanged: app.fixWindowSize(errorDialog)
}
Component {
id: progressComponent
ColumnLayout {
property alias progressBar: progressBar.value
property alias progressText: progressText.text
anchors.fill: parent
spacing: 4
ProgressBar {
id: progressBar
minimumValue: 0
maximumValue: 1
value: 0
Layout.fillWidth: true
}
Label {
id: progressText
text: ""
Layout.alignment: Qt.AlignRight
}
}
}
Ui.Dialog {
id: progressDialog
icon: "qrc:/images/icons/emblem-downloads.svg"
detailsVisible: true
detailedContentLoader.sourceComponent: progressComponent
rejectButton.text: qsTr("Cancel")
rejectButton.onClicked: Qt.quit()
onVisibleChanged: app.fixWindowSize(progressDialog)
onImplicitHeightChanged: app.fixWindowSize(progressDialog)
}
Component.onCompleted: {
app.init();
}
}
<RCC>
<qresource prefix="/qml">
<file>main.qml</file>
<file>ui/Dialog.qml</file>
<file>scripts/Utility.js</file>
</qresource>
</RCC>
.pragma library
function convertByteToHumanReadable(bytes) {
bytes = parseFloat(bytes);
var kb = 1024;
var mb = 1024 * kb;
var gb = 1024 * mb;
var tb = 1024 * gb;
var pb = 1024 * tb;
var eb = 1024 * pb;
var zb = 1024 * eb;
var yb = 1024 * zb;
var text = '';
if (bytes < kb) {
text = bytes.toFixed(0) + ' B';
}
else if (bytes < mb) {
text = (bytes / kb).toFixed(2) + ' KB';
}
else if (bytes < gb) {
text = (bytes / mb).toFixed(2) + ' MB';
}
else if (bytes < tb) {
text = (bytes / gb).toFixed(2) + ' GB';
}
else if (bytes < pb) {
text = (bytes / tb).toFixed(2) + ' TB';
}
else if (bytes < eb) {
text = (bytes / pb).toFixed(2) + ' PB';
}
else if (bytes < zb) {
text = (bytes / eb).toFixed(2) + ' EB';
}
else if (bytes < yb) {
text = (bytes / zb).toFixed(2) + ' ZB';
}
else if (bytes >= yb) {
text = (bytes / yb).toFixed(2) + ' YB';
}
return text;
}
import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
ColumnLayout {
id: dialog
visible: false
anchors.fill: parent
anchors.margins: 12
spacing: 12
property alias icon: icon.source
property alias primaryText: primaryText.text
property alias informativeText: informativeText.text
property alias detailsVisible: details.visible
property alias detailedText: detailedText.text
property alias detailedContentLoader: detailedContentLoader
property alias actionButton: actionButton
property alias acceptButton: acceptButton
property alias rejectButton: rejectButton
function open() {
dialog.visible = true;
}
function close() {
dialog.visible = false;
}
function toggleDetails() {
details.visible = details.visible ? false : true;
}
RowLayout {
Layout.fillWidth: true
spacing: 12
Image {
id: icon
source: ""
visible: source.toString() ? true : false
Layout.preferredWidth: 48
Layout.preferredHeight: 48
sourceSize.width: 128
sourceSize.height: 128
}
ColumnLayout {
Layout.fillWidth: true
spacing: 4
Label {
id: primaryText
text: ""
visible: text ? true : false
Layout.fillWidth: true
wrapMode: Text.WrapAnywhere
font.bold: true
font.pixelSize: 14
}
Label {
id: informativeText
text: ""
visible: text ? true : false
Layout.fillWidth: true
wrapMode: Text.WrapAnywhere
}
}
}
ColumnLayout {
id: details
visible: false
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 12
Label {
id: detailedText
text: ""
visible: text ? true : false
Layout.fillWidth: true
wrapMode: Text.WrapAnywhere
}
Loader {
id: detailedContentLoader
visible: (source.toString() || sourceComponent) ? true : false
Layout.fillWidth: true
}
}
RowLayout {
Layout.fillWidth: true
spacing: 4
Button {
id: actionButton
text: ""
visible: text ? true : false
}
Item {
Layout.fillWidth: true
}
Button {
id: acceptButton
text: ""
visible: text ? true : false
}
Button {
id: rejectButton
text: ""
visible: text ? true : false
}
}
}
#include "confighandler.h"
#include <QStringList>
#include <QStandardPaths>
#include "qtil_dir.h"
ConfigHandler::ConfigHandler(QObject *parent)
: QObject(parent)
{
appConfig_ = Qtil::Config(":/configs");
importAppConfigApplication();
importAppConfigInstallTypes();
}
QJsonObject ConfigHandler::getAppConfigApplication() const
{
return appConfigApplication_;
}
QJsonObject ConfigHandler::getAppConfigInstallTypes() const
{
return appConfigInstallTypes_;
}
void ConfigHandler::importAppConfigApplication()
{
appConfigApplication_ = appConfig_.get("application");
}
void ConfigHandler::importAppConfigInstallTypes()
{
auto installTypes = appConfig_.get("install_types");
for (const auto &key : installTypes.keys()) {
auto installtype = installTypes[key].toObject();
installtype["destination"] = convertPathString(installtype["destination"].toString());
installtype["generic_destination"] = convertPathString(installtype["generic_destination"].toString());
installTypes[key] = installtype;
}
auto installTypesAlias = appConfig_.get("install_types_alias");
for (const auto &key : installTypesAlias.keys()) {
auto installTypeAlias = installTypesAlias[key].toObject();
auto baseKey = installTypeAlias["base"].toString();
if (installTypes.contains(baseKey)) {
auto installType = installTypes[baseKey].toObject();
installType["base"] = baseKey;
installType["name"] = installTypeAlias["name"].toString();
installTypes[key] = installType;
}
}
appConfigInstallTypes_ = installTypes;
}
QString ConfigHandler::convertPathString(const QString &path) const
{
auto newPath = path;
if (newPath.contains("$HOME")) {
newPath.replace("$HOME", Qtil::Dir::homePath());
}
else if (newPath.contains("$XDG_DOCUMENTS_DIR")) {
newPath.replace("$XDG_DOCUMENTS_DIR", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
}
else if (newPath.contains("$XDG_DOWNLOAD_DIR")) {
newPath.replace("$XDG_DOWNLOAD_DIR", QStandardPaths::writableLocation(QStandardPaths::DownloadLocation));
}
else if (newPath.contains("$XDG_PICTURES_DIR")) {
newPath.replace("$XDG_PICTURES_DIR", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
}
else if (newPath.contains("$XDG_MUSIC_DIR")) {
newPath.replace("$XDG_MUSIC_DIR", QStandardPaths::writableLocation(QStandardPaths::MusicLocation));
}
else if (newPath.contains("$XDG_VIDEOS_DIR")) {
newPath.replace("$XDG_VIDEOS_DIR", QStandardPaths::writableLocation(QStandardPaths::MoviesLocation));
}
else if (newPath.contains("$XDG_DATA_HOME")) {
newPath.replace("$XDG_DATA_HOME", Qtil::Dir::genericDataPath());
}
else if (newPath.contains("$KDEHOME")) {
newPath.replace("$KDEHOME", Qtil::Dir::kdehomePath());
}
else if (newPath.contains("$APP_DATA")) {
newPath.replace("$APP_DATA", Qtil::Dir::genericDataPath() + "/" + getAppConfigApplication()["id"].toString());
}
return newPath;
}
#pragma once
#include <QObject>
#include <QJsonObject>
#include "qtil_config.h"
class ConfigHandler : public QObject
{
Q_OBJECT
public:
explicit ConfigHandler(QObject *parent = nullptr);
public slots:
QJsonObject getAppConfigApplication() const;
QJsonObject getAppConfigInstallTypes() const;
private:
void importAppConfigApplication();
void importAppConfigInstallTypes();
QString convertPathString(const QString &path) const;
Qtil::Config appConfig_;
QJsonObject appConfigApplication_;
QJsonObject appConfigInstallTypes_;
};