Inital commit
This commit is contained in:
commit
a1da4d9454
0
debian/.debhelper/generated/sigstoped/installed-by-dh_installdocs
vendored
Normal file
0
debian/.debhelper/generated/sigstoped/installed-by-dh_installdocs
vendored
Normal file
1
debian/.debhelper/sigstoped/dbgsym-build-ids
vendored
Normal file
1
debian/.debhelper/sigstoped/dbgsym-build-ids
vendored
Normal file
@ -0,0 +1 @@
|
||||
8d2a153010b3e35a0500b1969e6f855421d6aee4
|
13
debian/.debhelper/sigstoped/dbgsym-root/DEBIAN/control
vendored
Normal file
13
debian/.debhelper/sigstoped/dbgsym-root/DEBIAN/control
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
Package: sigstoped-dbgsym
|
||||
Source: sigstoped
|
||||
Version: 1:0.73-1
|
||||
Auto-Built-Package: debug-symbols
|
||||
Architecture: amd64
|
||||
Maintainer: Uvos <carl@uvos.xyz>
|
||||
Installed-Size: 349
|
||||
Depends: sigstoped (= 1:0.73-1)
|
||||
Section: debug
|
||||
Priority: optional
|
||||
Multi-Arch: same
|
||||
Description: debug symbols for sigstoped
|
||||
Build-Ids: 8d2a153010b3e35a0500b1969e6f855421d6aee4
|
1
debian/.debhelper/sigstoped/dbgsym-root/DEBIAN/md5sums
vendored
Normal file
1
debian/.debhelper/sigstoped/dbgsym-root/DEBIAN/md5sums
vendored
Normal file
@ -0,0 +1 @@
|
||||
fda7b3cbcccd3e15500982d40bd692e5 usr/lib/debug/.build-id/8d/2a153010b3e35a0500b1969e6f855421d6aee4.debug
|
Binary file not shown.
1
debian/.debhelper/sigstoped/dbgsym-root/usr/share/doc/sigstoped-dbgsym
vendored
Symbolic link
1
debian/.debhelper/sigstoped/dbgsym-root/usr/share/doc/sigstoped-dbgsym
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
sigstoped
|
3
debian/changelog
vendored
Normal file
3
debian/changelog
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
qsigstoped (1:1.0-1) unstable; urgency=medium
|
||||
Inital version
|
||||
-- Uvos <carl@uvos.xyz> Mon, 10 Jun 2020 15:00:00 +0100
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
||||
10
|
18
debian/control
vendored
Executable file
18
debian/control
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
Source: qsigstoped
|
||||
Section: base
|
||||
Priority: optional
|
||||
Maintainer: Uvos <carl@uvos.xyz>
|
||||
Build-Depends:
|
||||
debhelper,
|
||||
qt5-qmake,
|
||||
qt5-default,
|
||||
Standards-Version: 1.0
|
||||
|
||||
Package: qsigstoped
|
||||
Architecture: any
|
||||
Multi-arch: same
|
||||
Depends:
|
||||
libqt5gui5,
|
||||
libqt5core5a,
|
||||
Description: An application to configure the qsigstoped deamon
|
||||
|
2
debian/copywrite
vendored
Normal file
2
debian/copywrite
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
Unless stated otherwise, all files are:
|
||||
Copyright 2020 Carl Klemm and are licensed under the GPLv3
|
2
debian/gbp.conf
vendored
Normal file
2
debian/gbp.conf
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
[DEFAULT]
|
||||
upstream-tag=%(version)s
|
4
debian/rules
vendored
Executable file
4
debian/rules
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
|
63
desktopfile.cpp
Normal file
63
desktopfile.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#include "desktopfile.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
||||
DesktopFile::DesktopFile(const QString& fileName)
|
||||
{
|
||||
open(fileName);
|
||||
}
|
||||
|
||||
bool DesktopFile::operator==(const DesktopFile& in)
|
||||
{
|
||||
return execName == in.execName;
|
||||
}
|
||||
|
||||
bool DesktopFile::open(const QString& fileName)
|
||||
{
|
||||
if(QFile::exists(fileName))
|
||||
{
|
||||
QSettings desktopFile(fileName, QSettings::IniFormat);
|
||||
desktopFile.beginGroup("Desktop Entry");
|
||||
name = desktopFile.value("Name").toString();
|
||||
command = desktopFile.value("Exec").toString();
|
||||
execName = QFileInfo(command).fileName().split(' ').at(0);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<fileName<<" dose not exist.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QList<DesktopFile> DesktopFile::getDesktopFiles(const QList<QByteArray>& desktopFileDirs)
|
||||
{
|
||||
|
||||
QList<DesktopFile> desktopFiles;
|
||||
|
||||
for(int i = 0; i < desktopFileDirs.size(); ++i)
|
||||
{
|
||||
QDir directory(desktopFileDirs[i] + "/applications");
|
||||
if(directory.exists())
|
||||
{
|
||||
QStringList desktopFileNames = directory.entryList(QStringList() << "*.desktop",QDir::Files);
|
||||
for(int j = 0; j < desktopFileNames.size(); ++j)
|
||||
{
|
||||
DesktopFile desktopFile(directory.path() + "/" + desktopFileNames[j]);
|
||||
bool found = desktopFile.execName == "";
|
||||
for(int k = 0; k < desktopFiles.size(); ++k)if( desktopFile == desktopFiles[k] )
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!found)desktopFiles.push_back(desktopFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
return desktopFiles;
|
||||
}
|
26
desktopfile.h
Normal file
26
desktopfile.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef DESKTOPFILE_H
|
||||
#define DESKTOPFILE_H
|
||||
|
||||
#include<QString>
|
||||
|
||||
class DesktopFile
|
||||
{
|
||||
public:
|
||||
|
||||
QString name;
|
||||
QString command;
|
||||
QString execName;
|
||||
QString iconPath;
|
||||
|
||||
bool stop = false;
|
||||
|
||||
public:
|
||||
DesktopFile(const QString& fileName);
|
||||
DesktopFile(){}
|
||||
bool open(const QString& fileName);
|
||||
bool operator==(const DesktopFile& in);
|
||||
|
||||
static QList<DesktopFile> getDesktopFiles(const QList<QByteArray>& desktopFileDirs);
|
||||
};
|
||||
|
||||
#endif // DESKTOPFILE_H
|
31
desktopfilewidget.cpp
Normal file
31
desktopfilewidget.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include "desktopfilewidget.h"
|
||||
#include "ui_desktopfilewidget.h"
|
||||
#include <QDebug>
|
||||
|
||||
DesktopFileWidget::DesktopFileWidget(const DesktopFile& desktopfile, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DesktopFileWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->label->setText(desktopfile.name);
|
||||
ui->checkBox->setChecked(desktopfile.stop);
|
||||
ui->checkBox->setStyleSheet("QCheckBox::indicator { width: 32px; height: 32px; } ");
|
||||
|
||||
ui->checkBox->setTristate(false);
|
||||
|
||||
}
|
||||
|
||||
DesktopFileWidget::~DesktopFileWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
bool DesktopFileWidget::isChecked()
|
||||
{
|
||||
return ui->checkBox->isChecked();
|
||||
}
|
||||
|
||||
void DesktopFileWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
ui->checkBox->setCheckState(ui->checkBox->checkState() == Qt::Checked ? Qt::Unchecked : Qt::Checked);
|
||||
}
|
30
desktopfilewidget.h
Normal file
30
desktopfilewidget.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef DESKTOPFILEWIDGET_H
|
||||
#define DESKTOPFILEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QCheckBox>
|
||||
#include "desktopfile.h"
|
||||
|
||||
namespace Ui {
|
||||
class DesktopFileWidget;
|
||||
}
|
||||
|
||||
class DesktopFileWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DesktopFileWidget(const DesktopFile& desktopfile, QWidget *parent = nullptr);
|
||||
~DesktopFileWidget();
|
||||
|
||||
bool isChecked();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
Ui::DesktopFileWidget *ui;
|
||||
};
|
||||
|
||||
#endif // DESKTOPFILEWIDGET_H
|
68
desktopfilewidget.ui
Normal file
68
desktopfilewidget.ui
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DesktopFileWidget</class>
|
||||
<widget class="QWidget" name="DesktopFileWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="resources.qrc">
|
||||
<normaloff>:/icons/qsigstoped.svg</normaloff>:/icons/qsigstoped.svg</iconset>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="tabletTracking">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
BIN
icons/qsigstoped.png
Normal file
BIN
icons/qsigstoped.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
118
icons/qsigstoped.svg
Normal file
118
icons/qsigstoped.svg
Normal file
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
id="svg8"
|
||||
version="1.1"
|
||||
viewBox="0 0 81.090889 81.090889"
|
||||
height="81.090889mm"
|
||||
width="81.090889mm">
|
||||
<defs
|
||||
id="defs2">
|
||||
<linearGradient
|
||||
id="linearGradient934">
|
||||
<stop
|
||||
style="stop-color:#e6e6e6;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop930" />
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop932" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient928">
|
||||
<stop
|
||||
style="stop-color:#cccccc;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop924" />
|
||||
<stop
|
||||
style="stop-color:#666666;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop926" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient916">
|
||||
<stop
|
||||
id="stop912"
|
||||
offset="0"
|
||||
style="stop-color:#e6e6e6;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop914"
|
||||
offset="1"
|
||||
style="stop-color:#666666;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="89.681839"
|
||||
x2="144.12482"
|
||||
y1="46.304626"
|
||||
x1="132.61447"
|
||||
id="linearGradient918"
|
||||
xlink:href="#linearGradient916" />
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="89.680634"
|
||||
x2="123.60547"
|
||||
y1="46.303413"
|
||||
x1="112.09513"
|
||||
id="linearGradient920"
|
||||
xlink:href="#linearGradient934" />
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="99.306366"
|
||||
x2="-89.637817"
|
||||
y1="87.496368"
|
||||
x1="-47.003662"
|
||||
id="linearGradient922"
|
||||
xlink:href="#linearGradient928" />
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata5">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(-75.846843,-27.693599)"
|
||||
id="layer1">
|
||||
<circle
|
||||
r="40.495445"
|
||||
cy="68.239044"
|
||||
cx="116.39229"
|
||||
id="path835"
|
||||
style="opacity:1;fill:#000000;fill-opacity:0.923445;fill-rule:evenodd;stroke:#000000;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
y="46.303413"
|
||||
x="112.09513"
|
||||
height="43.377216"
|
||||
width="11.510338"
|
||||
id="rect837"
|
||||
style="opacity:1;mix-blend-mode:normal;fill:url(#linearGradient920);fill-opacity:1;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<rect
|
||||
style="opacity:1;mix-blend-mode:normal;fill:url(#linearGradient918);fill-opacity:1;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect837-3"
|
||||
width="11.510338"
|
||||
height="43.377216"
|
||||
x="132.61447"
|
||||
y="46.304626" />
|
||||
<rect
|
||||
transform="rotate(-90)"
|
||||
style="opacity:1;mix-blend-mode:normal;fill:url(#linearGradient922);fill-opacity:1;fill-rule:evenodd;stroke:#4d4d4d;stroke-width:0.1;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect837-6"
|
||||
width="11.510338"
|
||||
height="26.882883"
|
||||
x="-74.284752"
|
||||
y="80.577293" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.7 KiB |
92
main.cpp
Normal file
92
main.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
#include "maindialog.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "desktopfile.h"
|
||||
|
||||
void generateBlacklistFile(QString fileName, QVector<DesktopFileWidget*> widgets, const QList<DesktopFile>& desktopFiles, pid_t sigstopedPid)
|
||||
{
|
||||
QFile blacklist(fileName);
|
||||
blacklist.open(QIODevice::WriteOnly | QIODevice::Truncate);
|
||||
if(!blacklist.isOpen())
|
||||
{
|
||||
QMessageBox::critical(nullptr, "Error", "Can not open: " + fileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i = 0; i < widgets.size() && i < desktopFiles.size(); ++i)
|
||||
{
|
||||
if(widgets[i]->isChecked())
|
||||
{
|
||||
blacklist.write(desktopFiles[i].execName.toUtf8()+'\n');
|
||||
qDebug()<<desktopFiles[i].execName;
|
||||
}
|
||||
}
|
||||
kill(sigstopedPid, SIGUSR1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
pid_t sigstopedPid;
|
||||
QString pidfileName(QDir::home().path() + "/.config/sigstoped/pidfile");
|
||||
QFile pidfile(pidfileName);
|
||||
pidfile.open(QIODevice::ReadOnly);
|
||||
if(!pidfile.isOpen())
|
||||
{
|
||||
qDebug()<<QDir::home().path() + "/.config/sigstoped/pidfile";
|
||||
QMessageBox::critical(nullptr, "Error", "The sigstoped deamon must be running" );
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sigstopedPid = pidfile.readAll().toLong();
|
||||
qDebug()<<"sigstoped pid:"<<sigstopedPid;
|
||||
pidfile.close();
|
||||
}
|
||||
|
||||
QList<QByteArray> desktopFileDirs = qgetenv("XDG_DATA_DIRS").split(':');
|
||||
qDebug()<<"Looking for .desktop files in:";
|
||||
for(int i = 0; i < desktopFileDirs.size(); ++i) qDebug()<<QString(desktopFileDirs[i]);
|
||||
if(desktopFileDirs.size() == 0) QMessageBox::critical(nullptr, "Error", "XDG_DATA_DIRS must be set" );
|
||||
|
||||
QFile blacklist(QDir::home().path() + "/.config/sigstoped/blacklist");
|
||||
blacklist.open(QIODevice::ReadOnly);
|
||||
|
||||
QList<DesktopFile> desktopFiles = DesktopFile::getDesktopFiles(desktopFileDirs);
|
||||
if(blacklist.isOpen())
|
||||
{
|
||||
QList<QByteArray> blacklistedApplicationNames = blacklist.readAll().split('\n');
|
||||
if(blacklistedApplicationNames.size() > 0 && blacklistedApplicationNames.back() == "") blacklistedApplicationNames.pop_back();
|
||||
for(int i = 0; i < blacklistedApplicationNames.size(); ++i)
|
||||
{
|
||||
qDebug()<<blacklistedApplicationNames[i];
|
||||
for(int j = 0; j < desktopFiles.size(); ++j)
|
||||
{
|
||||
if(desktopFiles[j].execName.toUtf8() == blacklistedApplicationNames[i])
|
||||
{
|
||||
desktopFiles[j].stop = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainDialog w;
|
||||
QObject::connect(&w, &MainDialog::accepted, [&w, &desktopFiles, &sigstopedPid](){generateBlacklistFile(QDir::home().path() + "/.config/sigstoped/blacklist", w.getWidgets(), desktopFiles, sigstopedPid);});
|
||||
|
||||
w.setDesktopFiles(desktopFiles);
|
||||
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
37
maindialog.cpp
Normal file
37
maindialog.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "maindialog.h"
|
||||
#include "ui_maindialog.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QScroller>
|
||||
#include <QTouchDevice>
|
||||
|
||||
MainDialog::MainDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::MainDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(ui->buttonBox->button(ui->buttonBox->Apply), &QPushButton::clicked, this, &MainDialog::accepted);
|
||||
QScroller::grabGesture(ui->scrollArea, QScroller::TouchGesture);
|
||||
QScroller::grabGesture(ui->scrollArea, QScroller::LeftMouseButtonGesture);
|
||||
|
||||
|
||||
ui->scrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
|
||||
}
|
||||
|
||||
MainDialog::~MainDialog()
|
||||
{
|
||||
delete ui;
|
||||
for(int i = 0; i<widgets_.size(); ++i) delete widgets_[i];
|
||||
}
|
||||
|
||||
void MainDialog::setDesktopFiles(const QList<DesktopFile>& desktopFiles)
|
||||
{
|
||||
for(int i = 0; i<desktopFiles.size(); ++i) widgets_.push_back(new DesktopFileWidget(desktopFiles[i]));
|
||||
for(int i = 0; i<widgets_.size(); ++i) ui->scollItemLayout->insertWidget(-1, widgets_[i]);
|
||||
}
|
||||
|
||||
QVector<DesktopFileWidget*> MainDialog::getWidgets()
|
||||
{
|
||||
return widgets_;
|
||||
}
|
||||
|
30
maindialog.h
Normal file
30
maindialog.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef MAINDIALOG_H
|
||||
#define MAINDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QVector>
|
||||
#include "desktopfilewidget.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainDialog;
|
||||
}
|
||||
|
||||
class MainDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QVector<DesktopFileWidget*> widgets_;
|
||||
|
||||
public:
|
||||
explicit MainDialog(QWidget *parent = nullptr);
|
||||
~MainDialog();
|
||||
|
||||
void setDesktopFiles(const QList<DesktopFile>& desktopFiles);
|
||||
|
||||
QVector<DesktopFileWidget*> getWidgets();
|
||||
|
||||
private:
|
||||
Ui::MainDialog *ui;
|
||||
};
|
||||
|
||||
#endif // MAINDIALOG_H
|
116
maindialog.ui
Normal file
116
maindialog.ui
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainDialog</class>
|
||||
<widget class="QDialog" name="MainDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>QSigstoped</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
<activeoff>:/icons/qsigstoped.png</activeoff>
|
||||
</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Select Applications to stop in background:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>384</width>
|
||||
<height>216</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="scollItemLayout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>MainDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>MainDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
15
mainwindow.cpp
Normal file
15
mainwindow.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
24
qsigstoped.desktop
Normal file
24
qsigstoped.desktop
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
[Desktop Entry]
|
||||
|
||||
# The type as listed above
|
||||
Type=Application
|
||||
|
||||
# The version of the desktop entry specification to which this file complies
|
||||
Version=1.0
|
||||
|
||||
# The name of the application
|
||||
Name=QSigstoped
|
||||
|
||||
# A comment which can/will be used as a tooltip
|
||||
Comment=Tool to configure sigstoped
|
||||
|
||||
# The executable of the application, possibly with arguments.
|
||||
Exec=qsigstoped
|
||||
|
||||
# The name of the icon that will be used to display this entry
|
||||
Icon=qsigstoped
|
||||
|
||||
# Describes whether this application needs to be run in a terminal or not
|
||||
Terminal=false
|
||||
|
43
qsigstoped.pro
Normal file
43
qsigstoped.pro
Normal file
@ -0,0 +1,43 @@
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
desktopfile.cpp \
|
||||
desktopfilewidget.cpp \
|
||||
main.cpp \
|
||||
maindialog.cpp
|
||||
|
||||
HEADERS += \
|
||||
desktopfile.h \
|
||||
desktopfilewidget.h \
|
||||
maindialog.h
|
||||
|
||||
FORMS += \
|
||||
desktopfilewidget.ui \
|
||||
maindialog.ui
|
||||
|
||||
|
||||
unix:target.path = /usr/bin
|
||||
unix:icons.path = /usr/share/icons
|
||||
unix:icons.files = icons/*
|
||||
unix:desktopfile.path = /usr/share/applications
|
||||
unix:desktopfile.files = qsigstoped.desktop
|
||||
|
||||
INSTALLS += target icons desktopfile
|
||||
|
||||
RESOURCES += \
|
||||
resources.qrc
|
5
resources.qrc
Normal file
5
resources.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icons/qsigstoped.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
x
Reference in New Issue
Block a user