Skip to content
Snippets Groups Projects
Commit efb8d7f9 authored by Tanguy Raufflet's avatar Tanguy Raufflet
Browse files

Suppression Qt fichier core/operation.h

Il est de nouveau possible de compiler des plugins sans Qt
Suppression de l'héritage de GenericOperation à QObject
Fix des conséquences de la perte de l'héritage :
 --> Génération image TSV : feature getHint
 --> Fix QIntValidator (ScalingOp)
conversion TSV (revenu à l'ancienne version) + documentation calculs
parent 95c9a1a0
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@ using namespace std;
using namespace imagein;
using namespace genericinterface;
BinaryMaskOp::BinaryMaskOp() : GenericOperation(qApp->translate("Operations", "Apply mask").toStdString())
BinaryMaskOp::BinaryMaskOp() : GenericOperation(qApp->translate("BinaryMaskOp", "Apply mask").toStdString())
{
}
......@@ -60,7 +60,7 @@ void BinaryMaskOp::operator()(const ImageWindow *currentWnd,
dialog->setWindowTitle(currentImgName);
auto* layout = new QFormLayout(dialog);
auto* imgBox = new MixImageListBox(dialog, currentImgName.toStdString(), stdImgList, dblImgList);
layout->insertRow(0, tr("Mask to apply : "), imgBox);
layout->insertRow(0, qApp->translate("BinaryMaskOp","Mask to apply : "), imgBox);
auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel, Qt::Horizontal, dialog);
layout->insertRow(1, buttonBox);
QObject::connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept()));
......
......@@ -60,14 +60,35 @@ unsigned int ColorDialog::getHeight() const {
}
void ColorDialog::getHint() {
// QDialog* hint = new QDialog(QApplication::activeWindow());
// hint->setWindowTitle(QString(qApp->translate("ColorDialog", "A small tip for Qt HSV Color Model")));
// hint->setLayout(new QVBoxLayout);
// QLabel* pic = new QLabel(hint);
// pic->setPixmap(QPixmap(":/images/qcolor-hsv.png"));
// hint->resize(500,500);
// pic->resize(hint->size());
// hint->show();
emit needHint();
auto* hint = new QDialog(QApplication::activeWindow());
hint->setWindowTitle(QString(qApp->translate("ColorDialog", "A small tip")));
// Créer une disposition verticale pour le QDialog
auto* mainLayout = new QVBoxLayout(hint);
auto* huePic = new QLabel(hint);
huePic->setPixmap(QPixmap(":/img/qcolor_hsv.png"));
auto* hueLabel = new QLabel("<b>Hue</b> is the dominant color from 0 to 359 degrees on the color wheel bellow <br>", hint);
auto* satuPic = new QLabel(hint);
satuPic->setPixmap(QPixmap(":/img/qcolor-saturation.png"));
auto* satuLabel = new QLabel("<b>Saturation</b> is in the range 0 to 255 and refers to the vividness of the color <br>", hint);
auto* valuePic = new QLabel(hint);
valuePic->setPixmap(QPixmap(":/img/qcolor-value.png"));
auto* valueLabel = new QLabel("<b>Value</b> is in the range 0 to 255 and represents the brightness of the color <br>", hint);
// Ajouter les QLabel à la disposition principale
mainLayout->addWidget(hueLabel);
mainLayout->addWidget(huePic);
mainLayout->addWidget(satuLabel);
mainLayout->addWidget(satuPic);
mainLayout->addWidget(valueLabel);
mainLayout->addWidget(valuePic);
// Afficher le QDialog
hint->show();
}
......@@ -40,8 +40,6 @@ public:
unsigned int getHeight() const;
public slots:
void getHint();
signals:
void needHint();
private:
Ui::ColorDialog *ui;
......
......@@ -44,7 +44,6 @@ void ColorimetryOp::operator()(const imagein::Image*, const std::map<const image
ColorDialog* dialog = new ColorDialog(QApplication::activeWindow());
dialog->setWindowTitle(QString(qApp->translate("Operations", "RGB/HSV image generator")));
QObject::connect(dialog, SIGNAL(needHint()), this, SLOT(giveHint()));
QDialog::DialogCode code = static_cast<QDialog::DialogCode>(dialog->exec());
QColor color = dialog->getColor();
......@@ -81,20 +80,4 @@ void ColorimetryOp::operator()(const imagein::Image*, const std::map<const image
}
}
outImage(resImg, "RGB Image");
}
void ColorimetryOp::giveHint(){
QDialog* hint = new QDialog(QApplication::activeWindow());
hint->setWindowTitle(QString(qApp->translate("ColorDialog", "A small tip")));
hint->setLayout(new QVBoxLayout);
QLabel* pic = new QLabel(hint);
pic->setPixmap(QPixmap(":/img/qcolor_hsv.png"));
hint->resize(320,280);
pic->resize(hint->size());
hint->show();
std::string outputMessage1 = qApp->translate("ColorimetryOp","H, for hue, is in the range 0 to 359. Red is 0 (degrees), green is 120, and blue is 240 as shown by the pop-up image.\n\n").toStdString();
std::string outputMessage2 = qApp->translate("ColorimetryOp","S, for saturation, is in the range 0 to 255, and the bigger it is, the stronger the color is.\n\n").toStdString();
std::string outputMessage3 = qApp->translate("ColorimetryOp","V, for value, is in the range 0 to 255 and represents lightness or brightness of the color, 0 represents for black.\n\n-------------------------------------------").toStdString();
outText(outputMessage1+outputMessage2+outputMessage3);
}
}
\ No newline at end of file
......@@ -24,17 +24,12 @@
class ColorimetryOp : public Operation
{
Q_OBJECT
public:
ColorimetryOp();
void operator()(const imagein::Image*, const std::map<const imagein::Image*, std::string>&);
bool needCurrentImg() const;
public slots:
void giveHint();
};
#endif // COLORIMETRYOP_H
......@@ -65,21 +65,22 @@ void ScalingOp::operator()(const genericinterface::ImageWindow* currentWnd, cons
// QDoubleSpinBox* xScaleBoxN = new QDoubleSpinBox();
// QDoubleSpinBox* xScaleBoxD = new QDoubleSpinBox();
QLineEdit* xScaleBoxN = new QLineEdit();
xScaleBoxN->setText("1");
xScaleBoxN->setValidator(new QIntValidator(0, 100, this));
xScaleBoxN->setValidator(new QIntValidator(0, 100));
QLineEdit* xScaleBoxD = new QLineEdit();
xScaleBoxD->setText("1");
xScaleBoxD->setValidator(new QIntValidator(0, 100, this));
xScaleBoxD->setValidator(new QIntValidator(0, 100));
// QDoubleSpinBox* yScaleBoxN = new QDoubleSpinBox();
// QDoubleSpinBox* yScaleBoxD = new QDoubleSpinBox();
QLineEdit* yScaleBoxN = new QLineEdit();
yScaleBoxN->setText("1");
yScaleBoxN->setValidator(new QIntValidator(0, 100, this));
yScaleBoxN->setValidator(new QIntValidator(0, 100));
QLineEdit* yScaleBoxD = new QLineEdit();
yScaleBoxD->setText("1");
yScaleBoxD->setValidator(new QIntValidator(0, 100, this));
yScaleBoxD->setValidator(new QIntValidator(0, 100));
// xScaleBox->setValue(1.0);
// yScaleBox->setValue(1.0);
......
......@@ -53,15 +53,22 @@ void SplitHsvOp:: operator()(const imagein::Image* image, const std::map<const i
for(unsigned int i = 0; i < width; i++) {
for(unsigned int j = 0; j < height; j++) {
QColor color = QColor(image->getPixel(i, j, 0), image->getPixel(i, j, 1), image->getPixel(i, j, 2));
if(color.hue()<0) //Qt returns a hue value of -1 for achromatic colors
resImgH->setPixelAt(i,j,0);
else
resImgH->setPixelAt(i,j,color.hue());
/* Hue = -1 <-- R = G = B
* Hue = (360°+60*(G-B)/(Max-Min))%360 <-- R = Max
* Hue = 120°+60°*(B-R)/(Max-Min) <-- G = Max
* Hue = 2400°+60°*(R-G)/(Max-Min) <-- B = Max */
resImgH->setPixelAt(i,j,color.hue());
/* Saturation = 0 <-- Max = 0
* Saturation = 255*(Max-Min)/Max <-- Max != 0 */
resImgS->setPixelAt(i,j,color.saturation());
/* Value = max */
resImgV->setPixelAt(i,j,color.value());
}
}
this->outDoubleImage(resImgH, qApp->translate("Operations", "Hue").toStdString(),DISABLE, DISABLE,false);
this->outDoubleImage(resImgH, qApp->translate("Operations", "Hue").toStdString(),ENABLE, DISABLE,false,0,true);
this->outDoubleImage(resImgS, qApp->translate("Operations", "Saturation").toStdString(),DISABLE, DISABLE,false);
this->outDoubleImage(resImgV, qApp->translate("Operations", "Value").toStdString(),DISABLE, DISABLE,false);
}
......
......@@ -10,5 +10,7 @@
<file>img/arrow-top-left.png</file>
<file>img/arrow-top-right.png</file>
<file>img/qcolor_hsv.png</file>
<file>img/qcolor-saturation.png</file>
<file>img/qcolor-value.png</file>
</qresource>
</RCC>
app/img/qcolor-saturation.png

2.8 KiB

app/img/qcolor-value.png

2.8 KiB

app/img/qcolor_hsv.png

49.3 KiB | W: | H:

app/img/qcolor_hsv.png

39.4 KiB | W: | H:

app/img/qcolor_hsv.png
app/img/qcolor_hsv.png
app/img/qcolor_hsv.png
app/img/qcolor_hsv.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -22,13 +22,8 @@
#include <map>
#include <string>
#include <QObject>
#include <QApplication>
#include <QString>
#include "Image.h"
class QWidget;
namespace genericinterface {
class ImageWindow;
......@@ -45,7 +40,7 @@ class WindowService;
* For an exemple of a true generic operation class, see the PointOp implementation in imageinsa source code.
*/
class GenericOperation : public QObject{
class GenericOperation{
public:
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment