Skip to content
Snippets Groups Projects
Commit c0050115 authored by Sacha Percot-Tétu's avatar Sacha Percot-Tétu
Browse files

Moved utility method to namespace Tools

parent b9560566
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include "ImgWidget.h" #include "ImgWidget.h"
#include "ImageListBox.h" #include "ImageListBox.h"
#include "../Tools.h"
using namespace std; using namespace std;
using namespace imagein; using namespace imagein;
...@@ -106,7 +108,7 @@ vector<QWidget*> PointOp::operator()(const imagein::Image* image, const std::map ...@@ -106,7 +108,7 @@ vector<QWidget*> PointOp::operator()(const imagein::Image* image, const std::map
exprEdits[0] = new QLineEdit(pixelWidget); exprEdits[0] = new QLineEdit(pixelWidget);
exprEdits[0]->setFixedWidth(64); exprEdits[0]->setFixedWidth(64);
imageBoxes[0] = new ImageListBox(pixelWidget, image, imgList); imageBoxes[0] = new ImageListBox(pixelWidget, image, imgList);
valueLayouts[0]->addWidget(new QLabel("Image", pixelWidget)); valueLayouts[0]->addWidget(new QLabel(dialog->tr("Image"), pixelWidget));
valueLayouts[0]->addWidget(pixOperatorBoxes[0]); valueLayouts[0]->addWidget(pixOperatorBoxes[0]);
valueLayouts[0]->addWidget(imgOperatorBoxes[0]); valueLayouts[0]->addWidget(imgOperatorBoxes[0]);
valueLayouts[0]->addWidget(exprEdits[0]); valueLayouts[0]->addWidget(exprEdits[0]);
...@@ -127,7 +129,7 @@ vector<QWidget*> PointOp::operator()(const imagein::Image* image, const std::map ...@@ -127,7 +129,7 @@ vector<QWidget*> PointOp::operator()(const imagein::Image* image, const std::map
exprEdits[i] = new QLineEdit(colorWidget); exprEdits[i] = new QLineEdit(colorWidget);
exprEdits[i]->setFixedWidth(64); exprEdits[i]->setFixedWidth(64);
imageBoxes[i] = new ImageListBox(colorWidget, image, imgList); imageBoxes[i] = new ImageListBox(colorWidget, image, imgList);
valueLayouts[i]->addWidget(new QLabel(colorName(i-1, nChannel), colorWidget)); valueLayouts[i]->addWidget(new QLabel(Tools::colorName(i-1, nChannel), colorWidget));
valueLayouts[i]->addWidget(pixOperatorBoxes[i]); valueLayouts[i]->addWidget(pixOperatorBoxes[i]);
valueLayouts[i]->addWidget(imgOperatorBoxes[i]); valueLayouts[i]->addWidget(imgOperatorBoxes[i]);
valueLayouts[i]->addWidget(exprEdits[i]); valueLayouts[i]->addWidget(exprEdits[i]);
......
...@@ -40,16 +40,6 @@ class PointOp : public Operation { ...@@ -40,16 +40,6 @@ class PointOp : public Operation {
bool needCurrentImg(); bool needCurrentImg();
inline static QString colorName(int i, int n) {
if((n==1 || n==2) && i==0) return tr("Black");
if((n==2 && i==1) || (n==4 && i==3)) return tr("Alpha");
switch(i) { case 0: return tr("Red"); case 1: return tr("Green"); case 2: return tr("Blue"); default: return tr("Color"); }
}
static inline QString tr(const char* str) { return QCoreApplication::tr(str); }
private: private:
typedef imagein::Image::depth_t depth_t; typedef imagein::Image::depth_t depth_t;
......
/*
* Copyright 2011-2012 INSA Rennes
*
* This file is part of EIImage.
*
* EIImage is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EIImage is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EIImage. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOOLS_H
#define TOOLS_H
namespace Tools {
inline QString tr(const char* str) { return QCoreApplication::tr(str); }
inline QString colorName(int i, int n) {
if((n==1 || n==2) && i==0) return tr("Black");
if((n==2 && i==1) || (n==4 && i==3)) return tr("Alpha");
switch(i) { case 0: return tr("Red"); case 1: return tr("Green"); case 2: return tr("Blue"); default: return tr("Color"); }
}
}
#endif // TOOLS_H
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