Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/copy screenshot to xochitl #209

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion applications/launcher/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ QList<QObject*> Controller::getApps(){
}
// Sort by name
std::sort(applications.begin(), applications.end(), [=](const QObject* a, const QObject* b) -> bool {
return a->property("name") < b->property("name");
return a->property("name").toString() < b->property("name").toString();
});
return applications;
}
Expand Down
4 changes: 2 additions & 2 deletions applications/launcher/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ int main(int argc, char *argv[]){
QQmlContext* context = engine.rootContext();
Controller* controller = new Controller();
controller->filter = filter;
qmlRegisterType<AppItem>();
qmlRegisterType<Controller>();
qmlRegisterAnonymousType<AppItem>("codes.eeems.oxide", 2);
qmlRegisterAnonymousType<Controller>("codes.eeems.oxide", 2);
context->setContextProperty("screenGeometry", app.primaryScreen()->geometry());
context->setContextProperty("apps", QVariant::fromValue(controller->getApps()));
context->setContextProperty("controller", controller);
Expand Down
4 changes: 2 additions & 2 deletions applications/lockscreen/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private slots:
qWarning() << "onLogin script is not executable" << path;
return;
}
QProcess::execute(path);
QProcess::execute(path, QStringList());
}
void onFailedLogin(){
if(!settings.contains("onFailedLogin")){
Expand All @@ -423,7 +423,7 @@ private slots:
qWarning() << "onFailedLogin script is not executable" << path;
return;
}
QProcess::execute(path);
QProcess::execute(path, QStringList());
}

