libragephoto: add C++ namespaces (API change)
- RagePhoto::saveFile() -> use const char* instead of std::string - RagePhoto C++ -> C API: try catch for throwable functions (to match C impl. behaviour) - Rename header files and classes
This commit is contained in:
parent
b94e66624b
commit
e1cf6df258
14 changed files with 275 additions and 249 deletions
|
@ -16,7 +16,7 @@
|
|||
* responsible for anything with use of the software, you are self responsible.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <RagePhotoB>
|
||||
#include <RagePhoto>
|
||||
#include <gtkmm/application.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/button.h>
|
||||
|
@ -36,11 +36,11 @@ bool readPhotoFile(const std::string &filename, Gtk::Window *win, Gtk::Image *im
|
|||
if (ifs.is_open()) {
|
||||
std::string data(std::istreambuf_iterator<char>{ifs}, {});
|
||||
ifs.close();
|
||||
RagePhotoB ragePhoto;
|
||||
RagePhoto ragePhoto;
|
||||
const bool loaded = ragePhoto.load(data);
|
||||
if (!loaded) {
|
||||
const int32_t error = ragePhoto.error();
|
||||
if (error <= RagePhotoB::PhotoReadError) {
|
||||
if (error <= RagePhoto::PhotoReadError) {
|
||||
Gtk::MessageDialog msg(*win, "Failed to read photo: " + filename, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK, true);
|
||||
msg.set_title("Open Photo");
|
||||
msg.run();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* responsible for anything with use of the software, you are self responsible.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <RagePhotoB>
|
||||
#include <RagePhoto>
|
||||
#include <QApplication>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -35,11 +35,11 @@ bool readPhotoFile(const QString &filename, QMainWindow *mainWindow, QLabel *pho
|
|||
if (file.open(QIODevice::ReadOnly)) {
|
||||
const QByteArray fileData = file.readAll();
|
||||
file.close();
|
||||
RagePhotoB ragePhoto;
|
||||
RagePhoto ragePhoto;
|
||||
const bool loaded = ragePhoto.load(fileData.data(), static_cast<size_t>(fileData.size()));
|
||||
if (!loaded) {
|
||||
const int32_t error = ragePhoto.error();
|
||||
if (error <= RagePhotoB::PhotoReadError) {
|
||||
if (error <= RagePhoto::PhotoReadError) {
|
||||
QMessageBox::warning(mainWindow, "Open Photo", "Failed to read photo: " + filename);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue