Open GoogleCodeExporter opened 9 years ago
Original comment by cavalcan...@gmail.com
on 9 Aug 2011 at 1:47
Sorry, just know how to it in C++ :-P
{{{
QFileDialog dialog;
QString imagesDir =
QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
QString defaultName = QString("%1/%2").arg(imagesDir).arg("untitled.jpg");
QString fileName = dialog.getSaveFileName(0, "Save File", defaultName, "Images
(*.png *.gif *.jpg)");
m_image.save(fileName);
}}}
Could you post some pointers to the right direction on doing so using QML?
Original comment by milton.soares.filho
on 12 Aug 2011 at 4:08
Milton
The issue of storing the images within the location of the system photos is
that the user could delete it (e.g. using the Gallery app in cellphone) and we
never would known that (Symbian AFAICT lacks a inotify functionality like
Linux). Having the ordeal of scanning the directory of photos at startup and
updating the database at same time to remove elements that the user deleted is
not a good solution too.
Ideally, the photos snapped by CellarDoor should be moved to a private
directory, thus solving this issue.
In the case of cellphone, it could be in the app installation directory. But
there is an issue with this, because generally the apps are installed in the
'C' which lacks enough space to store photos.
The alternative is to use Qt Mobility (IIRC, SystemInfo module
http://doc.qt.nokia.com/qtmobility-1.1/qtsysteminfo.html) to inspect for the
bigger available disk (generally it is the 'E' drive in Symbian). Only as a
fallback, use 'C' drive.
There is an added complication that in Windows7 (and if IIRC, OSX too), that Qt
SDK doesn't include Qt Mobility (and even if included, serveral modules lack
the back ends for those OSes e.g. Camera/Bluetooth/etc), so this code will need
to be ifdef'ed in the utils.cpp.
Ok, this covers step 1: saving the photos.
Next, a new column will need to be appended in the database to refer to the
image location. This will be done by appending a new property in wine.cpp/h
class (I have it commented out):
/*
Q_PROPERTY(QString db_bottle READ bottle WRITE setBottle)
*/
When the photo was taken in the QML side, the third form will need to store the
path location + image name and have a 'getter' js method (just like in
InputOne.qml and InputSecond.qml) that will refer to this attribute.
Then in the Input.qml a call to getter() will be done to fill in the data to
the 'storage' object (that is shared between the QML X C++ side).
Finally, this new property will need to be read at the C++ controller and
dispatched to the Database.
Another issue to pay attention is that in the cellphone, the image will always
have the same name. And in Linux, it will be increasing (i.e. photo1.png,
photo2.png, etc). The name will need to be unique, in this case, the database
record ID property could be used to rename the photo name when moving it from
the current location to the app's private directory.
Cheers
Adenilson
Original comment by cavalcan...@gmail.com
on 12 Aug 2011 at 1:31
Original issue reported on code.google.com by
cavalcan...@gmail.com
on 28 Jul 2011 at 5:22