--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

@ -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

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

View File

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

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

@ -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

@ -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

@ -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;