--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2015-03-02 19:11:43 +02:00
parent 364ae3f82c
commit 22055ab684
28 changed files with 130 additions and 96 deletions

View File

@ -217,7 +217,7 @@ void VApplication::NewValentina(const QString &fileName)
{ {
const QString run = QString("\"%1\" \"%2\"").arg(qApp->applicationFilePath()).arg(fileName); const QString run = QString("\"%1\" \"%2\"").arg(qApp->applicationFilePath()).arg(fileName);
qCDebug(vApp)<<"New process with arguments. program ="<<run; qCDebug(vApp)<<"New process with arguments. program ="<<run;
if(QProcess::startDetached(run)) if (QProcess::startDetached(run))
{ {
qCDebug(vApp)<<"The process was started successfully."; qCDebug(vApp)<<"The process was started successfully.";
} }
@ -2231,7 +2231,7 @@ void VApplication::GatherLogs() const
void VApplication::DrMingw() void VApplication::DrMingw()
{ {
QFile drmingw("exchndl.dll"); QFile drmingw("exchndl.dll");
if(drmingw.exists()) if (drmingw.exists())
{// If don't want create reports just delete exchndl.dll from installer {// If don't want create reports just delete exchndl.dll from installer
LoadLibrary(L"exchndl.dll"); LoadLibrary(L"exchndl.dll");
} }

View File

@ -40,7 +40,8 @@ const QString VSettings::SettingConfigurationSendReportState = QStringLit
const QString VSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale"); const QString VSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale");
const QString VSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit"); const QString VSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit");
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language"); const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
const QString VSettings::SettingConfigurationConfirmItemDeletion = QStringLiteral("configuration/confirm_item_deletion"); const QString VSettings::SettingConfigurationConfirmItemDeletion
= QStringLiteral("configuration/confirm_item_deletion");
const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements"); const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString VSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements"); const QString VSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");

View File

