--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);
qCDebug(vApp)<<"New process with arguments. program ="<<run;
if(QProcess::startDetached(run))
if (QProcess::startDetached(run))
{
qCDebug(vApp)<<"The process was started successfully.";
}
@ -2231,7 +2231,7 @@ void VApplication::GatherLogs() const
void VApplication::DrMingw()
{
QFile drmingw("exchndl.dll");
if(drmingw.exists())
if (drmingw.exists())
{// If don't want create reports just delete exchndl.dll from installer
LoadLibrary(L"exchndl.dll");
}

View File

@ -33,39 +33,40 @@
#include <QLocale>
#include <QApplication>
const QString VSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
const QString VSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
const QString VSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
const QString VSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state");
const QString VSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale");
const QString VSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit");
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
const QString VSettings::SettingConfigurationConfirmItemDeletion = QStringLiteral("configuration/confirm_item_deletion");
const QString VSettings::SettingConfigurationOsSeparator = QStringLiteral("configuration/osSeparator");
const QString VSettings::SettingConfigurationAutosaveState = QStringLiteral("configuration/autosave/state");
const QString VSettings::SettingConfigurationAutosaveTime = QStringLiteral("configuration/autosave/time");
const QString VSettings::SettingConfigurationSendReportState = QStringLiteral("configuration/send_report/state");
const QString VSettings::SettingConfigurationLocale = QStringLiteral("configuration/locale");
const QString VSettings::SettingConfigurationUnit = QStringLiteral("configuration/unit");
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
const QString VSettings::SettingConfigurationConfirmItemDeletion
= QStringLiteral("configuration/confirm_item_deletion");
const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString VSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
const QString VSettings::SettingPathsPattern = QStringLiteral("paths/pattern");
const QString VSettings::SettingPathsLayout = QStringLiteral("paths/layout");
const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString VSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
const QString VSettings::SettingPathsPattern = QStringLiteral("paths/pattern");
const QString VSettings::SettingPathsLayout = QStringLiteral("paths/layout");
const QString VSettings::SettingPatternUser = QStringLiteral("pattern/user");
const QString VSettings::SettingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
const QString VSettings::SettingPatternUndo = QStringLiteral("pattern/undo");
const QString VSettings::SettingPatternUser = QStringLiteral("pattern/user");
const QString VSettings::SettingPatternGraphicalOutput = QStringLiteral("pattern/graphicalOutput");
const QString VSettings::SettingPatternUndo = QStringLiteral("pattern/undo");
const QString VSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString VSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString VSettings::SettingGeneralGeometry = QStringLiteral("geometry");
const QString VSettings::SettingGeneralWindowState = QStringLiteral("windowState");
const QString VSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString VSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString VSettings::SettingGeneralGeometry = QStringLiteral("geometry");
const QString VSettings::SettingGeneralWindowState = QStringLiteral("windowState");
const QString VSettings::SettingCommunityServer = QStringLiteral("community/server");
const QString VSettings::SettingCommunityServerSecure = QStringLiteral("community/serverSecure");
const QString VSettings::SettingCommunityUseProxy = QStringLiteral("community/useProxy");
const QString VSettings::SettingCommunityProxyAddress = QStringLiteral("community/proxyAddress");
const QString VSettings::SettingCommunityProxyPort = QStringLiteral("community/proxyPort");
const QString VSettings::SettingCommunityProxyUser = QStringLiteral("community/proxyUser");
const QString VSettings::SettingCommunityProxyPass = QStringLiteral("community/proxyPass");
const QString VSettings::SettingCommunityUsername = QStringLiteral("community/username");
const QString VSettings::SettingCommunitySavePassword = QStringLiteral("community/savePassword");
const QString VSettings::SettingCommunityUserPassword = QStringLiteral("community/userpassword");
const QString VSettings::SettingCommunityServer = QStringLiteral("community/server");
const QString VSettings::SettingCommunityServerSecure = QStringLiteral("community/serverSecure");
const QString VSettings::SettingCommunityUseProxy = QStringLiteral("community/useProxy");
const QString VSettings::SettingCommunityProxyAddress = QStringLiteral("community/proxyAddress");
const QString VSettings::SettingCommunityProxyPort = QStringLiteral("community/proxyPort");
const QString VSettings::SettingCommunityProxyUser = QStringLiteral("community/proxyUser");
const QString VSettings::SettingCommunityProxyPass = QStringLiteral("community/proxyPass");
const QString VSettings::SettingCommunityUsername = QStringLiteral("community/username");
const QString VSettings::SettingCommunitySavePassword = QStringLiteral("community/savePassword");
const QString VSettings::SettingCommunityUserPassword = QStringLiteral("community/userpassword");
//---------------------------------------------------------------------------------------------------------------------
VSettings::VSettings(Format format, Scope scope, const QString &organization, const QString &application,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -748,7 +748,7 @@ void VSpline::SetKcurve(qreal factor)
//---------------------------------------------------------------------------------------------------------------------
int VSpline::Sign(long double ld) const
{
if(qAbs(ld)<0.00000000001)
if (qAbs(ld)<0.00000000001)
{
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().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
}

View File

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

View File

@ -56,7 +56,7 @@
TableWindow::TableWindow(QWidget *parent)
:QMainWindow(parent), ui(new Ui::TableWindow),
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)
{
ui->setupUi(this);

View File

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

View File

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

View File

@ -52,9 +52,13 @@ QString compilerString()
return QLatin1String("GCC " ) + QLatin1String(__VERSION__);
#elif defined(Q_CC_MSVC)
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
{
return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
}
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));
}
#endif
return QLatin1String("<unknown compiler>");
}