private:
Expand Down
8 changes: 6 additions & 2 deletions applications/process-manager/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,12 @@ void Controller::sort(){
auto aprop = a->property(sortBy.c_str());
auto bprop = b->property(sortBy.c_str());
if(sortBy != lastSortBy && aprop == bprop){
return a->property(lastSortBy.c_str()) < b->property(lastSortBy.c_str());
aprop = a->property(lastSortBy.c_str());
bprop = b->property(lastSortBy.c_str());
}
return aprop < bprop;
if(sortBy == "name"){
return aprop.toString() < bprop.toString();
}
return aprop.toInt() < bprop.toInt();
});
}
14 changes: 7 additions & 7 deletions applications/settings-manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ public slots:
args << QVariant(typeId, ptr);
}
if(args.size() > 1){
qStdOut << toJson(args).toStdString().c_str() << endl;
qStdOut << toJson(args).toStdString().c_str() << Qt::endl;
}else if(args.size() == 1 && !args.first().isNull()){
qStdOut << toJson(args.first()).toStdString().c_str() << endl;
qStdOut << toJson(args.first()).toStdString().c_str() << Qt::endl;
}else{
qStdOut << "undefined" << endl;
qStdOut << "undefined" << Qt::endl;
}
if(once){
qApp->quit();
Expand Down Expand Up @@ -367,7 +367,7 @@ int main(int argc, char *argv[]){
qDebug() << "Failed to get value" << api->lastError();
return EXIT_FAILURE;
}
qStdOut << toJson(value).toStdString().c_str() << endl;
qStdOut << toJson(value).toStdString().c_str() << Qt::endl;
}else if(action == "set"){
auto property = args.at(2).toStdString();
if(!api->setProperty(property.c_str(), args.at(3).toStdString().c_str())){
Expand All @@ -385,7 +385,7 @@ int main(int argc, char *argv[]){
for(int i = 0, j = method.parameterCount(); i < j; ++i){
parameters << QMetaType::typeName(method.parameterType(i));
}
slotName.append(parameters.join(",")).append(")");
slotName.append(parameters.join(",").toUtf8()).append(")");
QByteArray theSignal = QMetaObject::normalizedSignature(method.methodSignature().constData());
QByteArray theSlot = QMetaObject::normalizedSignature(slotName);
if(!QMetaObject::checkConnectArgs(theSignal, theSlot)){
Expand Down Expand Up @@ -439,9 +439,9 @@ int main(int argc, char *argv[]){
QDBusMessage reply = api->callWithArgumentList(QDBus::Block, method, arguments);
auto result = reply.arguments();
if(result.size() > 1){
qStdOut << toJson(result).toStdString().c_str() << endl;
qStdOut << toJson(result).toStdString().c_str() << Qt::endl;
}else if(!result.first().isNull()){
qStdOut << toJson(result.first()).toStdString().c_str() << endl;
qStdOut << toJson(result.first()).toStdString().c_str() << Qt::endl;
}
if(!reply.errorName().isEmpty()){
return EXIT_FAILURE;
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void Application::stopNoSecurityCheck(){
}
qDebug() << "Stopping " << path();
if(!onStop().isEmpty()){
QProcess::execute(onStop());
QProcess::execute(onStop(), QStringList());
}
Application* pausedApplication = nullptr;
if(state == Paused){
Expand Down
11 changes: 7 additions & 4 deletions applications/system-service/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ class Application : public QObject{
Application(QString path, QObject* parent) : QObject(parent), m_path(path), m_backgrounded(false), fifos() {
m_process = new SandBoxProcess(this);
connect(m_process, &SandBoxProcess::started, this, &Application::started);
connect(m_process, QOverload<int>::of(&SandBoxProcess::finished), this, &Application::finished);
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&SandBoxProcess::finished), [=](int exitCode, QProcess::ExitStatus status){
Q_UNUSED(status);
finished(exitCode);
});
connect(m_process, &SandBoxProcess::readyReadStandardError, this, &Application::readyReadStandardError);
connect(m_process, &SandBoxProcess::readyReadStandardOutput, this, &Application::readyReadStandardOutput);
connect(m_process, &SandBoxProcess::stateChanged, this, &Application::stateChanged);
Expand Down Expand Up @@ -407,12 +410,13 @@ public slots:
}

private slots:
void showSplashScreen();
void started();
void finished(int exitCode);
void readyReadStandardError(){
const char* prefix = ("[" + name() + " " + QString::number(m_process->processId()) + "]").toUtf8();
QString error = m_process->readAllStandardError();
for(QString line : error.split(QRegExp("[\r\n]"), QString::SkipEmptyParts)){
for(QString line : error.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts)){
if(!line.isEmpty()){
sd_journal_print(LOG_ERR, "%s %s", prefix, (const char*)line.toUtf8());
}
Expand All @@ -421,7 +425,7 @@ private slots:
void readyReadStandardOutput(){
const char* prefix = ("[" + name() + " " + QString::number(m_process->processId()) + "]").toUtf8();
QString output = m_process->readAllStandardOutput();
for(QString line : output.split(QRegExp("[\r\n]"), QString::SkipEmptyParts)){
for(QString line : output.split(QRegularExpression("[\r\n]"), Qt::SkipEmptyParts)){
if(!line.isEmpty()){
sd_journal_print(LOG_INFO, "%s %s", prefix, (const char*)line.toUtf8());
}
Expand Down Expand Up @@ -455,7 +459,6 @@ private slots:
QMap<QString, FifoHandler*> fifos;

bool hasPermission(QString permission, const char* sender = __builtin_FUNCTION());
void showSplashScreen();
void delayUpTo(int milliseconds){
timer.invalidate();
timer.start();
Expand Down
41 changes: 41 additions & 0 deletions applications/system-service/appsapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,55 @@ class AppsAPI : public APIBase {
m_stopping = true;
writeApplications();
settings.sync();
auto frameBuffer = EPFrameBuffer::framebuffer();
qDebug() << "Waiting for other painting to finish...";
while(frameBuffer->paintingActive()){
EPFrameBuffer::waitForLastUpdate();
}
QPainter painter(frameBuffer);
auto rect = frameBuffer->rect();
auto fm = painter.fontMetrics();
auto size = frameBuffer->size();
qDebug() << "Clearing screen...";
painter.setPen(Qt::white);
painter.fillRect(rect, Qt::black);
EPFrameBuffer::sendUpdate(rect, EPFrameBuffer::Mono, EPFrameBuffer::FullUpdate, true);
EPFrameBuffer::waitForLastUpdate();
qDebug() << "Stopping applications...";
for(auto app : applications){
if(app->stateNoSecurityCheck() != Application::Inactive){
auto text = "Stopping " + app->displayName() + "...";
qDebug() << text.toStdString().c_str();
int padding = 10;
int textHeight = fm.height() + padding;
QRect textRect(
QPoint(0 + padding, size.height() - textHeight),
QSize(size.width() - padding * 2, textHeight)
);
painter.fillRect(textRect, Qt::black);
painter.drawText(
textRect,
Qt::AlignVCenter | Qt::AlignRight,
text
);
EPFrameBuffer::sendUpdate(textRect, EPFrameBuffer::Mono, EPFrameBuffer::PartialUpdate, true);
EPFrameBuffer::waitForLastUpdate();
}
app->stopNoSecurityCheck();
}
qDebug() << "Ensuring all applications have stopped...";
for(auto app : applications){
app->waitForFinished();
delete app;
}
applications.clear();
qDebug() << "Displaying final quit message...";
painter.fillRect(rect, Qt::black);
painter.drawText(rect, Qt::AlignCenter,"Goodbye!");
EPFrameBuffer::waitForLastUpdate();
EPFrameBuffer::sendUpdate(rect, EPFrameBuffer::Mono, EPFrameBuffer::FullUpdate, true);
painter.end();
EPFrameBuffer::waitForLastUpdate();
}
void startup();
int state() { return 0; } // Ignore this, it's a kludge to get the xml to generate
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void sigHandler(int signal){
int main(int argc, char *argv[]){
if(deviceSettings.getDeviceType() == DeviceSettings::RM2 && getenv("RM2FB_ACTIVE") == nullptr){
qWarning() << "rm2fb not detected. Running xochitl instead!";
return QProcess::execute("/usr/bin/xochitl");
return QProcess::execute("/usr/bin/xochitl", QStringList());
}
if (strcmp(qt_version, QT_VERSION_STR) != 0){
qDebug() << "Version mismatch, Runtime: " << qt_version << ", Build: " << QT_VERSION_STR;
Expand Down
2 changes: 1 addition & 1 deletion applications/system-service/notification.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void Notification::paintNotification(Application* resumeApp){
auto fm = painter.fontMetrics();
auto padding = 10;
auto radius = 10;
auto width = fm.width(text()) + (padding * 2);
auto width = fm.horizontalAdvance(text()) + (padding * 2);
auto height = fm.height() + (padding * 2);
auto left = size.width() - width;
auto top = size.height() - height;
Expand Down
3 changes: 2 additions & 1 deletion applications/system-service/wlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ void Wlan::setInterface(QString path){
removeInterface();
auto bus = QDBusConnection::systemBus();
m_interface = new Interface(WPA_SUPPLICANT_SERVICE, path, bus, this);
m_blobs = m_interface->blobs().toSet();
auto blobs =m_interface->blobs();
m_blobs = QSet<QString>(blobs.begin(), blobs.end());
connect(m_interface, &Interface::BSSAdded, this, &Wlan::onBSSAdded, Qt::QueuedConnection);
connect(m_interface, &Interface::BSSRemoved, this, &Wlan::onBSSRemoved, Qt::QueuedConnection);
connect(m_interface, &Interface::BlobAdded, this, &Wlan::onBlobAdded, Qt::QueuedConnection);
Expand Down
2 changes: 1 addition & 1 deletion package
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ anxiety() {
pkgdesc="Screenshot viewer for Oxide"
url=https://github.com/Eeems/oxide/tree/master/applications/screenshot-viewer
section=utils
installdepends=("tarnish=$pkgver")
installdepends=("tarnish=$pkgver" "imagemagick-png")
Eeems marked this conversation as resolved.
Show resolved Hide resolved

package() {
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/release/opt/bin/anxiety
Expand Down