Skip to content

Commit

Permalink
Screenshot Application (#166)
Browse files Browse the repository at this point in the history
Fix #39
Fix #176
  • Loading branch information
Eeems authored Mar 27, 2021
1 parent 2eb0b2b commit c3758ef
Show file tree
Hide file tree
Showing 43 changed files with 1,612 additions and 63 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
cd "$GITHUB_WORKSPACE"/toltec/package/oxide
tar -czvf ./oxide.tar.gz "$GITHUB_WORKSPACE"/result/*
cp "$GITHUB_WORKSPACE"/package .
sed -i "s/~VERSION~/$(cat version.txt)/" ./package
cat ./package
cd "$GITHUB_WORKSPACE"/toltec
make oxide
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ release: clean
INSTALL_ROOT=../../release $(MAKE) -C .build/system-service install
INSTALL_ROOT=../../release $(MAKE) -C .build/settings-manager install
INSTALL_ROOT=../../release $(MAKE) -C .build/screenshot-tool install
INSTALL_ROOT=../../release $(MAKE) -C .build/screenshot-viewer install
INSTALL_ROOT=../../release $(MAKE) -C .build/launcher install
INSTALL_ROOT=../../release $(MAKE) -C .build/lockscreen install
INSTALL_ROOT=../../release $(MAKE) -C .build/task-switcher install

build: tarnish erode rot oxide decay corrupt fret
build: tarnish erode rot oxide decay corrupt fret anxiety

erode:
mkdir -p .build/process-manager
Expand Down Expand Up @@ -98,3 +99,9 @@ corrupt: tarnish
cp -r applications/task-switcher/* .build/task-switcher
cd .build/task-switcher && qmake corrupt.pro
$(MAKE) -C .build/task-switcher all

anxiety: tarnish
mkdir -p .build/screenshot-viewer
cp -r applications/screenshot-viewer/* .build/screenshot-viewer
cd .build/screenshot-viewer && qmake anxiety.pro
$(MAKE) -C .build/screenshot-viewer all
2 changes: 2 additions & 0 deletions applications/launcher/widgets/AppItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Item {
height: root.height * 0.70
width: root.width * 0.90
source: root.source
sourceSize.width: width
sourceSize.height: height
}
Text {
text: root.text
Expand Down
32 changes: 32 additions & 0 deletions applications/lockscreen/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class Controller : public QObject {
if(state == "loaded" && pin == storedPin()){
qDebug() << "PIN matches!";
QTimer::singleShot(200, [this]{
onLogin();
if(getPinEntryUI()){
pinEntryUI->setProperty("message", "");
pinEntryUI->setProperty("pin", "");
Expand All @@ -200,6 +201,7 @@ class Controller : public QObject {

}else if(state == "loaded"){
qDebug() << "PIN doesn't match!";
onFailedLogin();
return false;
}
if(state == "prompt"){
Expand Down Expand Up @@ -393,6 +395,36 @@ private slots:
void chargerWarning(){
// TODO handle charger
}
void onLogin(){
if(!settings.contains("onLogin")){
return;
}
auto path = settings.value("onLogin").toString();
if(!QFile::exists(path)){
qWarning() << "onLogin script does not exist" << path;
return;
}
if(!QFileInfo(path).isExecutable()){
qWarning() << "onLogin script is not executable" << path;
return;
}
QProcess::execute(path);
}
void onFailedLogin(){
if(!settings.contains("onFailedLogin")){
return;
}
auto path = settings.value("onFailedLogin").toString();
if(!QFile::exists(path)){
qWarning() << "onFailedLogin script does not exist" << path;
return;
}
if(!QFileInfo(path).isExecutable()){
qWarning() << "onFailedLogin script is not executable" << path;
return;
}
QProcess::execute(path);
}

private:
QString confirmPin;
Expand Down
4 changes: 4 additions & 0 deletions applications/process-manager/erode.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ QML_DESIGNER_IMPORT_PATH =
target.path = /opt/bin
!isEmpty(target.path): INSTALLS += target

icons.files = ../../assets/etc/draft/icons/erode.svg
icons.path = /opt/etc/draft/icons
INSTALLS += icons

HEADERS += \
controller.h \
taskitem.h \
Expand Down
73 changes: 73 additions & 0 deletions applications/screenshot-viewer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------

*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash

# qtcreator generated files
*.pro.user*

# xemacs temporary files
*.flc

# Vim temporary files
.*.swp

# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*

# MinGW generated files
*.Debug
*.Release

# Python byte code
*.pyc

# Binaries
# --------
*.dll
*.exe

48 changes: 48 additions & 0 deletions applications/screenshot-viewer/anxiety.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
QT += gui
QT += quick
QT += dbus

CONFIG += c++11
CONFIG += qml_debug

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as 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 make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

linux-oe-g++ {
LIBS += -lqsgepaper
}

SOURCES += \
main.cpp \
../../shared/devicesettings.cpp \
../../shared/eventfilter.cpp

# Default rules for deployment.
target.path = /opt/bin
!isEmpty(target.path): INSTALLS += target

icons.files = ../../assets/etc/draft/icons/image.svg
icons.path = /opt/etc/draft/icons
INSTALLS += icons

DBUS_INTERFACES += ../../interfaces/dbusservice.xml
DBUS_INTERFACES += ../../interfaces/screenapi.xml
DBUS_INTERFACES += ../../interfaces/screenshot.xml

INCLUDEPATH += ../../shared
HEADERS += \
../../shared/dbussettings.h \
../../shared/devicesettings.h \
../../shared/eventfilter.h \
controller.h \
screenshotlist.h

RESOURCES += \
qml.qrc
Loading

0 comments on commit c3758ef

Please sign in to comment.