diff --git a/cyan.pro b/cyan.pro index 218755a..1570ea7 100644 --- a/cyan.pro +++ b/cyan.pro @@ -56,7 +56,7 @@ OBJECTS_DIR = $${DESTDIR}/.obj MOC_DIR = $${DESTDIR}/.moc RCC_DIR = $${DESTDIR}/.qrc -QT += widgets concurrent +QT += core gui concurrent TEMPLATE = app CONFIG += c++11 @@ -137,11 +137,11 @@ mac { ICON = res/Cyan.icns QMAKE_INFO_PLIST = res/Info.plist # ugly workaround for static build: - QMAKE_MACOSX_DEPLOYMENT_TARGET = $${OSX_COMPAT} - QMAKE_CFLAGS += -fopenmp - QMAKE_CXXFLAGS += -fopenmp - QMAKE_LFLAGS += -lomp -liconv - LIBS += -L /opt/local/lib/libomp + #QMAKE_MACOSX_DEPLOYMENT_TARGET = $${OSX_COMPAT} + #QMAKE_CFLAGS += -fopenmp + #QMAKE_CXXFLAGS += -fopenmp + #QMAKE_LFLAGS += -lomp -liconv + #LIBS += -L /opt/local/lib/libomp } win32 { diff --git a/src/FXX.cpp b/src/FXX.cpp index 87c6448..4989046 100644 --- a/src/FXX.cpp +++ b/src/FXX.cpp @@ -35,7 +35,7 @@ FXX::FXX() { - Magick::InitializeMagick(nullptr); + Magick::InitializeMagick(NULL); } FXX::Image FXX::readImage(const std::string &file, @@ -455,7 +455,7 @@ bool FXX::editProfile(std::string file, { bool result = false; if (!file.empty()) { - cmsHPROFILE lcmsProfile = nullptr; + cmsHPROFILE lcmsProfile = NULL; lcmsProfile = cmsOpenProfileFromFile(file.c_str(), "w"); if (lcmsProfile) { cmsContext ContextID = cmsGetProfileContextID(lcmsProfile); @@ -520,7 +520,7 @@ std::string FXX::getProfileTag(cmsHPROFILE profile, cmsSelectedType = cmsInfoDescription; } size = cmsGetProfileInfoASCII(profile, cmsSelectedType, - "en", "US", nullptr, 0); + "en", "US", NULL, 0); if (size > 0) { std::vector buffer(size); cmsUInt32Number newsize = cmsGetProfileInfoASCII(profile, cmsSelectedType, diff --git a/src/cyan.cpp b/src/cyan.cpp index e6d8d1a..39f19bf 100644 --- a/src/cyan.cpp +++ b/src/cyan.cpp @@ -51,8 +51,8 @@ #include #include #include -#include -#include +//#include +//#include #include #include @@ -72,35 +72,35 @@ extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory (PULONGLONG Cyan::Cyan(QWidget *parent) : QMainWindow(parent) - , scene(Q_NULLPTR) - , view(Q_NULLPTR) - , mainBar(Q_NULLPTR) - , profileBar(Q_NULLPTR) - , rgbProfile(Q_NULLPTR) - , cmykProfile(Q_NULLPTR) - , grayProfile(Q_NULLPTR) - , inputProfile(Q_NULLPTR) - , outputProfile(Q_NULLPTR) - , monitorProfile(Q_NULLPTR) - , renderingIntent(Q_NULLPTR) - , blackPoint(Q_NULLPTR) - , menuBar(Q_NULLPTR) - , fileMenu(Q_NULLPTR) - , helpMenu(Q_NULLPTR) - , openImageAction(Q_NULLPTR) - , saveImageAction(Q_NULLPTR) - , infoImageAction(Q_NULLPTR) - , quitAction(Q_NULLPTR) - , exportEmbeddedProfileAction(Q_NULLPTR) - , bitDepth(Q_NULLPTR) + , scene(NULL) + , view(NULL) + , mainBar(NULL) + , profileBar(NULL) + , rgbProfile(NULL) + , cmykProfile(NULL) + , grayProfile(NULL) + , inputProfile(NULL) + , outputProfile(NULL) + , monitorProfile(NULL) + , renderingIntent(NULL) + , blackPoint(NULL) + , menuBar(NULL) + , fileMenu(NULL) + , helpMenu(NULL) + , openImageAction(NULL) + , saveImageAction(NULL) + , infoImageAction(NULL) + , quitAction(NULL) + , exportEmbeddedProfileAction(NULL) + , bitDepth(NULL) , ignoreConvertAction(false) - , progBar(Q_NULLPTR) - , prefsMenu(Q_NULLPTR) + , progBar(NULL) + , prefsMenu(NULL) , nativeStyle(false) - , qualityBox(Q_NULLPTR) + , qualityBox(NULL) , activeLayer(-1) - , selectedLayer(Q_NULLPTR) - , selectedLayerLabel(Q_NULLPTR) + , selectedLayer(NULL) + , selectedLayerLabel(NULL) { // get style settings QSettings settings; @@ -110,7 +110,7 @@ Cyan::Cyan(QWidget *parent) // style app if (!nativeStyle) { - qApp->setStyle(QStyleFactory::create("fusion")); + qApp->setStyle(QStyleFactory::create("plastique")); QPalette palette; palette.setColor(QPalette::Window, QColor(53,53,53)); palette.setColor(QPalette::WindowText, Qt::white); @@ -586,11 +586,21 @@ void Cyan::openImageDialog() " (*.png *.jpg *.jpeg *.tif *.tiff *.psd *.xcf *.icc *.icm)") .arg(tr("Image files"))); if (!file.isEmpty()) { - QMimeDatabase db; - QMimeType type = db.mimeTypeForFile(file); - if (type.name().startsWith("image")) { openImage(file); } - else if (type.name().contains("iccprofile")) { openProfile(file); } + //QMimeDatabase db; + //QMimeType type = db.mimeTypeForFile(file); + //if (type.name().startsWith("image")) { openImage(file); } + //else if (type.name().contains("iccprofile")) { openProfile(file); } QFileInfo imageFile(file); + if (imageFile.suffix().endsWith("jpg", Qt::CaseInsensitive) || + imageFile.suffix().endsWith("jpeg", Qt::CaseInsensitive) || + imageFile.suffix().endsWith("tif", Qt::CaseInsensitive) || + imageFile.suffix().endsWith("tiff", Qt::CaseInsensitive) || + imageFile.suffix().endsWith("png", Qt::CaseInsensitive)) { + openImage(file); + } else if(imageFile.suffix().endsWith("icc", Qt::CaseInsensitive)) { + openProfile(file); + } + settings.setValue("lastDir", imageFile.absoluteDir().absolutePath()); } @@ -1288,6 +1298,7 @@ void Cyan::bitDepthChanged(int index) void Cyan::gimpPlugin() { +/* QStringList versions,folders,gimps; versions << "2.4" << "2.6" << "2.7" << "2.8" << "2.9" << "2.10" << "2.99" << "3.0"; gimps << ".gimp-" << ".config/GIMP-AppImage/" << ".config/GIMP/" << "AppData/Roaming/GIMP/" << "Library/Application Support/GIMP/" << ".var/app/org.gimp.GIMP/config/GIMP/"; @@ -1362,6 +1373,7 @@ void Cyan::gimpPlugin() } } if (reloadPlug) { gimpPlugin(); } +*/ } void Cyan::openProfile(QString file) @@ -1570,7 +1582,7 @@ void Cyan::handleReadWatcher() getConvertProfiles(); QFileInfo fileinfo(QString::fromStdString(image.filename)); setWindowTitle(fileinfo.fileName()); - if (!monitorProfile->currentData().toString().isEmpty()) { updateImage(); } + if (!monitorProfile->itemData(monitorProfile->currentIndex()).toString().isEmpty()) { updateImage(); } } else { QMessageBox::warning(this, tr("Image error"), QString::fromStdString(image.error)); diff --git a/src/cyan.h b/src/cyan.h index e2af39d..3a84461 100644 --- a/src/cyan.h +++ b/src/cyan.h @@ -68,7 +68,7 @@ class Cyan : public QMainWindow Q_OBJECT public: - Cyan(QWidget *parent = Q_NULLPTR); + Cyan(QWidget *parent = NULL); ~Cyan(); signals: diff --git a/src/helpdialog.cpp b/src/helpdialog.cpp index 5d382e4..76d9258 100644 --- a/src/helpdialog.cpp +++ b/src/helpdialog.cpp @@ -42,7 +42,7 @@ HelpDialog::HelpDialog(QWidget *parent, QString css, bool enableCloseButton) : QDialog(parent) - , browser(Q_NULLPTR) + , browser(NULL) { setWindowTitle(title); setWindowIcon(QIcon(":/cyan.png")); diff --git a/src/helpdialog.h b/src/helpdialog.h index 733044f..3306935 100644 --- a/src/helpdialog.h +++ b/src/helpdialog.h @@ -42,7 +42,7 @@ class HelpDialog : public QDialog Q_OBJECT public: - HelpDialog(QWidget *parent = Q_NULLPTR, + HelpDialog(QWidget *parent = NULL, QString title = QString(), QString html = QString(), QString css = QString(), diff --git a/src/imageview.cpp b/src/imageview.cpp index 75c5cee..66589b2 100644 --- a/src/imageview.cpp +++ b/src/imageview.cpp @@ -32,8 +32,10 @@ #include "imageview.h" #include -#include -#include +//#include +//#include +#include +#include #include ImageView::ImageView(QWidget* parent) : QGraphicsView(parent) @@ -54,7 +56,7 @@ ImageView::ImageView(QWidget* parent) : QGraphicsView(parent) void ImageView::wheelEvent(QWheelEvent* event) { setTransformationAnchor(QGraphicsView::AnchorUnderMouse); double scaleFactor = 1.15; - if(event->angleDelta().y() > 0) { // up + if(event->delta() > 0) { // up fit = false; scale(scaleFactor, scaleFactor); emit myZoom(scaleFactor, scaleFactor); @@ -99,10 +101,20 @@ void ImageView::dropEvent(QDropEvent *event) if (!mimeData->hasUrls()) { return; } if (mimeData->urls().at(0).isEmpty()) { return; } QUrl url = mimeData->urls().at(0); - QMimeDatabase db; + + if (url.toLocalFile().endsWith(".jpg", Qt::CaseInsensitive) || + url.toLocalFile().endsWith(".jpeg", Qt::CaseInsensitive) || + url.toLocalFile().endsWith(".tif", Qt::CaseInsensitive) || + url.toLocalFile().endsWith(".tiff", Qt::CaseInsensitive) || + url.toLocalFile().endsWith(".png", Qt::CaseInsensitive)) { + emit openImage(url.toLocalFile()); + } else if(url.toLocalFile().endsWith(".icc", Qt::CaseInsensitive)) { + emit openProfile(url.toLocalFile()); + } + /*QMimeDatabase db; QMimeType type = db.mimeTypeForFile(url.toLocalFile()); if (type.name().startsWith("image")) { emit openImage(url.toLocalFile()); } - else if (type.name().contains("iccprofile")) { emit openProfile(url.toLocalFile()); } + else if (type.name().contains("iccprofile")) { emit openProfile(url.toLocalFile()); }*/ } void ImageView::resizeEvent(QResizeEvent */*event*/) diff --git a/src/imageview.h b/src/imageview.h index 29a62aa..8aae572 100644 --- a/src/imageview.h +++ b/src/imageview.h @@ -46,7 +46,7 @@ class ImageView : public QGraphicsView Q_OBJECT public: - explicit ImageView(QWidget* parent = Q_NULLPTR); + explicit ImageView(QWidget* parent = NULL); bool fit; signals: diff --git a/src/main.cpp b/src/main.cpp index 480d2b8..cef9985 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QCoreApplication::setApplicationName("Cyan"); QCoreApplication::setOrganizationName("Cyan"); - QGuiApplication::setApplicationDisplayName("Cyan"); + //QGuiApplication::setApplicationDisplayName("Cyan"); QCoreApplication::setOrganizationDomain("net.fxarena"); QCoreApplication::setApplicationVersion(CYAN_VERSION); Cyan w; diff --git a/src/profiledialog.cpp b/src/profiledialog.cpp index 1468b28..97f860d 100644 --- a/src/profiledialog.cpp +++ b/src/profiledialog.cpp @@ -37,11 +37,11 @@ ProfileDialog::ProfileDialog(QWidget *parent, const QString &inputProfile) : QDialog(parent) - , profileFileName(Q_NULLPTR) - , profileDescription(Q_NULLPTR) - , profileCopyright(Q_NULLPTR) - , profileSaveButton(Q_NULLPTR) - , profileCloseButton(Q_NULLPTR) + , profileFileName(NULL) + , profileDescription(NULL) + , profileCopyright(NULL) + , profileSaveButton(NULL) + , profileCloseButton(NULL) { setWindowTitle(tr("Edit Color Profile")); setWindowIcon(QIcon(":/cyan.png")); diff --git a/src/profiledialog.h b/src/profiledialog.h index 3ec91c9..89d10ec 100644 --- a/src/profiledialog.h +++ b/src/profiledialog.h @@ -44,7 +44,7 @@ class ProfileDialog : public QDialog Q_OBJECT public: - ProfileDialog(QWidget *parent = Q_NULLPTR, + ProfileDialog(QWidget *parent = NULL, const QString &inputProfile = QString()); QLineEdit *profileFileName; QLineEdit *profileDescription;