parent
e6ae8a3487
commit
b75ef82d2e
@ -0,0 +1,34 @@
|
||||
#include "imagemaster.h"
|
||||
|
||||
#include <QImage>
|
||||
#include <QColor>
|
||||
#include <QVector>
|
||||
#include <QBuffer>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QStandardPaths>
|
||||
#include <QDebug>
|
||||
#include <QDateTime>
|
||||
|
||||
void saveImageFromColorArray(const QVector<QColor> &colorArray, int width, int height, int scale) {
|
||||
QImage image(width, height, QImage::Format_ARGB32);
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
int index = y * width + x;
|
||||
image.setPixelColor(x, y, colorArray.at(index));
|
||||
}
|
||||
}
|
||||
|
||||
QImage scaledImage = image.scaled(width * scale, height * scale, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
QString path = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
QString currentDateTime = QDateTime::currentDateTime().toString("yyyyMMdd_HHmmss");
|
||||
QString fileName = QDir(path).filePath(currentDateTime + ".png");
|
||||
|
||||
if (scaledImage.save(fileName)) {
|
||||
qDebug() << "Image saved successfully";
|
||||
} else {
|
||||
qDebug() << "Failed to save image";
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#ifndef IMAGEMASTER_H
|
||||
#define IMAGEMASTER_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QColor>
|
||||
|
||||
void saveImageFromColorArray(const QVector<QColor> &colorArray, int width, int height, int scale);
|
||||
|
||||
#endif // IMAGEMASTER_H
|
@ -1,30 +1,77 @@
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
import Sailfish.Pickers 1.0
|
||||
import QtQuick.Layouts 1.1
|
||||
|
||||
Page {
|
||||
id: page
|
||||
|
||||
// The effective value will be restricted by ApplicationWindow.allowedOrientations
|
||||
allowedOrientations: Orientation.All
|
||||
|
||||
SilicaListView {
|
||||
id: listView
|
||||
model: 20
|
||||
anchors.fill: parent
|
||||
header: PageHeader {
|
||||
title: qsTr("Nested Page")
|
||||
PageHeader {
|
||||
id: header
|
||||
title: "Settings Page"
|
||||
}
|
||||
delegate: BackgroundItem {
|
||||
id: delegate
|
||||
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.paddingLarge
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: header.bottom
|
||||
anchors.topMargin: Theme.paddingLarge
|
||||
|
||||
SectionHeader { text: "Performance" }
|
||||
|
||||
Label {
|
||||
x: Theme.horizontalPageMargin
|
||||
text: qsTr("Item") + " " + index
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor
|
||||
text: "FPS Limit"
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.horizontalPageMargin
|
||||
}
|
||||
TextField {
|
||||
id: fpsPicker
|
||||
width: parent.width - Theme.horizontalPageMargin * 2
|
||||
placeholderText: "Enter FPS limit(1-60)"
|
||||
validator: IntValidator { bottom: 1; top: 60 }
|
||||
onTextChanged: {
|
||||
if (fpsPicker.acceptableInput) {
|
||||
polling_timer.timeout = (1000/parseInt(text, 10))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SectionHeader { text: "Display" }
|
||||
|
||||
Label {
|
||||
text: "Min-Max Value"
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.horizontalPageMargin
|
||||
}
|
||||
Slider {
|
||||
id: rangeSlider
|
||||
width: parent.width - Theme.horizontalPageMargin * 2
|
||||
stepSize: 1
|
||||
value: 50
|
||||
minimumValue: 0
|
||||
maximumValue: 100
|
||||
onValueChanged: {
|
||||
// handle value change
|
||||
}
|
||||
}
|
||||
|
||||
SectionHeader { text: "Options" }
|
||||
|
||||
Label {
|
||||
text: "Noise"
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: Theme.horizontalPageMargin
|
||||
}
|
||||
Switch {
|
||||
id: noiseToggle
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Theme.horizontalPageMargin
|
||||
onCheckedChanged: {
|
||||
mlx90640.stubMode = checked
|
||||
}
|
||||
onClicked: console.log("Clicked " + index)
|
||||
}
|
||||
VerticalScrollDecorator {}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue