diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 4215d6185..9053b6acb 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -165,13 +165,8 @@ PyDoc_STRVAR(Console_doc, "FreeCAD Console\n" ); -Application::Application(ParameterManager * /*pcSysParamMngr*/, - ParameterManager * /*pcUserParamMngr*/, - std::map &mConfig) - ://_pcSysParamMngr(pcSysParamMngr), - //_pcUserParamMngr(pcUserParamMngr), - _mConfig(mConfig), - _pActiveDoc(0) +Application::Application(std::map &mConfig) + : _mConfig(mConfig), _pActiveDoc(0) { //_hApp = new ApplicationOCC; mpcPramManager["System parameter"] = _pcSysParamMngr; @@ -1277,7 +1272,7 @@ void Application::initApplication(void) // creating the application if (!(mConfig["Verbose"] == "Strict")) Console().Log("Create Application\n"); - Application::_pcSingleton = new Application(0,0,mConfig); + Application::_pcSingleton = new Application(mConfig); // set up Unit system default ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath diff --git a/src/App/Application.h b/src/App/Application.h index 1fee610b4..2be65a6e9 100644 --- a/src/App/Application.h +++ b/src/App/Application.h @@ -273,7 +273,7 @@ protected: private: /// Constructor - Application(ParameterManager *pcSysParamMngr, ParameterManager *pcUserParamMngr,std::map &mConfig); + Application(std::map &mConfig); /// Destructor virtual ~Application(); diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index da7a9a9f4..9dac5cd12 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -589,7 +589,7 @@ void BitmapFactoryInst::convert(const QImage& p, SoSFImage& img) const size[0] = p.width(); size[1] = p.height(); - int buffersize = p.numBytes(); + int buffersize = p.byteCount(); int numcomponents = 0; QVector table = p.colorTable(); if (!table.isEmpty()) { diff --git a/src/Gui/CommandTest.cpp b/src/Gui/CommandTest.cpp index 3f4cc9b1e..243eac15e 100644 --- a/src/Gui/CommandTest.cpp +++ b/src/Gui/CommandTest.cpp @@ -27,6 +27,7 @@ # include # include # include +# include # include # include # include @@ -294,10 +295,10 @@ CmdTestProgress1::CmdTestProgress1() void CmdTestProgress1::activated(int iMsg) { + QMutex mutex; + QMutexLocker ml(&mutex); try { - QMutex mutex; - mutex.lock(); unsigned long steps = 1000; Base::SequencerLauncher seq("Starting progress bar", steps); @@ -306,8 +307,6 @@ void CmdTestProgress1::activated(int iMsg) seq.next(true); QWaitCondition().wait(&mutex, 30); } - - mutex.unlock(); } catch (...) { @@ -337,10 +336,11 @@ CmdTestProgress2::CmdTestProgress2() void CmdTestProgress2::activated(int iMsg) { + QMutex mutex; + QMutexLocker ml(&mutex); + try { - QMutex mutex; - mutex.lock(); unsigned long steps = 1000; Base::SequencerLauncher seq("Starting progress bar", steps); @@ -378,11 +378,12 @@ CmdTestProgress3::CmdTestProgress3() void CmdTestProgress3::activated(int iMsg) { + QMutex mutex; + QMutexLocker ml(&mutex); + try { // level 1 - QMutex mutex; - mutex.lock(); unsigned long steps = 5; Base::SequencerLauncher seq1("Starting progress bar", steps); for (unsigned long i=0; isteps;i++) @@ -519,7 +522,6 @@ public: seq.next(true); QWaitCondition().wait(&mutex, 5); } - mutex.unlock(); } catch (...) { @@ -662,27 +664,23 @@ public: } virtual void Warning(const char * msg) { - mutex.lock(); + QMutexLocker ml(&mutex); matchWrn += strcmp(msg, "Write a warning to the console output.\n"); - mutex.unlock(); } virtual void Message(const char * msg) { - mutex.lock(); + QMutexLocker ml(&mutex); matchMsg += strcmp(msg, "Write a message to the console output.\n"); - mutex.unlock(); } virtual void Error(const char * msg) { - mutex.lock(); + QMutexLocker ml(&mutex); matchErr += strcmp(msg, "Write an error to the console output.\n"); - mutex.unlock(); } virtual void Log(const char * msg) { - mutex.lock(); + QMutexLocker ml(&mutex); matchLog += strcmp(msg, "Write a log to the console output.\n"); - mutex.unlock(); } }; diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 6914bae4a..ea7f85f24 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -265,10 +265,9 @@ void DlgParameterImp::onChangeParameterSet(int index) hGrp = hGrp->GetGroup("ParameterEditor"); QString path = QString::fromUtf8(hGrp->GetASCII("LastParameterGroup").c_str()); QStringList paths = path.split(QLatin1String("."), QString::SkipEmptyParts); - if (paths.empty()) - return; + QTreeWidgetItem* parent = 0; - for (int index=0; index < paramGroup->topLevelItemCount(); index++) { + for (int index=0; index < paramGroup->topLevelItemCount() && !paths.empty(); index++) { QTreeWidgetItem* child = paramGroup->topLevelItem(index); if (child->text(0) == paths.front()) { paths.pop_front(); diff --git a/src/Gui/Icons/freecad-doc.png b/src/Gui/Icons/freecad-doc.png index 75c7d5675..be7b5df6f 100644 Binary files a/src/Gui/Icons/freecad-doc.png and b/src/Gui/Icons/freecad-doc.png differ diff --git a/src/Gui/Icons/freecad-icon-16.png b/src/Gui/Icons/freecad-icon-16.png index 188653a47..0b250268b 100644 Binary files a/src/Gui/Icons/freecad-icon-16.png and b/src/Gui/Icons/freecad-icon-16.png differ diff --git a/src/Gui/Icons/freecad-icon-32.png b/src/Gui/Icons/freecad-icon-32.png index 7ddae937d..26ee81ab9 100644 Binary files a/src/Gui/Icons/freecad-icon-32.png and b/src/Gui/Icons/freecad-icon-32.png differ diff --git a/src/Gui/Icons/freecad-icon-48.png b/src/Gui/Icons/freecad-icon-48.png index 66eb0320f..253638adf 100644 Binary files a/src/Gui/Icons/freecad-icon-48.png and b/src/Gui/Icons/freecad-icon-48.png differ diff --git a/src/Gui/Icons/freecad-icon-64.png b/src/Gui/Icons/freecad-icon-64.png index 227f83edf..13674de03 100644 Binary files a/src/Gui/Icons/freecad-icon-64.png and b/src/Gui/Icons/freecad-icon-64.png differ diff --git a/src/Gui/Icons/freecad.svg b/src/Gui/Icons/freecad.svg index 79d5776a2..28d7e0e82 100644 --- a/src/Gui/Icons/freecad.svg +++ b/src/Gui/Icons/freecad.svg @@ -1,5 +1,6 @@ + + inkscape:version="0.91 r13725" + sodipodi:docname="freecad.svg" + inkscape:output_extension="org.inkscape.output.svg.inkscape" + version="1.1"> - - + + + + + + + + + + + + inkscape:window-y="0" + inkscape:window-maximized="1" /> @@ -104,19 +136,24 @@ inkscape:label="Layer 1" inkscape:groupmode="layer"> - - + inkscape:label="Layer 1" + id="layer1-4" + transform="translate(-6e-6,-0.36363683)"> + + + + - - diff --git a/src/Gui/Icons/freecad.xpm b/src/Gui/Icons/freecad.xpm index 9b846a06f..491df9aa9 100644 --- a/src/Gui/Icons/freecad.xpm +++ b/src/Gui/Icons/freecad.xpm @@ -1,362 +1,52 @@ /* XPM */ static char * freecad_xpm[] = { -"32 32 327 2", -" c None", -". c #5D0900", -"+ c #AF0D00", -"@ c #AF1001", -"# c #AF1601", -"$ c #AF1A02", -"% c #AF2003", -"& c #AF2404", -"* c #AF2904", -"= c #AF2C05", -"- c #AF2F05", -"; c #AF3105", -"> c #370700", -", c #AD0C00", -"' c #FF1100", -") c #FF1A01", -"! c #FF2203", -"~ c #FF2B04", -"{ c #FF3305", -"] c #FF3B07", -"^ c #FF4308", -"/ c #FF4909", -"( c #FF4E0A", -"_ c #FF500A", -": c #FF4F0A", -"< c #FF4B09", -"[ c #FF4608", -"} c #470C01", -"| c #FF1300", -"1 c #FF1D02", -"2 c #FF2603", -"3 c #FF2E04", -"4 c #FF3706", -"5 c #FF3F07", -"6 c #FF4708", -"7 c #FF4D09", -"8 c #FF520A", -"9 c #FF530A", -"0 c #FF1601", -"a c #FF1F02", -"b c #FF2904", -"c c #FF3205", -"d c #FF3A06", -"e c #FF4A09", -"f c #FF510A", -"g c #FF560B", -"h c #FF570B", -"i c #FF540B", -"j c #FF4709", -"k c #FF1901", -"l c #FF3505", -"m c #FF3E07", -"n c #FF550B", -"o c #FF5A0C", -"p c #AD0E00", -"q c #FF1C01", -"r c #FF2503", -"s c #FF3806", -"t c #FF4107", -"u c #FF590B", -"v c #FF5E0C", -"w c #FF5D0C", -"x c #01043C", -"y c #0E2470", -"z c #040C4A", -"A c #AD0F00", -"B c #FF1E02", -"C c #FF2803", -"D c #FF3105", -"E c #EA3505", -"F c #701802", -"G c #7D1F03", -"H c #7D2304", -"I c #7D2504", -"J c #7D2604", -"K c #7D2103", -"L c #7D1D02", -"M c #310606", -"N c #091452", -"O c #2858B8", -"P c #1E47A1", -"Q c #040943", -"R c #AD1101", -"S c #FF2102", -"T c #FF2A04", -"U c #FF3405", -"V c #DC3306", -"W c #420B00", -"X c #070739", -"Y c #1D3881", -"Z c #3366C2", -"` c #2E60BD", -" . c #08114E", -".. c #01063F", -"+. c #000541", -"@. c #00053F", -"#. c #AD1201", -"$. c #FF2303", -"%. c #FF2D04", -"&. c #FF3606", -"*. c #DC3506", -"=. c #4E0F01", -"-. c #030943", -";. c #193380", -">. c #0C1754", -",. c #060D46", -"'. c #03063D", -"). c #3662B3", -"!. c #3D73CB", -"~. c #386BC6", -"{. c #224596", -"]. c #02053E", -"^. c #01043D", -"/. c #091B62", -"(. c #0A3197", -"_. c #012995", -":. c #AD1301", -"<. c #FF2F05", -"[. c #DC3707", -"}. c #0F2264", -"|. c #386CC6", -"1. c #4076CD", -"2. c #3A68B8", -"3. c #254186", -"4. c #4476C5", -"5. c #4C85D8", -"6. c #477ED3", -"7. c #2D5FBC", -"8. c #204AA6", -"9. c #1A47AC", -"0. c #0F3AA2", -"a. c #052B95", -"b. c #00043F", -"c. c #AD1501", -"d. c #FF2703", -"e. c #DC3807", -"f. c #4F1101", -"g. c #4F1201", -"h. c #430D04", -"i. c #070A41", -"j. c #396ABE", -"k. c #4981D5", -"l. c #518BDC", -"m. c #5793E1", -"n. c #5A95E3", -"o. c #5691E1", -"p. c #5089DB", -"q. c #3D72CA", -"r. c #3365C1", -"s. c #1E4BAF", -"t. c #123EA5", -"u. c #041B70", -"v. c #FA4308", -"w. c #E44509", -"x. c #E44C0A", -"y. c #E4540A", -"z. c #923206", -"A. c #190522", -"B. c #172A6A", -"C. c #4F88DA", -"D. c #5995E3", -"E. c #62A0EB", -"F. c #65A3ED", -"G. c #426DB2", -"H. c #1C306E", -"I. c #152562", -"J. c #1F3A81", -"K. c #3060B8", -"L. c #2A5BBA", -"M. c #1F4DB0", -"N. c #143FA6", -"O. c #01053F", -"P. c #AD1601", -"Q. c #FF3D07", -"R. c #FF5F0C", -"S. c #AD3D08", -"T. c #02053C", -"U. c #5089DA", -"V. c #5D99E6", -"W. c #68A6EF", -"X. c #243975", -"Y. c #091047", -"Z. c #040A42", -"`. c #21489F", -" + c #1F4EB0", -".+ c #041765", -"++ c #000238", -"@+ c #AD1702", -"#+ c #FD4608", -"$+ c #F24A09", -"%+ c #F2510A", -"&+ c #F2570B", -"*+ c #892D0D", -"=+ c #0C0836", -"-+ c #152666", -";+ c #5A96E4", -">+ c #3C61A6", -",+ c #080E44", -"'+ c #040B46", -")+ c #1E4AAD", -"!+ c #072D94", -"~+ c #00156B", -"{+ c #000A4B", -"]+ c #000440", -"^+ c #00053E", -"/+ c #AD1802", -"(+ c #DC3B07", -"_+ c #310B12", -":+ c #0E0938", -"<+ c #0D134B", -"[+ c #234592", -"}+ c #3F73C9", -"|+ c #4B83D7", -"1+ c #538DDE", -"2+ c #0F1A53", -"3+ c #030942", -"4+ c #13358D", -"5+ c #103BA3", -"6+ c #052D99", -"7+ c #002795", -"8+ c #002692", -"9+ c #00033D", -"0+ c #020840", -"a+ c #112C7C", -"b+ c #2959B8", -"c+ c #3265C1", -"d+ c #3B70C9", -"e+ c #437AD0", -"f+ c #4A82D5", -"g+ c #080E46", -"h+ c #02063E", -"i+ c #0E2B80", -"j+ c #0B359F", -"k+ c #012896", -"l+ c #002289", -"m+ c #000239", -"n+ c #AD1902", -"o+ c #02043E", -"p+ c #0A1C63", -"q+ c #224FAE", -"r+ c #2C5DBB", -"s+ c #3467C2", -"t+ c #3A6FC8", -"u+ c #3F75CC", -"v+ c #0E1B58", -"w+ c #030842", -"x+ c #0D2F8C", -"y+ c #072F9B", -"z+ c #001A75", -"A+ c #000A4C", -"B+ c #000540", -"C+ c #DC3A07", -"D+ c #020842", -"E+ c #071050", -"F+ c #1A3886", -"G+ c #3063BF", -"H+ c #3468C3", -"I+ c #274B9C", -"J+ c #040941", -"K+ c #030C4A", -"L+ c #0A339C", -"M+ c #002895", -"N+ c #002083", -"O+ c #00033B", -"P+ c #214CA7", -"Q+ c #295AB9", -"R+ c #2B5CBA", -"S+ c #16307A", -"T+ c #020740", -"U+ c #020A46", -"V+ c #0A2E93", -"W+ c #022A97", -"X+ c #001569", -"Y+ c #00023A", -"Z+ c #FF3506", -"`+ c #FF3C07", -" @ c #01063E", -".@ c #13348B", -"+@ c #1E4CAF", -"@@ c #1A409E", -"#@ c #0D2575", -"$@ c #0A1E68", -"%@ c #0B277E", -"&@ c #09319B", -"*@ c #00248E", -"=@ c #00043E", -"-@ c #010844", -";@ c #103BA2", -">@ c #133EA6", -",@ c #133FA6", -"'@ c #123DA5", -")@ c #062E9A", -"!@ c #00156A", -"~@ c #FF2C04", -"{@ c #FF3906", -"]@ c #4E0E01", -"^@ c #01186D", -"/@ c #052E9A", -"(@ c #07309B", -"_@ c #072C92", -":@ c #062582", -"<@ c #072F9A", -"[@ c #032B98", -"}@ c #001261", -"|@ c #00105A", -"1@ c #002288", -"2@ c #00258F", -"3@ c #000137", -"4@ c #DC3105", -"5@ c #00023B", -"6@ c #001975", -"7@ c #001466", -"8@ c #00043D", -"9@ c #002693", -"0@ c #000746", -"a@ c #000C4F", -"b@ c #000645", -"c@ c #510C00", -"d@ c #510D01", -"e@ c #430900", -"f@ c #400900", -"g@ c #001A76", -"h@ c #000A4D", -"i@ c #001D7C", -"j@ c #00063F", -"k@ c #00033C", -"l@ c #000C51", -" ", -" ", -" ", -" . + @ # $ % & * = - ; ; - = > ", -" , ' ) ! ~ { ] ^ / ( _ : < [ } ", -" , | 1 2 3 4 5 6 7 8 9 8 7 6 } ", -" , 0 a b c d ^ e f g h i : j } ", -" , k ! ~ l m [ ( n o o g : j } ", -" p q r 3 s t e 8 u v w h _ j } x y z ", -" A B C D E F G H I J I H K L M N O P Q ", -" R S T U V W X Y Z ` . ..+.@. ", -" #.$.%.&.*.=. -.;.>.,. '.).!.~.{.].^./.(._.+. ", -" :.r <.s [.=. }.|.1.2.3.4.5.6.1.~.7.8.9.0.a.b. ", -" c.d.D d e.> f.g.h.i.j.k.l.m.n.o.p.6.q.r.O s.t.u. ", -" c.b c ] v.w.x.y.z.A.B.C.D.E.F.G.H.I.J.K.L.M.N.O. ", -" P.T { Q.[ : h R.S. T.U.V.W.X.Y. Z.`. +N..+++ ", -" @+~ l m #+$+%+&+*+=+-+p.;+>+,+ '+)+t.!+~+{+]+^+ ", -" /+%.&.m (+> _+:+<+[+}+|+1+2+ 3+4+5+6+7+7+8+9+ ", -" /+%.&.5 (+=.0+a+b+c+d+e+f+g+ h+i+j+k+7+7+l+m+ ", -" n+3 &.m (+=.o+p+q+r+s+t+u+v+ w+x+y+7+z+A+B+ ", -" n+3 &.m C+=. D+D+E+F+G+H+I+J+ K+L+M+N+O+ ", -" n+3 &.Q.e.=. ].P+Q+R+S+T+ 0+U+V+W+7+X+Y+ ", -" n+3 Z+`+[.=. @.@+@ + +@@#@$@%@&@W+7+7+*@=@ ", -" n+%.U d *.=. -@;@>@N.,@'@0.j+)@7+7+7+7+7+!@=@ ", -" n+~@{ {@V ]@ ^@/@(@_@:@<@[@7+7+*@}@|@1@7+2@3@ ", -" /+~ D 4 4@]@ 5@6@8+7@]+8@=@9@7+7+0@ +.a@b@ ", -" > c@d@d@e@f@ @.5@ @.g@7+8++. ", -" h@7+i@j@ ", -" k@l@O+ ", -" ", -" ", -" "}; +"32 32 17 1", +" c None", +". c #002CA9", +"+ c #0231A9", +"@ c #0036AB", +"# c #FF0000", +"$ c #0D3AA9", +"% c #0141AB", +"& c #383B8F", +"* c #1648A9", +"= c #FF1A00", +"- c #1250AB", +"; c #FF1E0A", +"> c #1E57AB", +", c #1A5DAC", +"' c #FF2C0B", +") c #2A64AC", +"! c #3469AB", +" ", +" ", +" ", +" ###===;;;''''; ", +" ###==;;;'''''; ", +" ##===;;''''''; ", +" ##==;;;''''''' ", +" ##==;;;''''''' ", +" #===;;'''''''' %$ ", +" #===;;'''''''; %%% ", +" #==;; -**% +. ", +" #==;; %*- ----*%%$+.. ", +" #==;; *-->>,>>--*%$@+ ", +" ===;;' ->,,),,>-*%%@+ ", +" ==;;;'''' >>,)!),>-*%%@+ ", +" ==;;;'''' >,)!! %%@+ ", +" ==;;;'''' ->,) %@+... ", +" ==;;; &**->,, $@..... ", +" ==;;; %%*-->> @+..... ", +" ==;;; $%%*--- @+... ", +" ==;;; %*** @+.. ", +" ==;;; %%%%% @+... ", +" ==;;; $$%%$$@@+..... ", +" ==;;; +@@@@@++....... ", +" ==;;; ..++++......... ", +" ===;; ... ..... .. ", +" ... ", +" ... ", +" . ", +" ", +" ", +" "}; diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index 122e32436..245218382 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -39,6 +39,7 @@ #include "Command.h" #include "InputField.h" #include "BitmapFactory.h" +#include "propertyeditor/PropertyItem.h" using namespace Gui; using namespace App; diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index 9bf3cb0d5..56c5dae1f 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -84,6 +84,10 @@ void MDIView::deleteSelf() parent->deleteLater(); else this->deleteLater(); + + // detach from document + if (_pcDocument) + onClose(); _pcDocument = 0; } diff --git a/src/Gui/ProgressDialog.cpp b/src/Gui/ProgressDialog.cpp index 10c444bc8..c1eccae10 100644 --- a/src/Gui/ProgressDialog.cpp +++ b/src/Gui/ProgressDialog.cpp @@ -195,7 +195,7 @@ void SequencerDialog::showRemainingTime() QTime time( 0,0, 0); time = time.addSecs( rest/1000 ); QString remain = Gui::ProgressDialog::tr("Remaining: %1").arg(time.toString()); - QString status = QString::fromAscii("%1\t[%2]").arg(txt).arg(remain); + QString status = QString::fromLatin1("%1\t[%2]").arg(txt).arg(remain); if (thr != currentThread) { QMetaObject::invokeMethod(d->dlg, "setLabelText", diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index e2af8c1d2..e69fe525a 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -38,6 +38,7 @@ #include "QuantitySpinBox.h" #include "QuantitySpinBox_p.h" #include "DlgExpressionInput.h" +#include "propertyeditor/PropertyItem.h" #include "BitmapFactory.h" #include "Command.h" #include diff --git a/src/Gui/Quarter/SignalThread.cpp b/src/Gui/Quarter/SignalThread.cpp index bcd9b78c6..2b7254d3c 100644 --- a/src/Gui/Quarter/SignalThread.cpp +++ b/src/Gui/Quarter/SignalThread.cpp @@ -30,6 +30,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \**************************************************************************/ +#include + #include "SignalThread.h" using namespace SIM::Coin3D::Quarter; @@ -47,25 +49,23 @@ void SignalThread::trigger(void) { // lock first to make sure the QThread is actually waiting for a signal - this->mutex.lock(); + QMutexLocker ml(&this->mutex); this->waitcond.wakeOne(); - this->mutex.unlock(); } void SignalThread::stopThread(void) { - this->mutex.lock(); + QMutexLocker ml(&this->mutex); this->isstopped = true; this->waitcond.wakeOne(); - this->mutex.unlock(); } void SignalThread::run(void) { - this->mutex.lock(); + QMutexLocker ml(&this->mutex); while (!this->isstopped) { // just wait, and trigger every time we receive a signal this->waitcond.wait(&this->mutex); @@ -73,5 +73,4 @@ SignalThread::run(void) emit triggerSignal(); } } - this->mutex.unlock(); } diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index a20077620..0e6610abe 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -134,7 +134,7 @@ public: splash->showMessage(msg.replace(QLatin1String("\n"), QString()), alignment, textColor); QMutex mutex; - mutex.lock(); + QMutexLocker ml(&mutex); QWaitCondition().wait(&mutex, 50); } diff --git a/src/Gui/ViewProvider.cpp b/src/Gui/ViewProvider.cpp index 7aaa985c5..b4c54ec1e 100644 --- a/src/Gui/ViewProvider.cpp +++ b/src/Gui/ViewProvider.cpp @@ -266,6 +266,16 @@ void ViewProvider::setDisplayMaskMode( const char* type ) setModeSwitch(); } +SoNode* ViewProvider::getDisplayMaskMode(const char* type) const +{ + std::map::const_iterator it = _sDisplayMaskModes.find( type ); + if (it != _sDisplayMaskModes.end()) { + return pcModeSwitch->getChild(it->second); + } + + return 0; +} + std::vector ViewProvider::getDisplayMaskModes() const { std::vector types; diff --git a/src/Gui/ViewProvider.h b/src/Gui/ViewProvider.h index f410ffaea..694d72b27 100644 --- a/src/Gui/ViewProvider.h +++ b/src/Gui/ViewProvider.h @@ -308,6 +308,8 @@ protected: void addDisplayMaskMode( SoNode *node, const char* type ); /// Activates the display mask mode \a type void setDisplayMaskMode( const char* type ); + /// Get the node to the display mask mode \a type + SoNode* getDisplayMaskMode(const char* type) const; /// Returns a list of added display mask modes std::vector getDisplayMaskModes() const; void setDefaultMode(int); diff --git a/src/Gui/iisTaskPanel/src/iisiconlabel.h b/src/Gui/iisTaskPanel/src/iisiconlabel.h index 0d1ffe13f..8ce6229c9 100644 --- a/src/Gui/iisTaskPanel/src/iisiconlabel.h +++ b/src/Gui/iisTaskPanel/src/iisiconlabel.h @@ -9,6 +9,7 @@ #define IISICONLABEL_H #include +#include #include "iistaskpanel_global.h" diff --git a/src/Gui/iisTaskPanel/src/iistaskbox.h b/src/Gui/iisTaskPanel/src/iistaskbox.h index a62d2c93b..09788d0d8 100644 --- a/src/Gui/iisTaskPanel/src/iistaskbox.h +++ b/src/Gui/iisTaskPanel/src/iistaskbox.h @@ -9,6 +9,11 @@ #define IISTASKBOX_H #include +#include +#include +#include +#include +#include #include "iistaskpanel_global.h" diff --git a/src/Gui/iisTaskPanel/src/iistaskgroup.h b/src/Gui/iisTaskPanel/src/iistaskgroup.h index 522eadc3e..7f4b5e654 100644 --- a/src/Gui/iisTaskPanel/src/iistaskgroup.h +++ b/src/Gui/iisTaskPanel/src/iistaskgroup.h @@ -9,6 +9,10 @@ #define IISTASKGROUP_H #include +#include +#include +#include +#include #include "iistaskpanel_global.h" diff --git a/src/Gui/iisTaskPanel/src/iistaskheader.cpp b/src/Gui/iisTaskPanel/src/iistaskheader.cpp index 31b714cc2..479df3e7c 100644 --- a/src/Gui/iisTaskPanel/src/iistaskheader.cpp +++ b/src/Gui/iisTaskPanel/src/iistaskheader.cpp @@ -5,6 +5,12 @@ * * ***************************************************************************/ +#include +#include +#include +#include +#include + #include "iistaskheader.h" #include "iistaskpanelscheme.h" #include "iisiconlabel.h" diff --git a/src/Gui/iisTaskPanel/src/iistaskheader.h b/src/Gui/iisTaskPanel/src/iistaskheader.h index c64b4b2cd..cebe26b8a 100644 --- a/src/Gui/iisTaskPanel/src/iistaskheader.h +++ b/src/Gui/iisTaskPanel/src/iistaskheader.h @@ -9,6 +9,10 @@ #define IISTASKHEADER_H #include +#include +#include +#include +#include #include "iistaskpanel_global.h" diff --git a/src/Gui/iisTaskPanel/src/iistaskpanel.h b/src/Gui/iisTaskPanel/src/iistaskpanel.h index 4a3d0bb16..a8277d95f 100644 --- a/src/Gui/iisTaskPanel/src/iistaskpanel.h +++ b/src/Gui/iisTaskPanel/src/iistaskpanel.h @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include "iistaskpanel_global.h" diff --git a/src/Gui/iisTaskPanel/src/iistaskpanelscheme.h b/src/Gui/iisTaskPanel/src/iistaskpanelscheme.h index f4e0ef95d..a66ecb84d 100644 --- a/src/Gui/iisTaskPanel/src/iistaskpanelscheme.h +++ b/src/Gui/iisTaskPanel/src/iistaskpanelscheme.h @@ -9,6 +9,10 @@ #define IISTASKPANELSCHEME_H #include +#include +#include +#include +#include #include "iistaskpanel_global.h" diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp index ba10d2ef8..879286f8f 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp +++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp @@ -91,7 +91,7 @@ void PropertyItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem & QItemDelegate::paint(painter, option, index); - QColor color = static_cast(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &option)); + QColor color = static_cast(QApplication::style()->styleHint(QStyle::SH_Table_GridLineColor, &opt, qobject_cast(parent()))); painter->setPen(QPen(color)); if (index.column() == 1 || !(property && property->isSeparator())) { int right = (option.direction == Qt::LeftToRight) ? option.rect.right() : option.rect.left(); diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 3281189a3..487904333 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -1208,7 +1208,13 @@ class _CommandComponent: FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() -def makeIfcSpreadsheet(obj=None): +def makeIfcSpreadsheet(archobj=None): + ifc_container = None + for obj in FreeCAD.ActiveDocument.Objects : + if obj.Name == "IfcPropertiesContainer" : + ifc_container = obj + if not ifc_container : + ifc_container = FreeCAD.ActiveDocument.addObject('App::DocumentObjectGroup','IfcPropertiesContainer') import Spreadsheet ifc_spreadsheet = FreeCAD.ActiveDocument.addObject('Spreadsheet::Sheet','IfcProperties') ifc_spreadsheet.set('A1', translate("Arch","Category")) @@ -1216,14 +1222,15 @@ def makeIfcSpreadsheet(obj=None): ifc_spreadsheet.set('C1', translate("Arch","Type")) ifc_spreadsheet.set('D1', translate("Arch","Value")) ifc_spreadsheet.set('E1', translate("Arch","Unit")) - if obj : - if hasattr(obj,"IfcProperties"): - obj.IfcProperties = ifc_spreadsheet + ifc_container.addObject(ifc_spreadsheet) + if archobj : + if hasattr(obj,"IfcProperties") : + archobj.IfcProperties = ifc_spreadsheet return ifc_spreadsheet else : - FreeCAD.Console.PrintWarning(translate("Arch", "The object have not IfcProperties attribute. Cancel spreadsheet creation for object : ") + obj.Label) + FreeCAD.Console.PrintWarning(translate("Arch", "The object have not IfcProperties attribute. Cancel spreadsheet creation for object : ") + archobj.Label) FreeCAD.ActiveDocument.removeObject(ifc_spreadsheet) - else: + else : return ifc_spreadsheet class _CommandIfcSpreadsheet: diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 6bc11f95f..2ec10273c 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -1368,15 +1368,15 @@ class DraftToolBar: self.isRelative.setChecked(not self.isRelative.isChecked()) self.relativeMode = self.isRelative.isChecked() spec = True - elif txt.endswith("i"): + elif txt.endswith("I"): if self.hasFill.isVisible(): self.hasFill.setChecked(not self.hasFill.isChecked()) spec = True - elif txt.endswith("f"): + elif txt.endswith("F"): if self.finishButton.isVisible(): self.finish() spec = True - elif txt.endswith("t"): + elif txt.endswith("T"): self.toggleContinue() spec = True elif txt.endswith("w"): @@ -1415,7 +1415,8 @@ class DraftToolBar: self.closeLine() elif self.isCopy.isVisible(): self.isCopy.setChecked(not self.isCopy.isChecked()) - elif txt.endswith("n"): + spec = True + elif txt.endswith("N"): if self.continueCmd.isVisible(): self.continueCmd.setChecked(not self.continueCmd.isChecked()) spec = True diff --git a/src/Mod/Mesh/App/Mesh.cpp b/src/Mod/Mesh/App/Mesh.cpp index 43f619bed..6a2e726b3 100644 --- a/src/Mod/Mesh/App/Mesh.cpp +++ b/src/Mod/Mesh/App/Mesh.cpp @@ -592,16 +592,24 @@ void MeshObject::getPointsFromSelection(std::vector& inds) const MeshCore::MeshAlgorithm(this->_kernel).GetPointsFlag(inds, MeshCore::MeshPoint::SELECTED); } +unsigned long MeshObject::countSelectedFacets() const +{ + return MeshCore::MeshAlgorithm(this->_kernel).CountFacetFlag(MeshCore::MeshFacet::SELECTED); +} + bool MeshObject::hasSelectedFacets() const { - unsigned long ct = MeshCore::MeshAlgorithm(this->_kernel).CountFacetFlag(MeshCore::MeshFacet::SELECTED); - return ct > 0; + return (countSelectedFacets() > 0); +} + +unsigned long MeshObject::countSelectedPoints() const +{ + return MeshCore::MeshAlgorithm(this->_kernel).CountPointFlag(MeshCore::MeshPoint::SELECTED); } bool MeshObject::hasSelectedPoints() const { - unsigned long ct = MeshCore::MeshAlgorithm(this->_kernel).CountPointFlag(MeshCore::MeshPoint::SELECTED); - return ct > 0; + return (countSelectedPoints() > 0); } std::vector MeshObject::getPointsFromFacets(const std::vector& facets) const diff --git a/src/Mod/Mesh/App/Mesh.h b/src/Mod/Mesh/App/Mesh.h index 74d224382..5e75bf3ee 100644 --- a/src/Mod/Mesh/App/Mesh.h +++ b/src/Mod/Mesh/App/Mesh.h @@ -220,7 +220,9 @@ public: void addPointsToSelection(const std::vector&) const; void removeFacetsFromSelection(const std::vector&) const; void removePointsFromSelection(const std::vector&) const; + unsigned long countSelectedFacets() const; bool hasSelectedFacets() const; + unsigned long countSelectedPoints() const; bool hasSelectedPoints() const; void getFacetsFromSelection(std::vector&) const; void getPointsFromSelection(std::vector&) const; diff --git a/src/Mod/Mesh/Gui/MeshSelection.cpp b/src/Mod/Mesh/Gui/MeshSelection.cpp index b3cb4524f..df6eb31cf 100644 --- a/src/Mod/Mesh/Gui/MeshSelection.cpp +++ b/src/Mod/Mesh/Gui/MeshSelection.cpp @@ -170,6 +170,8 @@ void MeshSelection::prepareBrushSelection(bool add,SoEventCallbackCB *cb) if (viewer) { stopInteractiveCallback(viewer); startInteractiveCallback(viewer, cb); + viewer->navigationStyle()->stopSelection(); + // set cross cursor Gui::BrushSelection* brush = new Gui::BrushSelection(); brush->setClosed(true); diff --git a/src/Mod/Mesh/Gui/ViewProvider.cpp b/src/Mod/Mesh/Gui/ViewProvider.cpp index 3cf05a785..fc0b8dd50 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.cpp +++ b/src/Mod/Mesh/Gui/ViewProvider.cpp @@ -1697,6 +1697,13 @@ void ViewProviderMesh::deselectFacet(unsigned long facet) } } +bool ViewProviderMesh::isFacetSelected(unsigned long facet) +{ + const Mesh::MeshObject& rMesh = static_cast(pcObject)->Mesh.getValue(); + const MeshCore::MeshFacetArray& faces = rMesh.getKernel().GetFacets(); + return faces[facet].IsFlag(MeshCore::MeshFacet::SELECTED); +} + void ViewProviderMesh::selectComponent(unsigned long uFacet) { std::vector selection; @@ -1766,6 +1773,24 @@ void ViewProviderMesh::removeSelection(const std::vector& indices unhighlightSelection(); } +void ViewProviderMesh::invertSelection() +{ + const Mesh::MeshObject& rMesh = static_cast(pcObject)->Mesh.getValue(); + const MeshCore::MeshFacetArray& faces = rMesh.getKernel().GetFacets(); + unsigned long num_notsel = std::count_if(faces.begin(), faces.end(), + std::bind2nd(MeshCore::MeshIsNotFlag(), + MeshCore::MeshFacet::SELECTED)); + std::vector notselect; + notselect.reserve(num_notsel); + MeshCore::MeshFacetArray::_TConstIterator beg = faces.begin(); + MeshCore::MeshFacetArray::_TConstIterator end = faces.end(); + for (MeshCore::MeshFacetArray::_TConstIterator jt = beg; jt != end; ++jt) { + if (!jt->IsFlag(MeshCore::MeshFacet::SELECTED)) + notselect.push_back(jt-beg); + } + setSelection(notselect); +} + void ViewProviderMesh::clearSelection() { const Mesh::MeshObject& rMesh = static_cast(pcObject)->Mesh.getValue(); diff --git a/src/Mod/Mesh/Gui/ViewProvider.h b/src/Mod/Mesh/Gui/ViewProvider.h index c684e5abf..d0e5af03d 100644 --- a/src/Mod/Mesh/Gui/ViewProvider.h +++ b/src/Mod/Mesh/Gui/ViewProvider.h @@ -138,6 +138,7 @@ public: /** @name Editing */ //@{ bool doubleClicked(void){ return false; } + bool isFacetSelected(unsigned long facet); void selectComponent(unsigned long facet); void deselectComponent(unsigned long facet); void selectFacet(unsigned long facet); @@ -145,6 +146,7 @@ public: void setSelection(const std::vector&); void addSelection(const std::vector&); void removeSelection(const std::vector&); + void invertSelection(); void clearSelection(); void deleteSelection(); void getFacetsFromPolygon(const std::vector& picked, diff --git a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp index cf93b10da..56d962655 100644 --- a/src/Mod/PartDesign/Gui/TaskPadParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPadParameters.cpp @@ -293,7 +293,7 @@ void TaskPadParameters::onModeChanged(int index) case 0: pcPad->Type.setValue("Length"); // Avoid error message - if (ui->lengthEdit->value() < Precision::Confusion()) + if (ui->lengthEdit->value() < Base::Quantity(Precision::Confusion(), Base::Unit::Length)) ui->lengthEdit->setValue(5.0); break; case 1: pcPad->Type.setValue("UpToLast"); break; diff --git a/src/Mod/Points/App/Properties.cpp b/src/Mod/Points/App/Properties.cpp index 1c94f60d8..0c901023b 100644 --- a/src/Mod/Points/App/Properties.cpp +++ b/src/Mod/Points/App/Properties.cpp @@ -190,22 +190,21 @@ unsigned int PropertyGreyValueList::getMemSize (void) const void PropertyGreyValueList::removeIndices( const std::vector& uIndices ) { -#if 0 // We need a sorted array std::vector uSortedInds = uIndices; std::sort(uSortedInds.begin(), uSortedInds.end()); - const std::vector& rValueList = getValues(); + const std::vector& rValueList = getValues(); assert( uSortedInds.size() <= rValueList.size() ); if ( uSortedInds.size() > rValueList.size() ) return; - std::vector remainValue; + std::vector remainValue; remainValue.reserve(rValueList.size() - uSortedInds.size()); std::vector::iterator pos = uSortedInds.begin(); - for ( std::vector::const_iterator it = rValueList.begin(); it != rValueList.end(); ++it ) { + for ( std::vector::const_iterator it = rValueList.begin(); it != rValueList.end(); ++it ) { unsigned long index = it - rValueList.begin(); if (pos == uSortedInds.end()) remainValue.push_back( *it ); @@ -216,7 +215,6 @@ void PropertyGreyValueList::removeIndices( const std::vector& uIn } setValues(remainValue); -#endif } PropertyNormalList::PropertyNormalList() diff --git a/src/Mod/Points/Gui/ViewProvider.cpp b/src/Mod/Points/Gui/ViewProvider.cpp index a3d35e0fc..5d41b4a5a 100644 --- a/src/Mod/Points/Gui/ViewProvider.cpp +++ b/src/Mod/Points/Gui/ViewProvider.cpp @@ -428,6 +428,15 @@ void ViewProviderScattered::updateData(const App::Property* prop) // The number of points might have changed, so force also a resize of the Inventor internals setActiveMode(); } + else if (prop->getTypeId() == Points::PropertyNormalList::getClassTypeId()) { + setActiveMode(); + } + else if (prop->getTypeId() == Points::PropertyGreyValueList::getClassTypeId()) { + setActiveMode(); + } + else if (prop->getTypeId() == App::PropertyColorList::getClassTypeId()) { + setActiveMode(); + } } void ViewProviderScattered::cut(const std::vector& picked, Gui::View3DInventorViewer &Viewer) @@ -446,24 +455,63 @@ void ViewProviderScattered::cut(const std::vector& picked, Gui::View3DI SbViewVolume vol = pCam->getViewVolume(); // search for all points inside/outside the polygon - Points::PointKernel newKernel; - for (Points::PointKernel::const_iterator jt = points.begin(); jt != points.end(); ++jt) { + std::vector removeIndices; + removeIndices.reserve(points.size()); + + unsigned long index = 0; + for (Points::PointKernel::const_iterator jt = points.begin(); jt != points.end(); ++jt, ++index) { SbVec3f pt(jt->x,jt->y,jt->z); // project from 3d to 2d vol.projectToScreen(pt, pt); - if (!cPoly.Contains(Base::Vector2D(pt[0],pt[1]))) - newKernel.push_back(*jt); + if (cPoly.Contains(Base::Vector2D(pt[0],pt[1]))) + removeIndices.push_back(index); } - if (newKernel.size() == points.size()) + if (removeIndices.empty()) return; // nothing needs to be done //Remove the points from the cloud and open a transaction object for the undo/redo stuff Gui::Application::Instance->activeDocument()->openCommand("Cut points"); // sets the points outside the polygon to update the Inventor node - fea->Points.setValue(newKernel); + fea->Points.removeIndices(removeIndices); + + std::map Map; + pcObject->getPropertyMap(Map); + + for (std::map::iterator it = Map.begin(); it != Map.end(); ++it) { + Base::Type type = it->second->getTypeId(); + if (type == Points::PropertyNormalList::getClassTypeId()) { + static_cast(it->second)->removeIndices(removeIndices); + } + else if (type == Points::PropertyGreyValueList::getClassTypeId()) { + static_cast(it->second)->removeIndices(removeIndices); + } + else if (type == App::PropertyColorList::getClassTypeId()) { + //static_cast(it->second)->removeIndices(removeIndices); + const std::vector& colors = static_cast(it->second)->getValues(); + + if (removeIndices.size() > colors.size()) + break; + + std::vector remainValue; + remainValue.reserve(colors.size() - removeIndices.size()); + + std::vector::iterator pos = removeIndices.begin(); + for (std::vector::const_iterator jt = colors.begin(); jt != colors.end(); ++jt) { + unsigned long index = jt - colors.begin(); + if (pos == removeIndices.end()) + remainValue.push_back( *jt ); + else if (index != *pos) + remainValue.push_back( *jt ); + else + ++pos; + } + + static_cast(it->second)->setValues(remainValue); + } + } // unset the modified flag because we don't need the features' execute() to be called Gui::Application::Instance->activeDocument()->commitCommand(); diff --git a/src/Mod/Sandbox/App/DocumentThread.cpp b/src/Mod/Sandbox/App/DocumentThread.cpp index 7f13cb304..ecec31d77 100644 --- a/src/Mod/Sandbox/App/DocumentThread.cpp +++ b/src/Mod/Sandbox/App/DocumentThread.cpp @@ -53,7 +53,7 @@ void DocumentThread::run() { App::Document* doc = App::GetApplication().getActiveDocument(); DocumentProtector dp(doc); - dp.addObject("Mesh::Ellipsoid", (const char*)objectName().toAscii()); + dp.addObject("Mesh::Ellipsoid", (const char*)objectName().toLatin1()); dp.recompute(); } diff --git a/src/Mod/Sandbox/Gui/Command.cpp b/src/Mod/Sandbox/Gui/Command.cpp index 1e2bf3637..f97e2ca1d 100644 --- a/src/Mod/Sandbox/Gui/Command.cpp +++ b/src/Mod/Sandbox/Gui/Command.cpp @@ -100,7 +100,7 @@ void CmdSandboxDocumentThread::activated(int iMsg) App::GetApplication().newDocument("Thread"); for (int i=0; i<5; i++) { Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); - dt->setObjectName(QString::fromAscii("MyMesh_%1").arg(i)); + dt->setObjectName(QString::fromLatin1("MyMesh_%1").arg(i)); QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater())); dt->start(); } @@ -178,7 +178,7 @@ void CmdSandboxDocThreadWithSeq::activated(int iMsg) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); - dt->setObjectName(QString::fromAscii("MyMesh")); + dt->setObjectName(QString::fromLatin1("MyMesh")); QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater())); dt->start(); #ifdef FC_DEBUG @@ -217,7 +217,7 @@ void CmdSandboxDocThreadBusy::activated(int iMsg) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); - dt->setObjectName(QString::fromAscii("MyMesh")); + dt->setObjectName(QString::fromLatin1("MyMesh")); QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater())); dt->start(); #ifdef FC_DEBUG @@ -410,7 +410,7 @@ void CmdSandboxPythonThread::activated(int iMsg) App::GetApplication().newDocument("Thread"); for (int i=0; i<5; i++) { Sandbox::PythonThread* pt = new Sandbox::PythonThread(); - pt->setObjectName(QString::fromAscii("MyMesh_%1").arg(i)); + pt->setObjectName(QString::fromLatin1("MyMesh_%1").arg(i)); QObject::connect(pt, SIGNAL(finished()), pt, SLOT(deleteLater())); pt->start(); } @@ -462,7 +462,7 @@ void CmdSandboxDocThreadWithDialog::activated(int iMsg) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); - dt->setObjectName(QString::fromAscii("MyMesh")); + dt->setObjectName(QString::fromLatin1("MyMesh")); QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater())); dt->start(); //QFileDialog::getOpenFileName(); @@ -489,7 +489,7 @@ void CmdSandboxDocThreadWithFileDlg::activated(int iMsg) { App::GetApplication().newDocument("Thread"); Sandbox::DocumentThread* dt = new Sandbox::DocumentThread(); - dt->setObjectName(QString::fromAscii("MyMesh")); + dt->setObjectName(QString::fromLatin1("MyMesh")); QObject::connect(dt, SIGNAL(finished()), dt, SLOT(deleteLater())); dt->start(); QFileDialog::getOpenFileName(); @@ -1014,9 +1014,9 @@ public: painter.drawPath(path); painter.setPen(Qt::white); painter.drawText(25, 40, 70, 20, Qt::AlignHCenter|Qt::AlignVCenter, - QString::fromAscii("Distance: 2.784mm")); + QString::fromLatin1("Distance: 2.784mm")); //QPainterPath text; - //text.addText(25,55,QFont(), QString::fromAscii("Distance")); + //text.addText(25,55,QFont(), QString::fromLatin1("Distance")); //painter.setBrush(QBrush(Qt::white, Qt::SolidPattern)); //painter.drawPath(text); } @@ -1054,7 +1054,7 @@ CmdTestImageNode::CmdTestImageNode() void CmdTestImageNode::activated(int iMsg) { - QString text = QString::fromAscii("Distance: 2.7jgiorjgor84mm"); + QString text = QString::fromLatin1("Distance: 2.7jgiorjgor84mm"); QFont font; QFontMetrics fm(font); int w = fm.width(text); @@ -1168,10 +1168,10 @@ void CmdTestRedirectPaint::activated(int iMsg) QCalendarWidget* cal = new QCalendarWidget(); QLabel* label = new QLabel(); QPainter::setRedirected(cal,label); - cal->setWindowTitle(QString::fromAscii("QCalendarWidget")); + cal->setWindowTitle(QString::fromLatin1("QCalendarWidget")); cal->show(); label->show(); - label->setWindowTitle(QString::fromAscii("QLabel")); + label->setWindowTitle(QString::fromLatin1("QLabel")); } //=========================================================================== @@ -1193,7 +1193,7 @@ void CmdTestCryptographicHash::activated(int iMsg) { QByteArray data = "FreeCAD"; QByteArray hash = QCryptographicHash::hash(data, QCryptographicHash::Md5); - QMessageBox::information(0,QLatin1String("Hash of: FreeCAD"),QString::fromAscii(hash)); + QMessageBox::information(0,QLatin1String("Hash of: FreeCAD"),QString::fromLatin1(hash)); } //=========================================================================== @@ -1353,13 +1353,13 @@ void CmdMengerSponge::activated(int iMsg) { bool ok; int level = QInputDialog::getInteger(Gui::getMainWindow(), - QString::fromAscii("Menger sponge"), - QString::fromAscii("Recursion depth:"), + QString::fromLatin1("Menger sponge"), + QString::fromLatin1("Recursion depth:"), 3, 1, 5, 1, &ok); if (!ok) return; int ret = QMessageBox::question(Gui::getMainWindow(), - QString::fromAscii("Parallel"), - QString::fromAscii("Do you want to run this in a thread pool?"), + QString::fromLatin1("Parallel"), + QString::fromLatin1("Do you want to run this in a thread pool?"), QMessageBox::Yes|QMessageBox::No); bool parallel=(ret == QMessageBox::Yes); float x0=0,y0=0,z0=0; @@ -1405,7 +1405,7 @@ CmdTestGraphicsView::CmdTestGraphicsView() void CmdTestGraphicsView::activated(int iMsg) { Gui::GraphicsView3D* view3D = new Gui::GraphicsView3D(getActiveGuiDocument(), Gui::getMainWindow()); - view3D->setWindowTitle(QString::fromAscii("Graphics scene")); + view3D->setWindowTitle(QString::fromLatin1("Graphics scene")); view3D->setWindowIcon(QApplication::windowIcon()); view3D->resize(400, 300); Gui::getMainWindow()->addWindow(view3D); diff --git a/src/Mod/Sandbox/Gui/GLGraphicsView.cpp b/src/Mod/Sandbox/Gui/GLGraphicsView.cpp index 26c7bf441..0c6feddef 100644 --- a/src/Mod/Sandbox/Gui/GLGraphicsView.cpp +++ b/src/Mod/Sandbox/Gui/GLGraphicsView.cpp @@ -265,7 +265,7 @@ void GraphicsScene::drawBackground(QPainter *painter, const QRectF &) painter->save(); painter->fillRect(40,40,40,60,Qt::lightGray); - painter->drawText(50,50, QString::fromAscii("Done with QPainter")); + painter->drawText(50,50, QString::fromLatin1("Done with QPainter")); painter->restore(); QTimer::singleShot(20, this, SLOT(update())); diff --git a/src/Mod/Sandbox/Gui/Overlay.cpp b/src/Mod/Sandbox/Gui/Overlay.cpp index 273887135..b355d680c 100644 --- a/src/Mod/Sandbox/Gui/Overlay.cpp +++ b/src/Mod/Sandbox/Gui/Overlay.cpp @@ -59,7 +59,7 @@ public: { QPainter p(&img); p.setPen(Qt::white); - p.drawText(200,200,QString::fromAscii("Render to QImage")); + p.drawText(200,200,QString::fromLatin1("Render to QImage")); } img = QGLWidget::convertToGLFormat(img); @@ -70,7 +70,7 @@ public: { QPainter p(fbo); p.setPen(Qt::white); - p.drawText(200,200,QString::fromAscii("Render to QGLFramebufferObject")); + p.drawText(200,200,QString::fromLatin1("Render to QGLFramebufferObject")); p.end(); //img = fbo->toImage(); //img = QGLWidget::convertToGLFormat(img); @@ -498,7 +498,7 @@ void DrawingPlane::terminate() SoGLRenderAction a(SbViewportRegion(128,128)); a.apply(_pcView3D->getSoRenderManager()->getSceneGraph()); fbo->release(); - fbo->toImage().save(QString::fromAscii("C:/Temp/DrawingPlane.png")); + fbo->toImage().save(QString::fromLatin1("C:/Temp/DrawingPlane.png")); delete fbo; } diff --git a/src/Mod/Sandbox/Gui/TaskPanelView.cpp b/src/Mod/Sandbox/Gui/TaskPanelView.cpp index b9723c148..1ebe6952f 100644 --- a/src/Mod/Sandbox/Gui/TaskPanelView.cpp +++ b/src/Mod/Sandbox/Gui/TaskPanelView.cpp @@ -388,62 +388,62 @@ TaskPanelView::TaskPanelView(QWidget *parent) tabWidget->addTab(page1, QLatin1String("Action Box")); // setup ActionBox 1 - ui->ActionBox1->setIcon(QPixmap(QString::fromAscii(":/icons/document-open.svg"))); - ui->ActionBox1->header()->setText(QString::fromAscii("Header of the group")); + ui->ActionBox1->setIcon(QPixmap(QString::fromLatin1(":/icons/document-open.svg"))); + ui->ActionBox1->header()->setText(QString::fromLatin1("Header of the group")); connect(ui->ActionBox1->header(), SIGNAL(clicked()), action, SIGNAL(triggered())); - QSint::ActionLabel *a1 = ui->ActionBox1->createItem(QString::fromAscii("This action has no icon")); + QSint::ActionLabel *a1 = ui->ActionBox1->createItem(QString::fromLatin1("This action has no icon")); connect(a1, SIGNAL(clicked()), action, SIGNAL(triggered())); - QSint::ActionLabel *a2 = ui->ActionBox1->createItem(QPixmap(QString::fromAscii(":/icons/document-print.svg")), - QString::fromAscii("This action has icon")); + QSint::ActionLabel *a2 = ui->ActionBox1->createItem(QPixmap(QString::fromLatin1(":/icons/document-print.svg")), + QString::fromLatin1("This action has icon")); connect(a2, SIGNAL(clicked()), action, SIGNAL(triggered())); QLayout *hbl1 = ui->ActionBox1->createHBoxLayout(); - QSint::ActionLabel *a3 = ui->ActionBox1->createItem(QString::fromAscii("1st action in row"), hbl1); + QSint::ActionLabel *a3 = ui->ActionBox1->createItem(QString::fromLatin1("1st action in row"), hbl1); connect(a3, SIGNAL(clicked()), action, SIGNAL(triggered())); - QSint::ActionLabel *a4 = ui->ActionBox1->createItem(QString::fromAscii("2nd action in row"), hbl1); + QSint::ActionLabel *a4 = ui->ActionBox1->createItem(QString::fromLatin1("2nd action in row"), hbl1); connect(a4, SIGNAL(clicked()), action, SIGNAL(triggered())); // setup ActionBox 2 - ui->ActionBox2->setIcon(QPixmap(QString::fromAscii(":/icons/document-save.png"))); - ui->ActionBox2->header()->setText(QString::fromAscii("Checkable actions allowed")); + ui->ActionBox2->setIcon(QPixmap(QString::fromLatin1(":/icons/document-save.png"))); + ui->ActionBox2->header()->setText(QString::fromLatin1("Checkable actions allowed")); connect(ui->ActionBox2->header(), SIGNAL(clicked()), action, SIGNAL(triggered())); - QSint::ActionLabel *b1 = ui->ActionBox2->createItem(QString::fromAscii("Action 1 (Exclusive)")); + QSint::ActionLabel *b1 = ui->ActionBox2->createItem(QString::fromLatin1("Action 1 (Exclusive)")); b1->setCheckable(true); b1->setAutoExclusive(true); b1->setChecked(true); - QSint::ActionLabel *b2 = ui->ActionBox2->createItem(QString::fromAscii("Action 2 (Exclusive)")); + QSint::ActionLabel *b2 = ui->ActionBox2->createItem(QString::fromLatin1("Action 2 (Exclusive)")); b2->setCheckable(true); b2->setAutoExclusive(true); - QSint::ActionLabel *b3 = ui->ActionBox2->createItem(QString::fromAscii("Action 3 (Exclusive)")); + QSint::ActionLabel *b3 = ui->ActionBox2->createItem(QString::fromLatin1("Action 3 (Exclusive)")); b3->setCheckable(true); b3->setAutoExclusive(true); - QSint::ActionLabel *b4 = ui->ActionBox2->createItem(QString::fromAscii("Non-exclusive but still checkable")); + QSint::ActionLabel *b4 = ui->ActionBox2->createItem(QString::fromLatin1("Non-exclusive but still checkable")); b4->setCheckable(true); // setup ActionBox 3 - ui->ActionBox3->setIcon(QPixmap(QString::fromAscii(":/icons/document-print.png"))); - ui->ActionBox3->header()->setText(QString::fromAscii("Also, widgets allowed as well")); + ui->ActionBox3->setIcon(QPixmap(QString::fromLatin1(":/icons/document-print.png"))); + ui->ActionBox3->header()->setText(QString::fromLatin1("Also, widgets allowed as well")); - ui->ActionBox3->addWidget(new QPushButton(QString::fromAscii("PushButton"), this)); - ui->ActionBox3->addWidget(new QCheckBox(QString::fromAscii("CheckBox"), this)); + ui->ActionBox3->addWidget(new QPushButton(QString::fromLatin1("PushButton"), this)); + ui->ActionBox3->addWidget(new QCheckBox(QString::fromLatin1("CheckBox"), this)); QLayout *hbl3 = ui->ActionBox3->createHBoxLayout(); - ui->ActionBox3->addWidget(new QRadioButton(QString::fromAscii("RadioButton 1"), this), hbl3); - ui->ActionBox3->addWidget(new QRadioButton(QString::fromAscii("RadioButton 2"), this), hbl3); + ui->ActionBox3->addWidget(new QRadioButton(QString::fromLatin1("RadioButton 1"), this), hbl3); + ui->ActionBox3->addWidget(new QRadioButton(QString::fromLatin1("RadioButton 2"), this), hbl3); // setup ActionBox 4 - ui->ActionBox4->setIcon(QPixmap(QString::fromAscii(":/icons/document-open.png"))); - ui->ActionBox4->header()->setText(QString::fromAscii("ActionBox with different scheme")); + ui->ActionBox4->setIcon(QPixmap(QString::fromLatin1(":/icons/document-open.png"))); + ui->ActionBox4->header()->setText(QString::fromLatin1("ActionBox with different scheme")); - ui->ActionBox4->createItem(QString::fromAscii("This action has no icon")); - ui->ActionBox4->createItem(QPixmap(QString::fromAscii(":/icons/document-print.png")), - QString::fromAscii("This action has icon")); + ui->ActionBox4->createItem(QString::fromLatin1("This action has no icon")); + ui->ActionBox4->createItem(QPixmap(QString::fromLatin1(":/icons/document-print.png")), + QString::fromLatin1("This action has icon")); QLayout *hbl4 = ui->ActionBox4->createHBoxLayout(); - ui->ActionBox4->createItem(QString::fromAscii("1st action in row"), hbl4); - ui->ActionBox4->createItem(QString::fromAscii("2nd action in row"), hbl4); - ui->ActionBox4->createItem(QString::fromAscii("3rd action in row"), hbl4); + ui->ActionBox4->createItem(QString::fromLatin1("1st action in row"), hbl4); + ui->ActionBox4->createItem(QString::fromLatin1("2nd action in row"), hbl4); + ui->ActionBox4->createItem(QString::fromLatin1("3rd action in row"), hbl4); const char* ActionBoxNewStyle = "QSint--ActionBox {" @@ -490,17 +490,17 @@ TaskPanelView::TaskPanelView(QWidget *parent) "}" ; - ui->ActionBox4->setStyleSheet(QString::fromAscii(ActionBoxNewStyle)); + ui->ActionBox4->setStyleSheet(QString::fromLatin1(ActionBoxNewStyle)); // setup ActionBox 5 Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager(); - ui->ActionBox5->setIcon(QPixmap(QString::fromAscii(":/icons/document-save.png"))); - ui->ActionBox5->header()->setText(QString::fromAscii("TaskGroup with different scheme")); + ui->ActionBox5->setIcon(QPixmap(QString::fromLatin1(":/icons/document-save.png"))); + ui->ActionBox5->header()->setText(QString::fromLatin1("TaskGroup with different scheme")); rcCmdMgr.addTo("Std_New", ui->ActionBox5); rcCmdMgr.addTo("Std_Open", ui->ActionBox5); rcCmdMgr.addTo("Std_Save", ui->ActionBox5); - ui->ActionBox5->setStyleSheet(QString::fromAscii(ActionBoxNewStyle)); + ui->ActionBox5->setStyleSheet(QString::fromLatin1(ActionBoxNewStyle)); } { Ui_TaskGroup* ui(new Ui_TaskGroup); @@ -512,22 +512,22 @@ TaskPanelView::TaskPanelView(QWidget *parent) // create ActionGroups on ActionPanel QIcon save = QIcon::fromTheme(QString::fromLatin1("document-save")); - QSint::ActionGroup *group1 = ui->ActionPanel->createGroup(save.pixmap(24,24), QString::fromAscii("Expandable Group")); + QSint::ActionGroup *group1 = ui->ActionPanel->createGroup(save.pixmap(24,24), QString::fromLatin1("Expandable Group")); group1->addAction(ui->actionNew); group1->addAction(ui->actionLoad); - group1->addWidget(new QPushButton(QString::fromAscii("Just a button"), this)); + group1->addWidget(new QPushButton(QString::fromLatin1("Just a button"), this)); group1->addAction(ui->actionSave); group1->addAction(ui->actionPrint); - group1->addWidget(new QPushButton(QString::fromAscii("Just another button"), this)); + group1->addWidget(new QPushButton(QString::fromLatin1("Just another button"), this)); QIcon redo = QIcon::fromTheme(QString::fromLatin1("edit-redo")); - QSint::ActionGroup *group2 = ui->ActionPanel->createGroup(redo.pixmap(24,24), QString::fromAscii("Non-Expandable Group"), false); + QSint::ActionGroup *group2 = ui->ActionPanel->createGroup(redo.pixmap(24,24), QString::fromLatin1("Non-Expandable Group"), false); group2->addAction(ui->actionNew); group2->addAction(ui->actionLoad); group2->addAction(ui->actionSave); group2->addAction(ui->actionPrint); - ui->ActionPanel->addWidget(new QLabel(QString::fromAscii("Action Group without header"), this)); + ui->ActionPanel->addWidget(new QLabel(QString::fromLatin1("Action Group without header"), this)); QSint::ActionGroup *group3 = ui->ActionPanel->createGroup(); group3->addAction(ui->actionNew); @@ -585,7 +585,7 @@ TaskPanelView::TaskPanelView(QWidget *parent) QGridLayout* gridLayout = new QGridLayout(this); iisTaskPanel *taskPanel = new iisTaskPanel(this); iisTaskBox *tb1 = new iisTaskBox( - QPixmap(QString::fromAscii(":/icons/document-save.svg")),QLatin1String("Expandable Group"),true, this); + QPixmap(QString::fromLatin1(":/icons/document-save.svg")),QLatin1String("Expandable Group"),true, this); taskPanel->addWidget(tb1); gridLayout->addWidget(taskPanel, 0, 0, 2, 1); @@ -678,7 +678,7 @@ TaskPanelView::~TaskPanelView() void TaskPanelView::executeAction() { - QMessageBox::about(0, QString::fromAscii("Action clicked"), QString::fromAscii("Do something here :)")); + QMessageBox::about(0, QString::fromLatin1("Action clicked"), QString::fromLatin1("Do something here :)")); } void TaskPanelView::on_rbDefaultScheme_toggled(bool b) diff --git a/src/Mod/Sandbox/Gui/Workbench.cpp b/src/Mod/Sandbox/Gui/Workbench.cpp index 9f732814e..e2de1b877 100644 --- a/src/Mod/Sandbox/Gui/Workbench.cpp +++ b/src/Mod/Sandbox/Gui/Workbench.cpp @@ -51,7 +51,7 @@ Workbench::Workbench() { // Tree view Gui::DockWindow* tree = new Gui::DockWindow(0, Gui::getMainWindow()); - tree->setWindowTitle(QString::fromAscii("Tree view")); + tree->setWindowTitle(QString::fromLatin1("Tree view")); Gui::TreeView* treeWidget = new Gui::TreeView(tree); treeWidget->setRootIsDecorated(false); ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/TreeView"); @@ -63,7 +63,7 @@ Workbench::Workbench() pLayout->addWidget(treeWidget, 0, 0); tree->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Tree view (MVC)"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Tree view (MVC)"))); tree->setMinimumWidth(210); Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); pDockMgr->registerDockWindow("Std_TreeViewMVC", tree); diff --git a/src/Tools/ImageTools/ImageConv/imageconv.cpp b/src/Tools/ImageTools/ImageConv/imageconv.cpp index c644f832e..99dc7df42 100644 --- a/src/Tools/ImageTools/ImageConv/imageconv.cpp +++ b/src/Tools/ImageTools/ImageConv/imageconv.cpp @@ -83,7 +83,7 @@ bool CImageConvApp::Save(const QString& fn) { if (!fn.isEmpty()) { - return m_clPixmap.save(fn, ext.toUpper().toAscii()); + return m_clPixmap.save(fn, ext.toUpper().toLatin1()); } } @@ -113,7 +113,7 @@ bool CImageConvApp::ConvertToXPM(bool bAppendToFile) cout << "Try converting to XPM..." << endl; if (list.count() == 0) { - cout << "Cannot find " << (const char*)m_Dir.nameFilters().join(" ").toAscii() << endl; + cout << "Cannot find " << (const char*)m_Dir.nameFilters().join(" ").toLatin1() << endl; return false; } @@ -126,7 +126,7 @@ bool CImageConvApp::ConvertToXPM(bool bAppendToFile) if (m_Output == *it) continue; // if the file is the output file itself - cout << "Converting " << (const char*)(*it).toAscii() << " ..."; + cout << "Converting " << (const char*)(*it).toLatin1() << " ..."; if (Load(*it) == true) { @@ -250,21 +250,21 @@ bool CImageConvApp::AppendToFile(const QString& file) void CImageConvApp::Error() { - cerr << "Usage: " << (const char*)m_Executable.toAscii() << " [OPTION(S)] -i input file(s) {-o output file}" << endl; - cerr << "Try '" << (const char*)m_Executable.toAscii() << " --help' for more information." << endl; + cerr << "Usage: " << (const char*)m_Executable.toLatin1() << " [OPTION(S)] -i input file(s) {-o output file}" << endl; + cerr << "Try '" << (const char*)m_Executable.toLatin1() << " --help' for more information." << endl; exit(0); } void CImageConvApp::Version() { - cerr << (const char*)m_Executable.toAscii() << " 1.0.0 " << endl; + cerr << (const char*)m_Executable.toLatin1() << " 1.0.0 " << endl; exit(0); } void CImageConvApp::Usage() { - cerr << "Usage: " << (const char*)m_Executable.toAscii() << " [OPTION(S)] -i input file(s) {-o output file}\n" << endl; + cerr << "Usage: " << (const char*)m_Executable.toLatin1() << " [OPTION(S)] -i input file(s) {-o output file}\n" << endl; cerr << "Options:" << endl; cerr << " -i \tSpecify the input file(s).\n" @@ -297,7 +297,7 @@ void CImageConvApp::Usage() cerr << "This program supports the following image formats:\n" " BMP, GIF, JPEG, MNG, PNG, PNM, XBM and XPM\n\n" - << (const char*)m_Executable.toAscii() << " uses Qt Version " << qVersion() << "\n" + << (const char*)m_Executable.toLatin1() << " uses Qt Version " << qVersion() << "\n" "Qt can be downloaded at http://www.trolltech.com." << endl; exit(0); diff --git a/src/Tools/ImageTools/ImageConv/main.cpp b/src/Tools/ImageTools/ImageConv/main.cpp index 7ce23857a..d65f399fc 100644 --- a/src/Tools/ImageTools/ImageConv/main.cpp +++ b/src/Tools/ImageTools/ImageConv/main.cpp @@ -136,7 +136,7 @@ int main( int argc, char **argv ) } catch(const CICException& e) { - cerr << (const char*)e.what().toAscii() << endl; + cerr << (const char*)e.what().toLatin1() << endl; CImageConvApp::Error(); } catch(...) diff --git a/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp b/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp index 0a1a53253..5144194c6 100644 --- a/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp +++ b/src/Tools/plugins/imageformats/svg/qsvgiohandler.cpp @@ -111,13 +111,13 @@ bool QSvgIOHandlerPrivate::load(QIODevice *device) loaded = true; } #else - webView.setContent(device->readAll(), QString::fromAscii("image/svg+xml")); - QString node = QString::fromAscii("document.rootElement.nodeName"); + webView.setContent(device->readAll(), QString::fromLatin1("image/svg+xml")); + QString node = QString::fromLatin1("document.rootElement.nodeName"); QString root = webView.page()->mainFrame()->evaluateJavaScript(node).toString(); if (!root.isEmpty() && root.compare(QLatin1String("svg"), Qt::CaseInsensitive) == 0) { - QString w = QString::fromAscii("document.rootElement.width.baseVal.value"); - QString h = QString::fromAscii("document.rootElement.height.baseVal.value"); + QString w = QString::fromLatin1("document.rootElement.width.baseVal.value"); + QString h = QString::fromLatin1("document.rootElement.height.baseVal.value"); double ww = webView.page()->mainFrame()->evaluateJavaScript(w).toDouble(); double hh = webView.page()->mainFrame()->evaluateJavaScript(h).toDouble();