diff options
author | q5sys <jt@obs-sec.com> | 2016-11-20 01:43:17 -0500 |
---|---|---|
committer | q5sys <jt@obs-sec.com> | 2016-11-20 01:43:17 -0500 |
commit | b9840ef585385fece513e24e4cea193d35328dc0 (patch) | |
tree | baf3f6ea9b462bb35bb71679639dbc345b36f400 | |
parent | search clear function on ESC press (diff) | |
parent | Add a new dialog UI form (not integrated yet) for a front-end to "dd"ing ISO/... (diff) | |
download | lumina-b9840ef585385fece513e24e4cea193d35328dc0.tar.gz lumina-b9840ef585385fece513e24e4cea193d35328dc0.tar.bz2 lumina-b9840ef585385fece513e24e4cea193d35328dc0.zip |
search clear function on ESC press
27 files changed, 865 insertions, 181 deletions
diff --git a/src-qt5/core-utils/lumina-config/LPlugins.cpp b/src-qt5/core-utils/lumina-config/LPlugins.cpp index 089a181c..dfd490e6 100644 --- a/src-qt5/core-utils/lumina-config/LPlugins.cpp +++ b/src-qt5/core-utils/lumina-config/LPlugins.cpp @@ -173,6 +173,13 @@ void LPlugins::LoadPanelPlugins(){ info.ID = "audioplayer"; info.icon = "media-playback-start"; PANEL.insert(info.ID, info); + //JSON Menu Scripts + info = LPI(); //clear it + info.name = QObject::tr("Menu Script"); + info.description = QObject::tr("Run an external script to generate a user defined menu"); + info.ID = "jsonmenu"; + info.icon = "text-x-script"; + PANEL.insert(info.ID, info); } // DESKTOP PLUGINS @@ -293,7 +300,7 @@ void LPlugins::LoadMenuPlugins(){ info.ID = "app"; info.icon = "application-x-desktop"; MENU.insert(info.ID, info); - //Custom Apps + //JSON Menu Scripts info = LPI(); //clear it info.name = QObject::tr("Menu Script"); info.description = QObject::tr("Run an external script to generate a user defined menu"); diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp index aff7bda3..d5d3d9bd 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp +++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp @@ -9,7 +9,7 @@ #include "GetPluginDialog.h" #include "AppDialog.h" - +#include "ScriptDialog.h" PanelWidget::PanelWidget(QWidget *parent, QWidget *Main, LPlugins *Pinfo) : QWidget(parent), ui(new Ui::PanelWidget){ ui->setupUi(this); @@ -66,6 +66,18 @@ void PanelWidget::LoadSettings(QSettings *settings, int Dnum, int Pnum){ it->setWhatsThis(plugs[i]); //make sure to preserve the entire plugin ID (is the unique version) ui->list_plugins->addItem(it); } + + }else if(pid.startsWith("jsonmenu")){ + LPI info = PINFO->panelPluginInfo( plugs[i].section("::::",0,0) ); + if(info.ID.isEmpty()){ continue; } //invalid plugin type (no longer available?) + QString exec = plugs[i].section("::::",1,1); + QListWidgetItem *item = new QListWidgetItem(); + item->setWhatsThis( plugs[i] ); + item->setIcon( LXDG::findIcon(plugs[i].section("::::",3,3),info.icon) ); + item->setText( plugs[i].section("::::",2,2) +" ("+info.name+")" ); + item->setToolTip( info.description ); + ui->list_plugins->addItem(item); + }else{ LPI info = PINFO->panelPluginInfo(pid); if(!info.ID.isEmpty()){ @@ -180,23 +192,35 @@ void PanelWidget::on_tool_addplugin_clicked(){ dlg.exec(); if(!dlg.selected){ return; } //cancelled QString pan = dlg.plugID; //getNewPanelPlugin(); + QListWidgetItem *it = 0; if(pan == "applauncher"){ //Prompt for the application to add QString app =getSysApp(); if(app.isEmpty()){ return; } //cancelled pan.append("::"+app); XDGDesktop desk(app); - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name); + it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name); it->setWhatsThis(pan); - ui->list_plugins->addItem(it); - ui->list_plugins->setCurrentItem(it); - ui->list_plugins->scrollToItem(it); + + }else if(pan=="jsonmenu"){ + //Need to prompt for the script file, name, and icon to use + //new ID format: "jsonmenu"::::<exec to run>::::<name>::::<icon> + ScriptDialog SD(this); + SD.exec(); + if(!SD.isValid()){ return; } + LPI info = PINFO->panelPluginInfo(pan); + it = new QListWidgetItem( LXDG::findIcon(SD.icon(),"text-x-script"), SD.name()+" ("+info.ID+")" ); + it->setWhatsThis(info.ID+"::::"+SD.command()+"::::"+SD.name()+"::::"+SD.icon()); + it->setToolTip( info.description ); }else{ if(pan.isEmpty()){ return; } //nothing selected //Add the new plugin to the list LPI info = PINFO->panelPluginInfo(pan); - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name); + it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name); it->setWhatsThis(info.ID); + } + //Now add the new item to the list + if(it!=0){ ui->list_plugins->addItem(it); ui->list_plugins->setCurrentItem(it); ui->list_plugins->scrollToItem(it); diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h index 0f94785c..ed7549aa 100644 --- a/src-qt5/core-utils/lumina-config/globals.h +++ b/src-qt5/core-utils/lumina-config/globals.h @@ -35,6 +35,8 @@ #include <LuminaOS.h> #include <LuminaThemes.h> +#include "pages/PageWidget.h" + #endif //Now the global class for available system applications diff --git a/src-qt5/core-utils/lumina-config/lumina-config.pro b/src-qt5/core-utils/lumina-config/lumina-config.pro index fe5494de..57531e69 100644 --- a/src-qt5/core-utils/lumina-config/lumina-config.pro +++ b/src-qt5/core-utils/lumina-config/lumina-config.pro @@ -15,6 +15,7 @@ include(../../core/libLumina/LDesktopUtils.pri) #includes LUtils include(../../core/libLumina/LuminaXDG.pri) include(../../core/libLumina/LuminaSingleApplication.pri) include(../../core/libLumina/LuminaThemes.pri) +include(../../core/libLumina/LInputDevice.pri) SOURCES += main.cpp \ mainWindow.cpp \ diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index fba3998b..ea0cfb00 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -38,7 +38,7 @@ static QList<PAGEINFO> KnownPages(){ list << PageInfo("interface-menu", QObject::tr("Menu"), QObject::tr("Menu Plugins"), "preferences-plugin",QObject::tr("Change what options are shown on the desktop context menu"), "interface", QStringList(), QStringList() << "desktop" << "menu" << "plugins" << "shortcuts"); list << PageInfo("session-locale", QObject::tr("Localization"), QObject::tr("Locale Settings"), "preferences-desktop-locale",QObject::tr("Change the default locale settings for this user"), "user", QStringList(), QStringList() << "user"<<"locale"<<"language"<<"translations"); list << PageInfo("session-options", QObject::tr("General Options"), QObject::tr("User Settings"), "configure",QObject::tr("Change basic user settings such as time/date formats"), "user", QStringList(), QStringList() << "user"<<"settings"<<"time"<<"date"<<"icon"<<"reset"<<"numlock"<<"clock"); - + //list << PageInfo("mouse", QObject::tr("Mouse Settings"), QObject::tr("Mouse Settings"), "input-mouse",QObject::tr("Adjust mouse settings"), "user", QStringList(), QStringList() << "user"<<"speed"<<"accel"<<"mouse"); //Now sort the items according to the translated name QStringList names; for(int i=0; i<list.length(); i++){ names << list[i].name; } @@ -66,6 +66,7 @@ static QList<PAGEINFO> KnownPages(){ #include "page_session_locale.h" #include "page_session_options.h" #include "page_compton.h" +#include "page_mouse.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" @@ -82,6 +83,7 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="session-locale"){ page = new page_session_locale(parent); } else if(id=="session-options"){ page = new page_session_options(parent); } else if(id=="compton"){ page = new page_compton(parent); } + else if(id=="mouse"){ page = new page_mouse(parent); } //Return the main control_panel page as the fallback/default if(page==0){ id.clear(); page = new page_main(parent); } page->setWhatsThis(id); diff --git a/src-qt5/core-utils/lumina-config/pages/page_compton.cpp b/src-qt5/core-utils/lumina-config/pages/page_compton.cpp index 5f7cd190..8cdb2ea7 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_compton.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_compton.cpp @@ -29,6 +29,7 @@ void page_compton::SaveSettings(){ emit HasPendingChanges(false); QSettings settings("lumina-desktop","sessionsettings"); settings.setValue("enableCompositing", !ui->check_disablecompton->isChecked()); + settings.setValue("compositingWithGpuAccelOnly", ui->check_GPUverify->isChecked()); QString set = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/compton.conf"; LUtils::writeFile(set, ui->text_file->toPlainText().split("\n"),true); } @@ -37,6 +38,7 @@ void page_compton::LoadSettings(int){ emit ChangePageTitle( tr("Compositor Settings") ); QSettings settings("lumina-desktop","sessionsettings"); ui->check_disablecompton->setChecked( !settings.value("enableCompositing", true).toBool() ); + ui->check_GPUverify->setChecked( settings.value("compositingWithGpuAccelOnly", true).toBool() ); QString set = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/compton.conf"; qDebug() << "Load Compton settings:" << set; ui->text_file->setPlainText( LUtils::readFile(set).join("\n") ); diff --git a/src-qt5/core-utils/lumina-config/pages/page_compton.ui b/src-qt5/core-utils/lumina-config/pages/page_compton.ui index 9083a2fb..857331d6 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_compton.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_compton.ui @@ -34,6 +34,13 @@ </widget> </item> <item> + <widget class="QCheckBox" name="check_GPUverify"> + <property name="text"> + <string>Only use compositing with GPU acceleration </string> + </property> + </widget> + </item> + <item> <widget class="QPlainTextEdit" name="text_file"/> </item> </layout> diff --git a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui index ef72c4f1..8440e198 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui @@ -29,11 +29,138 @@ <item> <widget class="QTabWidget" name="tabWidget_apps"> <property name="currentIndex"> - <number>1</number> + <number>0</number> </property> <property name="movable"> <bool>false</bool> </property> + <widget class="QWidget" name="tab_auto"> + <attribute name="title"> + <string>Basic Settings</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_7"> + <item> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <layout class="QFormLayout" name="formLayout_10"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::ExpandingFieldsGrow</enum> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_37"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Web Browser:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QToolButton" name="tool_default_webbrowser"> + <property name="text"> + <string notr="true">...</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_38"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>E-Mail Client:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QToolButton" name="tool_default_email"> + <property name="text"> + <string notr="true">...</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="1"> + <layout class="QFormLayout" name="formLayout_11"> + <item row="0" column="0"> + <widget class="QLabel" name="label_39"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>File Manager:</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_40"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>Virtual Terminal:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QToolButton" name="tool_default_filemanager"> + <property name="text"> + <string>...</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QToolButton" name="tool_default_terminal"> + <property name="text"> + <string>...</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> <widget class="QWidget" name="tab_defaults"> <attribute name="title"> <string>Advanced</string> @@ -163,133 +290,6 @@ </item> </layout> </widget> - <widget class="QWidget" name="tab_auto"> - <attribute name="title"> - <string>Basic Settings</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <layout class="QFormLayout" name="formLayout_10"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_37"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Web Browser:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="tool_default_webbrowser"> - <property name="text"> - <string notr="true">...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_38"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>E-Mail Client:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="tool_default_email"> - <property name="text"> - <string notr="true">...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item row="0" column="1"> - <layout class="QFormLayout" name="formLayout_11"> - <item row="0" column="0"> - <widget class="QLabel" name="label_39"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>File Manager:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_40"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Virtual Terminal:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="tool_default_filemanager"> - <property name="text"> - <string>...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="tool_default_terminal"> - <property name="text"> - <string>...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> </widget> </item> </layout> diff --git a/src-qt5/core-utils/lumina-config/pages/page_mouse.cpp b/src-qt5/core-utils/lumina-config/pages/page_mouse.cpp new file mode 100644 index 00000000..dbe075d7 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse.cpp @@ -0,0 +1,77 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_mouse.h" +#include "ui_page_mouse.h" +#include "getPage.h" + +//========== +// PUBLIC +//========== +page_mouse::page_mouse(QWidget *parent) : PageWidget(parent), ui(new Ui::page_mouse()){ + ui->setupUi(this); + connect(ui->slider_accel, SIGNAL(valueChanged(int)), this, SLOT(accelChanged(int)) ); + updateIcons(); + qDebug() << "List Devices:"; + QList<LInputDevice*> devices = LInput::listDevices(); + for(int i=0; i<devices.length(); i++){ + if(!devices[i]->isPointer()){ + ::free( devices.takeAt(i)); + i--; + }else{ + qDebug() << "Found Pointer:" << devices[i]->devNumber(); + qDebug() << " - isExtension:" << devices[i]->isExtension(); + qDebug() << " - Properties:" << devices[i]->listProperties(); + } + } +} + +page_mouse::~page_mouse(){ + for(int i=0; i<devices.length(); i++){ ::free(devices[i]); } +} + +//================ +// PUBLIC SLOTS +//================ +void page_mouse::SaveSettings(){ + + emit HasPendingChanges(false); +} + +void page_mouse::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + +} + +void page_mouse::updateIcons(){ + +} + +//================= +// PRIVATE +//================= + +//================= +// PRIVATE SLOTS +//================= +void page_mouse::accelChanged(int val){ + if(val<=4){ + val = 4-val; + ui->label_accel->setText( QString("1/%1").arg(QString::number(val)) ); + QProcess::startDetached("xset mouse 1/"+QString::number(val)); + }else{ + val = val-4; + if(val%2==0){ + val = val/2; + ui->label_accel->setText( QString::number(val) ); + QProcess::startDetached("xset mouse "+QString::number(val)); + }else{ + ui->label_accel->setText( QString::number(val)+"/2" ); + QProcess::startDetached("xset mouse "+QString::number(val)+"/2"); + } + } +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_mouse.h b/src-qt5/core-utils/lumina-config/pages/page_mouse.h new file mode 100644 index 00000000..849917c5 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse.h @@ -0,0 +1,36 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_MOUSE_H +#define _LUMINA_CONFIG_PAGE_MOUSE_H +#include "../globals.h" +#include "PageWidget.h" + +#include <LInputDevice.h> + +namespace Ui{ + class page_mouse; +}; + +class page_mouse : public PageWidget{ + Q_OBJECT +public: + page_mouse(QWidget *parent); + ~page_mouse(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_mouse *ui; + QList<LInputDevice*> devices; + +private slots: + void accelChanged(int val); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_mouse.ui b/src-qt5/core-utils/lumina-config/pages/page_mouse.ui new file mode 100644 index 00000000..619e38dc --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_mouse.ui @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>page_mouse</class> + <widget class="QWidget" name="page_mouse"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Mouse Acceleration</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QSlider" name="slider_accel"> + <property name="maximum"> + <number>20</number> + </property> + <property name="value"> + <number>4</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBelow</enum> + </property> + <property name="tickInterval"> + <number>2</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_accel"> + <property name="text"> + <string notr="true"/> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp b/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp index 333f9da8..1af87cd2 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp @@ -33,6 +33,7 @@ page_session_options::page_session_options(QWidget *parent) : PageWidget(parent) connect(ui->check_session_playloginaudio, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) ); connect(ui->check_session_playlogoutaudio, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) ); connect(ui->check_autoapplinks, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) ); + connect(ui->check_watch_app_procs, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) ); updateIcons(); } @@ -53,6 +54,14 @@ void page_session_options::SaveSettings(){ sessionsettings.setValue("TimeFormat", ui->line_session_time->text()); sessionsettings.setValue("DateFormat", ui->line_session_date->text()); sessionsettings.setValue("DateTimeOrder", ui->combo_session_datetimeorder->currentData().toString()); + + QString lopenWatchFile = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/nowatch"; + if(QFile::exists(lopenWatchFile) && ui->check_watch_app_procs->isChecked()){ + QFile::remove(lopenWatchFile); + }else if(!QFile::exists(lopenWatchFile) && !ui->check_watch_app_procs->isChecked()){ + QFile file(lopenWatchFile); + if(file.open(QIODevice::WriteOnly) ){ file.close(); } //just need to touch it to create the file + } emit HasPendingChanges(false); } @@ -71,6 +80,9 @@ void page_session_options::LoadSettings(int){ int index = ui->combo_session_datetimeorder->findData( sessionsettings.value("DateTimeOrder","timeonly").toString() ); ui->combo_session_datetimeorder->setCurrentIndex(index); + QString lopenWatchFile = QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/nowatch"; + ui->check_watch_app_procs->setChecked( !QFile::exists(lopenWatchFile) ); + sessionLoadTimeSample(); sessionLoadDateSample(); QApplication::processEvents(); //throw away any interaction events from loading diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_options.ui b/src-qt5/core-utils/lumina-config/pages/page_session_options.ui index 55d204ae..255166de 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_session_options.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_session_options.ui @@ -60,6 +60,13 @@ </widget> </item> <item> + <widget class="QCheckBox" name="check_watch_app_procs"> + <property name="text"> + <string>Show application crash data</string> + </property> + </widget> + </item> + <item> <layout class="QHBoxLayout" name="horizontalLayout_14"> <item> <widget class="QPushButton" name="push_session_setUserIcon"> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index b1db2860..b36ca7ba 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -13,7 +13,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_interface_panels.h \ $${PWD}/page_session_locale.h \ $${PWD}/page_session_options.h \ - $${PWD}/page_compton.h + $${PWD}/page_compton.h \ + $${PWD}/page_mouse.h SOURCES += $${PWD}/page_main.cpp \ @@ -28,7 +29,8 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_interface_panels.cpp \ $${PWD}/page_session_locale.cpp \ $${PWD}/page_session_options.cpp \ - $${PWD}/page_compton.cpp + $${PWD}/page_compton.cpp \ + $${PWD}/page_mouse.cpp FORMS += $${PWD}/page_main.ui \ @@ -43,4 +45,5 @@ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_interface_panels.ui \ $${PWD}/page_session_locale.ui \ $${PWD}/page_session_options.ui \ - $${PWD}/page_compton.ui + $${PWD}/page_compton.ui \ + $${PWD}/page_mouse.ui diff --git a/src-qt5/core/libLumina/LInputDevice.cpp b/src-qt5/core/libLumina/LInputDevice.cpp new file mode 100644 index 00000000..d141e39a --- /dev/null +++ b/src-qt5/core/libLumina/LInputDevice.cpp @@ -0,0 +1,112 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "LInputDevice.h" + +//Qt Library includes +#include <QString> +#include <QX11Info> +#include <QDebug> + +//XCB Library includes +#include <xcb/xcb.h> +#include <xcb/xcb_atom.h> +#include <xcb/xinput.h> +#include <xcb/xproto.h> + +//=================== +// LInputDevice Class +//=================== +// === PUBLIC === +LInputDevice::LInputDevice(unsigned int id, unsigned int type){ + devID = id; + devType = type; + //devName = name; + getProperties(); //need to populate the name/atom correlations for properties +} + +LInputDevice::~LInputDevice(){ + +} + +unsigned int LInputDevice::devNumber(){ + return devID; +} + +bool LInputDevice::isPointer(){ + return (devType==XCB_INPUT_DEVICE_USE_IS_X_POINTER \ + || devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_POINTER); +} + +bool LInputDevice::isKeyboard(){ + return (devType==XCB_INPUT_DEVICE_USE_IS_X_KEYBOARD \ + || devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_KEYBOARD); +} + +bool LInputDevice::isExtension(){ + return (devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE \ + || devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_KEYBOARD \ + || devType==XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_POINTER); +} + +// Property Management +QStringList LInputDevice::listProperties(){ + return devProps.keys(); +} + +QVariant LInputDevice::propertyValue(QString prop){ + if(!devProps.contains(prop)){ return QVariant(); } + //Now generate the property request + // xcb_input_get_device_property_cookie_t cookie = xcb_input_get_device_property_unchecked( QX11Info::connection(), devProps.value(prop), \ +// XCB_ATOM_ATOM, 0, 1000, devID, NULL); + QVariant result; + return result; +} + +// === PRIVATE === +void LInputDevice::getProperties(){ + devProps.clear(); + xcb_input_list_device_properties_cookie_t cookie = xcb_input_list_device_properties_unchecked(QX11Info::connection(), devID); + xcb_input_list_device_properties_reply_t *reply = xcb_input_list_device_properties_reply(QX11Info::connection(), cookie, NULL); + //Get the atoms + xcb_atom_t *atoms = xcb_input_list_device_properties_atoms(reply); + //qDebug() << "Property Response Type:" << reply->response_type; //Always seems to be "1" + QList<xcb_get_atom_name_cookie_t> cookies; + for(int i=0; i<reply->num_atoms; i++){ cookies << xcb_get_atom_name(QX11Info::connection(), atoms[i]); } + for(int i=0; i<reply->num_atoms; i++){ + xcb_get_atom_name_reply_t *nr = xcb_get_atom_name_reply(QX11Info::connection(), cookies[i], NULL); + devProps.insert(QString::fromUtf8( xcb_get_atom_name_name(nr), xcb_get_atom_name_name_length(nr) ),atoms[i] ); + ::free(nr); + } + //Done with data structure + ::free(reply); +} +//====================== +// LInput Static Functions +//====================== +QList<LInputDevice*> LInput::listDevices(){ + QList<LInputDevice*> devices; + xcb_input_list_input_devices_cookie_t cookie = xcb_input_list_input_devices_unchecked(QX11Info::connection()); + xcb_input_list_input_devices_reply_t *reply = xcb_input_list_input_devices_reply(QX11Info::connection(), cookie, NULL); + if(reply==0){ return devices; } //error - nothing returned + //Use the iterator for going through the reply + //qDebug() << "Create iterator"; + xcb_input_device_info_iterator_t iter = xcb_input_list_input_devices_devices_iterator(reply); + //xcb_str_iterator_t nameiter = xcb_input_list_input_devices_names_iterator(reply); + + //Now step through the reply + while(iter.data != 0 ){ + devices << new LInputDevice(iter.data->device_id, iter.data->device_use); + //qDebug() << "Found Input Device:" << iter.data->device_id; + //qDebug() << " - num_class_info:" << iter.data->num_class_info; + if(iter.rem>0){ xcb_input_device_info_next(&iter); } + else{ break; } + } + //Free the reply (done with it) + ::free(reply); + //return the information + return devices; +} diff --git a/src-qt5/core/libLumina/LInputDevice.h b/src-qt5/core/libLumina/LInputDevice.h new file mode 100644 index 00000000..f7a4713c --- /dev/null +++ b/src-qt5/core/libLumina/LInputDevice.h @@ -0,0 +1,53 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +// This class governs all the XCB input device interactions +// and provides simpler Qt-based functions for use elsewhere +//=========================================== +#ifndef _LUMINA_XCB_INPUT_DEVICES_H +#define _LUMINA_XCB_INPUT_DEVICES_H + +#include <QList> +#include <QString> +#include <QStringList> +#include <QHash> +#include <QVariant> + +#include <xcb/xproto.h> + +class LInputDevice{ +public: + LInputDevice(unsigned int id, unsigned int type); //don't use this directly - use the "listDevices()" function instead + ~LInputDevice(); + + //Device Information + //QString name(); //Return the name of this device + unsigned int devNumber(); + bool isPointer(); + bool isKeyboard(); + bool isExtension(); + + //Property Management + QStringList listProperties(); + QVariant propertyValue(QString prop); + +private: + unsigned int devID; //device ID number - assigned at class creation + unsigned int devType; //device "use" identifier - assigned at class creation + QHash<QString, xcb_atom_t> devProps; //Known device properties <name, atom> + + void getProperties(); + //QString devName; //device name - use this for cross-session management (id #'s can get changed every session) +}; + +//Static functions for overall management +class LInput{ + public: + static QList<LInputDevice*> listDevices(); //NOTE: Make sure you "free()" all the LInputDevice objects when finished + +}; + +#endif diff --git a/src-qt5/core/libLumina/LInputDevice.pri b/src-qt5/core/libLumina/LInputDevice.pri new file mode 100644 index 00000000..e90728ce --- /dev/null +++ b/src-qt5/core/libLumina/LInputDevice.pri @@ -0,0 +1,13 @@ + +QT *= x11extras + +LIBS *= -lc -lxcb -lxcb-xinput + +#LUtils Files +SOURCES *= $${PWD}/LInputDevice.cpp +HEADERS *= $${PWD}/LInputDevice.h + +INCLUDEPATH *= ${PWD} + +#include LUtils and LuminaOS +#include(LUtils.pri) diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index 3708af6d..a8016460 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore +// Copyright (c) 2014-2016, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -1124,6 +1124,7 @@ void LXCB::closeSystemTray(WId trayID){ xcb_destroy_window(QX11Info::connection(), trayID); } + // === SetScreenWorkArea() === /*void LXCB::SetScreenWorkArea(unsigned int screen, QRect rect){ //This is only useful because Fluxbox does not set the _NET_WORKAREA root atom diff --git a/src-qt5/core/libLumina/LuminaX11.h b/src-qt5/core/libLumina/LuminaX11.h index 7b6cce3c..2c741111 100644 --- a/src-qt5/core/libLumina/LuminaX11.h +++ b/src-qt5/core/libLumina/LuminaX11.h @@ -1,6 +1,6 @@ //=========================================== // Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore +// Copyright (c) 2014-2016, Ken Moore // Available under the 3-clause BSD license // See the LICENSE file for full details //=========================================== @@ -161,7 +161,6 @@ public: WId startSystemTray(int screen = 0); //Startup the system tray (returns window ID for tray) void closeSystemTray(WId); //Close the system tray - //============ // WM Functions (directly changing/reading properties) // - Using these directly may prevent the WM from seeing the change diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf index 9b819e7c..56ff8b84 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf @@ -42,6 +42,13 @@ mime_default_unknown/*=lumina-textedit.desktop mime_default_application/x-shellscript=lumina-textedit.desktop mime_default_application/pdf_ifexists=pc-pdfviewer.desktop mime_default_application/pdf_ifexists=okular.desktop +mime_default_application/zip_ifexists=lumina-archiver.desktop +mime_default_application/x-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-bzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lrzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lzma-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-xz-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-tar_ifexists=lumina-archiver.desktop #THEME SETTINGS theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf index 4950b1a0..46d00053 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf @@ -36,13 +36,13 @@ session_default_email_ifexists=trojita.desktop mime_default_text/*_ifexists=lumina-textedit.desktop mime_default_audio/*_ifexists=vlc.desktop mime_default_video/*_ifexists=vlc.desktop -mime_default_application/zip_ifexists=peazip.desktop -mime_default_application/x-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-bzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lrzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lzma-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-xz-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-tar_ifexists=peazip.desktop +mime_default_application/zip_ifexists=lumina-archiver.desktop +mime_default_application/x-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-bzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lrzip-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-lzma-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-xz-compressed-tar_ifexists=lumina-archiver.desktop +mime_default_application/x-tar_ifexists=lumina-archiver.desktop mime_default_unknown/*=lumina-textedit.desktop mime_default_application/x-shellscript=lumina-textedit.desktop diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp index 9710045c..9d41374c 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.cpp @@ -18,7 +18,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ this->setWindowTitle(tr("Archive Manager")); BACKEND = new Backend(this); connect(BACKEND, SIGNAL(ProcessStarting()), this, SLOT(ProcStarting()) ); - connect(BACKEND, SIGNAL(ProcessFinished()), this, SLOT(ProcFinished()) ); + connect(BACKEND, SIGNAL(ProcessFinished(bool, QString)), this, SLOT(ProcFinished(bool, QString)) ); connect(BACKEND, SIGNAL(ProgressUpdate(int, QString)), this, SLOT(ProcUpdate(int, QString)) ); //Add a spacer between toolbar items @@ -33,16 +33,18 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ connect(ui->actionAdd_File, SIGNAL(triggered()), this, SLOT(addFiles()) ); connect(ui->actionRemove_File, SIGNAL(triggered()), this, SLOT(remFiles()) ); connect(ui->actionExtract_All, SIGNAL(triggered()), this, SLOT(extractFiles()) ); + connect(ui->actionExtract_Sel, SIGNAL(triggered()), this, SLOT(extractSelection()) ); connect(ui->actionAdd_Dirs, SIGNAL(triggered()), this, SLOT(addDirs()) ); connect(ui->tree_contents, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(ViewFile(QTreeWidgetItem*)) ); ui->progressBar->setVisible(false); ui->label_progress->setVisible(false); + ui->label_progress_icon->setVisible(false); ui->actionAdd_File->setEnabled(false); ui->actionRemove_File->setEnabled(false); ui->actionExtract_All->setEnabled(false); ui->actionAdd_Dirs->setEnabled(false); loadIcons(); - ui->tree_contents->setHeaderLabels( QStringList() << tr("File") << tr("MimeType") << tr("Size") << tr("Compressed")+" " ); + ui->tree_contents->setHeaderLabels( QStringList() << tr("File") << tr("MimeType") << tr("Size")+" " ); } MainUI::~MainUI(){ @@ -51,7 +53,11 @@ MainUI::~MainUI(){ void MainUI::LoadArguments(QStringList args){ for(int i=0; i<args.length(); i++){ - if(QFile::exists(args[i])){ BACKEND->loadFile(args[i]); break;} + if(QFile::exists(args[i])){ + ui->label_progress->setText(tr("Opening Archive...")); + BACKEND->loadFile(args[i]); + break; + } } } @@ -64,6 +70,7 @@ void MainUI::loadIcons(){ ui->actionAdd_Dirs->setIcon( LXDG::findIcon("archive-insert-directory","") ); ui->actionRemove_File->setIcon( LXDG::findIcon("archive-remove","") ); ui->actionExtract_All->setIcon( LXDG::findIcon("archive-extract","") ); + ui->actionExtract_Sel->setIcon( LXDG::findIcon("archive-extract","") ); } //=================== @@ -72,17 +79,16 @@ void MainUI::loadIcons(){ QTreeWidgetItem* MainUI::findItem(QString path, QTreeWidgetItem *start){ if(start==0){ for(int i=0; i<ui->tree_contents->topLevelItemCount(); i++){ - QString itpath = ui->tree_contents->topLevelItem(i)->whatsThis(0); - if(itpath == path){ return ui->tree_contents->topLevelItem(i); } - else if(path.startsWith(itpath+"/")){ return findItem(path, ui->tree_contents->topLevelItem(i)); } + if(ui->tree_contents->topLevelItem(i)->whatsThis(0) == path){ return ui->tree_contents->topLevelItem(i); } + else if(path.startsWith(ui->tree_contents->topLevelItem(i)->whatsThis(0)+"/")){ return findItem(path, ui->tree_contents->topLevelItem(i)); } } }else{ for(int i=0; i<start->childCount(); i++){ - QString itpath = start->child(i)->whatsThis(0); - if(itpath == path){ return start->child(i); } - else if(path.startsWith(itpath+"/")){ return findItem(path, start->child(i)); } + if(start->child(i)->whatsThis(0) == path){ return start->child(i); } + else if(path.startsWith(start->child(i)->whatsThis(0)+"/")){ return findItem(path, start->child(i)); } } } + //qDebug() << "Could not find item:" << path; return 0; //nothing found } @@ -158,24 +164,28 @@ void MainUI::NewArchive(){ if(QFile::exists(file)){ if( !QFile::remove(file) ){ QMessageBox::warning(this, tr("Error"), QString(tr("Could not overwrite file:"))+"\n"+file); } } + ui->label_progress->setText(""); //just clear it (this action is instant) BACKEND->loadFile(file); } void MainUI::OpenArchive(){ QString file = QFileDialog::getOpenFileName(this, tr("Open Archive"), QDir::homePath(), OpenFileTypes() ); if(file.isEmpty()){ return; } + ui->label_progress->setText(tr("Opening Archive...")); BACKEND->loadFile(file); } void MainUI::addFiles(){ QStringList files = QFileDialog::getOpenFileNames(this, tr("Add to Archive"), QDir::homePath() ); if(files.isEmpty()){ return; } + ui->label_progress->setText(tr("Adding Items...")); BACKEND->startAdd(files); } void MainUI::addDirs(){ QString dirs = QFileDialog::getExistingDirectory(this, tr("Add to Archive"), QDir::homePath() ); if(dirs.isEmpty()){ return; } + ui->label_progress->setText(tr("Adding Items...")); BACKEND->startAdd(QStringList() << dirs); } @@ -186,35 +196,57 @@ void MainUI::remFiles(){ items << sel[i]->whatsThis(0); } items.removeDuplicates(); + ui->label_progress->setText(tr("Removing Items...")); BACKEND->startRemove(items); } void MainUI::extractFiles(){ QString dir = QFileDialog::getExistingDirectory(this, tr("Extract Into Directory"), QDir::homePath() ); if(dir.isEmpty()){ return; } + ui->label_progress->setText(tr("Extracting...")); BACKEND->startExtract(dir, true); } +void MainUI::extractSelection(){ + if(ui->tree_contents->currentItem()==0){ return; } + QString sel = ui->tree_contents->currentItem()->whatsThis(0); + QString dir = QFileDialog::getExistingDirectory(this, tr("Extract Into Directory"), QDir::homePath() ); + if(dir.isEmpty()){ return; } + ui->label_progress->setText(tr("Extracting...")); + BACKEND->startExtract(dir, true, sel); +} + void MainUI::ViewFile(QTreeWidgetItem *it){ if(it->childCount()>0){ return; } //directory - not viewable + ui->label_progress->setText(tr("Extracting...")); BACKEND->startViewFile(it->whatsThis(0)); } void MainUI::UpdateTree(){ - ui->tree_contents->setHeaderLabels( QStringList() << tr("File") << tr("MimeType") << tr("Size") << tr("Compressed")+" " ); + this->setEnabled(false); + ui->tree_contents->setHeaderLabels( QStringList() << tr("File") << tr("MimeType") << tr("Size")+" " ); QStringList files = BACKEND->heirarchy(); files.sort(); //Remove any entries for file no longer in the archive bool changed = cleanItems(files); - qDebug() << "Found Files:" << files; + //qDebug() << "Found Files:" << files; for(int i=0; i<files.length(); i++){ if(0 != findItem(files[i]) ){ continue; } //already in the tree widget QString mime = LXDG::findAppMimeForFile(files[i].section("/",-1), false); //first match only - QTreeWidgetItem *it = new QTreeWidgetItem( QStringList() << files[i].section("/",-1) << mime << LUtils::BytesToDisplaySize( BACKEND->size(files[i])) << LUtils::BytesToDisplaySize(BACKEND->csize(files[i])) ); + QTreeWidgetItem *it = new QTreeWidgetItem(); + it->setText(0, files[i].section("/",-1) ); + if(!BACKEND->isLink(files[i])){ + it->setText(1, LXDG::findAppMimeForFile(files[i].section("/",-1), false) ); + it->setText(2, LUtils::BytesToDisplaySize( BACKEND->size(files[i])) ); + }else{ + it->setText(1, QString(tr("Link To: %1")).arg(BACKEND->linkTo(files[i]) ) ); + } it->setWhatsThis(0, files[i]); if(BACKEND->isDir(files[i])){ it->setIcon(0, LXDG::findIcon("folder","")); it->setText(1,""); //clear the mimetype + }else if(BACKEND->isLink(files[i])){ + it->setIcon(0, LXDG::findIcon("emblem-symbolic-link","") ); }else{ it->setIcon(0, LXDG::findMimeIcon(files[i].section("/",-1)) ); } @@ -226,14 +258,23 @@ void MainUI::UpdateTree(){ else{ parent->addChild(it); } }else{ ui->tree_contents->addTopLevelItem(it); + QApplication::processEvents(); } changed = true; } - int wid = 0; + if(changed){ - for(int i=3; i>0; i--){ui->tree_contents->resizeColumnToContents(i); wid+= ui->tree_contents->columnWidth(i); } + int wid = ui->tree_contents->fontMetrics().width("W")*5; + ui->tree_contents->setColumnWidth(2, wid); + for(int i=1; i<2; i++){ui->tree_contents->resizeColumnToContents(i); QApplication::processEvents(); wid+= ui->tree_contents->columnWidth(i); } + //qDebug() << "Set column 0 width:" << wid << ui->tree_contents->viewport()->width(); ui->tree_contents->setColumnWidth(0, ui->tree_contents->viewport()->width()-wid); } + ui->tree_contents->sortItems(0, Qt::AscendingOrder); //sort by name + ui->tree_contents->sortItems(1,Qt::AscendingOrder); //sort by mimetype (put dirs first - still organized by name) + + this->setEnabled(true); + ui->tree_contents->setEnabled(true); } //Backend Handling @@ -241,17 +282,22 @@ void MainUI::ProcStarting(){ ui->progressBar->setRange(0,0); ui->progressBar->setValue(0); ui->progressBar->setVisible(true); - ui->label_progress->setVisible(true); + ui->label_progress->setVisible(!ui->label_progress->text().isEmpty()); + ui->label_progress_icon->setVisible(false); ui->tree_contents->setEnabled(false); ui->label_archive->setText(BACKEND->currentFile()); } -void MainUI::ProcFinished(){ +void MainUI::ProcFinished(bool success, QString msg){ + UpdateTree(); ui->progressBar->setRange(0,0); ui->progressBar->setValue(0); ui->progressBar->setVisible(false); - ui->label_progress->setVisible(false); - ui->tree_contents->setEnabled(true); + ui->label_progress->setText(msg); + ui->label_progress->setVisible(!msg.isEmpty()); + ui->label_progress_icon->setVisible(!msg.isEmpty()); + if(success){ ui->label_progress_icon->setPixmap( LXDG::findIcon("task-complete","").pixmap(32,32) );} + else{ ui->label_progress_icon->setPixmap( LXDG::findIcon("task-attention","").pixmap(32,32) );} if(ui->label_archive->text()!=BACKEND->currentFile()){ ui->label_archive->setText(BACKEND->currentFile()); this->setWindowTitle(BACKEND->currentFile().section("/",-1)); @@ -265,7 +311,6 @@ void MainUI::ProcFinished(){ ui->actionRemove_File->setEnabled(canmodify && info.exists()); ui->actionExtract_All->setEnabled(info.exists()); ui->actionAdd_Dirs->setEnabled(canmodify); - UpdateTree(); } void MainUI::ProcUpdate(int percent, QString txt){ diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.h b/src-qt5/desktop-utils/lumina-archiver/MainUI.h index 09207aa3..bb462a7d 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.h +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.h @@ -44,13 +44,14 @@ private slots: void addDirs(); void remFiles(); void extractFiles(); + void extractSelection(); void ViewFile(QTreeWidgetItem *it); void UpdateTree(); //Backend Handling void ProcStarting(); - void ProcFinished(); + void ProcFinished(bool, QString); void ProcUpdate(int percent, QString txt); }; diff --git a/src-qt5/desktop-utils/lumina-archiver/MainUI.ui b/src-qt5/desktop-utils/lumina-archiver/MainUI.ui index 8c2b2836..1aff2e4f 100644 --- a/src-qt5/desktop-utils/lumina-archiver/MainUI.ui +++ b/src-qt5/desktop-utils/lumina-archiver/MainUI.ui @@ -57,6 +57,31 @@ <item> <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> + <widget class="QLabel" name="label_progress_icon"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="text"> + <string notr="true"/> + </property> + </widget> + </item> + <item> <widget class="QProgressBar" name="progressBar"> <property name="value"> <number>24</number> @@ -68,6 +93,9 @@ <property name="text"> <string notr="true"/> </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> </widget> </item> </layout> @@ -101,6 +129,7 @@ <addaction name="actionRemove_File"/> <addaction name="separator"/> <addaction name="actionExtract_All"/> + <addaction name="actionExtract_Sel"/> </widget> <addaction name="menuFile"/> <addaction name="menuEdit"/> @@ -183,6 +212,11 @@ <string>Add directory to archive</string> </property> </action> + <action name="actionExtract_Sel"> + <property name="text"> + <string>Extract Selection</string> + </property> + </action> </widget> <resources/> <connections/> diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp index 4dee247b..919a6813 100644 --- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp +++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.cpp @@ -32,7 +32,7 @@ void Backend::loadFile(QString path){ flags.clear(); flags << "-f" << filepath; //add the actual archive path if(QFile::exists(path)){ startList(); } - else{ contents.clear(); emit ProcessFinished(); } + else{ contents.clear(); emit ProcessFinished(true, ""); } } bool Backend::canModify(){ @@ -75,6 +75,16 @@ bool Backend::isDir(QString file){ return contents.value(file)[0].startsWith("d"); } +bool Backend::isLink(QString file){ + if(!contents.contains(file)){ return false; } + return contents.value(file)[0].startsWith("l"); +} + +QString Backend::linkTo(QString file){ + if(!contents.contains(file)){ return ""; } + return contents.value(file)[2]; +} + //Modification routines void Backend::startAdd(QStringList paths){ //NOTE: All the "paths" have to have the same parent directory @@ -115,11 +125,13 @@ void Backend::startRemove(QStringList paths){ PROC.start("tar", args); } -void Backend::startExtract(QString path, bool overwrite){ +void Backend::startExtract(QString path, bool overwrite, QString file){ QStringList args; args << "-x"; if(!overwrite){ args << "-k"; } - args << flags << "-C" << path; + args << flags; + if(!file.isEmpty()){ args << "--include" << file << "--strip-components" << QString::number(file.count("/")); } + args << "-C" << path; STARTING=true; //qDebug() << "Starting command:" << "tar" << args; PROC.start("tar", args); @@ -151,14 +163,23 @@ void Backend::parseLines(QStringList lines){ QString file = info[1]; QString perms = ""; if(file.endsWith("/")){ perms = "d"; file.chop(1); } - contents.insert(file, QStringList() << perms << "-1" ); //Save the [perms, size ] + contents.insert(file, QStringList() << perms << "-1" <<""); //Save the [perms, size, linkto ] } else if(info.length()<9){ continue; } //invalid line //TAR Archive parsing while(info.length()>9){ info[8] = info[8]+" "+info[9]; info.removeAt(9); } //Filename has spaces in it QString file = info[8]; if(file.endsWith("/")){ file.chop(1); } - contents.insert(file, QStringList() << info[0] << info[4] ); //Save the [perms, size ] + QString linkto; + //See if this file has the "link to" or "->" notation + if(file.contains(" -> ")){ linkto = file.section(" -> ",1,-1); file = file.section(" -> ",0,0); } + else if(file.contains(" link to ")){ + //Special case - alternate form of a link within a tar archive (not reflected in perms) + linkto = file.section(" link to ",1,-1); + file = file.section(" link to ",0,0); + if(info[0].startsWith("-")){ info[0].replace(0,1,"l"); } + } + contents.insert(file, QStringList() << info[0] << info[4] << linkto); //Save the [perms, size, linkto ] } } @@ -174,17 +195,19 @@ void Backend::startList(){ // PRIVATE SLOTS //=============== void Backend::procFinished(int retcode, QProcess::ExitStatus){ + static QString result; processData(); - qDebug() << "Process Finished:" << PROC.arguments() << retcode; + //qDebug() << "Process Finished:" << PROC.arguments() << retcode; LIST = STARTING = false; if(PROC.arguments().contains("-tv")){ if(retcode!=0){ contents.clear(); } //could not read archive - emit ProcessFinished(); + emit ProcessFinished(true,result); + result.clear(); }else{ bool needupdate = true; QStringList args = PROC.arguments(); if(args.contains("-x") && retcode==0){ - needupdate=false; + needupdate=false; if(args.contains("--include")){ //Need to find the full path to the extracted file QString path = args.last() +"/"+ args[ args.indexOf("--include")+1].section("/",-1); @@ -201,8 +224,10 @@ void Backend::procFinished(int retcode, QProcess::ExitStatus){ QFile::remove(tmpfilepath); } } + if(args.contains("-x")){ result = tr("Extraction Finished"); } + else if(args.contains("-c")){ result = tr("Modification Finished"); } if(needupdate){ startList(); } - else{ emit ProcessFinished(); } + else{ emit ProcessFinished(retcode==0, result); result.clear(); } } } @@ -213,7 +238,9 @@ void Backend::processData(){ if(read.endsWith("\n")){ data.clear(); } else{ data = read.section("\n",-1); read = read.section("\n",0,-2); } QStringList lines = read.split("\n",QString::SkipEmptyParts); + QString info; if(LIST){ parseLines(lines); } + else if(!lines.isEmpty()){ info = lines.last(); } //qDebug() << lines; - emit ProgressUpdate(-1, ""); + emit ProgressUpdate(-1, info); } diff --git a/src-qt5/desktop-utils/lumina-archiver/TarBackend.h b/src-qt5/desktop-utils/lumina-archiver/TarBackend.h index f12aae63..47bc0bb6 100644 --- a/src-qt5/desktop-utils/lumina-archiver/TarBackend.h +++ b/src-qt5/desktop-utils/lumina-archiver/TarBackend.h @@ -29,14 +29,17 @@ public: double size(QString file); double csize(QString file); bool isDir(QString file); + bool isLink(QString file); + QString linkTo(QString file); //Modification routines void startAdd(QStringList paths); void startRemove(QStringList paths); - void startExtract(QString path, bool overwrite); //path to dir + void startExtract(QString path, bool overwrite, QString file=""); //path to dir, overwrite, optional file to extract (everything otherwise) void startViewFile(QString path); + //Special process public slots: private: @@ -58,7 +61,7 @@ signals: void FileLoaded(); void ProcessStarting(); void ProgressUpdate(int, QString); //percentage, text - void ProcessFinished(); + void ProcessFinished(bool, QString); //success, text }; #endif diff --git a/src-qt5/desktop-utils/lumina-archiver/isoDialog.ui b/src-qt5/desktop-utils/lumina-archiver/isoDialog.ui new file mode 100644 index 00000000..99ba31fb --- /dev/null +++ b/src-qt5/desktop-utils/lumina-archiver/isoDialog.ui @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>isoDialog</class> + <widget class="QDialog" name="isoDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>305</width> + <height>179</height> + </rect> + </property> + <property name="windowTitle"> + <string>Burn ISO/IMG to device</string> + </property> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label_iso"> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Transfer Rate</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QSpinBox" name="spin_rate_num"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>1023</number> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="combo_rate_units"/> + </item> + </layout> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>USB Device</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QCheckBox" name="check_sync"> + <property name="text"> + <string>Wipe all extra space on device (conv = sync)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QComboBox" name="combo_devices"/> + </item> + <item> + <widget class="QToolButton" name="tool_refresh"> + <property name="toolTip"> + <string>Refresh Device List</string> + </property> + <property name="text"> + <string notr="true"/> + </property> + </widget> + </item> + </layout> + </item> + <item row="4" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="5" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="push_cancel"> + <property name="text"> + <string>Cancel</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="push_start"> + <property name="text"> + <string>Start</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> |