View File

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

View File

@ -275,7 +275,7 @@ private:
}
// 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
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 |= noEND ;
m_iSynFlags |= noEND;
}
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> p = points;
for(int i = 0; i < p.size(); i++)
for (int i = 0; i < p.size(); 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;
}
else
{
QPointF temp = p.at(j);
if(current == temp)
if (current == temp)
{
QVector<QPointF>::iterator iter = p.begin() + j;
p.erase(iter);

View File

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

View File

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

View File

@ -284,7 +284,7 @@ qint64 VLayoutDetail::Square() const
QVector<qreal> x;
QVector<qreal> y;
for(int i=0; i < n; ++i)
for (int i=0; i < n; ++i)
{
x.append(d->layoutAllowence.at(i).x());
y.append(d->layoutAllowence.at(i).y());
@ -356,7 +356,7 @@ QVector<QPointF> VLayoutDetail::Map(const QVector<QPointF> &points) const
if (d->mirror)
{
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));
}

View File

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

View File

@ -48,7 +48,7 @@ VObjEngine::VObjEngine()
:QPaintEngine(svgEngineFeatures()), stream(nullptr), globalPointsCount(0), outputDevice(nullptr), planeCount(0),
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].y = 0;
@ -137,9 +137,9 @@ void VObjEngine::drawPath(const QPainterPath &path)
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].y = polygon.at(i).y();
@ -150,10 +150,10 @@ void VObjEngine::drawPath(const QPainterPath &path)
int offset = 0;
delaunay2d_t *res = delaunay2d_from(points, num_points);//Calculate faces
QPointF pf[MAX_POINTS];
QPointF pf[MAX_POINTS];
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)
{
@ -165,7 +165,7 @@ void VObjEngine::drawPath(const QPainterPath &path)
}
int num_verts = res->faces[offset];
offset++;
for( int j = 0; j < num_verts; j++ )
for ( int j = 0; j < num_verts; j++ )
{
int p0 = res->faces[offset + j];
pf[j] = QPointF(points[p0].x, points[p0].y);
@ -173,13 +173,13 @@ void VObjEngine::drawPath(const QPainterPath &path)
if (skipFace == false )
{
QPolygonF face;
for( int i = 0; i < num_verts; i++ )
for ( int i = 0; i < num_verts; i++ )
{
face << QPointF(pf[i]);
}
QPolygonF united = polygon.united(face);
qint64 sqUnited = Square(united);
if(sqUnited <= sq)
if (sqUnited <= sq)
{// This face incide our base polygon.
drawPolygon(pf, num_verts, QPaintEngine::OddEvenMode);
}
@ -289,7 +289,7 @@ QPolygonF VObjEngine::MakePointsUnique(const QPolygonF &polygon) const
{
QVector<QPointF> set;
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)
{
@ -310,7 +310,7 @@ qint64 VObjEngine::Square(const QPolygonF &poly) const
qreal s, res = 0;
qint64 sq = 0;
for(int i=0; i < n; i++)
for (int i=0; i < n; i++)
{
x.append(poly.at(i).x());
y.append(poly.at(i).y());

View File

@ -34,13 +34,13 @@
class QTextStream;
#define MAX_POINTS 512
#define MAX_POINTS 512
class VObjEngine : public QPaintEngine
{
public:
VObjEngine();
virtual ~VObjEngine();
virtual ~VObjEngine();
virtual bool begin(QPaintDevice *pdev);
virtual bool end();
@ -67,7 +67,7 @@ private:
QTextStream *stream;
unsigned int globalPointsCount;
QIODevice *outputDevice;
del_point2d_t points[MAX_POINTS];
del_point2d_t points[MAX_POINTS];
unsigned int planeCount;
QSize size;
int resolution;

View File

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

View File

@ -55,7 +55,7 @@ public:
void setResolution(int dpi);
protected:
virtual int metric(PaintDeviceMetric metric) const;
virtual int metric(PaintDeviceMetric metric) const;
private:
Q_DISABLE_COPY(VObjPaintDevice)
VObjEngine *engine;

View File

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

View File

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