@ -85,7 +85,7 @@ void PathPage::DefaultPath()
QTableWidgetItem *item = pathTable->item(row, 1); QTableWidgetItem *item = pathTable->item(row, 1);
SCASSERT(item != nullptr); SCASSERT(item != nullptr);
switch(row) switch (row)
{ {
case 1: // standard measurements case 1: // standard measurements
item->setText(VSettings::StandardTablesPath()); item->setText(VSettings::StandardTablesPath());
@ -110,7 +110,7 @@ void PathPage::EditPath()
SCASSERT(item != nullptr); SCASSERT(item != nullptr);
QString path; QString path;
switch(row) switch (row)
{ {
case 0: // individual measurements case 0: // individual measurements
path = qApp->getSettings()->GetPathIndividualMeasurements(); path = qApp->getSettings()->GetPathIndividualMeasurements();

View File

@ -75,7 +75,7 @@ void DialogLayoutProgress::Arranged(int count)
void DialogLayoutProgress::Error(const LayoutErrors &state) void DialogLayoutProgress::Error(const LayoutErrors &state)
{ {
QString text; QString text;
switch(state) switch (state)
{ {
case LayoutErrors::NoError: case LayoutErrors::NoError:
return; return;

View File

@ -323,7 +323,7 @@ QSizeF DialogLayoutSettings::Template()
qreal width = 0; qreal width = 0;
qreal height = 0; qreal height = 0;
switch(temp) switch (temp)
{ {
case PaperSizeTemplate::A0: case PaperSizeTemplate::A0:
width = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit); width = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
@ -366,7 +366,7 @@ Unit DialogLayoutSettings::LayoutUnit() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::CorrectPaperDecimals() void DialogLayoutSettings::CorrectPaperDecimals()
{ {
switch(oldPaperUnit) switch (oldPaperUnit)
{ {
case Unit::Cm: case Unit::Cm:
case Unit::Mm: case Unit::Mm:
@ -389,7 +389,7 @@ void DialogLayoutSettings::CorrectPaperDecimals()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogLayoutSettings::CorrectLayoutDecimals() void DialogLayoutSettings::CorrectLayoutDecimals()
{ {
switch(oldLayoutUnit) switch (oldLayoutUnit)
{ {
case Unit::Cm: case Unit::Cm:
case Unit::Mm: case Unit::Mm:

View File

@ -31,8 +31,9 @@
#include "dialogtool.h" #include "dialogtool.h"
namespace Ui { namespace Ui
class DialogCurveIntersectAxis; {
class DialogCurveIntersectAxis;
} }
class VisToolCurveIntersectAxis; class VisToolCurveIntersectAxis;

View File

@ -31,8 +31,9 @@
#include "dialogtool.h" #include "dialogtool.h"
namespace Ui { namespace Ui
class DialogLineIntersectAxis; {
class DialogLineIntersectAxis;
} }
class VisToolLineIntersectAxis; class VisToolLineIntersectAxis;

View File

@ -748,7 +748,7 @@ void VSpline::SetKcurve(qreal factor)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
int VSpline::Sign(long double ld) const int VSpline::Sign(long double ld) const
{ {
if(qAbs(ld)<0.00000000001) if (qAbs(ld)<0.00000000001)
{ {
return 0; return 0;
} }
@ -844,7 +844,7 @@ qreal VSpline::ParamT (const QPointF &pBt) const
ts += CalcT (GetP1().toQPointF().x(), d->p2.x(), d->p3.x(), GetP4().toQPointF().x(), pBt.x()); ts += CalcT (GetP1().toQPointF().x(), d->p2.x(), d->p3.x(), GetP4().toQPointF().x(), pBt.x());
ts += CalcT (GetP1().toQPointF().y(), d->p2.y(), d->p3.y(), GetP4().toQPointF().y(), pBt.y()); ts += CalcT (GetP1().toQPointF().y(), d->p2.y(), d->p3.y(), GetP4().toQPointF().y(), pBt.y());
if(ts.isEmpty()) if (ts.isEmpty())
{ {
return -1; // We don't have candidates return -1; // We don't have candidates
} }

View File

@ -71,10 +71,10 @@ Q_LOGGING_CATEGORY(vMainWindow, "v.mainwindow")
* @param parent parent widget. * @param parent parent widget.
*/ */
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), currentTool(Tool::Arrow), lastUsedTool(Tool::Arrow), :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), currentTool(Tool::Arrow),
currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), lastUsedTool(Tool::Arrow), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr),
isInitialized(false), dialogTable(nullptr), dialogTool(nullptr), dialogHistory(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), dialogTable(nullptr), dialogTool(nullptr),
comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), dialogHistory(nullptr), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
currentToolBoxIndex(0), drawMode(true), recentFileActs(), currentToolBoxIndex(0), drawMode(true), recentFileActs(),
separatorAct(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr), separatorAct(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr),
gradationSizes(nullptr), toolOptions(nullptr), lock(nullptr) gradationSizes(nullptr), toolOptions(nullptr), lock(nullptr)
@ -2201,7 +2201,9 @@ void MainWindow::CreateMenus()
void MainWindow::LastUsedTool() void MainWindow::LastUsedTool()
{ {
if (currentTool == lastUsedTool) if (currentTool == lastUsedTool)
{
return; return;
}
switch ( lastUsedTool ) switch ( lastUsedTool )
{ {

View File

@ -56,7 +56,7 @@
TableWindow::TableWindow(QWidget *parent) TableWindow::TableWindow(QWidget *parent)
:QMainWindow(parent), ui(new Ui::TableWindow), :QMainWindow(parent), ui(new Ui::TableWindow),
listDetails(QVector<VLayoutDetail>()), papers(QList<QGraphicsItem *>()), shadows(QList<QGraphicsItem *>()), listDetails(QVector<VLayoutDetail>()), papers(QList<QGraphicsItem *>()), shadows(QList<QGraphicsItem *>()),
scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()),fileName(QString()), scenes(QList<QGraphicsScene *>()), details(QList<QList<QGraphicsItem *> >()), fileName(QString()),
description(QString()), tempScene(nullptr) description(QString()), tempScene(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);

View File

@ -39,8 +39,9 @@ class VToolLinePoint : public VToolPoint
{ {
Q_OBJECT Q_OBJECT
public: public:
VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &lineColor, const QString &formula, VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const
const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = nullptr); QString &lineColor, const QString &formula, const quint32 &basePointId, const qreal &angle,
QGraphicsItem * parent = nullptr);
virtual ~VToolLinePoint(); virtual ~VToolLinePoint();
virtual int type() const {return Type;} virtual int type() const {return Type;}
enum { Type = UserType + static_cast<int>(Tool::LinePoint)}; enum { Type = UserType + static_cast<int>(Tool::LinePoint)};

View File

@ -173,10 +173,10 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
* @return the created tool * @return the created tool
*/ */
VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line, VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line,
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine, const QString &lineColor, const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
const QString &pointName, const qreal &mx, const qreal &my, const QString &lineColor, const QString &pointName, const qreal &mx,
VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const qreal &my, VMainGraphicsScene *scene, VPattern *doc,
const Document &parse, const Source &typeCreation) VContainer *data, const Document &parse, const Source &typeCreation)
{ {
const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(p1Line); const QSharedPointer<VPointF> firstPoint = data->GeometricObject<VPointF>(p1Line);
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(p2Line); const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(p2Line);

View File

@ -185,7 +185,7 @@ int VAbstractTool::ConfirmDeletion()
msgBox.setText(tr("Do you really want to delete?")); msgBox.setText(tr("Do you really want to delete?"));
msgBox.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No); msgBox.setStandardButtons(QDialogButtonBox::Yes | QDialogButtonBox::No);
msgBox.setDefaultButton(QDialogButtonBox::No); msgBox.setDefaultButton(QDialogButtonBox::No);
msgBox.setIconPixmap(qApp->style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32,32) ); msgBox.setIconPixmap(qApp->style()->standardIcon(QStyle::SP_MessageBoxQuestion).pixmap(32, 32) );
int dialogResult = msgBox.exec(); int dialogResult = msgBox.exec();

View File

@ -52,9 +52,13 @@ QString compilerString()
return QLatin1String("GCC " ) + QLatin1String(__VERSION__); return QLatin1String("GCC " ) + QLatin1String(__VERSION__);
#elif defined(Q_CC_MSVC) #elif defined(Q_CC_MSVC)
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle) if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
{
return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13)); return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
}
if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle) if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
{
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15)); return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
}
#endif #endif
return QLatin1String("<unknown compiler>"); return QLatin1String("<unknown compiler>");
} }

View File

@ -84,7 +84,7 @@ QString VPatternConverter::XSDSchema(int ver) const
{ {
CheckVersion(ver); CheckVersion(ver);
switch(ver) switch (ver)
{ {
case (0x000100): case (0x000100):
return QStringLiteral("://schema/pattern/v0.1.0.xsd"); return QStringLiteral("://schema/pattern/v0.1.0.xsd");
@ -107,7 +107,7 @@ void VPatternConverter::ApplyPatches()
{ {
try try
{ {
switch(ver) switch (ver)
{ {
case (0x000100): case (0x000100):
{ {

View File

@ -275,7 +275,7 @@ private:
} }
// Custom value recognition // Custom value recognition
static int IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal , const std::locale &s_locale); static int IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const std::locale &s_locale);
// cppcheck-suppress functionStatic // cppcheck-suppress functionStatic
int TestNames(); int TestNames();

View File

@ -412,7 +412,7 @@ bool QmuParserTokenReader::IsBuiltIn ( token_type &a_Tok )
} }
m_iSynFlags = noBC | noOPT | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE; m_iSynFlags = noBC | noOPT | noARG_SEP | noPOSTOP | noASSIGN | noIF | noELSE;
m_iSynFlags |= noEND ; m_iSynFlags |= noEND;
} }
else if (i == cmBO) else if (i == cmBO)
{ {

View File

@ -226,20 +226,20 @@ QVector<QPointF> VAbstractDetail::Equidistant(const QVector<QPointF> &points, co
QVector<QPointF> VAbstractDetail::RemoveDublicates(const QVector<QPointF> &points) QVector<QPointF> VAbstractDetail::RemoveDublicates(const QVector<QPointF> &points)
{ {
QVector<QPointF> p = points; QVector<QPointF> p = points;
for(int i = 0; i < p.size(); i++) for (int i = 0; i < p.size(); i++)
{ {
QPointF current = p.at(i); QPointF current = p.at(i);
for(int j = i; j < p.size(); j++) for (int j = i; j < p.size(); j++)
{ {
if(j == i) if (j == i)
{ {
continue; continue;
} }
else else
{ {
QPointF temp = p.at(j); QPointF temp = p.at(j);
if(current == temp) if (current == temp)
{ {
QVector<QPointF>::iterator iter = p.begin() + j; QVector<QPointF>::iterator iter = p.begin() + j;
p.erase(iter); p.erase(iter);

View File

@ -80,7 +80,7 @@ int VBank::GetTiket()
} }
} }
switch(caseType) switch (caseType)
{ {
case Cases::CaseThreeGroup: case Cases::CaseThreeGroup:
return GetNextThreeGroups(); return GetNextThreeGroups();
@ -260,7 +260,7 @@ int VBank::ArrangedCount() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VBank::PrepareGroup() void VBank::PrepareGroup()
{ {
switch(caseType) switch (caseType)
{ {
case Cases::CaseThreeGroup: case Cases::CaseThreeGroup:
PrepareThreeGroups(); PrepareThreeGroups();

View File

@ -143,7 +143,7 @@ QVector<QPointF> VContour::UniteWithContour(const VLayoutDetail &detail, int glo
} }
int i=0; int i=0;
while(i < d->globalContour.count()) while (i < d->globalContour.count())
{ {
if (i == i2) if (i == i2)
{ {

View File

@ -284,7 +284,7 @@ qint64 VLayoutDetail::Square() const
QVector<qreal> x; QVector<qreal> x;
QVector<qreal> y; QVector<qreal> y;
for(int i=0; i < n; ++i) for (int i=0; i < n; ++i)
{ {
x.append(d->layoutAllowence.at(i).x()); x.append(d->layoutAllowence.at(i).x());
y.append(d->layoutAllowence.at(i).y()); y.append(d->layoutAllowence.at(i).y());
@ -356,7 +356,7 @@ QVector<QPointF> VLayoutDetail::Map(const QVector<QPointF> &points) const
if (d->mirror) if (d->mirror)
{ {
QList<QPointF> list = p.toList(); QList<QPointF> list = p.toList();
for(int k=0, s=list.size(), max=(s/2); k<max; k++) for (int k=0, s=list.size(), max=(s/2); k<max; k++)
{ {
list.swap(k, s-(1+k)); list.swap(k, s-(1+k));
} }

View File

@ -360,7 +360,7 @@ VPosition::CrossingType VPosition::Crossing(const VLayoutDetail &detail, const i
return CrossingType::EdgeError; return CrossingType::EdgeError;
} }
for(int i = 1; i <= globalEdgesCount; i++) for (int i = 1; i <= globalEdgesCount; i++)
{ {
const QLineF globalEdge = gContour.GlobalEdge(i); const QLineF globalEdge = gContour.GlobalEdge(i);
if (globalEdge.isNull()) // Got null edge if (globalEdge.isNull()) // Got null edge
@ -368,7 +368,7 @@ VPosition::CrossingType VPosition::Crossing(const VLayoutDetail &detail, const i
return CrossingType::EdgeError; return CrossingType::EdgeError;
} }
for(int j = 1; j <= detailEdgesCount; j++) for (int j = 1; j <= detailEdgesCount; j++)
{ {
if (i == globalI && j == detailI) if (i == globalI && j == detailI)
{ {
@ -416,7 +416,7 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons
if (gContour.GetContour().isEmpty()) if (gContour.GetContour().isEmpty())
{ {
const QLineF globalEdge = gContour.GlobalEdge(1); const QLineF globalEdge = gContour.GlobalEdge(1);
for(int i = 0; i < lPoints.count(); i++) for (int i = 0; i < lPoints.count(); i++)
{ {
if (CheckSide(globalEdge, lPoints.at(i)) < 0) if (CheckSide(globalEdge, lPoints.at(i)) < 0)
{ {
@ -432,13 +432,13 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons
QVector<qreal> constant; QVector<qreal> constant;
QVector<qreal> multiple; QVector<qreal> multiple;
for(int i=0; i<polyCorners; i++) for (int i=0; i<polyCorners; i++)
{ {
const qreal xi = gContour.at(i).x(); const qreal xi = gContour.at(i).x();
const qreal xj = gContour.at(j).x(); const qreal xj = gContour.at(j).x();
const qreal yi = gContour.at(i).y(); const qreal yi = gContour.at(i).y();
const qreal yj = gContour.at(j).y(); const qreal yj = gContour.at(j).y();
if(qFuzzyCompare(yj, yi)) if (qFuzzyCompare(yj, yi))
{ {
constant.insert(i, xi); constant.insert(i, xi);
multiple.insert(i, 0); multiple.insert(i, 0);
@ -452,7 +452,7 @@ VPosition::InsideType VPosition::InsideContour(const VLayoutDetail &detail, cons
j=i; j=i;
} }
for(int m = 1; m <= detail.EdgesCount(); ++m) for (int m = 1; m <= detail.EdgesCount(); ++m)
{ {
if (m == detailI) if (m == detailI)
{ {

View File

@ -48,7 +48,7 @@ VObjEngine::VObjEngine()
:QPaintEngine(svgEngineFeatures()), stream(nullptr), globalPointsCount(0), outputDevice(nullptr), planeCount(0), :QPaintEngine(svgEngineFeatures()), stream(nullptr), globalPointsCount(0), outputDevice(nullptr), planeCount(0),
size(), resolution(96), matrix() size(), resolution(96), matrix()
{ {
for(int i=0; i < MAX_POINTS; i++) for (int i=0; i < MAX_POINTS; i++)
{ {
points[i].x = 0; points[i].x = 0;
points[i].y = 0; points[i].y = 0;
@ -137,9 +137,9 @@ void VObjEngine::drawPath(const QPainterPath &path)
unsigned int num_points = 0; unsigned int num_points = 0;
for(int i=0; i < polygon.count(); i++) for (int i=0; i < polygon.count(); i++)
{ {
if( num_points < MAX_POINTS ) if ( num_points < MAX_POINTS )
{ {
points[num_points].x = polygon.at(i).x(); points[num_points].x = polygon.at(i).x();
points[num_points].y = polygon.at(i).y(); points[num_points].y = polygon.at(i).y();
@ -153,7 +153,7 @@ void VObjEngine::drawPath(const QPainterPath &path)
QPointF pf[MAX_POINTS]; QPointF pf[MAX_POINTS];
bool skipFace=false;//Need skip first face bool skipFace=false;//Need skip first face
for(unsigned int i = 0; i < res->num_faces; i++ ) for (unsigned int i = 0; i < res->num_faces; i++ )
{ {
if (offset == 0) if (offset == 0)
{ {
@ -165,7 +165,7 @@ void VObjEngine::drawPath(const QPainterPath &path)
} }
int num_verts = res->faces[offset]; int num_verts = res->faces[offset];
offset++; offset++;
for( int j = 0; j < num_verts; j++ ) for ( int j = 0; j < num_verts; j++ )
{ {
int p0 = res->faces[offset + j]; int p0 = res->faces[offset + j];
pf[j] = QPointF(points[p0].x, points[p0].y); pf[j] = QPointF(points[p0].x, points[p0].y);
@ -173,13 +173,13 @@ void VObjEngine::drawPath(const QPainterPath &path)
if (skipFace == false ) if (skipFace == false )
{ {
QPolygonF face; QPolygonF face;
for( int i = 0; i < num_verts; i++ ) for ( int i = 0; i < num_verts; i++ )
{ {
face << QPointF(pf[i]); face << QPointF(pf[i]);
} }
QPolygonF united = polygon.united(face); QPolygonF united = polygon.united(face);
qint64 sqUnited = Square(united); qint64 sqUnited = Square(united);
if(sqUnited <= sq) if (sqUnited <= sq)
{// This face incide our base polygon. {// This face incide our base polygon.
drawPolygon(pf, num_verts, QPaintEngine::OddEvenMode); drawPolygon(pf, num_verts, QPaintEngine::OddEvenMode);
} }
@ -289,7 +289,7 @@ QPolygonF VObjEngine::MakePointsUnique(const QPolygonF &polygon) const
{ {
QVector<QPointF> set; QVector<QPointF> set;
QPolygonF uniquePolygon; QPolygonF uniquePolygon;
for(int i=0; i < polygon.count(); i++) for (int i=0; i < polygon.count(); i++)
{ {
if (set.contains(polygon.at(i)) == false) if (set.contains(polygon.at(i)) == false)
{ {
@ -310,7 +310,7 @@ qint64 VObjEngine::Square(const QPolygonF &poly) const
qreal s, res = 0; qreal s, res = 0;
qint64 sq = 0; qint64 sq = 0;
for(int i=0; i < n; i++) for (int i=0; i < n; i++)
{ {
x.append(poly.at(i).x()); x.append(poly.at(i).x());
y.append(poly.at(i).y()); y.append(poly.at(i).y());

View File

@ -160,5 +160,3 @@ int VObjPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
} }
return 0; return 0;
} }

View File

@ -37,7 +37,8 @@
static const char kDoNotAskAgainKey[] = "DoNotAskAgain"; static const char kDoNotAskAgainKey[] = "DoNotAskAgain";
namespace Utils { namespace Utils
{
class CheckableMessageBoxPrivate class CheckableMessageBoxPrivate
{ {
@ -131,7 +132,9 @@ QAbstractButton *CheckableMessageBox::clickedButton() const
QDialogButtonBox::StandardButton CheckableMessageBox::clickedStandardButton() const QDialogButtonBox::StandardButton CheckableMessageBox::clickedStandardButton() const
{ {
if (d->clickedButton) if (d->clickedButton)
{
return d->buttonBox->standardButton(d->clickedButton); return d->buttonBox->standardButton(d->clickedButton);
}
return QDialogButtonBox::NoButton; return QDialogButtonBox::NoButton;
} }
@ -148,7 +151,9 @@ void CheckableMessageBox::setText(const QString &t)
QPixmap CheckableMessageBox::iconPixmap() const QPixmap CheckableMessageBox::iconPixmap() const
{ {
if (const QPixmap *p = d->pixmapLabel->pixmap()) if (const QPixmap *p = d->pixmapLabel->pixmap())
{
return QPixmap(*p); return QPixmap(*p);
}
return QPixmap(); return QPixmap();
} }
@ -212,14 +217,19 @@ QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
{ {
foreach (QAbstractButton *b, d->buttonBox->buttons()) foreach (QAbstractButton *b, d->buttonBox->buttons())
if (QPushButton *pb = qobject_cast<QPushButton *>(b)) if (QPushButton *pb = qobject_cast<QPushButton *>(b))
{
if (pb->isDefault()) if (pb->isDefault())
{
return d->buttonBox->standardButton(pb); return d->buttonBox->standardButton(pb);
}
}
return QDialogButtonBox::NoButton; return QDialogButtonBox::NoButton;
} }
void CheckableMessageBox::setDefaultButton(QDialogButtonBox::StandardButton s) void CheckableMessageBox::setDefaultButton(QDialogButtonBox::StandardButton s)
{ {
if (QPushButton *b = d->buttonBox->button(s)) { if (QPushButton *b = d->buttonBox->button(s))
{
b->setDefault(true); b->setDefault(true);
b->setFocus(); b->setFocus();
} }
@ -277,13 +287,16 @@ QMessageBox::StandardButton CheckableMessageBox::dialogButtonBoxToMessageBoxButt
bool askAgain(QSettings *settings, const QString &settingsSubKey) bool askAgain(QSettings *settings, const QString &settingsSubKey)
{ {
//QTC_CHECK(settings); //QTC_CHECK(settings);
if (settings) { if (settings)
{
settings->beginGroup(QLatin1String(kDoNotAskAgainKey)); settings->beginGroup(QLatin1String(kDoNotAskAgainKey));
bool shouldNotAsk = settings->value(settingsSubKey, false).toBool(); bool shouldNotAsk = settings->value(settingsSubKey, false).toBool();
settings->endGroup(); settings->endGroup();
if (shouldNotAsk) if (shouldNotAsk)
{
return false; return false;
} }
}
return true; return true;
} }
@ -310,7 +323,9 @@ void initDoNotAskAgainMessageBox(CheckableMessageBox &messageBox, const QString
void doNotAskAgain(QSettings *settings, const QString &settingsSubKey) void doNotAskAgain(QSettings *settings, const QString &settingsSubKey)
{ {
if (!settings) if (!settings)
{
return; return;
}
settings->beginGroup(QLatin1String(kDoNotAskAgainKey)); settings->beginGroup(QLatin1String(kDoNotAskAgainKey));
settings->setValue(settingsSubKey, true); settings->setValue(settingsSubKey, true);
@ -336,13 +351,17 @@ CheckableMessageBox::doNotAskAgainQuestion(QWidget *parent, const QString &title
{ {
if (!askAgain(settings, settingsSubKey)) if (!askAgain(settings, settingsSubKey))
{
return acceptButton; return acceptButton;
}
CheckableMessageBox messageBox(parent); CheckableMessageBox messageBox(parent);
initDoNotAskAgainMessageBox(messageBox, title, text, buttons, defaultButton, Question); initDoNotAskAgainMessageBox(messageBox, title, text, buttons, defaultButton, Question);
messageBox.exec(); messageBox.exec();
if (messageBox.isChecked() && (messageBox.clickedStandardButton() == acceptButton)) if (messageBox.isChecked() && (messageBox.clickedStandardButton() == acceptButton))
{
doNotAskAgain(settings, settingsSubKey); doNotAskAgain(settings, settingsSubKey);
}
return messageBox.clickedStandardButton(); return messageBox.clickedStandardButton();
} }
@ -364,13 +383,17 @@ CheckableMessageBox::doNotShowAgainInformation(QWidget *parent, const QString &t
{ {
if (!askAgain(settings, settingsSubKey)) if (!askAgain(settings, settingsSubKey))
{
return defaultButton; return defaultButton;
}
CheckableMessageBox messageBox(parent); CheckableMessageBox messageBox(parent);
initDoNotAskAgainMessageBox(messageBox, title, text, buttons, defaultButton, Information); initDoNotAskAgainMessageBox(messageBox, title, text, buttons, defaultButton, Information);
messageBox.exec(); messageBox.exec();
if (messageBox.isChecked()) if (messageBox.isChecked())
{
doNotAskAgain(settings, settingsSubKey); doNotAskAgain(settings, settingsSubKey);
}
return messageBox.clickedStandardButton(); return messageBox.clickedStandardButton();
} }
@ -396,8 +419,10 @@ bool CheckableMessageBox::hasSuppressedQuestions(QSettings *settings)
//Q_ASSERT(settings, return false); //Q_ASSERT(settings, return false);
bool hasSuppressed = false; bool hasSuppressed = false;
settings->beginGroup(QLatin1String(kDoNotAskAgainKey)); settings->beginGroup(QLatin1String(kDoNotAskAgainKey));
foreach (const QString &subKey, settings->childKeys()) { foreach (const QString &subKey, settings->childKeys())
if (settings->value(subKey, false).toBool()) { {
if (settings->value(subKey, false).toBool())
{
hasSuppressed = true; hasSuppressed = true;
break; break;
} }

View File

@ -25,7 +25,8 @@ QT_BEGIN_NAMESPACE
class QSettings; class QSettings;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils { namespace Utils
{
class CheckableMessageBoxPrivate; class CheckableMessageBoxPrivate;