From 21f15207fbc352604d25ac4f6770bf507e63a5b9 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 12:44:42 +0100 Subject: [PATCH 01/44] Fixes: fakevim: more 'z' commands --- src/plugins/fakevim/fakevimhandler.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 591b307d960..b63ebd90627 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -688,17 +688,27 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, indentRegion(m_tc.block(), m_tc.block().next()); finishMovement(); } else if (m_submode == ZSubMode) { - if (key == Key_Return) { - // cursor line to top of window, cursor on first non-blank + //qDebug() << "Z_MODE " << cursorLineInDocument() << linesOnScreen(); + if (key == Key_Return || key == 't') { // cursor line to top of window + if (!m_mvcount.isEmpty()) + m_tc.setPosition(positionForLine(count())); scrollToLineInDocument(cursorLineInDocument()); - moveToFirstNonBlankOnLine(); + if (key == Key_Return) + moveToFirstNonBlankOnLine(); finishMovement(); - } else if (key == '.') { // center cursor line + } else if (key == '.' || key == 'z') { // cursor line to center of window + if (!m_mvcount.isEmpty()) + m_tc.setPosition(positionForLine(count())); scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); - moveToFirstNonBlankOnLine(); + if (key == '.') + moveToFirstNonBlankOnLine(); finishMovement(); - } else if (key == 'z') { // center cursor line - scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); + } else if (key == '-' || key == 'b') { // cursor line to bottom of window + if (!m_mvcount.isEmpty()) + m_tc.setPosition(positionForLine(count())); + scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() - 1); + if (key == '-') + moveToFirstNonBlankOnLine(); finishMovement(); } else { qDebug() << "IGNORED Z_MODE " << key << text; From bd15f2b308eebf54be1ed4dea23f1b8f349f41c1 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 27 Jan 2009 12:49:44 +0100 Subject: [PATCH 02/44] Fixes: Set alternate base on light themes Details: Not all themes have ok contrast for alternate base and we want to keep it light, so I'm enforcing it for themes with white background. --- src/plugins/projectexplorer/projecttreewidget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index f08885ab6b9..1da33786a2f 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -48,6 +48,7 @@ #include #include #include +#include using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; @@ -74,6 +75,11 @@ public: setUniformRowHeights(true); setTextElideMode(Qt::ElideNone); setAlternatingRowColors(true); + QPalette pal = palette(); + if (pal.base().color() == Qt::white) { // Leave dark themes as they are + pal.setBrush(QPalette::AlternateBase, QColor(239, 239, 239)); + setPalette(pal); + } setProperty("AlternateEmpty", true); // Let Manhattan to override style default // setExpandsOnDoubleClick(false); } From 4038641db3eb272e555c5c39b796e28d1a6083f2 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 27 Jan 2009 13:00:27 +0100 Subject: [PATCH 03/44] Fixes: Desaturate qt file icon a bit --- .../qt4projectmanager/images/qt_project.png | Bin 613 -> 623 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/plugins/qt4projectmanager/images/qt_project.png b/src/plugins/qt4projectmanager/images/qt_project.png index 3a1bfa5fda47a4a651e977e13d6eed5031b049bc..fc05f588abbc08d7d4f5f45c1603021e60de1355 100644 GIT binary patch delta 537 zcmaFL@}6ZvVm-GtC)cuNA`A?S?>$`{Lo80WPTrp#94KKcwAtas=%qFXH`}hWYp0*Ay6QyAR|-TA~i#3iSq_UKCZvqyE?j8Bv+VZ+}r)! zrhWQ%504e>?+WVYoc~#Oes8(j{PUmpXKalU&Yt(2QGhkWM5?}Gp1EPyQKg+ReGxit zd*kMF^)sz_<+5oNQ-Ib~1_>Uv;Hf=~ZjOu!6FpicWR@*rP%@gfVpRtRL#xxnBma6B znOK#a_TOI~qu1^by7czjqKE%(zGMh}diP$m+3eRgdw2iJUA^<8^oAy5M;8lLhhO(9 z`@Yr1NipY`UEjIO=6qOj{o~(BYNp$#c*e?wibe!~e4hP#=V6ToL$#b+kIq)|@z?3- zqy}wXbt>k+S%1DQr)Y|{_LkMMarI{sdkU2q6*6XZ@e3^u+x%7A=UiAALq@nY!=7E6 z-%BL>xifLEd;P0Zi=nS7$@lfI-~QGNdsgTt_b7%W-2S#<)A}P4#$Ruh@z-x_{%e11 zMg_}((%7oK^Y%ZC-sp0~^5s9*BZ7kWn{sbk^cjad2sc|-@b}ovfT9Ps9p?S}qLeOm zGhN9topka^z$}I%u4gyyN|OD1S2gsD{v0+HyL9N)IZ>A->sQ66HRV@+JZQ-v wXXmY~htDve# z`xZBuCY1!vrE^`5c#50HI-R`~+QK87R9MJ0Nq(`AFPq>&dk4oOzH=WfcKmeD^10=b z?}!&Y_GNQ@z~Jr87OS z3J7gGta$tOZNm#^UVN>Zv#YSk?7*2D*>(%>tt;GJ^1XO(>~FS;cW3Tz+qCh>a`F56 zJ`AtkO09k^`ReVh=~us=>8#JuD>mH3(ajU=eAXZ|i%Vd|N^|euo3H<7u*rybbLp`DP+QL o287PpZC>!hi2ux+hxspG7kplN`RY>!1_lNWPgg&ebxsLQ0K`A|u>b%7 From f449bc6f91a1e44237bc1ea9075b61862ed50405 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 13:23:02 +0100 Subject: [PATCH 04/44] Fixes: fakevim: fix cursor positioning after search --- src/plugins/fakevim/fakevimhandler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index b63ebd90627..65333413d20 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1582,10 +1582,14 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward) if (forward) m_tc.movePosition(Right, MoveAnchor, 1); + int oldLine = cursorLineInDocument() - cursorLineOnScreen(); + EDITOR(setTextCursor(m_tc)); if (EDITOR(find(needle, flags))) { m_tc = EDITOR(textCursor()); m_tc.setPosition(m_tc.anchor()); + if (oldLine != cursorLineInDocument() - cursorLineOnScreen()) + scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); return; } @@ -1594,6 +1598,8 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward) if (EDITOR(find(needle, flags))) { m_tc = EDITOR(textCursor()); m_tc.setPosition(m_tc.anchor()); + if (oldLine != cursorLineInDocument() - cursorLineOnScreen()) + scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); if (forward) showRedMessage("search hit BOTTOM, continuing at TOP"); else From 4362285c8a0ab6ae9d2e8d845bf97457b255fdba Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 27 Jan 2009 13:36:01 +0100 Subject: [PATCH 05/44] Fixes: Improved outputpane buttons Details: I was not entirely happy about how they looked. This should fix a text centering issue as well as improve shadows and reduce hover glare. I also made them slightly transparent to blend them into the background color a bit. --- src/plugins/coreplugin/images/panel_button.png | Bin 442 -> 472 bytes .../coreplugin/images/panel_button_checked.png | Bin 407 -> 434 bytes .../images/panel_button_checked_hover.png | Bin 407 -> 483 bytes .../coreplugin/images/panel_button_hover.png | Bin 439 -> 518 bytes .../coreplugin/images/panel_button_pressed.png | Bin 440 -> 466 bytes src/plugins/coreplugin/outputpane.cpp | 2 +- 6 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/images/panel_button.png b/src/plugins/coreplugin/images/panel_button.png index a101043f41678b9ae897e322cb3dadf0a311e8fe..76793ca29256d3d30691f415585a282850969e5c 100644 GIT binary patch delta 446 zcmdnRe1my{NGZx^prw85kJYlDyqr7{K7C^X_^E1_sUokH}&M25w;xW@MN( zM}mQYfxX1j*OmPyqco3#bsmRSHvgr|#RNXEUlvmCRU14LZ=A2~=VPHE9O5U44_ zE@^Smc1QC%)dx&g+Dj+rEeK#Q6;+)4PH{q1lt{hO%qRc-wtQZdF{S*0zxrb$k3l$5r-t$Ufo4{l-}~yNSs42so2=V$Gv`L$_UR>_i>-E9O?JxO>oe(z zU0-r4V|k)Pk=0xa8NObwUF)hRexI|bqCS2_qJXPlp^Up&!mVv*>-Oiz1Zb*0G?Td= zmU=eKDP!%@`l-xHN`9^`OGC5;RsD{3I)(e$%s;<&u13$`LSZkyKg6Q z%wF61JgTe~DWM4f3iP}H delta 416 zcmcb?yo-5)O1)%>YeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_s6$PZ!6K zid%1H?agX&5NTb%Yr_VvrU_b4r*(UXG`03`%%8BFohb&&e~BICEB??kM1knVYuELjHMGpy>I}JW5r`Pd8uUh^p_}7a<$DcioMrcemx< zFO<1dTKlE5{cz(XmBy`;LPU<%in!`0N@U4ATKsxfNT}%3O1oDF?&g*6H1}mLS3POK zbL;*0BMNqf9k0?hFVs2h5qdR{y{q=H!GT!MtlQt1CcW%)R&fnFo2F20x5oNeZxF9=`c!tP>yw4`e8 zk#(;hyqRGZx^prw85kJYlDyqr7{K7C^X_^E1_sUokH}&M25w;xW@MN( zM}mQYfxX1j*OmPyqco4GsdnR0D+UHeBTpB{kc@k8XKl=C4q$NgZ)%>>;IT@6!pe}Y z=4S6d?f)F@UH>%aEiF08FS6?k|E3)~O3FkpiNw?|N;$dNoB8dkD-#ONf7)h!=l8o- z_Ix4Ni=rEt@)|TB#r$Bp*XYh&(fRmC+0GcF*=MV?(<0qwE!$M4Qnvf<*Q&jBCqCba zI1oEY<<0kMv)R7-2ahH(Iz&z@Dp!#?uIMTB$!7odhLyRuLqe}cUy%6xT;#uh?DZY% zxF19@#9rs+T2TMmsB^i}8`leby&*m;*z{w#uYeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_nk;PZ!6K zid%1HZOm#35O8(BA0{Qh;^>j7sT9Z|_Rp7Vzv7b9@i%g(=0|u4Z}3)6TI;JIz#_=H zdP1f58)5kwrgyl*=O6VkY~QK0;%H%wtBZQsAu*P>uK912>wkYdF#Wj#$0P%ulO|`c z%6_(4u5;SpR-UZq#ZlFV5`43YdDx3g#dPL$lo#gOype#T65 zvyc08loXWw1eZ@2SpKQhkz?T)toZZo1>##?nWBzBG z*V}S~?|<*OJom&Vous@^KNJ=BiMdW(lIbGZx^prw85kJYlDyqr7{K7C^X_^E1_sUokH}&M25w;xW@MN( zM}mQYfxX1j*OmPyqco2gN5qj^FBljYlRaG=Lo)8YowYHmIY6SdUp!DiP_@{oO-jS> zyRBE;5%vP}zOx}#TfL7vP2cA->Eth_b<2V_X&BZ&x%IN_#gwX}AwTy2{oh_}^M7aa zt+dS>!&YDY{IX;h;{k^rreimjKel-9Iq6RJ>8GDkH%73`DUO(Swen@vUN?!hCGQ+U zLR;UKb=#bu|7BTbp5=23x&9mPzt0srmuAf1Fz@-2cMcYP%;zjGne4sHXmHsiP{j3l zs}l!&wRGAJ)5kCUh|xHKsh;;BmK9b6*!@(KH_! zv6bKbg+hP%oC{Kqv+R8SIr3+Bz)i<56I@;$nW#SToaWqMtL6V6&bjn@iq%9Ad~w#r zOKGNuTHH;S!0V=;ZTM3oFC9)(@lg}LQp$Vm#`HXiWA4*Z8{a$qo^k%US9j?1&eJPb zaYar$Sb8@+cl+(gLK%BAU*U$j^AcwzQ+q_WT-*r@mdP!xH(`njxg HN@xNA@6gOU delta 380 zcmaFNJe_%hO1)%>YeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_nk;PZ!6K zid%1@46|AsME*X`S-Nq9N3zylM*)`{9a|4S!6x55C&Db9ReZI${S!BDnB*qHJ$r(^ z_pjc)uD|1mdbhZx3<;3+~ubwczKaVMr`=2-}hD|${e45b&K2&>m~(-rPAF$mbjF} zTwj_f;lYu3^~N^29deH?f<#=is@J=y952)}X9epZ}3! or)8XIGyCAopT}zc2_`Vq&a-=dg=x&kwUQJP0lvt?CQ69WTdo2QFoNXEUlvo>ZQau7MTzr2ORJ(SPN+Do)6 z_#fx;NB>2hTTS(QJ85G8M``)_u>V~V(R{2YGvC$kdXctJ%JcGvx`N<7_V2Yd@9#Ql zcnV3jJ^Wm@doQEHfjK_&o+~JEe6;?#X6uD0<m@3|e$IPyX+=+iw?a{bz7& z595yI7c)e@{{HJIz%n6dUhRaFDNPoAtC#4$oql`$EyKBfg02@Qr}ymSZDNR=mbfuu zPUxD;FGD`|Y&ETaf1tp^Mdo<99K*#7lL^aS-aNWy>z&~L9GXi%-RSt=&(3ger<2-0 zlQ}bme79T^GnyD2Gf_p%Q&@eYlINMvb0(iK7Bo1vVUg;i-~XQ8)>Plb_I8TznuB1% zCq?-5(*@sM)0ON^Pd!~=u0GNCiAvZ}m)$pWT7tMvKiw3NuUC|MIMuISdENDFfs50h z|Ni&8#!miAm2JuHyH2gM&#JAC7FvCkYx7N>wPCMYC#g(){PD*{31bJ_y7LOzZ?_h| s<6`LW;8wJIowi6oDb#CkTjGxoyw&?zCx`EwrV5HhPgg&ebxsLQ0GKP`00000 delta 413 zcmZo;+0HycrCzecHKHUqKdq!Zu_%?nF(p4KRlzeiF+DXXH8G{K@MNkD0|R5Er;B4q z#jQ8946|At1lo?9igh*lN?opOZdXW3ekr-8xNCx*+~H@Tnn##jE-mSszJb#vC?h#> zVcPSFXBk7nru38p{-0!6sLgp}#s|IO2fSG?1%5gDy8hJbr+xAFYVY$OGGIBq zN$mZMWtt(OuGhSRu9xyx&a+RCT&Cn=-=!qc#`tPi+?Iu}cRg8^a&sH6=Ol*q9~}ZS z6D2N~@M?5z%6gnR>qKm)k?)+Af_{NU!?M*&h0dS*>~rqj0%;eY2T~nM2dB8~6gp$p z>ft#>`{DOxZ>LPs2v@SH|1S_48p}Izl7@Zj?Crre%O*VWylj%SeEICo=q1r*Du;)2N*i0 X)~DaSb*Yenfq}u()z4*}Q$iB}EG)x9 diff --git a/src/plugins/coreplugin/images/panel_button_pressed.png b/src/plugins/coreplugin/images/panel_button_pressed.png index b92a1dda0cd92dc9edc9b56097b71a0088169cca..dc522d2387804e3dee50185190b7ef6a85dae6f4 100644 GIT binary patch delta 440 zcmdnNe2IC2NGZx^prw85kJYlDyqr7{K7C^X_^E1_sUokH}&M25w;xW@MN( zM}mQYfxX1j*OmPyqco4W@abJjt_%!}L7py-AsP4H&a%xq>>$!&?|IvU$=Rjg@g?65 z0jAxhONF1X?VQkE;<)4^D^up8umpKU_6b_ziUReomv4}^^c7=zsj_+F;orY%kM^XM zg|9K4f8I8M^$vsCp`{-f_b~BuRdg+SVb+&ibN{`qp>OcC(@QjH}}cBpus`25F@aoh7s5!c4t@7ck7&u!8PydEPo z(?^XV+^hTk_4)(zpYhIA{Bk`u^JBZjg6mzKX&0;Jn{);(ub<(v^783tOG;l^^l4;u zJpTCO_7O$43}OEE<`vl!*1cZh_q0T-v?^}-<>0F;RX)nc7#?xi`G))X1ecq_OZ{3I zOK-jXUTw|6RJQx>0)3~t-7^oD#@^b-`Xl7P?X=CE;@zy5UzS{WVEC~@=atl=Ra%>L sm@BsJo1ebKp~vR@4wZY2;txJ@FIwdOQ$uKqA1FpVUHx3vIVCg!0Mg~bssI20 delta 414 zcmcb_yn}gyO1)%>YeY$Kep*R+Vo@rCV@iHfs)A>3VtQ&&YGO)d;mK4R1_s6`PZ!6K zid%1@c4xIZh}hUknMQDI+_*(#q6Q1McD-u6;H9PC*x%$$^`GFt)m-+IGgqn6WFJ?q z$!-(h8X_7!ulQz|%OR z!rk{tYGm6YjfUqxLwTo{${b&~>y4Tq&*246x9;fJf9=5iXSpvMBi8TU(Xsz%L#pnq z6Jp)>cKazEdnpehHr8*W$lfApL1)Dc_n1Q}kE{hBi)>W%Tb?LU;d^<(y4Sw`EOlkc?4FYryswU`3lhHn z$>w{r0>fn!bJJ_3vR6}EmSrk<3PsJ^G5@}C9B2NEfQ2^g2iYGAKm0pgoPn7^o!vbl Udrt=!0|Nttr>mdKI;Vst02@KLs{jB1 diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index f983f5b15d9..8ced09f0482 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -520,7 +520,7 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent *event) QPushButton::paintEvent(event); const QFontMetrics fm = fontMetrics(); - const int baseLine = (height() - fm.height()) / 2 + fm.ascent(); + const int baseLine = (height() - fm.height() + 1) / 2 + fm.ascent(); const int numberWidth = fm.width(m_number); QPainter p(this); From 9d8fc28706eaf3b725810b7f99855f9df34eac68 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 14:08:17 +0100 Subject: [PATCH 06/44] Fixes: fakevim: show column/line information in standalone application --- src/plugins/fakevim/fakevimhandler.cpp | 29 ++++++++++---------- tests/manual/fakevim/main.cpp | 37 +++++++++++++++++++++----- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 65333413d20..d8cbeff59e4 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -893,6 +893,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, moveDown(qMax(count() - 1, 0)); moveRight(rightDist()); finishMovement(); + } else if (key == control('d')) { + int sline = cursorLineOnScreen(); + // FIXME: this should use the "scroll" option, and "count" + moveDown(linesOnScreen() / 2); + moveToFirstNonBlankOnLine(); + scrollToLineInDocument(cursorLineInDocument() - sline); + finishMovement(); } else if (key == 'e') { m_moveType = MoveInclusive; moveToWordBoundary(false, true); @@ -1068,6 +1075,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, // FIXME: this is non-vim, but as Ctrl-R is taken globally // we have a substitute here redo(); + } else if (key == control('u')) { + int sline = cursorLineOnScreen(); + // FIXME: this should use the "scroll" option, and "count" + moveUp(linesOnScreen() / 2); + moveToFirstNonBlankOnLine(); + scrollToLineInDocument(cursorLineInDocument() - sline); + finishMovement(); } else if (key == 'v') { enterVisualMode(VisualCharMode); } else if (key == 'V') { @@ -1137,20 +1151,6 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } recordInsertText(str); recordEndGroup(); - } else if (key == control('d')) { - int sline = cursorLineOnScreen(); - // FIXME: this should use the "scroll" option, and "count" - moveDown(linesOnScreen() / 2); - moveToFirstNonBlankOnLine(); - scrollToLineInDocument(cursorLineInDocument() - sline); - finishMovement(); - } else if (key == control('u')) { - int sline = cursorLineOnScreen(); - // FIXME: this should use the "scroll" option, and "count" - moveUp(linesOnScreen() / 2); - moveToFirstNonBlankOnLine(); - scrollToLineInDocument(cursorLineInDocument() - sline); - finishMovement(); } else if (key == Key_PageDown || key == control('f')) { moveDown(count() * (linesOnScreen() - 2)); finishMovement(); @@ -1588,6 +1588,7 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward) if (EDITOR(find(needle, flags))) { m_tc = EDITOR(textCursor()); m_tc.setPosition(m_tc.anchor()); + // making this unconditional feels better, but is not "vim like" if (oldLine != cursorLineInDocument() - cursorLineOnScreen()) scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); return; diff --git a/tests/manual/fakevim/main.cpp b/tests/manual/fakevim/main.cpp index 2de37c10733..a78453528a2 100644 --- a/tests/manual/fakevim/main.cpp +++ b/tests/manual/fakevim/main.cpp @@ -17,8 +17,8 @@ class Proxy : public QObject Q_OBJECT public: - Proxy(QWidget *widget, QObject *parent = 0) - : QObject(parent), m_widget(widget) + Proxy(QWidget *widget, QMainWindow *mw, QObject *parent = 0) + : QObject(parent), m_widget(widget), m_mainWindow(mw) {} public slots: @@ -30,13 +30,35 @@ public slots: ed->setExtraSelections(s); } + void changeStatusData(const QString &info) + { + m_statusData = info; + updateStatusBar(); + } + + void changeStatusMessage(const QString &info) + { + m_statusMessage = info; + updateStatusBar(); + } + void changeExtraInformation(const QString &info) { QMessageBox::information(m_widget, "Information", info); } + + void updateStatusBar() + { + int slack = 80 - m_statusMessage.size() - m_statusData.size(); + QString msg = m_statusMessage + QString(slack, QChar(' ')) + m_statusData; + m_mainWindow->statusBar()->showMessage(msg); + } private: QWidget *m_widget; + QMainWindow *m_mainWindow; + QString m_statusMessage; + QString m_statusData; }; int main(int argc, char *argv[]) @@ -64,11 +86,11 @@ int main(int argc, char *argv[]) //widget->resize(450, 350); widget->setFocus(); - Proxy proxy(widget); + QMainWindow mw; + Proxy proxy(widget, &mw); FakeVimHandler handler(widget, 0); - QMainWindow mw; mw.setWindowTitle("Fakevim (" + title + ")"); mw.setCentralWidget(widget); mw.resize(600, 650); @@ -85,15 +107,16 @@ int main(int argc, char *argv[]) mw.statusBar()->setFont(font); QObject::connect(&handler, SIGNAL(commandBufferChanged(QString)), - mw.statusBar(), SLOT(showMessage(QString))); + &proxy, SLOT(changeStatusMessage(QString))); QObject::connect(&handler, SIGNAL(quitRequested()), &app, SLOT(quit())); QObject::connect(&handler, SIGNAL(selectionChanged(QList)), &proxy, SLOT(changeSelection(QList))); - QObject::connect(&handler, - SIGNAL(extraInformationChanged(QString)), + QObject::connect(&handler, SIGNAL(extraInformationChanged(QString)), &proxy, SLOT(changeExtraInformation(QString))); + QObject::connect(&handler, SIGNAL(statusDataChanged(QString)), + &proxy, SLOT(changeStatusData(QString))); handler.setupWidget(); if (args.size() >= 1) From e71c9807e3b3a00d9cf1d5668f622fb7aa767632 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 14:50:36 +0100 Subject: [PATCH 07/44] Fixes: fakevim: use proper QObject parent for handler Details: before that it was the plugin, so there was a lot of inactive handlers left around --- src/plugins/fakevim/fakevimhandler.cpp | 4 ---- src/plugins/fakevim/fakevimplugin.cpp | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index d8cbeff59e4..c77eb149b7d 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -2114,10 +2114,6 @@ FakeVimHandler::~FakeVimHandler() bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev) { - //if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::ShortcutOverride) - // qDebug() << ob << ev->type() << qApp << d->editor() - // << QEvent::KeyPress << QEvent::ShortcutOverride; - if (ev->type() == QEvent::KeyPress && ob == d->editor()) return d->handleEvent(static_cast(ev)); diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index d1ab5b40630..329c965318f 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -187,7 +187,7 @@ void FakeVimPluginPrivate::installHandler(Core::IEditor *editor) { QWidget *widget = editor->widget(); - FakeVimHandler *handler = new FakeVimHandler(widget, this); + FakeVimHandler *handler = new FakeVimHandler(widget, widget); connect(handler, SIGNAL(extraInformationChanged(QString)), this, SLOT(showExtraInformation(QString))); From d21668d86883b3f192db97ff00bfb89429cb5e2e Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 27 Jan 2009 14:53:42 +0100 Subject: [PATCH 08/44] Fixes: Run from the sidebar running the wrong project. Task: 242196 Details: Introduced while fixing the run from context menu runs wrong project fix. --- src/plugins/projectexplorer/projectexplorer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index a9d4e2fc208..1c013f0222c 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -517,6 +517,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er cmd = am->registerAction(m_runAction, Constants::RUN, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); mbuild->addAction(cmd, Constants::G_BUILD_RUN); + modeManager->addAction(cmd, Constants::P_ACTION_RUN, m_runConfigurationMenu); m_runActionContextMenu = new QAction(runIcon, tr("Run"), this); cmd = am->registerAction(m_runActionContextMenu, Constants::RUNCONTEXTMENU, globalcontext); @@ -533,8 +534,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er connect(mbuild->menu(), SIGNAL(aboutToShow()), this, SLOT(populateRunConfigurationMenu())); connect(m_runConfigurationMenu, SIGNAL(triggered(QAction *)), this, SLOT(runConfigurationMenuTriggered(QAction *))); - modeManager->addAction(cmd, Constants::P_ACTION_RUN, m_runConfigurationMenu); - // jump to next task m_taskAction = new QAction(tr("Go to Task Window"), this); m_taskAction->setIcon(QIcon(Core::Constants::ICON_NEXT)); From e33c21934a9a42fdd6938094cdeb8e9882e8847e Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 27 Jan 2009 15:01:25 +0100 Subject: [PATCH 09/44] Fixes: Kill alternate row colors Details: It was worth a try but it seems redundant, so we might as well kill it. --- src/plugins/projectexplorer/projecttreewidget.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 1da33786a2f..859cef01af1 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -74,13 +74,6 @@ public: setContextMenuPolicy(Qt::CustomContextMenu); setUniformRowHeights(true); setTextElideMode(Qt::ElideNone); - setAlternatingRowColors(true); - QPalette pal = palette(); - if (pal.base().color() == Qt::white) { // Leave dark themes as they are - pal.setBrush(QPalette::AlternateBase, QColor(239, 239, 239)); - setPalette(pal); - } - setProperty("AlternateEmpty", true); // Let Manhattan to override style default // setExpandsOnDoubleClick(false); } From fd90f88866f8b199d6e0d728015a56b48da59c1d Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 15:09:56 +0100 Subject: [PATCH 10/44] Fixes: fakevim: disable main cursor in search mode --- src/plugins/fakevim/fakevimhandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index c77eb149b7d..6eb7d3e1b01 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -780,6 +780,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, m_commandHistoryIndex = m_commandHistory.size() - 1; updateMiniBuffer(); } else if (key == '/' || key == '?') { + enterExMode(); // to get the cursor disabled m_mode = (key == '/') ? SearchForwardMode : SearchBackwardMode; m_commandBuffer.clear(); m_searchHistory.append(QString()); From 5e941eec3758c15f0a93abaed919b5baa12dd227 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 15:17:03 +0100 Subject: [PATCH 11/44] Fixes: fakevim: make 'd' use the yank buffer also in visual line mode Details: --- src/plugins/fakevim/fakevimhandler.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 6eb7d3e1b01..7e24d7d5068 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -880,13 +880,12 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, m_opcount = m_mvcount; m_mvcount.clear(); m_submode = DeleteSubMode; - } else if (key == 'd') { - //setAnchor(); + } else if (key == 'd' && m_visualMode == VisualLineMode) { leaveVisualMode(); int beginLine = lineForPosition(m_marks['<']); int endLine = lineForPosition(m_marks['>']); selectRange(beginLine, endLine); - recordRemoveSelectedText(); + m_registers[m_register] = recordRemoveSelectedText(); } else if (key == 'D') { setAnchor(); recordBeginGroup(); From 5dbcc615c210ad24a9abff4c7340ae64a65b75ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 27 Jan 2009 15:12:32 +0100 Subject: [PATCH 12/44] Split up general text editor settings The page had grown too large so now the display settings have been split off onto their own page. --- .../cpptools/completionsettingspage.ui | 61 +++-- .../texteditor/behaviorsettingspage.cpp | 187 ++++++++++++++ ...lsettingspage.h => behaviorsettingspage.h} | 27 +- ...ettingspage.ui => behaviorsettingspage.ui} | 89 +------ .../texteditor/displaysettingspage.cpp | 153 +++++++++++ src/plugins/texteditor/displaysettingspage.h | 87 +++++++ src/plugins/texteditor/displaysettingspage.ui | 116 +++++++++ .../texteditor/generalsettingspage.cpp | 237 ------------------ src/plugins/texteditor/texteditor.pro | 11 +- src/plugins/texteditor/texteditorsettings.cpp | 46 ++-- src/plugins/texteditor/texteditorsettings.h | 8 +- 11 files changed, 637 insertions(+), 385 deletions(-) create mode 100644 src/plugins/texteditor/behaviorsettingspage.cpp rename src/plugins/texteditor/{generalsettingspage.h => behaviorsettingspage.h} (77%) rename src/plugins/texteditor/{generalsettingspage.ui => behaviorsettingspage.ui} (78%) create mode 100644 src/plugins/texteditor/displaysettingspage.cpp create mode 100644 src/plugins/texteditor/displaysettingspage.h create mode 100644 src/plugins/texteditor/displaysettingspage.ui delete mode 100644 src/plugins/texteditor/generalsettingspage.cpp diff --git a/src/plugins/cpptools/completionsettingspage.ui b/src/plugins/cpptools/completionsettingspage.ui index 372c225943f..c71a2abc821 100644 --- a/src/plugins/cpptools/completionsettingspage.ui +++ b/src/plugins/cpptools/completionsettingspage.ui @@ -15,33 +15,42 @@ - - - &Case-sensitive completion - - - true - - - - - - - &Automatically insert braces - - - true - - - - - - - Autocomplete common &prefix - - - true + + + Completion Settings + + + + + &Case-sensitive completion + + + true + + + + + + + &Automatically insert braces + + + true + + + + + + + Autocomplete common &prefix + + + true + + + + diff --git a/src/plugins/texteditor/behaviorsettingspage.cpp b/src/plugins/texteditor/behaviorsettingspage.cpp new file mode 100644 index 00000000000..be3cf2ddf27 --- /dev/null +++ b/src/plugins/texteditor/behaviorsettingspage.cpp @@ -0,0 +1,187 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include "behaviorsettingspage.h" +#include "interactionsettings.h" +#include "storagesettings.h" +#include "tabsettings.h" +#include "ui_behaviorsettingspage.h" + +#include + +#include + +using namespace TextEditor; + +struct BehaviorSettingsPage::BehaviorSettingsPagePrivate +{ + explicit BehaviorSettingsPagePrivate(const BehaviorSettingsPageParameters &p); + + const BehaviorSettingsPageParameters m_parameters; + Ui::BehaviorSettingsPage m_page; + TabSettings m_tabSettings; + StorageSettings m_storageSettings; + InteractionSettings m_interactionSettings; +}; + +BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate + (const BehaviorSettingsPageParameters &p) + : m_parameters(p) +{ + if (const QSettings *s = Core::ICore::instance()->settings()) { + m_tabSettings.fromSettings(m_parameters.settingsPrefix, s); + m_storageSettings.fromSettings(m_parameters.settingsPrefix, s); + m_interactionSettings.fromSettings(m_parameters.settingsPrefix, s); + } +} + +BehaviorSettingsPage::BehaviorSettingsPage(const BehaviorSettingsPageParameters &p, + QObject *parent) + : Core::IOptionsPage(parent), + m_d(new BehaviorSettingsPagePrivate(p)) +{ +} + +BehaviorSettingsPage::~BehaviorSettingsPage() +{ + delete m_d; +} + +QString BehaviorSettingsPage::name() const +{ + return m_d->m_parameters.name; +} + +QString BehaviorSettingsPage::category() const +{ + return m_d->m_parameters.category; +} + +QString BehaviorSettingsPage::trCategory() const +{ + return m_d->m_parameters.trCategory; +} + +QWidget *BehaviorSettingsPage::createPage(QWidget *parent) +{ + QWidget *w = new QWidget(parent); + m_d->m_page.setupUi(w); + settingsToUI(); + return w; +} + +void BehaviorSettingsPage::apply() +{ + TabSettings newTabSettings; + StorageSettings newStorageSettings; + InteractionSettings newInteractionSettings; + + settingsFromUI(newTabSettings, newStorageSettings, newInteractionSettings); + + Core::ICore *core = Core::ICore::instance(); + QSettings *s = core->settings(); + + if (newTabSettings != m_d->m_tabSettings) { + m_d->m_tabSettings = newTabSettings; + if (s) + m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s); + + emit tabSettingsChanged(newTabSettings); + } + + if (newStorageSettings != m_d->m_storageSettings) { + m_d->m_storageSettings = newStorageSettings; + if (s) + m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s); + + emit storageSettingsChanged(newStorageSettings); + } + + if (newInteractionSettings != m_d->m_interactionSettings) { + m_d->m_interactionSettings = newInteractionSettings; + if (s) + m_d->m_interactionSettings.toSettings(m_d->m_parameters.settingsPrefix, s); + } +} + +void BehaviorSettingsPage::settingsFromUI(TabSettings &tabSettings, + StorageSettings &storageSettings, + InteractionSettings &interactionSettings) const +{ + tabSettings.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked(); + tabSettings.m_autoIndent = m_d->m_page.autoIndent->isChecked(); + tabSettings.m_smartBackspace = m_d->m_page.smartBackspace->isChecked(); + tabSettings.m_tabSize = m_d->m_page.tabSize->value(); + tabSettings.m_indentSize = m_d->m_page.indentSize->value(); + + storageSettings.m_cleanWhitespace = m_d->m_page.cleanWhitespace->isChecked(); + storageSettings.m_inEntireDocument = m_d->m_page.inEntireDocument->isChecked(); + storageSettings.m_cleanIndentation = m_d->m_page.cleanIndentation->isChecked(); + storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked(); + + interactionSettings.m_useVim = m_d->m_page.useVim->isChecked(); +} + +void BehaviorSettingsPage::settingsToUI() +{ + const TabSettings &tabSettings = m_d->m_tabSettings; + m_d->m_page.insertSpaces->setChecked(tabSettings.m_spacesForTabs); + m_d->m_page.autoIndent->setChecked(tabSettings.m_autoIndent); + m_d->m_page.smartBackspace->setChecked(tabSettings.m_smartBackspace); + m_d->m_page.tabSize->setValue(tabSettings.m_tabSize); + m_d->m_page.indentSize->setValue(tabSettings.m_indentSize); + + const StorageSettings &storageSettings = m_d->m_storageSettings; + m_d->m_page.cleanWhitespace->setChecked(storageSettings.m_cleanWhitespace); + m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument); + m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation); + m_d->m_page.addFinalNewLine->setChecked(storageSettings.m_addFinalNewLine); + + const InteractionSettings &interactionSettings = m_d->m_interactionSettings; + m_d->m_page.useVim->setChecked(interactionSettings.m_useVim); +} + +TabSettings BehaviorSettingsPage::tabSettings() const +{ + return m_d->m_tabSettings; +} + +StorageSettings BehaviorSettingsPage::storageSettings() const +{ + return m_d->m_storageSettings; +} + +InteractionSettings BehaviorSettingsPage::interactionSettings() const +{ + return m_d->m_interactionSettings; +} diff --git a/src/plugins/texteditor/generalsettingspage.h b/src/plugins/texteditor/behaviorsettingspage.h similarity index 77% rename from src/plugins/texteditor/generalsettingspage.h rename to src/plugins/texteditor/behaviorsettingspage.h index 1f70fd6b0b0..68f7b408296 100644 --- a/src/plugins/texteditor/generalsettingspage.h +++ b/src/plugins/texteditor/behaviorsettingspage.h @@ -31,8 +31,8 @@ ** ***************************************************************************/ -#ifndef GENERALSETTINGSPAGE_H -#define GENERALSETTINGSPAGE_H +#ifndef BEHAVIORSETTINGSPAGE_H +#define BEHAVIORSETTINGSPAGE_H #include "texteditor_global.h" @@ -44,10 +44,9 @@ namespace TextEditor { struct TabSettings; struct StorageSettings; -struct DisplaySettings; struct InteractionSettings; -struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters +struct BehaviorSettingsPageParameters { QString name; QString category; @@ -55,13 +54,13 @@ struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters QString settingsPrefix; }; -class TEXTEDITOR_EXPORT GeneralSettingsPage : public Core::IOptionsPage +class BehaviorSettingsPage : public Core::IOptionsPage { Q_OBJECT public: - GeneralSettingsPage(const GeneralSettingsPageParameters &p, QObject *parent); - virtual ~GeneralSettingsPage(); + BehaviorSettingsPage(const BehaviorSettingsPageParameters &p, QObject *parent); + virtual ~BehaviorSettingsPage(); // IOptionsPage QString name() const; @@ -74,27 +73,21 @@ public: TabSettings tabSettings() const; StorageSettings storageSettings() const; - DisplaySettings displaySettings() const; InteractionSettings interactionSettings() const; - void setDisplaySettings(const DisplaySettings &); - signals: void tabSettingsChanged(const TextEditor::TabSettings &); void storageSettingsChanged(const TextEditor::StorageSettings &); - void displaySettingsChanged(const TextEditor::DisplaySettings &); private: void settingsFromUI(TabSettings &rc, StorageSettings &storageSettings, - DisplaySettings &displaySettings, - InteractionSettings &interactionSettings - ) const; + InteractionSettings &interactionSettings) const; void settingsToUI(); - struct GeneralSettingsPagePrivate; - GeneralSettingsPagePrivate *m_d; + struct BehaviorSettingsPagePrivate; + BehaviorSettingsPagePrivate *m_d; }; } // namespace TextEditor -#endif // GENERALSETTINGSPAGE_H +#endif // BEHAVIORSETTINGSPAGE_H diff --git a/src/plugins/texteditor/generalsettingspage.ui b/src/plugins/texteditor/behaviorsettingspage.ui similarity index 78% rename from src/plugins/texteditor/generalsettingspage.ui rename to src/plugins/texteditor/behaviorsettingspage.ui index 301ee8bdf55..a2fb68e5b20 100644 --- a/src/plugins/texteditor/generalsettingspage.ui +++ b/src/plugins/texteditor/behaviorsettingspage.ui @@ -1,13 +1,13 @@ - TextEditor::generalSettingsPage - + TextEditor::BehaviorSettingsPage + 0 0 - 514 - 475 + 484 + 398 @@ -255,71 +255,6 @@ - - - Display Settings - - - - - - - - Display right &margin at column - - - - - - - false - - - 999 - - - - - - - - - Enable text &wrapping - - - - - - - Display line &numbers - - - - - - - &Visualize whitespace - - - - - - - Display &folding markers - - - - - - - Highlight current &line - - - - - - - Interaction Settings @@ -335,7 +270,7 @@ - + Qt::Vertical @@ -373,20 +308,14 @@ toggled(bool) cleanIndentation setEnabled(bool) - - - showWrapColumn - toggled(bool) - wrapColumn - setEnabled(bool) - 399 - 308 + 20 + 20 - 474 - 308 + 20 + 20 diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp new file mode 100644 index 00000000000..7f47290b3f4 --- /dev/null +++ b/src/plugins/texteditor/displaysettingspage.cpp @@ -0,0 +1,153 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include "displaysettingspage.h" +#include "displaysettings.h" +#include "ui_displaysettingspage.h" + +#include + +#include + +using namespace TextEditor; + +struct DisplaySettingsPage::DisplaySettingsPagePrivate +{ + explicit DisplaySettingsPagePrivate(const DisplaySettingsPageParameters &p); + + const DisplaySettingsPageParameters m_parameters; + Ui::DisplaySettingsPage m_page; + DisplaySettings m_displaySettings; +}; + +DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate + (const DisplaySettingsPageParameters &p) + : m_parameters(p) +{ + if (const QSettings *s = Core::ICore::instance()->settings()) { + m_displaySettings.fromSettings(m_parameters.settingsPrefix, s); + } +} + +DisplaySettingsPage::DisplaySettingsPage(const DisplaySettingsPageParameters &p, + QObject *parent) + : Core::IOptionsPage(parent), + m_d(new DisplaySettingsPagePrivate(p)) +{ +} + +DisplaySettingsPage::~DisplaySettingsPage() +{ + delete m_d; +} + +QString DisplaySettingsPage::name() const +{ + return m_d->m_parameters.name; +} + +QString DisplaySettingsPage::category() const +{ + return m_d->m_parameters.category; +} + +QString DisplaySettingsPage::trCategory() const +{ + return m_d->m_parameters.trCategory; +} + +QWidget *DisplaySettingsPage::createPage(QWidget *parent) +{ + QWidget *w = new QWidget(parent); + m_d->m_page.setupUi(w); + settingsToUI(); + return w; +} + +void DisplaySettingsPage::apply() +{ + DisplaySettings newDisplaySettings; + + settingsFromUI(newDisplaySettings); + + Core::ICore *core = Core::ICore::instance(); + QSettings *s = core->settings(); + + if (newDisplaySettings != m_d->m_displaySettings) { + m_d->m_displaySettings = newDisplaySettings; + if (s) + m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s); + + emit displaySettingsChanged(newDisplaySettings); + } +} + +void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings) const +{ + displaySettings.m_displayLineNumbers = m_d->m_page.displayLineNumbers->isChecked(); + displaySettings.m_textWrapping = m_d->m_page.enableTextWrapping->isChecked(); + displaySettings.m_showWrapColumn = m_d->m_page.showWrapColumn->isChecked(); + displaySettings.m_wrapColumn = m_d->m_page.wrapColumn->value(); + displaySettings.m_visualizeWhitespace = m_d->m_page.visualizeWhitespace->isChecked(); + displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked(); + displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked(); +} + +void DisplaySettingsPage::settingsToUI() +{ + const DisplaySettings &displaySettings = m_d->m_displaySettings; + m_d->m_page.displayLineNumbers->setChecked(displaySettings.m_displayLineNumbers); + m_d->m_page.enableTextWrapping->setChecked(displaySettings.m_textWrapping); + m_d->m_page.showWrapColumn->setChecked(displaySettings.m_showWrapColumn); + m_d->m_page.wrapColumn->setValue(displaySettings.m_wrapColumn); + m_d->m_page.visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace); + m_d->m_page.displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers); + m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine); +} + +DisplaySettings DisplaySettingsPage::displaySettings() const +{ + return m_d->m_displaySettings; +} + +void DisplaySettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings) +{ + if (newDisplaySettings != m_d->m_displaySettings) { + m_d->m_displaySettings = newDisplaySettings; + Core::ICore *core = Core::ICore::instance(); + if (QSettings *s = core->settings()) + m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s); + + emit displaySettingsChanged(newDisplaySettings); + } +} diff --git a/src/plugins/texteditor/displaysettingspage.h b/src/plugins/texteditor/displaysettingspage.h new file mode 100644 index 00000000000..3337cafa922 --- /dev/null +++ b/src/plugins/texteditor/displaysettingspage.h @@ -0,0 +1,87 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#ifndef DISPLAYSETTINGSPAGE_H +#define DISPLAYSETTINGSPAGE_H + +#include "texteditor_global.h" + +#include + +#include + +namespace TextEditor { + +struct DisplaySettings; + +struct DisplaySettingsPageParameters +{ + QString name; + QString category; + QString trCategory; + QString settingsPrefix; +}; + +class DisplaySettingsPage : public Core::IOptionsPage +{ + Q_OBJECT + +public: + DisplaySettingsPage(const DisplaySettingsPageParameters &p, QObject *parent); + virtual ~DisplaySettingsPage(); + + // IOptionsPage + QString name() const; + QString category() const; + QString trCategory() const; + + QWidget *createPage(QWidget *parent); + void apply(); + void finish() { } + + DisplaySettings displaySettings() const; + void setDisplaySettings(const DisplaySettings &); + +signals: + void displaySettingsChanged(const TextEditor::DisplaySettings &); + +private: + void settingsFromUI(DisplaySettings &displaySettings) const; + void settingsToUI(); + struct DisplaySettingsPagePrivate; + DisplaySettingsPagePrivate *m_d; +}; + +} // namespace TextEditor + +#endif // DISPLAYSETTINGSPAGE_H diff --git a/src/plugins/texteditor/displaysettingspage.ui b/src/plugins/texteditor/displaysettingspage.ui new file mode 100644 index 00000000000..30fdf5cf93b --- /dev/null +++ b/src/plugins/texteditor/displaysettingspage.ui @@ -0,0 +1,116 @@ + + + TextEditor::DisplaySettingsPage + + + + 0 + 0 + 514 + 194 + + + + Form + + + + + + Display Settings + + + + + + + + Display right &margin at column + + + + + + + false + + + 999 + + + + + + + + + Enable text &wrapping + + + + + + + Display line &numbers + + + + + + + &Visualize whitespace + + + + + + + Display &folding markers + + + + + + + Highlight current &line + + + + + + + + + + Qt::Vertical + + + + 20 + 8 + + + + + + + + + + showWrapColumn + toggled(bool) + wrapColumn + setEnabled(bool) + + + 399 + 308 + + + 474 + 308 + + + + + diff --git a/src/plugins/texteditor/generalsettingspage.cpp b/src/plugins/texteditor/generalsettingspage.cpp deleted file mode 100644 index 28400d10ebf..00000000000 --- a/src/plugins/texteditor/generalsettingspage.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/*************************************************************************** -** -** This file is part of Qt Creator -** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). -** -** Contact: Qt Software Information (qt-info@nokia.com) -** -** -** Non-Open Source Usage -** -** Licensees may use this file in accordance with the Qt Beta Version -** License Agreement, Agreement version 2.2 provided with the Software or, -** alternatively, in accordance with the terms contained in a written -** agreement between you and Nokia. -** -** GNU General Public License Usage -** -** Alternatively, this file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the packaging -** of this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: -** -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt GPL Exception -** version 1.3, included in the file GPL_EXCEPTION.txt in this package. -** -***************************************************************************/ - -#include "displaysettings.h" -#include "generalsettingspage.h" -#include "interactionsettings.h" -#include "storagesettings.h" -#include "tabsettings.h" -#include "ui_generalsettingspage.h" - -#include - -#include -#include - -using namespace TextEditor; - -struct GeneralSettingsPage::GeneralSettingsPagePrivate -{ - explicit GeneralSettingsPagePrivate(const GeneralSettingsPageParameters &p); - - const GeneralSettingsPageParameters m_parameters; - Ui::generalSettingsPage m_page; - TabSettings m_tabSettings; - StorageSettings m_storageSettings; - DisplaySettings m_displaySettings; - InteractionSettings m_interactionSettings; -}; - -GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate - (const GeneralSettingsPageParameters &p) - : m_parameters(p) -{ - if (const QSettings *s = Core::ICore::instance()->settings()) { - m_tabSettings.fromSettings(m_parameters.settingsPrefix, s); - m_storageSettings.fromSettings(m_parameters.settingsPrefix, s); - m_displaySettings.fromSettings(m_parameters.settingsPrefix, s); - m_interactionSettings.fromSettings(m_parameters.settingsPrefix, s); - } -} - -GeneralSettingsPage::GeneralSettingsPage(const GeneralSettingsPageParameters &p, - QObject *parent) - : Core::IOptionsPage(parent), - m_d(new GeneralSettingsPagePrivate(p)) -{ -} - -GeneralSettingsPage::~GeneralSettingsPage() -{ - delete m_d; -} - -QString GeneralSettingsPage::name() const -{ - return m_d->m_parameters.name; -} - -QString GeneralSettingsPage::category() const -{ - return m_d->m_parameters.category; -} - -QString GeneralSettingsPage::trCategory() const -{ - return m_d->m_parameters.trCategory; -} - -QWidget *GeneralSettingsPage::createPage(QWidget *parent) -{ - QWidget *w = new QWidget(parent); - m_d->m_page.setupUi(w); - settingsToUI(); - return w; -} - -void GeneralSettingsPage::apply() -{ - TabSettings newTabSettings; - StorageSettings newStorageSettings; - DisplaySettings newDisplaySettings; - InteractionSettings newInteractionSettings; - - settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings, - newInteractionSettings); - - Core::ICore *core = Core::ICore::instance(); - QSettings *s = core->settings(); - - if (newTabSettings != m_d->m_tabSettings) { - m_d->m_tabSettings = newTabSettings; - if (s) - m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s); - - emit tabSettingsChanged(newTabSettings); - } - - if (newStorageSettings != m_d->m_storageSettings) { - m_d->m_storageSettings = newStorageSettings; - if (s) - m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s); - - emit storageSettingsChanged(newStorageSettings); - } - - if (newDisplaySettings != m_d->m_displaySettings) { - m_d->m_displaySettings = newDisplaySettings; - if (s) - m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s); - - emit displaySettingsChanged(newDisplaySettings); - } - - if (newInteractionSettings != m_d->m_interactionSettings) { - m_d->m_interactionSettings = newInteractionSettings; - if (s) - m_d->m_interactionSettings.toSettings(m_d->m_parameters.settingsPrefix, s); - - } -} - -void GeneralSettingsPage::settingsFromUI(TabSettings &rc, - StorageSettings &storageSettings, - DisplaySettings &displaySettings, - InteractionSettings &interactionSettings) const -{ - rc.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked(); - rc.m_autoIndent = m_d->m_page.autoIndent->isChecked(); - rc.m_smartBackspace = m_d->m_page.smartBackspace->isChecked(); - rc.m_tabSize = m_d->m_page.tabSize->value(); - rc.m_indentSize = m_d->m_page.indentSize->value(); - - storageSettings.m_cleanWhitespace = m_d->m_page.cleanWhitespace->isChecked(); - storageSettings.m_inEntireDocument = m_d->m_page.inEntireDocument->isChecked(); - storageSettings.m_cleanIndentation = m_d->m_page.cleanIndentation->isChecked(); - storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked(); - - displaySettings.m_displayLineNumbers = m_d->m_page.displayLineNumbers->isChecked(); - displaySettings.m_textWrapping = m_d->m_page.enableTextWrapping->isChecked(); - displaySettings.m_showWrapColumn = m_d->m_page.showWrapColumn->isChecked(); - displaySettings.m_wrapColumn = m_d->m_page.wrapColumn->value(); - displaySettings.m_visualizeWhitespace = m_d->m_page.visualizeWhitespace->isChecked(); - displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked(); - displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked(); - - interactionSettings.m_useVim = m_d->m_page.useVim->isChecked(); -} - -void GeneralSettingsPage::settingsToUI() -{ - TabSettings rc = m_d->m_tabSettings; - m_d->m_page.insertSpaces->setChecked(rc.m_spacesForTabs); - m_d->m_page.autoIndent->setChecked(rc.m_autoIndent); - m_d->m_page.smartBackspace->setChecked(rc.m_smartBackspace); - m_d->m_page.tabSize->setValue(rc.m_tabSize); - m_d->m_page.indentSize->setValue(rc.m_indentSize); - - StorageSettings storageSettings = m_d->m_storageSettings; - m_d->m_page.cleanWhitespace->setChecked(storageSettings.m_cleanWhitespace); - m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument); - m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation); - m_d->m_page.addFinalNewLine->setChecked(storageSettings.m_addFinalNewLine); - - DisplaySettings displaySettings = m_d->m_displaySettings; - m_d->m_page.displayLineNumbers->setChecked(displaySettings.m_displayLineNumbers); - m_d->m_page.enableTextWrapping->setChecked(displaySettings.m_textWrapping); - m_d->m_page.showWrapColumn->setChecked(displaySettings.m_showWrapColumn); - m_d->m_page.wrapColumn->setValue(displaySettings.m_wrapColumn); - m_d->m_page.visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace); - m_d->m_page.displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers); - m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine); - - InteractionSettings interactionSettings = m_d->m_interactionSettings; - m_d->m_page.useVim->setChecked(interactionSettings.m_useVim); -} - -TabSettings GeneralSettingsPage::tabSettings() const -{ - return m_d->m_tabSettings; -} - -StorageSettings GeneralSettingsPage::storageSettings() const -{ - return m_d->m_storageSettings; -} - -DisplaySettings GeneralSettingsPage::displaySettings() const -{ - return m_d->m_displaySettings; -} - -InteractionSettings GeneralSettingsPage::interactionSettings() const -{ - return m_d->m_interactionSettings; -} - -void GeneralSettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings) -{ - if (newDisplaySettings != m_d->m_displaySettings) { - m_d->m_displaySettings = newDisplaySettings; - Core::ICore *core = Core::ICore::instance(); - if (QSettings *s = core->settings()) - m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s); - - emit displaySettingsChanged(newDisplaySettings); - } -} diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index 56c39604fb4..0ec180bc06a 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -9,6 +9,7 @@ SOURCES += texteditorplugin.cpp \ plaintexteditorfactory.cpp \ basetextdocument.cpp \ basetexteditor.cpp \ + behaviorsettingspage.cpp \ texteditoractionhandler.cpp \ completionsupport.cpp \ completionwidget.cpp \ @@ -17,10 +18,10 @@ SOURCES += texteditorplugin.cpp \ tabsettings.cpp \ storagesettings.cpp \ displaysettings.cpp \ + displaysettingspage.cpp \ fontsettings.cpp \ textblockiterator.cpp \ linenumberfilter.cpp \ - generalsettingspage.cpp \ basetextmark.cpp \ findinfiles.cpp \ basefilefind.cpp \ @@ -32,6 +33,7 @@ HEADERS += texteditorplugin.h \ plaintexteditorfactory.h \ basetexteditor_p.h \ basetextdocument.h \ + behaviorsettingspage.h \ completionsupport.h \ completionwidget.h \ basetexteditor.h \ @@ -43,18 +45,19 @@ HEADERS += texteditorplugin.h \ tabsettings.h \ storagesettings.h \ displaysettings.h \ + displaysettingspage.h \ fontsettings.h \ textblockiterator.h \ itexteditable.h \ itexteditor.h \ linenumberfilter.h \ texteditor_global.h \ - generalsettingspage.h \ basetextmark.h \ findinfiles.h \ basefilefind.h \ texteditorsettings.h \ codecselector.h -FORMS += fontsettingspage.ui \ - generalsettingspage.ui +FORMS += behaviorsettingspage.ui \ + displaysettingspage.ui \ + fontsettingspage.ui RESOURCES += texteditor.qrc diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index 999ad0d8ae7..a8f6019597d 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -33,8 +33,9 @@ #include "texteditorsettings.h" +#include "behaviorsettingspage.h" #include "displaysettings.h" -#include "generalsettingspage.h" +#include "displaysettingspage.h" #include "fontsettingspage.h" #include "storagesettings.h" #include "tabsettings.h" @@ -93,34 +94,43 @@ TextEditorSettings::TextEditorSettings(QObject *parent) m_fontSettingsPage = new FontSettingsPage(formatDescriptions, QLatin1String("TextEditor"), - tr("Text Editor")); + tr("Text Editor"), + this); pm->addObject(m_fontSettingsPage); - // Add the GUI used to configure the tab, storage and display settings - TextEditor::GeneralSettingsPageParameters generalSettingsPageParameters; - generalSettingsPageParameters.name = tr("General"); - generalSettingsPageParameters.category = QLatin1String("TextEditor"); - generalSettingsPageParameters.trCategory = tr("Text Editor"); - generalSettingsPageParameters.settingsPrefix = QLatin1String("text"); - m_generalSettingsPage = new GeneralSettingsPage(generalSettingsPageParameters, this); - pm->addObject(m_generalSettingsPage); + // Add the GUI used to configure the tab, storage and interaction settings + TextEditor::BehaviorSettingsPageParameters behaviorSettingsPageParameters; + behaviorSettingsPageParameters.name = tr("Behavior"); + behaviorSettingsPageParameters.category = QLatin1String("TextEditor"); + behaviorSettingsPageParameters.trCategory = tr("Text Editor"); + behaviorSettingsPageParameters.settingsPrefix = QLatin1String("text"); + m_behaviorSettingsPage = new BehaviorSettingsPage(behaviorSettingsPageParameters, this); + pm->addObject(m_behaviorSettingsPage); + + TextEditor::DisplaySettingsPageParameters displaySettingsPageParameters; + displaySettingsPageParameters.name = tr("Display"); + displaySettingsPageParameters.category = QLatin1String("TextEditor"); + displaySettingsPageParameters.trCategory = tr("Text Editor"); + displaySettingsPageParameters.settingsPrefix = QLatin1String("text"); + m_displaySettingsPage = new DisplaySettingsPage(displaySettingsPageParameters, this); + pm->addObject(m_displaySettingsPage); connect(m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)), this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings))); - connect(m_generalSettingsPage, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)), + connect(m_behaviorSettingsPage, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)), this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings))); - connect(m_generalSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), + connect(m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings))); - connect(m_generalSettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), + connect(m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings))); } TextEditorSettings::~TextEditorSettings() { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); - pm->removeObject(m_generalSettingsPage); pm->removeObject(m_fontSettingsPage); - delete m_fontSettingsPage; + pm->removeObject(m_behaviorSettingsPage); + pm->removeObject(m_displaySettingsPage); m_instance = 0; } @@ -137,15 +147,15 @@ FontSettings TextEditorSettings::fontSettings() const TabSettings TextEditorSettings::tabSettings() const { - return m_generalSettingsPage->tabSettings(); + return m_behaviorSettingsPage->tabSettings(); } StorageSettings TextEditorSettings::storageSettings() const { - return m_generalSettingsPage->storageSettings(); + return m_behaviorSettingsPage->storageSettings(); } DisplaySettings TextEditorSettings::displaySettings() const { - return m_generalSettingsPage->displaySettings(); + return m_displaySettingsPage->displaySettings(); } diff --git a/src/plugins/texteditor/texteditorsettings.h b/src/plugins/texteditor/texteditorsettings.h index efaec3176b2..f90fa676ee1 100644 --- a/src/plugins/texteditor/texteditorsettings.h +++ b/src/plugins/texteditor/texteditorsettings.h @@ -40,7 +40,8 @@ namespace TextEditor { -class GeneralSettingsPage; +class BehaviorSettingsPage; +class DisplaySettingsPage; class FontSettingsPage; class FontSettings; struct TabSettings; @@ -74,8 +75,9 @@ signals: void displaySettingsChanged(const TextEditor::DisplaySettings &); private: - TextEditor::FontSettingsPage *m_fontSettingsPage; - TextEditor::GeneralSettingsPage *m_generalSettingsPage; + FontSettingsPage *m_fontSettingsPage; + BehaviorSettingsPage *m_behaviorSettingsPage; + DisplaySettingsPage *m_displaySettingsPage; static TextEditorSettings *m_instance; }; From ce2ad5f2591ab6bd98c957f23054e45f941e820a Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 27 Jan 2009 15:30:24 +0100 Subject: [PATCH 13/44] Fixes: Add outline to sidebar icon Details: Just a quick fix so it doesnt look odd in the menu. --- src/plugins/coreplugin/images/sidebaricon.png | Bin 294 -> 436 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/plugins/coreplugin/images/sidebaricon.png b/src/plugins/coreplugin/images/sidebaricon.png index 8aab325d6efbccee7b903a02c70e225cea3aaed7..b7951415874932b2291b06a274ec973633cc0f96 100644 GIT binary patch delta 351 zcmZ3+w1s&>T>VW(X+BvgZ{B6B3=E7Wo-U3d8t11@+?&T_DA1Cg>zu)?2GO!;I zzL>gW<>Uig3`sp7r6QK@5N!Apo}-!i_5#xaVU0^%{SO70<`(8HRc7GG&V9dVb8+8{ zpJgUew%KdT9;X+CSl>Qj#^7#J9qdAc};Xq;a=>9pV>10I+8k9cAOc;*I3g$A%6 zWoTFVRy48sn6n*EhMV|l|ETpjlk#dL)5@6I>K0b8$sG_r@m0dWGhBf&cK-z%MkcR@ z;No;awT7LUR>$QkibO+ysm)=w2%9-C|Lz}w>^9Z)r;WEBzUF!F4(s)w?0aq-aPvO% z7ux<&a9YXD4_eGe8E*5b-JoeNJG Q7#J8lUHx3vIVCg!0Hc^yLjV8( From 75aaeff2c4acbeb47f0ea85f63fd92f794e3365d Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 15:53:50 +0100 Subject: [PATCH 14/44] Fixes: immediately rebuild view if custom dumpers are selected in optiosn --- src/plugins/debugger/debuggermanager.cpp | 26 +++++++++++++++++++++++- src/plugins/debugger/debuggermanager.h | 12 ++++++----- src/plugins/debugger/debuggerplugin.cpp | 5 +++++ src/plugins/debugger/gdbengine.cpp | 13 ++---------- src/plugins/debugger/gdbengine.h | 6 +++--- src/plugins/debugger/idebuggerengine.h | 2 ++ src/plugins/debugger/scriptengine.h | 3 +++ 7 files changed, 47 insertions(+), 20 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 7b0e6c24273..8180c7cfd10 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -888,7 +888,9 @@ void DebuggerManager::executeDebuggerCommand(const QString &command) void DebuggerManager::sessionLoaded() { - exitDebugger(); + cleanupViews(); + setStatus(DebuggerProcessNotReady); + setBusyCursor(false); loadSessionData(); } @@ -1092,6 +1094,28 @@ bool DebuggerManager::useFastStart() const return 0; // && m_settings.m_useFastStart; } +void DebuggerManager::setUseCustomDumpers(bool on) +{ + m_settings.m_useCustomDumpers = on; + engine()->setUseCustomDumpers(on); +} + +void DebuggerManager::setUseFastStart(bool on) +{ + m_settings.m_useFastStart = on; +} + +void DebuggerManager::setDebugDumpers(bool on) +{ + m_settings.m_debugDumpers = on; + engine()->setDebugDumpers(on); +} + +void DebuggerManager::setSkipKnownFrames(bool on) +{ + m_settings.m_skipKnownFrames = on; +} + void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber, QObject **object) { diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 5d5e7abd0da..493f2e8cb42 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -167,8 +167,6 @@ private: virtual WatchHandler *watchHandler() = 0; virtual void showApplicationOutput(const QString &data) = 0; - //virtual QAction *useCustomDumpersAction() const = 0; - //virtual QAction *debugDumpersAction() const = 0; virtual bool skipKnownFrames() const = 0; virtual bool debugDumpers() const = 0; virtual bool useCustomDumpers() const = 0; @@ -283,6 +281,12 @@ public slots: void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever + void setUseCustomDumpers(bool on); + void setUseToolTips(bool on); + void setDebugDumpers(bool on); + void setSkipKnownFrames(bool on); + void setUseFastStart(bool on); + private slots: void showDebuggerOutput(const QString &prefix, const QString &msg); void showDebuggerInput(const QString &prefix, const QString &msg); @@ -312,9 +316,7 @@ private: StackHandler *stackHandler() { return m_stackHandler; } ThreadsHandler *threadsHandler() { return m_threadsHandler; } WatchHandler *watchHandler() { return m_watchHandler; } - //QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; } - //QAction *useToolTipsAction() const { return m_useToolTipsAction; } - //QAction *debugDumpersAction() const { return m_debugDumpersAction; } + bool skipKnownFrames() const; bool debugDumpers() const; bool useCustomDumpers() const; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 4f7e0b1a897..f8bb4a86b75 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -251,6 +251,7 @@ public: void finish() {} // automatically calls "apply" private: + friend class DebuggerPlugin; Ui::GdbOptionPage m_ui; DebuggerSettings m_settings; @@ -300,6 +301,10 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) //m_dumpLogAction = new QAction(this); //m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes")); + // + connect(m_ui.checkBoxUseCustomDumpers, SIGNAL(clicked(bool)), + m_plugin->m_manager, SLOT(setUseCustomDumpers(bool))); + return w; } diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 4b84c88cb7f..cff7be0df07 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1760,14 +1760,6 @@ void GdbEngine::setDebugDumpers(bool on) } } -//QByteArray GdbEngine::dumperChannel() const -//{ -// return m_dumperServer->serverName().toLatin1(); -// //QByteArray ba; -// //ba.setNum(m_dumperServer->serverPort()); -// //return ba; -//} - ////////////////////////////////////////////////////////////////////// // @@ -2889,11 +2881,10 @@ static QString sizeofTypeExpression(const QString &type) return "sizeof(" + gdbQuoteTypes(type) + ")"; } -void GdbEngine::setCustomDumpersWanted(bool on) +void GdbEngine::setUseCustomDumpers(bool on) { Q_UNUSED(on); - // FIXME: a bit too harsh, but otherwise the treeview - // sometimes look funny + // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny //m_expandedINames.clear(); updateLocals(); } diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 60493a53e58..a603aee375d 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -134,6 +134,9 @@ private: void loadSymbols(const QString &moduleName); void loadAllSymbols(); + void setDebugDumpers(bool on); + void setUseCustomDumpers(bool on); + // // Own stuff // @@ -167,9 +170,6 @@ private: void updateLocals(); private slots: - void setDebugDumpers(bool on); - void setCustomDumpersWanted(bool on); - void handleResponse(); void gdbProcError(QProcess::ProcessError error); diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index 50fbafda559..1558d140ee6 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -86,6 +86,8 @@ public: virtual void loadAllSymbols() = 0; virtual void reloadRegisters() = 0; + virtual void setDebugDumpers(bool on) = 0; + virtual void setUseCustomDumpers(bool on) = 0; }; } // namespace Internal diff --git a/src/plugins/debugger/scriptengine.h b/src/plugins/debugger/scriptengine.h index 0f7cc47ac1f..b7f37f2cc67 100644 --- a/src/plugins/debugger/scriptengine.h +++ b/src/plugins/debugger/scriptengine.h @@ -101,6 +101,9 @@ private: void loadSessionData() {} void saveSessionData() {} + void setDebugDumpers(bool) {} + void setUseCustomDumpers(bool) {} + void assignValueInDebugger(const QString &expr, const QString &value); void executeDebuggerCommand(const QString & command); From fe4f03caa0f3269797065b1169cdbe76c04a8f36 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Tue, 27 Jan 2009 15:54:18 +0100 Subject: [PATCH 15/44] Fixes: Don't hover disabled buttons Details: Manhattan would incorrectly hover a disabled toolbutton. This fixes it. --- src/plugins/coreplugin/manhattanstyle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index af361aacbb9..72b86d85d7c 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -518,7 +518,8 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption painter->drawLine(rect.bottomLeft(), rect.bottomRight()); } #ifndef Q_WS_MAC - else if (option->state & State_MouseOver) { + else if (option->state & State_Enabled && + option->state & State_MouseOver) { QColor lighter(255, 255, 255, 35); painter->fillRect(rect, lighter); painter->drawLine(rect.topRight(), rect.bottomRight()); From 5044d07e6017ff4cb1f1d5be3aaff8133618886e Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 16:07:47 +0100 Subject: [PATCH 16/44] Fixes: fakevim: remove '-- PASSING --' message when 'passing' mode is over. --- src/plugins/fakevim/fakevimhandler.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 7e24d7d5068..261c5f151cf 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -391,6 +391,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev) return true; } m_mode = CommandMode; + updateMiniBuffer(); return false; } From d8005df09a94783def1597000a20be1574a475be Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 16:28:42 +0100 Subject: [PATCH 17/44] Fixes: fakevim: put text cut by 'X' into proper register --- src/plugins/fakevim/fakevimhandler.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 261c5f151cf..f20c9522db6 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1072,10 +1072,6 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, m_subsubdata = key; } else if (key == 'u') { undo(); - } else if (key == 'U') { - // FIXME: this is non-vim, but as Ctrl-R is taken globally - // we have a substitute here - redo(); } else if (key == control('u')) { int sline = cursorLineOnScreen(); // FIXME: this should use the "scroll" option, and "count" @@ -1113,7 +1109,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, if (leftDist() > 0) { setAnchor(); moveLeft(qMin(count(), leftDist())); - recordRemoveSelectedText(); + m_registers[m_register] = recordRemoveSelectedText(); } finishMovement(); } else if (key == 'y' && m_visualMode == NoVisualMode) { From 32881501e1f4415279671cdecb8a1a8075c99997 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 16:44:04 +0100 Subject: [PATCH 18/44] Fixes: fakevim: ignore remaining Ctrl combinations in insert mode --- src/plugins/fakevim/fakevimhandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index f20c9522db6..26e127b9428 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -1220,6 +1220,8 @@ bool FakeVimHandler::Private::handleInsertMode(int key, int, const QString &text QString str = QString(m_config[ConfigTabStop].toInt(), ' '); m_lastInsertion.append(str); m_tc.insertText(str); + } else if (key >= control('a') && key <= control('z')) { + // ignore these } else if (!text.isEmpty()) { m_lastInsertion.append(text); if (m_submode == ReplaceSubMode) { From d22f833a9c08c36b075916dc1cd715d80f9c1039 Mon Sep 17 00:00:00 2001 From: con Date: Tue, 27 Jan 2009 16:46:54 +0100 Subject: [PATCH 19/44] Fixes: - Avoid some annoying debug output. Details: - No stupid "true" and "namespace bla already registered" output anymore. --- src/plugins/help/helpplugin.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 9e07f46f69f..3eddaa5e0ec 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -98,7 +98,7 @@ void HelpManager::registerDocumentation(const QStringList &fileNames) } } if (needsSetup) - qDebug() << m_helpEngine->setupData(); + m_helpEngine->setupData(); } HelpPlugin::HelpPlugin() : @@ -450,9 +450,12 @@ void HelpPlugin::extensionsInitialized() #endif QHelpEngineCore hc(fi.absoluteFilePath()); hc.setupData(); - if (!hc.registerDocumentation(qchFileName)) - qDebug() << hc.error(); - needsSetup = true; + QString fileNamespace = QHelpEngineCore::namespaceName(qchFileName); + if (!fileNamespace.isEmpty() && !hc.registeredDocumentations().contains(fileNamespace)) { + if (!hc.registerDocumentation(qchFileName)) + qDebug() << hc.error(); + needsSetup = true; + } } int i = m_helpEngine->customValue( From e3b273bb8f9c3c7897d4e8b08d71cf80484b88c7 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 17:11:38 +0100 Subject: [PATCH 20/44] Fixes: compile fix --- src/plugins/debugger/debuggermanager.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 493f2e8cb42..e16941a79f5 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -282,7 +282,6 @@ public slots: void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever void setUseCustomDumpers(bool on); - void setUseToolTips(bool on); void setDebugDumpers(bool on); void setSkipKnownFrames(bool on); void setUseFastStart(bool on); From 484356dd3355657a000194468fda4b28dcbde3c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 27 Jan 2009 16:44:06 +0100 Subject: [PATCH 21/44] Recognize inl files as C++ In some projects these kind of files are used for completely inlined classes, that can be split up in a header and source file automatically. --- src/plugins/cppeditor/CppEditor.mimetypes.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/cppeditor/CppEditor.mimetypes.xml b/src/plugins/cppeditor/CppEditor.mimetypes.xml index cd79d5f441e..0c58890e9b5 100644 --- a/src/plugins/cppeditor/CppEditor.mimetypes.xml +++ b/src/plugins/cppeditor/CppEditor.mimetypes.xml @@ -133,5 +133,6 @@ + From 9772ab9904da97df72d3cdc029d7381d126e84bc Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 17:15:51 +0100 Subject: [PATCH 22/44] Fixes: debugger: revert change from " to ' style quoting Details: ' was used interanlly sometimes --- share/qtcreator/gdbmacros/gdbmacros.cpp | 18 +++++++++--------- tests/manual/gdbdebugger/simple/app.cpp | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index 5b9b36d1282..d89a6672354 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -109,7 +109,7 @@ int qtGhVersion = QT_VERSION; 'P(d, name, value)' roughly expands to: - d << (name) << "='" << value << "'"; + d << (name) << "=\"" << value << "\""; Useful (i.e. understood by the IDE) names include: @@ -551,7 +551,7 @@ void QDumper::addCommaIfNeeded() if (pos == 0) return; char c = qDumpOutBuffer[pos - 1]; - if (c == '}' || c == '\'' || c == ']') + if (c == '}' || c == '"' || c == ']') put(','); } @@ -630,7 +630,7 @@ void QDumper::endHash() void QDumper::putEllipsis() { addCommaIfNeeded(); - *this << "{name='',value='',type='" << innertype << "'}"; + *this << "{name=\"\",value=\"\",type=\"" << innertype << "\"}"; } // @@ -642,7 +642,7 @@ void QDumper::putEllipsis() #define P(dumper,name,value) \ do { \ dumper.addCommaIfNeeded(); \ - dumper << (name) << "='" << value << "'"; \ + dumper << (name) << "=\"" << value << '"'; \ } while (0) // simple string property @@ -740,7 +740,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr return; case 'B': if (isEqual(type, "QByteArray")) { - d << key << "encoded='1',"; + d << key << "encoded=\"1\","; P(d, key, *(QByteArray*)addr); } return; @@ -769,7 +769,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr return; case 'S': if (isEqual(type, "QString")) { - d << key << "encoded='1',"; + d << key << "encoded=\"1\","; P(d, key, *(QString*)addr); } return; @@ -2008,7 +2008,7 @@ static void qDumpQVariantHelper(const void *data, QString *value, *numchild = 0; break; case QVariant::String: - *value = QLatin1Char('\'') + v.toString() + QLatin1Char('\''); + *value = QLatin1Char('"') + v.toString() + QLatin1Char('"'); *numchild = 0; break; case QVariant::StringList: @@ -2240,9 +2240,9 @@ static void qDumpStdString(QDumper &d) qCheckAccess(str.c_str() + str.size() - 1); } - d << ",value='"; + d << ",value=\""; d.putBase64Encoded(str.c_str(), str.size()); - d << "'"; + d << "\""; P(d, "valueencoded", "1"); P(d, "type", "std::string"); P(d, "numchild", "0"); diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index b719915c479..e5cf4d1a032 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -145,14 +145,33 @@ void testQByteArray() void testQHash() { +#if 0 QHash hgg0; hgg0[11] = 11.0; hgg0[22] = 22.0; + hgg0[22] = 22.0; + hgg0[22] = 22.0; + hgg0[22] = 22.0; + hgg0[22] = 22.0; + hgg0[22] = 22.0; +#endif + +#if 1 QHash hgg1; hgg1["22.0"] = 22.0; + hgg1["23.0"] = 22.0; + hgg1["24.0"] = 22.0; + hgg1["25.0"] = 22.0; + hgg1["26.0"] = 22.0; + hgg1["27.0"] = 27.0; + hgg1["28.0"] = 28.0; + hgg1["29.0"] = 29.0; +#endif + +#if 0 QHash hgg2; hgg2[22] = "22.0"; @@ -165,6 +184,7 @@ void testQHash() hash.insert("Hallo", QPointer(&ob)); hash.insert("Welt", QPointer(&ob)); hash.insert(".", QPointer(&ob)); +#endif } void testQImage() From 08e17e6e6b9e76eb5b5305b09a2387d0eec33d4b Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 27 Jan 2009 17:41:31 +0100 Subject: [PATCH 23/44] Fixes: debugger: more quote fixes --- share/qtcreator/gdbmacros/gdbmacros.cpp | 86 ++++++++++++------------ src/plugins/debugger/debuggermanager.cpp | 4 +- src/plugins/debugger/gdbengine.cpp | 7 +- tests/manual/gdbdebugger/simple/app.cpp | 4 +- 4 files changed, 52 insertions(+), 49 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index d89a6672354..6a1385359fb 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -642,7 +642,7 @@ void QDumper::putEllipsis() #define P(dumper,name,value) \ do { \ dumper.addCommaIfNeeded(); \ - dumper << (name) << "=\"" << value << '"'; \ + dumper << (name) << "=\"" << value << "\""; \ } while (0) // simple string property @@ -2482,54 +2482,54 @@ void qDumpObjectData440( // They are mentioned here nevertheless. For types that not listed // here, dumpers won't be used. d << "dumpers=[" - "'"NS"QByteArray'," - "'"NS"QDateTime'," - "'"NS"QDir'," - "'"NS"QFile'," - "'"NS"QFileInfo'," - "'"NS"QHash'," - "'"NS"QHashNode'," - "'"NS"QImage'," - "'"NS"QLinkedList'," - "'"NS"QList'," - "'"NS"QLocale'," - "'"NS"QMap'," - "'"NS"QMapNode'," - "'"NS"QModelIndex'," + "\""NS"QByteArray\"," + "\""NS"QDateTime\"," + "\""NS"QDir\"," + "\""NS"QFile\"," + "\""NS"QFileInfo\"," + "\""NS"QHash\"," + "\""NS"QHashNode\"," + "\""NS"QImage\"," + "\""NS"QLinkedList\"," + "\""NS"QList\"," + "\""NS"QLocale\"," + "\""NS"QMap\"," + "\""NS"QMapNode\"," + "\""NS"QModelIndex\"," #if QT_VERSION >= 0x040500 - "'"NS"QMultiMap'," + "\""NS"QMultiMap\"," #endif - "'"NS"QObject'," - "'"NS"QObjectMethodList'," // hack to get nested properties display - "'"NS"QObjectPropertyList'," + "\""NS"QObject\"," + "\""NS"QObjectMethodList\"," // hack to get nested properties display + "\""NS"QObjectPropertyList\"," #if PRIVATE_OBJECT_ALLOWED - "'"NS"QObjectSignal'," - "'"NS"QObjectSignalList'," - "'"NS"QObjectSlot'," - "'"NS"QObjectSlotList'," + "\""NS"QObjectSignal\"," + "\""NS"QObjectSignalList\"," + "\""NS"QObjectSlot\"," + "\""NS"QObjectSlotList\"," #endif // PRIVATE_OBJECT_ALLOWED - // << "'"NS"QRegion'," - "'"NS"QSet'," - "'"NS"QString'," - "'"NS"QStringList'," - "'"NS"QTextCodec'," - "'"NS"QVariant'," - "'"NS"QVector'," - "'"NS"QWidget'," - "'string'," - "'wstring'," - "'std::basic_string'," - "'std::list'," - "'std::map'," - "'std::string'," - "'std::vector'," - "'std::wstring'," + // << "\""NS"QRegion\"," + "\""NS"QSet\"," + "\""NS"QString\"," + "\""NS"QStringList\"," + "\""NS"QTextCodec\"," + "\""NS"QVariant\"," + "\""NS"QVector\"," + "\""NS"QWidget\"," + "\"string\"," + "\"wstring\"," + "\"std::basic_string\"," + "\"std::list\"," + "\"std::map\"," + "\"std::string\"," + "\"std::vector\"," + "\"std::wstring\"," "]"; d << ",qtversion=[" - "'" << ((QT_VERSION >> 16) & 255) << "'," - "'" << ((QT_VERSION >> 8) & 255) << "'," - "'" << ((QT_VERSION) & 255) << "']"; - d << ",namespace='"NS"'"; + "\"" << ((QT_VERSION >> 16) & 255) << "\"," + "\"" << ((QT_VERSION >> 8) & 255) << "\"," + "\"" << ((QT_VERSION) & 255) << "\"]"; + d << ",namespace=\""NS"\""; d.disarm(); } diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 8180c7cfd10..efa5d1f6333 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -1096,8 +1096,8 @@ bool DebuggerManager::useFastStart() const void DebuggerManager::setUseCustomDumpers(bool on) { - m_settings.m_useCustomDumpers = on; - engine()->setUseCustomDumpers(on); + //m_settings.m_useCustomDumpers = on; + //engine()->setUseCustomDumpers(on); } void DebuggerManager::setUseFastStart(bool on) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index cff7be0df07..a415f47e3cb 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -2883,6 +2883,7 @@ static QString sizeofTypeExpression(const QString &type) void GdbEngine::setUseCustomDumpers(bool on) { + qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on; Q_UNUSED(on); // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny //m_expandedINames.clear(); @@ -3298,7 +3299,8 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record) QByteArray out = output.data(); out = out.mid(out.indexOf('"') + 2); // + 1 is success marker out = out.left(out.lastIndexOf('"')); - out = out.replace('\'', '"'); + //out.replace('\'', '"'); + out.replace("\\", ""); out = "dummy={" + out + "}"; //qDebug() << "OUTPUT: " << out; @@ -3488,7 +3490,8 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, QByteArray out = output.data(); out = out.mid(out.indexOf('"') + 2); // + 1 is the 'success marker' out = out.left(out.lastIndexOf('"')); - out = out.replace('\'', '"'); + //out.replace('\'', '"'); + out.replace("\\", ""); out = "dummy={" + out + "}"; //qDebug() << "OUTPUT: " << out; diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index e5cf4d1a032..442e0e23d1a 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -145,7 +145,7 @@ void testQByteArray() void testQHash() { -#if 0 +#if 1 QHash hgg0; hgg0[11] = 11.0; hgg0[22] = 22.0; @@ -171,7 +171,7 @@ void testQHash() #endif -#if 0 +#if 1 QHash hgg2; hgg2[22] = "22.0"; From 460c7c9a2220281d8251a546ee843d8bf2212609 Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 27 Jan 2009 17:44:40 +0100 Subject: [PATCH 24/44] Fixes: Crash on startup introduced while fixing a bug. --- src/plugins/projectexplorer/projectexplorer.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 1c013f0222c..2afd5e5f3b6 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -517,11 +517,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er cmd = am->registerAction(m_runAction, Constants::RUN, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); mbuild->addAction(cmd, Constants::G_BUILD_RUN); - modeManager->addAction(cmd, Constants::P_ACTION_RUN, m_runConfigurationMenu); - - m_runActionContextMenu = new QAction(runIcon, tr("Run"), this); - cmd = am->registerAction(m_runActionContextMenu, Constants::RUNCONTEXTMENU, globalcontext); - mproject->addAction(cmd, Constants::G_PROJECT_RUN); Core::ActionContainer *mrc = am->createMenu(Constants::RUNCONFIGURATIONMENU); m_runConfigurationMenu = mrc->menu(); @@ -534,6 +529,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er connect(mbuild->menu(), SIGNAL(aboutToShow()), this, SLOT(populateRunConfigurationMenu())); connect(m_runConfigurationMenu, SIGNAL(triggered(QAction *)), this, SLOT(runConfigurationMenuTriggered(QAction *))); + modeManager->addAction(cmd, Constants::P_ACTION_RUN, m_runConfigurationMenu); + + m_runActionContextMenu = new QAction(runIcon, tr("Run"), this); + cmd = am->registerAction(m_runActionContextMenu, Constants::RUNCONTEXTMENU, globalcontext); + mproject->addAction(cmd, Constants::G_PROJECT_RUN); + // jump to next task m_taskAction = new QAction(tr("Go to Task Window"), this); m_taskAction->setIcon(QIcon(Core::Constants::ICON_NEXT)); From daea8e66bf1ec3984d38be4f1321783375b8993e Mon Sep 17 00:00:00 2001 From: dt Date: Tue, 27 Jan 2009 18:23:02 +0100 Subject: [PATCH 25/44] Fixes: Changing the build config should update the run config. Task: 242465 Details: connect quite a few signals. It doesn't work 100%, since it really depends on to many things. --- src/plugins/qt4projectmanager/qmakestep.cpp | 1 + .../qt4projectmanager/qt4runconfiguration.cpp | 111 ++++++++++++++---- .../qt4projectmanager/qt4runconfiguration.h | 42 +++++++ 3 files changed, 134 insertions(+), 20 deletions(-) diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp index d8c4204ccdf..a477b921b8e 100644 --- a/src/plugins/qt4projectmanager/qmakestep.cpp +++ b/src/plugins/qt4projectmanager/qmakestep.cpp @@ -104,6 +104,7 @@ bool QMakeStep::init(const QString &name) m_buildConfiguration = name; const QtVersion *qtVersion = m_pro->qtVersion(name); + if (!qtVersion->isValid()) { #if defined(Q_OS_MAC) emit addToOutputWindow(tr("\nNo valid Qt version set. Set one in Preferences \n")); diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index 3ff03bcc28a..6503e9b3a98 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -46,6 +46,7 @@ #include #include +#include using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager; @@ -54,17 +55,27 @@ using ProjectExplorer::PersistentSettingsReader; using ProjectExplorer::PersistentSettingsWriter; Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, QString proFilePath) - : ApplicationRunConfiguration(pro), m_proFilePath(proFilePath), m_userSetName(false) + : ApplicationRunConfiguration(pro), + m_proFilePath(proFilePath), + m_userSetName(false), + m_configWidget(0), + m_executableLabel(0), + m_workingDirectoryLabel(0) { setName(tr("Qt4RunConfiguration")); if (!m_proFilePath.isEmpty()) { updateCachedValues(); setName(QFileInfo(m_proFilePath).baseName()); } + connect(pro, SIGNAL(activeBuildConfigurationChanged()), + this, SIGNAL(effectiveExecutableChanged())); + connect(pro, SIGNAL(activeBuildConfigurationChanged()), + this, SIGNAL(effectiveWorkingDirectoryChanged())); } Qt4RunConfiguration::~Qt4RunConfiguration() { + } QString Qt4RunConfiguration::type() const @@ -72,37 +83,92 @@ QString Qt4RunConfiguration::type() const return "Qt4ProjectManager.Qt4RunConfiguration"; } -QWidget *Qt4RunConfiguration::configurationWidget() + +////// +/// Qt4RunConfigurationWidget +///// + +Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4RunConfiguration, QWidget *parent) + : QWidget(parent), m_qt4RunConfiguration(qt4RunConfiguration), m_ignoreChange(false) { - QWidget *configWidget = new QWidget; - QFormLayout *toplayout = new QFormLayout(configWidget); + QFormLayout *toplayout = new QFormLayout(this); toplayout->setMargin(0); QLabel *nameLabel = new QLabel(tr("Name:")); - QLineEdit *nameLineEdit = new QLineEdit(name()); - nameLabel->setBuddy(nameLineEdit); - toplayout->addRow(nameLabel, nameLineEdit); + m_nameLineEdit = new QLineEdit(m_qt4RunConfiguration->name()); + nameLabel->setBuddy(m_nameLineEdit); + toplayout->addRow(nameLabel, m_nameLineEdit); - QLabel *executableLabel = new QLabel(tr("Executable:")); - QLabel *executableLabel2 = new QLabel(executable()); - toplayout->addRow(executableLabel, executableLabel2); + m_executableLabel = new QLabel(m_qt4RunConfiguration->executable()); + toplayout->addRow(tr("Executable:"), m_executableLabel); - QLabel *workingDirectoryLabel = new QLabel(tr("Working Directory:")); - QLabel *workingDirectoryLabel2 = new QLabel(workingDirectory()); - toplayout->addRow(workingDirectoryLabel, workingDirectoryLabel2); + m_workingDirectoryLabel = new QLabel(m_qt4RunConfiguration->workingDirectory()); + toplayout->addRow(tr("Working Directory:"), m_workingDirectoryLabel); QLabel *argumentsLabel = new QLabel(tr("&Arguments:")); - QLineEdit *argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(commandLineArguments())); - argumentsLabel->setBuddy(argumentsLineEdit); - toplayout->addRow(argumentsLabel, argumentsLineEdit); + m_argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments())); + argumentsLabel->setBuddy(m_argumentsLineEdit); + toplayout->addRow(argumentsLabel, m_argumentsLineEdit); - connect(argumentsLineEdit, SIGNAL(textEdited(const QString&)), + connect(m_argumentsLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(setCommandLineArguments(const QString&))); - connect(nameLineEdit, SIGNAL(textEdited(const QString&)), + connect(m_nameLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(nameEdited(const QString&))); - return configWidget; + connect(qt4RunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)), + this, SLOT(commandLineArgumentsChanged(QString))); + connect(qt4RunConfiguration, SIGNAL(nameChanged(QString)), + this, SLOT(nameChanged(QString))); + + connect(qt4RunConfiguration, SIGNAL(effectiveExecutableChanged()), + this, SLOT(effectiveExecutableChanged())); + connect(qt4RunConfiguration, SIGNAL(effectiveWorkingDirectoryChanged()), + this, SLOT(effectiveWorkingDirectoryChanged())); + +} + +void Qt4RunConfigurationWidget::setCommandLineArguments(const QString &args) +{ + m_ignoreChange = true; + m_qt4RunConfiguration->setCommandLineArguments(args); + m_ignoreChange = false; +} + +void Qt4RunConfigurationWidget::nameEdited(const QString &name) +{ + m_ignoreChange = true; + m_qt4RunConfiguration->nameEdited(name); + m_ignoreChange = false; +} + +void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args) +{ + if (!m_ignoreChange) + m_argumentsLineEdit->setText(args); +} + +void Qt4RunConfigurationWidget::nameChanged(const QString &name) +{ + if (!m_ignoreChange) + m_nameLineEdit->setText(name); +} + +void Qt4RunConfigurationWidget::effectiveExecutableChanged() +{ + m_executableLabel->setText(m_qt4RunConfiguration->executable()); +} + +void Qt4RunConfigurationWidget::effectiveWorkingDirectoryChanged() +{ + m_workingDirectoryLabel->setText(m_qt4RunConfiguration->workingDirectory()); +} + +////// TODO c&p above + +QWidget *Qt4RunConfiguration::configurationWidget() +{ + return new Qt4RunConfigurationWidget(this, 0); } void Qt4RunConfiguration::save(PersistentSettingsWriter &writer) const @@ -156,6 +222,7 @@ ProjectExplorer::Environment Qt4RunConfiguration::environment() const void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString) { m_commandLineArguments = ProjectExplorer::Environment::parseCombinedArgString(argumentsString); + emit commandLineArgumentsChanged(argumentsString); } void Qt4RunConfiguration::nameEdited(const QString &name) @@ -167,6 +234,7 @@ void Qt4RunConfiguration::nameEdited(const QString &name) setName(name); m_userSetName = true; } + emit nameChanged(name); } QString Qt4RunConfiguration::proFilePath() const @@ -222,6 +290,9 @@ void Qt4RunConfiguration::updateCachedValues() m_runMode = ProjectExplorer::ApplicationRunConfiguration::Gui; delete reader; + + emit effectiveExecutableChanged(); + emit effectiveWorkingDirectoryChanged(); } QString Qt4RunConfiguration::resolveVariables(const QString &buildConfiguration, const QString& in) const @@ -310,7 +381,7 @@ QString Qt4RunConfiguration::qmakeBuildConfigFromBuildConfiguration(const QStrin else return "release"; } else { - // Old sytle always CONFIG+=debug_and_release + // Old style always CONFIG+=debug_and_release if (qobject_cast(project())->qtVersion(buildConfigurationName)->defaultBuildConfig() & QtVersion::DebugBuild) return "debug"; else diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h index c51ac521fe5..ce1d44769e0 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -36,6 +36,11 @@ #include #include +#include + +class QWidget; +class QLabel; +class QLineEdit; namespace Qt4ProjectManager { @@ -45,9 +50,13 @@ namespace Internal { class Qt4ProFileNode; + + class Qt4RunConfiguration : public ProjectExplorer::ApplicationRunConfiguration { Q_OBJECT + // to change the name and arguments + friend class Qt4RunConfigurationWidget; public: Qt4RunConfiguration(Qt4Project *pro, QString proFilePath); virtual ~Qt4RunConfiguration(); @@ -68,6 +77,14 @@ public: // Should just be called from qt4project, since that knows that the file changed on disc void updateCachedValues(); +signals: + void nameChanged(const QString&); + void commandLineArgumentsChanged(const QString&); + + // note those signals might not emited for every change + void effectiveExecutableChanged(); + void effectiveWorkingDirectoryChanged(); + private slots: void setCommandLineArguments(const QString &argumentsString); void nameEdited(const QString&); @@ -88,6 +105,31 @@ private: QString m_workingDir; ProjectExplorer::ApplicationRunConfiguration::RunMode m_runMode; bool m_userSetName; + QWidget *m_configWidget; + QLabel *m_executableLabel; + QLabel *m_workingDirectoryLabel; +}; + +class Qt4RunConfigurationWidget : public QWidget +{ + Q_OBJECT +public: + Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4runconfigration, QWidget *parent); +private slots: + void setCommandLineArguments(const QString &arguments); + void nameEdited(const QString &name); + // TODO connect to signals from qt4runconfiguration for changed arguments and names + void commandLineArgumentsChanged(const QString &args); + void nameChanged(const QString &name); + void effectiveExecutableChanged(); + void effectiveWorkingDirectoryChanged(); +private: + Qt4RunConfiguration *m_qt4RunConfiguration; + bool m_ignoreChange; + QLabel *m_executableLabel; + QLabel *m_workingDirectoryLabel; + QLineEdit *m_nameLineEdit; + QLineEdit *m_argumentsLineEdit; }; class Qt4RunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory From b06502387bf3a20e1be73fed84c096bac65c54d8 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 10:57:23 +0100 Subject: [PATCH 26/44] Fixes: debugger: fix custom dumpers Details: again... --- src/plugins/debugger/debuggermanager.cpp | 4 +- src/plugins/debugger/gdbengine.cpp | 390 +++++++++++------------ 2 files changed, 191 insertions(+), 203 deletions(-) diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index efa5d1f6333..8180c7cfd10 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -1096,8 +1096,8 @@ bool DebuggerManager::useFastStart() const void DebuggerManager::setUseCustomDumpers(bool on) { - //m_settings.m_useCustomDumpers = on; - //engine()->setUseCustomDumpers(on); + m_settings.m_useCustomDumpers = on; + engine()->setUseCustomDumpers(on); } void DebuggerManager::setUseFastStart(bool on) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index a415f47e3cb..14ad290a195 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -253,6 +253,7 @@ void GdbEngine::init() m_gdbVersion = 100; m_shared = 0; m_outputCodec = QTextCodec::codecForLocale(); + m_dataDumperState = DataDumperUninitialized; m_oldestAcceptableToken = -1; @@ -733,7 +734,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record) --m_pendingRequests; PENDING_DEBUG(" TYPE " << cmd.type << " DECREMENTS PENDING TO: " << m_pendingRequests << cmd.command); - if (m_pendingRequests == 0) + if (m_pendingRequests <= 0) updateWatchModel2(); } else { PENDING_DEBUG(" UNKNOWN TYPE " << cmd.type << " LEAVES PENDING AT: " @@ -2883,7 +2884,7 @@ static QString sizeofTypeExpression(const QString &type) void GdbEngine::setUseCustomDumpers(bool on) { - qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on; + //qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on; Q_UNUSED(on); // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny //m_expandedINames.clear(); @@ -3052,15 +3053,15 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren) //qDebug() << "CMD: " << cmd; - sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data)); + QVariant var; + var.setValue(data); + sendSynchronizedCommand(cmd, WatchDumpCustomValue1, var); q->showStatusMessage( tr("Retrieving data for watch view (%1 requests pending)...") .arg(m_pendingRequests + 1), 10000); // retrieve response - QVariant var; - var.setValue(data); sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var); } @@ -3268,7 +3269,7 @@ void GdbEngine::updateWatchModel2() return; } - PENDING_DEBUG("REBUILDING MODEL") + PENDING_DEBUG("REBUILDING MODEL"); emit gdbInputAvailable(QString(), "[" + currentTime() + "] "); q->showStatusMessage(tr("Finished retrieving data."), 400); @@ -3454,7 +3455,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, } else if (record.resultClass == GdbResultError) { // Record an extra result, as the socket result will be lost // in transmission - --m_pendingRequests; + //--m_pendingRequests; QString msg = record.data.findChild("msg").data(); //qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg; #ifdef QT_DEBUG @@ -3469,12 +3470,12 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, return; } #endif - if (msg.startsWith("The program being debugged was sig")) - msg = strNotInScope; - if (msg.startsWith("The program being debugged stopped while")) - msg = strNotInScope; - data.setError(msg); - insertData(data); + //if (msg.startsWith("The program being debugged was sig")) + // msg = strNotInScope; + //if (msg.startsWith("The program being debugged stopped while")) + // msg = strNotInScope; + //data.setError(msg); + //insertData(data); } } @@ -3485,220 +3486,207 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, QTC_ASSERT(data.isValid(), return); //qDebug() << "CUSTOM VALUE RESULT: " << record.toString(); //qDebug() << "FOR DATA: " << data.toString() << record.resultClass; - if (record.resultClass == GdbResultDone) { - GdbMi output = record.data.findChild("consolestreamoutput"); - QByteArray out = output.data(); - out = out.mid(out.indexOf('"') + 2); // + 1 is the 'success marker' - out = out.left(out.lastIndexOf('"')); - //out.replace('\'', '"'); - out.replace("\\", ""); - out = "dummy={" + out + "}"; - //qDebug() << "OUTPUT: " << out; - - GdbMi contents; - contents.fromString(out); - //qDebug() << "CONTENTS" << contents.toString(true); - - if (!contents.isValid()) { - qDebug() << "INVALID"; - // custom dumper produced no output - if (data.isValueNeeded()) - data.setValue(""); - if (data.isTypeNeeded()) - data.setType(""); - if (data.isChildrenNeeded()) - data.setChildCount(0); - if (data.isChildCountNeeded()) - data.setChildCount(0); - data.setValueToolTip(""); - insertData(data); - } else { - setWatchDataType(data, contents.findChild("type")); - setWatchDataValue(data, contents.findChild("value"), - contents.findChild("valueencoded").data().toInt()); - setWatchDataAddress(data, contents.findChild("addr")); - setWatchDataChildCount(data, contents.findChild("numchild")); - setWatchDataValueToolTip(data, contents.findChild("valuetooltip")); - setWatchDataValueDisabled(data, contents.findChild("valuedisabled")); - setWatchDataEditValue(data, contents.findChild("editvalue")); - if (qq->watchHandler()->isDisplayedIName(data.iname)) { - GdbMi editvalue = contents.findChild("editvalue"); - if (editvalue.isValid()) { - setWatchDataEditValue(data, editvalue); - qq->watchHandler()->showEditValue(data); - } - } - if (!qq->watchHandler()->isExpandedIName(data.iname)) - data.setChildrenUnneeded(); - GdbMi children = contents.findChild("children"); - if (children.isValid() || !qq->watchHandler()->isExpandedIName(data.iname)) - data.setChildrenUnneeded(); - data.setValueUnneeded(); - - // try not to repeat data too often - WatchData childtemplate; - setWatchDataType(childtemplate, contents.findChild("childtype")); - setWatchDataChildCount(childtemplate, contents.findChild("childnumchild")); - //qDebug() << "DATA: " << data.toString(); - insertData(data); - foreach (GdbMi item, children.children()) { - WatchData data1 = childtemplate; - data1.name = item.findChild("name").data(); - data1.iname = data.iname + "." + data1.name; - //qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data() - // << item.findChild("nameencoded").data()[1]; - if (item.findChild("nameencoded").data()[0] == '1') - data1.name = QByteArray::fromBase64(data1.name.toUtf8()); - QString key = item.findChild("key").data(); - if (!key.isEmpty()) - data1.name += " (" + key + ")"; - setWatchDataType(data1, item.findChild("type")); - setWatchDataExpression(data1, item.findChild("exp")); - setWatchDataChildCount(data1, item.findChild("numchild")); - setWatchDataValue(data1, item.findChild("value"), - item.findChild("valueencoded").data().toInt()); - setWatchDataAddress(data1, item.findChild("addr")); - setWatchDataValueToolTip(data1, item.findChild("valuetooltip")); - setWatchDataValueDisabled(data1, item.findChild("valuedisabled")); - if (!qq->watchHandler()->isExpandedIName(data1.iname)) - data1.setChildrenUnneeded(); - //qDebug() << "HANDLE CUSTOM SUBCONTENTS:" << data1.toString(); - insertData(data1); - } - } - //qDebug() << "HANDLE CUSTOM VALUE CONTENTS: " << data.toString(); - } else if (record.resultClass == GdbResultError) { - // FIXME: Should not happen here, i.e. could be removed - QString msg = record.data.findChild("msg").data(); - //qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg; - if (msg.startsWith("The program being debugged was sig")) - msg = strNotInScope; - if (msg.startsWith("The program being debugged stopped while")) - msg = strNotInScope; - data.setError(msg); - insertData(data); - } else { + if (record.resultClass != GdbResultDone) { qDebug() << "STRANGE CUSTOM DUMPER RESULT DATA: " << data.toString(); + return; + } + + GdbMi output = record.data.findChild("consolestreamoutput"); + QByteArray out = output.data(); + + int markerPos = out.indexOf('"') + 1; // position of 'success marker' + if (markerPos == -1 || out.at(markerPos) == 'f') { // 't' or 'f' + // custom dumper produced no output + data.setError(strNotInScope); + insertData(data); + return; + } + + out = out.mid(markerPos + 1); + out = out.left(out.lastIndexOf('"')); + out.replace("\\", ""); + out = "dummy={" + out + "}"; + + GdbMi contents; + contents.fromString(out); + //qDebug() << "CONTENTS" << contents.toString(true); + if (!contents.isValid()) { + data.setError(strNotInScope); + insertData(data); + return; + } + + setWatchDataType(data, contents.findChild("type")); + setWatchDataValue(data, contents.findChild("value"), + contents.findChild("valueencoded").data().toInt()); + setWatchDataAddress(data, contents.findChild("addr")); + setWatchDataChildCount(data, contents.findChild("numchild")); + setWatchDataValueToolTip(data, contents.findChild("valuetooltip")); + setWatchDataValueDisabled(data, contents.findChild("valuedisabled")); + setWatchDataEditValue(data, contents.findChild("editvalue")); + if (qq->watchHandler()->isDisplayedIName(data.iname)) { + GdbMi editvalue = contents.findChild("editvalue"); + if (editvalue.isValid()) { + setWatchDataEditValue(data, editvalue); + qq->watchHandler()->showEditValue(data); + } + } + if (!qq->watchHandler()->isExpandedIName(data.iname)) + data.setChildrenUnneeded(); + GdbMi children = contents.findChild("children"); + if (children.isValid() || !qq->watchHandler()->isExpandedIName(data.iname)) + data.setChildrenUnneeded(); + data.setValueUnneeded(); + + // try not to repeat data too often + WatchData childtemplate; + setWatchDataType(childtemplate, contents.findChild("childtype")); + setWatchDataChildCount(childtemplate, contents.findChild("childnumchild")); + //qDebug() << "DATA: " << data.toString(); + insertData(data); + foreach (GdbMi item, children.children()) { + WatchData data1 = childtemplate; + data1.name = item.findChild("name").data(); + data1.iname = data.iname + "." + data1.name; + //qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data() + // << item.findChild("nameencoded").data()[1]; + if (item.findChild("nameencoded").data()[0] == '1') + data1.name = QByteArray::fromBase64(data1.name.toUtf8()); + QString key = item.findChild("key").data(); + if (!key.isEmpty()) + data1.name += " (" + key + ")"; + setWatchDataType(data1, item.findChild("type")); + setWatchDataExpression(data1, item.findChild("exp")); + setWatchDataChildCount(data1, item.findChild("numchild")); + setWatchDataValue(data1, item.findChild("value"), + item.findChild("valueencoded").data().toInt()); + setWatchDataAddress(data1, item.findChild("addr")); + setWatchDataValueToolTip(data1, item.findChild("valuetooltip")); + setWatchDataValueDisabled(data1, item.findChild("valuedisabled")); + if (!qq->watchHandler()->isExpandedIName(data1.iname)) + data1.setChildrenUnneeded(); + //qDebug() << "HANDLE CUSTOM SUBCONTENTS:" << data1.toString(); + insertData(data1); } } void GdbEngine::updateLocals() { - setTokenBarrier(); +setTokenBarrier(); - m_pendingRequests = 0; - PENDING_DEBUG("\nRESET PENDING"); - m_toolTipCache.clear(); - m_toolTipExpression.clear(); - qq->watchHandler()->reinitializeWatchers(); +m_pendingRequests = 0; +PENDING_DEBUG("\nRESET PENDING"); +m_toolTipCache.clear(); +m_toolTipExpression.clear(); +qq->watchHandler()->reinitializeWatchers(); - int level = currentFrame(); - // '2' is 'list with type and value' - QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level); - sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2 - // '2' is 'list with type and value' - sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2 +int level = currentFrame(); +// '2' is 'list with type and value' +QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level); +sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2 +// '2' is 'list with type and value' +sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2 } void GdbEngine::handleStackListArguments(const GdbResultRecord &record) { - // stage 1/2 +// stage 1/2 - // Linux: - // 12^done,stack-args= - // [frame={level="0",args=[ - // {name="argc",type="int",value="1"}, - // {name="argv",type="char **",value="(char **) 0x7..."}]}] - // Mac: - // 78^done,stack-args= - // {frame={level="0",args={ - // varobj= - // {exp="this",value="0x38a2fab0",name="var21",numchild="3", - // type="CurrentDocumentFind * const",typecode="PTR", - // dynamic_type="",in_scope="true",block_start_addr="0x3938e946", - // block_end_addr="0x3938eb2d"}, - // varobj= - // {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}", - // name="var22",numchild="1",type="const QString ...} }}} - // - // In both cases, iterating over the children of stack-args/frame/args - // is ok. - m_currentFunctionArgs.clear(); - if (record.resultClass == GdbResultDone) { - const GdbMi list = record.data.findChild("stack-args"); - const GdbMi frame = list.findChild("frame"); - const GdbMi args = frame.findChild("args"); - m_currentFunctionArgs = args.children(); - } else if (record.resultClass == GdbResultError) { - qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen"; - } +// Linux: +// 12^done,stack-args= +// [frame={level="0",args=[ +// {name="argc",type="int",value="1"}, +// {name="argv",type="char **",value="(char **) 0x7..."}]}] +// Mac: +// 78^done,stack-args= +// {frame={level="0",args={ +// varobj= +// {exp="this",value="0x38a2fab0",name="var21",numchild="3", +// type="CurrentDocumentFind * const",typecode="PTR", +// dynamic_type="",in_scope="true",block_start_addr="0x3938e946", +// block_end_addr="0x3938eb2d"}, +// varobj= +// {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}", +// name="var22",numchild="1",type="const QString ...} }}} +// +// In both cases, iterating over the children of stack-args/frame/args +// is ok. +m_currentFunctionArgs.clear(); +if (record.resultClass == GdbResultDone) { + const GdbMi list = record.data.findChild("stack-args"); + const GdbMi frame = list.findChild("frame"); + const GdbMi args = frame.findChild("args"); + m_currentFunctionArgs = args.children(); +} else if (record.resultClass == GdbResultError) { + qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen"; +} } void GdbEngine::handleStackListLocals(const GdbResultRecord &record) { - // stage 2/2 +// stage 2/2 - // There could be shadowed variables - QList locals = record.data.findChild("locals").children(); - locals += m_currentFunctionArgs; +// There could be shadowed variables +QList locals = record.data.findChild("locals").children(); +locals += m_currentFunctionArgs; - setLocals(locals); +setLocals(locals); } void GdbEngine::setLocals(const QList &locals) { - //qDebug() << m_varToType; - QHash seen; +//qDebug() << m_varToType; +QHash seen; - foreach (const GdbMi &item, locals) { - // Local variables of inlined code are reported as - // 26^done,locals={varobj={exp="this",value="",name="var4",exp="this", - // numchild="1",type="const QtSharedPointer::Basic 1) - continue; - QString name = item.findChild("exp").data(); - #else - QString name = item.findChild("name").data(); - #endif - int n = seen.value(name); - if (n) { - seen[name] = n + 1; - WatchData data; - data.iname = "local." + name + QString::number(n + 1); - data.name = name + QString(" ").arg(n); - //data.setValue(""); +foreach (const GdbMi &item, locals) { + // Local variables of inlined code are reported as + // 26^done,locals={varobj={exp="this",value="",name="var4",exp="this", + // numchild="1",type="const QtSharedPointer::Basic 1) + continue; + QString name = item.findChild("exp").data(); + #else + QString name = item.findChild("name").data(); + #endif + int n = seen.value(name); + if (n) { + seen[name] = n + 1; + WatchData data; + data.iname = "local." + name + QString::number(n + 1); + data.name = name + QString(" ").arg(n); + //data.setValue(""); + setWatchDataValue(data, item.findChild("value")); + data.setType(""); + data.setChildCount(0); + insertData(data); + } else { + seen[name] = 1; + WatchData data; + data.iname = "local." + name; + data.name = name; + data.exp = name; + data.framekey = m_currentFrame + data.name; + setWatchDataType(data, item.findChild("type")); + // set value only directly if it is simple enough, otherwise + // pass through the insertData() machinery + if (isIntOrFloatType(data.type) || isPointerType(data.type)) setWatchDataValue(data, item.findChild("value")); - data.setType(""); - data.setChildCount(0); - insertData(data); - } else { - seen[name] = 1; - WatchData data; - data.iname = "local." + name; - data.name = name; - data.exp = name; - data.framekey = m_currentFrame + data.name; - setWatchDataType(data, item.findChild("type")); - // set value only directly if it is simple enough, otherwise - // pass through the insertData() machinery - if (isIntOrFloatType(data.type) || isPointerType(data.type)) - setWatchDataValue(data, item.findChild("value")); - if (!qq->watchHandler()->isExpandedIName(data.iname)) - data.setChildrenUnneeded(); - if (isPointerType(data.type) || data.name == "this") - data.setChildCount(1); - if (0 && m_varToType.contains(data.framekey)) { - qDebug() << "RE-USING " << m_varToType.value(data.framekey); - data.setType(m_varToType.value(data.framekey)); - } - insertData(data); + if (!qq->watchHandler()->isExpandedIName(data.iname)) + data.setChildrenUnneeded(); + if (isPointerType(data.type) || data.name == "this") + data.setChildCount(1); + if (0 && m_varToType.contains(data.framekey)) { + qDebug() << "RE-USING " << m_varToType.value(data.framekey); + data.setType(m_varToType.value(data.framekey)); } + insertData(data); + } } } From eb021724dfe1653d2f00dc5d3474fa25bb1ee5aa Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 12:15:40 +0100 Subject: [PATCH 27/44] Fixes: debugger: sort array and list indices numerically --- share/qtcreator/gdbmacros/gdbmacros.cpp | 42 ++++++++++++------------- src/plugins/debugger/debuggerplugin.cpp | 5 +-- src/plugins/debugger/gdbengine.cpp | 2 ++ src/plugins/debugger/watchhandler.cpp | 17 ++-------- src/plugins/fakevim/fakevimhandler.cpp | 1 + tests/manual/gdbdebugger/simple/app.cpp | 3 +- 6 files changed, 29 insertions(+), 41 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index 6a1385359fb..c70e3b75a43 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -839,7 +839,7 @@ static void qDumpQByteArray(QDumper &d) unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?'; sprintf(buf, "%02x (%u '%c')", c, c, u); d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); P(d, "value", buf); d.endHash(); } @@ -1104,14 +1104,14 @@ static void qDumpQHash(QDumper &d) while (node != end) { d.beginHash(); if (simpleKey) { - P(d, "name", "[" << i << "]"); + P(d, "name", i); qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key"); if (simpleValue) qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset)); P(d, "type", valueType); P(d, "addr", addOffset(node, valueOffset)); } else { - P(d, "name", "[" << i << "]"); + P(d, "name", i); //P(d, "exp", "*(char*)" << node); P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node); P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'"); @@ -1215,7 +1215,7 @@ static void qDumpQList(QDumper &d) d << ",children=["; for (int i = 0; i != n; ++i) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); if (innerTypeIsPointer) { void *p = ldata.d->array + i + pdata->begin; if (p) { @@ -1275,7 +1275,7 @@ static void qDumpQLinkedList(QDumper &d) const void *p = deref(ldata); for (int i = 0; i != n; ++i) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); const void *addr = addOffset(p, 2 * sizeof(void*)); qDumpInnerValueOrPointer(d, d.innertype, stripped, addr); p = deref(p); @@ -1414,7 +1414,7 @@ static void qDumpQMap(QDumper &d) while (node != end) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); if (simpleKey) { P(d, "type", valueType); qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key"); @@ -1660,7 +1660,7 @@ static void qDumpQObjectMethodList(QDumper &d) const QMetaMethod & method = mo->method(i); int mt = method.methodType(); d.beginHash(); - P(d, "name", "[" << i << "] " << mo->indexOfMethod(method.signature()) + P(d, "name", i << " " << mo->indexOfMethod(method.signature()) << " " << method.signature()); P(d, "value", (mt == QMetaMethod::Signal ? "" : "") << " (" << mt << ")"); d.endHash(); @@ -1712,11 +1712,11 @@ static void qDumpQObjectSignal(QDumper &d) for (int i = 0; i != connList.size(); ++i) { const QObjectPrivate::Connection &conn = connList.at(i); d.beginHash(); - P(d, "name", "[" << i << "] receiver"); + P(d, "name", i << " receiver"); qDumpInnerValueHelper(d, NS"QObject *", conn.receiver); d.endHash(); d.beginHash(); - P(d, "name", "[" << i << "] slot"); + P(d, "name", i << " slot"); P(d, "type", ""); if (conn.receiver) P(d, "value", conn.receiver->metaObject()->method(conn.method).signature()); @@ -1725,7 +1725,7 @@ static void qDumpQObjectSignal(QDumper &d) P(d, "numchild", "0"); d.endHash(); d.beginHash(); - P(d, "name", "[" << i << "] type"); + P(d, "name", i << " type"); P(d, "type", ""); P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>"); P(d, "numchild", "0"); @@ -1756,7 +1756,7 @@ static void qDumpQObjectSignalList(QDumper &d) int k = mo->indexOfSignal(method.signature()); const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, k); d.beginHash(); - P(d, "name", "[" << k << "]"); + P(d, "name", k); P(d, "value", method.signature()); P(d, "numchild", connList.size()); //P(d, "numchild", "1"); @@ -1796,17 +1796,17 @@ static void qDumpQObjectSlot(QDumper &d) const QMetaMethod & method = sender.sender->metaObject()->method(sender.signal); d.beginHash(); - P(d, "name", "[" << s << "] sender"); + P(d, "name", s << " sender"); qDumpInnerValueHelper(d, NS"QObject *", sender.sender); d.endHash(); d.beginHash(); - P(d, "name", "[" << s << "] signal"); + P(d, "name", s << " signal"); P(d, "type", ""); P(d, "value", method.signature()); P(d, "numchild", "0"); d.endHash(); d.beginHash(); - P(d, "name", "[" << s << "] type"); + P(d, "name", s << " type"); P(d, "type", ""); P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>"); P(d, "numchild", "0"); @@ -1843,7 +1843,7 @@ static void qDumpQObjectSlotList(QDumper &d) if (method.methodType() == QMetaMethod::Slot) { d.beginHash(); int k = mo->indexOfSlot(method.signature()); - P(d, "name", "[" << k << "]"); + P(d, "name", k); P(d, "value", method.signature()); // count senders. expensive... @@ -1911,7 +1911,7 @@ static void qDumpQSet(QDumper &d) for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) { for (node = hd->buckets[bucket]; node->next; node = node->next) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); P(d, "type", d.innertype); P(d, "exp", "(('"NS"QHashNode<" << d.innertype << ","NS"QHashDummyValue>'*)" @@ -1970,7 +1970,7 @@ static void qDumpQStringList(QDumper &d) d << ",children=["; for (int i = 0; i != n; ++i) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); P(d, "value", list[i]); P(d, "valueencoded", "1"); d.endHash(); @@ -2108,7 +2108,7 @@ static void qDumpQVector(QDumper &d) d << ",children=["; for (int i = 0; i != n; ++i) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); qDumpInnerValueOrPointer(d, d.innertype, stripped, addOffset(v, i * innersize + typeddatasize)); d.endHash(); @@ -2156,7 +2156,7 @@ static void qDumpStdList(QDumper &d) it = list.begin(); for (int i = 0; i < 1000 && it != list.end(); ++i, ++it) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->()); d.endHash(); } @@ -2218,7 +2218,7 @@ static void qDumpStdMap(QDumper &d) d.endHash(); } else { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); P(d, "addr", it.operator->()); P(d, "type", pairType); d.endHash(); @@ -2305,7 +2305,7 @@ static void qDumpStdVector(QDumper &d) d << ",children=["; for (int i = 0; i != n; ++i) { d.beginHash(); - P(d, "name", "[" << i << "]"); + P(d, "name", i); qDumpInnerValueOrPointer(d, d.innertype, stripped, addOffset(v->start, i * innersize)); d.endHash(); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index f8bb4a86b75..3f9cfc6caaa 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -565,10 +565,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes connect(resetToSimpleAction, SIGNAL(triggered()), m_manager, SLOT(setSimpleDockWidgetArrangement())); - - m_generalOptionPage = 0; - - // FIXME: + // FIXME: m_generalOptionPage = new GdbOptionPage(this); addObject(m_generalOptionPage); diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 14ad290a195..c559bcb2c1c 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -3548,6 +3548,8 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, WatchData data1 = childtemplate; data1.name = item.findChild("name").data(); data1.iname = data.iname + "." + data1.name; + if (!data1.name.isEmpty() && data1.name.at(0).isDigit()) + data1.name = '[' + data1.name + ']'; //qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data() // << item.findChild("nameencoded").data()[1]; if (item.findChild("nameencoded").data()[0] == '1') diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index b2c43b28f64..a00b7fad7ce 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -255,7 +255,6 @@ QString WatchData::toString() const return res; } - static bool iNameSorter(const WatchData &d1, const WatchData &d2) { if (d1.level != d2.level) @@ -265,19 +264,9 @@ static bool iNameSorter(const WatchData &d1, const WatchData &d2) QString name1 = d1.iname.section('.', level, level); QString name2 = d2.iname.section('.', level, level); //MODEL_DEBUG(" SORT: " << name1 << name2 << (name1 < name2)); - - if (name1 != name2) { - // This formerly used inames. in this case 'lastIndexOf' probably - // makes more sense. - if (name1.startsWith('[') && name2.startsWith('[')) { - return name1.mid(1, name1.indexOf(']') - 1).toInt() - < name2.mid(1, name2.indexOf(']') - 1).toInt(); - // numbers should be sorted according to their numerical value - //int pos = d1.name.lastIndexOf('.'); - //if (pos != -1 && pos + 1 != d1.name.size() && d1.name.at(pos + 1).isDigit()) - // return d1.name.size() < d2.name.size(); - // fall through - } + if (name1 != name2 && !name1.isEmpty() && !name2.isEmpty()) { + if (name1.at(0).isDigit() && name2.at(0).isDigit()) + return name1.toInt() < name2.toInt(); return name1 < name2; } } diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 26e127b9428..e23ba991fb0 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -437,6 +437,7 @@ void FakeVimHandler::Private::setupWidget() m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap); } m_wasReadOnly = EDITOR(isReadOnly()); + //EDITOR(setReadOnly(true)); showBlackMessage("vi emulation mode."); updateMiniBuffer(); } diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index 442e0e23d1a..98fa2111dc9 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -244,7 +244,6 @@ void testQLinkedList() f.append(Foo(1)); f.append(Foo(2)); #endif - QLinkedList v; v.push_back("aa"); v.push_back("bb"); @@ -258,7 +257,7 @@ void testQList() QList li; QList lu; - for (int i = 0; i != 3; ++i) { + for (int i = 0; i != 30; ++i) { li.append(i); } li.append(101); From 3e6cf4e96c74c892d919edf1b97a64c699a704d0 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 12:44:46 +0100 Subject: [PATCH 28/44] Fixes: fakevim: code cosmetics --- src/plugins/fakevim/fakevimplugin.cpp | 31 +++++---------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 329c965318f..2f0a3894328 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -126,7 +126,6 @@ private slots: private: FakeVimPlugin *q; QAction *m_installHandlerAction; - Core::ICore *m_core; }; } // namespace Internal @@ -136,7 +135,6 @@ FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin) { q = plugin; m_installHandlerAction = 0; - m_core = 0; } FakeVimPluginPrivate::~FakeVimPluginPrivate() @@ -149,10 +147,7 @@ void FakeVimPluginPrivate::shutdown() bool FakeVimPluginPrivate::initialize() { - m_core = Core::ICore::instance(); - QTC_ASSERT(m_core, return false); - - Core::ActionManager *actionManager = m_core->actionManager(); + Core::ActionManager *actionManager = Core::ICore::instance()->actionManager(); QTC_ASSERT(actionManager, return false); QList globalcontext; @@ -174,7 +169,7 @@ bool FakeVimPluginPrivate::initialize() this, SLOT(installHandlerOnCurrentEditor())); // EditorManager - QObject *editorManager = m_core->editorManager(); + QObject *editorManager = Core::ICore::instance()->editorManager(); connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), this, SLOT(editorAboutToClose(Core::IEditor*))); connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), @@ -239,9 +234,9 @@ void FakeVimPluginPrivate::writeFile(bool *handled, if (editor && editor->file()->fileName() == fileName) { // Handle that as a special case for nicer interaction with core Core::IFile *file = editor->file(); - m_core->fileManager()->blockFileChange(file); + Core::ICore::instance()->fileManager()->blockFileChange(file); file->save(fileName); - m_core->fileManager()->unblockFileChange(file); + Core::ICore::instance()->fileManager()->unblockFileChange(file); *handled = true; } } @@ -258,33 +253,17 @@ void FakeVimPluginPrivate::removeHandler() void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor) { - Q_UNUSED(editor); //qDebug() << "OPENING: " << editor << editor->widget(); - //installHandler(editor); - -#if 1 QSettings *s = ICore::instance()->settings(); bool automatic = s->value("textInteractionSettings/UseVim").toBool(); - //qDebug() << "USE VIM: " << automatic; if (automatic) installHandler(editor); -#endif - -#if 0 - QWidget *widget = editor->widget(); - if (BaseTextEditor *bt = qobject_cast(widget)) { - InteractionSettings settings = bt->interactionSettings(); - qDebug() << "USE VIM: " << settings.m_useVim; - if (settings.m_useVim) - installHandler(editor); - } -#endif } void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor) { + //qDebug() << "CLOSING: " << editor << editor->widget(); Q_UNUSED(editor); - //qDebug() << "CLOSING: " << editor; } void FakeVimPluginPrivate::showCommandBuffer(const QString &contents) From d9da6dccf68ccde5dc13c0ae2b39551ccb4e3d62 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 13:23:45 +0100 Subject: [PATCH 29/44] Fixes: snippets: compile fix for dead code --- src/plugins/snippets/README | 1 + src/plugins/snippets/snippetscompletion.cpp | 37 +++++++++++++-------- src/plugins/snippets/snippetscompletion.h | 19 +++++------ src/plugins/snippets/snippetsplugin.cpp | 26 +++++++++------ src/plugins/snippets/snippetswindow.cpp | 12 +++---- 5 files changed, 53 insertions(+), 42 deletions(-) create mode 100644 src/plugins/snippets/README diff --git a/src/plugins/snippets/README b/src/plugins/snippets/README new file mode 100644 index 00000000000..0631c716c2e --- /dev/null +++ b/src/plugins/snippets/README @@ -0,0 +1 @@ +This is dead code for now. diff --git a/src/plugins/snippets/snippetscompletion.cpp b/src/plugins/snippets/snippetscompletion.cpp index 129d27d63cc..1ab6464a33e 100644 --- a/src/plugins/snippets/snippetscompletion.cpp +++ b/src/plugins/snippets/snippetscompletion.cpp @@ -50,8 +50,7 @@ const QIcon SnippetsCompletion::m_fileIcon = QIcon(":/snippets/images/file.png") SnippetsCompletion::SnippetsCompletion(QObject *parent) : ICompletionCollector(parent) { - m_core = SnippetsPlugin::core(); - m_snippetsWnd = SnippetsPlugin::snippetsWindow(); + m_snippetsWindow = SnippetsPlugin::snippetsWindow(); updateCompletions(); } @@ -66,9 +65,9 @@ void SnippetsCompletion::updateCompletions() { qDeleteAll(m_autoCompletions.values()); m_autoCompletions.clear(); - +#if 0 int index = 0; - foreach (SnippetSpec *spec, m_snippetsWnd->snippets()) { + foreach (SnippetSpec *spec, m_snippetsWindow->snippets()) { if (!spec->completionShortcut().isEmpty()) { TextEditor::CompletionItem *item = new TextEditor::CompletionItem; item->m_key = spec->name(); @@ -79,6 +78,7 @@ void SnippetsCompletion::updateCompletions() ++index; } } +#endif } bool SnippetsCompletion::triggersCompletion(TextEditor::ITextEditable *editor) @@ -96,29 +96,36 @@ int SnippetsCompletion::startCompletion(TextEditor::ITextEditable *editor) return m_startPosition; } -void SnippetsCompletion::completions(QList *completions) +#if 0 +void SnippetsCompletion::completions(const QList &completions) { const int length = m_editor->position() - m_startPosition; if (length >= 2) { QString key = m_editor->textAt(m_startPosition, length); foreach (TextEditor::CompletionItem* item, m_autoCompletions.values()) { - if (item->m_key.startsWith(key, Qt::CaseInsensitive)) { - (*completions) << item; - } + if (item->m_key.startsWith(key, Qt::CaseInsensitive)) + completions->append(item); } } } +#endif QString SnippetsCompletion::text(TextEditor::CompletionItem *item) const { - const SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index); +#if 0 + const SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index); return spec->name(); +#endif + return QString(); } QString SnippetsCompletion::details(TextEditor::CompletionItem *item) const { - const SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index); +#if 0 + const SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index); return spec->description(); +#endif + return QString(); } QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const @@ -126,18 +133,20 @@ QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const return m_fileIcon; } -void SnippetsCompletion::complete(TextEditor::CompletionItem *item) +void SnippetsCompletion::complete(const TextEditor::CompletionItem &item) { - SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index); +#if 0 + SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index); int length = m_editor->position() - m_startPosition; m_editor->setCurPos(m_startPosition); m_editor->remove(length); - m_snippetsWnd->insertSnippet(m_editor, spec); + m_snippetsWindow->insertSnippet(m_editor, spec); +#endif } -bool SnippetsCompletion::partiallyComplete() +bool SnippetsCompletion::partiallyComplete(const myns::QList&) { return false; } diff --git a/src/plugins/snippets/snippetscompletion.h b/src/plugins/snippets/snippetscompletion.h index 5749bd0cbe9..df19b40e3d1 100644 --- a/src/plugins/snippets/snippetscompletion.h +++ b/src/plugins/snippets/snippetscompletion.h @@ -36,15 +36,11 @@ #include -#include -#include #include +#include +#include #include -namespace Core { -class ICore; -} - namespace TextEditor { class ITextEditable; class ITextEditor; @@ -72,10 +68,12 @@ public: QString details(TextEditor::CompletionItem *item) const; QIcon icon(TextEditor::CompletionItem *item) const; - void complete(TextEditor::CompletionItem *item); - bool partiallyComplete(); + void complete(const TextEditor::CompletionItem &item); + bool partiallyComplete(const QList &); void cleanup(); + void completions(QList*); + private slots: void updateCompletions(); @@ -83,10 +81,9 @@ private: static int findStartOfName(const TextEditor::ITextEditor *editor); TextEditor::ITextEditable *m_editor; - int m_startPosition; // Position of the cursor from which completion started + int m_startPosition; // Position of the cursor from which completion started - SnippetsWindow *m_snippetsWnd; - Core::ICore *m_core; + SnippetsWindow *m_snippetsWindow; QMultiMap m_autoCompletions; diff --git a/src/plugins/snippets/snippetsplugin.cpp b/src/plugins/snippets/snippetsplugin.cpp index 32dd4bc04e2..3eae254875c 100644 --- a/src/plugins/snippets/snippetsplugin.cpp +++ b/src/plugins/snippets/snippetsplugin.cpp @@ -36,16 +36,18 @@ #include "snippetsplugin.h" #include "snippetspec.h" -#include #include -#include +#include #include +#include #include #include -#include +#include #include -#include +#include +#include +#include #include #include @@ -56,6 +58,7 @@ SnippetsPlugin *SnippetsPlugin::m_instance = 0; SnippetsPlugin::SnippetsPlugin() { m_instance = this; + m_snippetsCompletion = 0; } SnippetsPlugin::~SnippetsPlugin() @@ -78,17 +81,20 @@ bool SnippetsPlugin::initialize(const QStringList &arguments, QString *) context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); m_snippetWnd = new SnippetsWindow(); - addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree", - m_snippetWnd, - QList() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window")) - << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR), - Qt::RightDockWidgetArea)); + Core::BaseView *view = new Core::BaseView; + view->setUniqueViewName("Snippets.SnippetsTree"); + view->setWidget(m_snippetWnd); + view->setContext(QList() + << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window")) + << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR)); + //view->setDefaultPosition(Qt::RightDockWidgetArea)); + addAutoReleasedObject(view); m_snippetsCompletion = new SnippetsCompletion(this); addObject(m_snippetsCompletion); foreach (SnippetSpec *snippet, m_snippetWnd->snippets()) { QShortcut *sc = new QShortcut(m_snippetWnd); - Core::ICommand *cmd = am->registerShortcut(sc, simplifySnippetName(snippet), context); + Core::Command *cmd = am->registerShortcut(sc, simplifySnippetName(snippet), context); cmd->setCategory(tr("Snippets")); connect(sc, SIGNAL(activated()), this, SLOT(snippetActivated())); m_shortcuts.insert(sc, snippet); diff --git a/src/plugins/snippets/snippetswindow.cpp b/src/plugins/snippets/snippetswindow.cpp index f6377e199af..982b8752049 100644 --- a/src/plugins/snippets/snippetswindow.cpp +++ b/src/plugins/snippets/snippetswindow.cpp @@ -59,8 +59,6 @@ Q_DECLARE_METATYPE(Snippets::Internal::SnippetSpec *) SnippetsWindow::SnippetsWindow() { - m_core = SnippetsPlugin::core(); - setWindowTitle(tr("Snippets")); setWindowIcon(QIcon(":/snippets/images/snippets.png")); setOrientation(Qt::Vertical); @@ -79,7 +77,7 @@ SnippetsWindow::SnippetsWindow() if (!initSnippetsDir()) setDisabled(true); else { - QDir defaultDir(m_core->resourcePath() + QLatin1String("/snippets")); + QDir defaultDir(Core::ICore::instance()->resourcePath() + QLatin1String("/snippets")); if (defaultDir.exists()) initSnippets(defaultDir); initSnippets(m_snippetsDir); @@ -110,9 +108,9 @@ void SnippetsWindow::activateSnippet(QTreeWidgetItem *item, int column) return; TextEditor::ITextEditable *editor = 0; - if (m_core->editorManager()->currentEditor()) + if (Core::ICore::instance()->editorManager()->currentEditor()) editor = qobject_cast( - m_core->editorManager()->currentEditor()); + Core::ICore::instance()->editorManager()->currentEditor()); if (editor) { SnippetSpec* spec = qVariantValue(item->data(0, Qt::UserRole)); insertSnippet(editor, spec); @@ -229,9 +227,9 @@ void SnippetsWindow::showInputWidget(bool canceled, const QString &value) return; TextEditor::ITextEditor *te = 0; - if (m_core->editorManager()->currentEditor()) + if (Core::ICore::instance()->editorManager()->currentEditor()) te = qobject_cast( - m_core->editorManager()->currentEditor()); + Core::ICore::instance()->editorManager()->currentEditor()); int arg = m_requiredArgs.takeFirst(); if (arg != -1) From 6bf55b6184133f07112bd64cf3b1e196bf01ea91 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 13:24:43 +0100 Subject: [PATCH 30/44] Fixes: snippet: compile fix for dead code --- src/plugins/snippets/snippetswindow.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/plugins/snippets/snippetswindow.h b/src/plugins/snippets/snippetswindow.h index f0c4e032751..a81457c2902 100644 --- a/src/plugins/snippets/snippetswindow.h +++ b/src/plugins/snippets/snippetswindow.h @@ -44,10 +44,6 @@ class QDir; class QLabel; QT_END_NAMESPACE -namespace Core { -class ICore; -} - namespace TextEditor { class ITextEditable; class ITextEditor; @@ -97,7 +93,6 @@ private: SnippetSpec *m_currentSnippet; TextEditor::ITextEditable *m_currentEditor; - Core::ICore *m_core; QDir m_snippetsDir; SnippetsTree *m_snippetsTree; From 615660c0216f68745d9b714aa007038fcf677fab Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 13:40:59 +0100 Subject: [PATCH 31/44] Fixes: qtestlibplugin: some care for dead code --- src/plugins/qtestlib/qtestlibplugin.cpp | 41 +++++++++++++------------ src/plugins/qtestlib/qtestlibplugin.h | 30 +++++++++--------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/plugins/qtestlib/qtestlibplugin.cpp b/src/plugins/qtestlib/qtestlibplugin.cpp index 3bb2d1df359..86ea4f57160 100644 --- a/src/plugins/qtestlib/qtestlibplugin.cpp +++ b/src/plugins/qtestlib/qtestlibplugin.cpp @@ -33,8 +33,8 @@ #include "qtestlibplugin.h" -//#include -//#include +#include +#include #include #include @@ -116,28 +116,27 @@ static QTestFunction::MessageType stringToMessageType(const QString &str) } // ----------------------------------- -QTestLibPlugin::QTestLibPlugin() : - m_projectExplorer(0), - m_core(0), - m_outputPane(0) +QTestLibPlugin::QTestLibPlugin() + : m_projectExplorer(0), m_outputPane(0) { } QTestLibPlugin::~QTestLibPlugin() { - if (m_core && m_outputPane) - m_core->pluginManager()->removeObject(m_outputPane); + if (m_outputPane) + ExtensionSystem::PluginManager::instance()->removeObject(m_outputPane); } -bool QTestLibPlugin::init(ExtensionSystem::PluginManagerInterface *app, QString *errorMessage) +bool QTestLibPlugin::init(const QStringList &arguments, QString *errorMessage) { + Q_UNUSED(arguments); Q_UNUSED(errorMessage); - m_projectExplorer = app->getObject(); - connect(m_projectExplorer->qObject(), SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)), + m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); + connect(m_projectExplorer, SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)), this, SLOT(projectRunHook(ProjectExplorer::Project *))); m_outputPane = new QTestOutputPane(this); - app->addObject(m_outputPane); + ExtensionSystem::PluginManager::instance()->addObject(m_outputPane); return true; } @@ -169,10 +168,10 @@ void QTestLibPlugin::projectRunHook(ProjectExplorer::Project *proj) //NBS proj->setCustomApplicationOutputHandler(this); //NBS proj->setExtraApplicationRunArguments(QStringList() << QLatin1String("-xml") << QLatin1String("-o") << m_outputFile); - const QString proFile = proj->fileName(); - const QFileInfo fi(proFile); - if (QFile::exists(fi.absolutePath())) - m_projectDirectory = fi.absolutePath(); +// const QString proFile = proj->fileName(); +// const QFileInfo fi(proFile); +// if (QFile::exists(fi.absolutePath())) +// m_projectDirectory = fi.absolutePath(); } void QTestLibPlugin::clear() @@ -319,9 +318,11 @@ bool QTestFunction::indexHasIncidents(const QModelIndex &function, IncidentType return false; } + // -------------- QTestOutputPane -QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin) : - QObject(plugin), + +QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin) + : QObject(plugin), m_plugin(plugin), m_widget(0), m_model(new QStandardItemModel(this)) @@ -485,8 +486,8 @@ void QTestOutputWidget::gotoLocation(QModelIndex index) QTestLocation loc = tag.value(); - m_coreInterface->editorManager()->openEditor(loc.file); - Core::EditorInterface *edtIface = m_coreInterface->editorManager()->currentEditor(); + Core::ICore::instance()->editorManager()->openEditor(loc.file); + Core::EditorInterface *edtIface = Core::ICore::instance()->editorManager()->currentEditor(); if (!edtIface) return; TextEditor::ITextEditor *editor = diff --git a/src/plugins/qtestlib/qtestlibplugin.h b/src/plugins/qtestlib/qtestlibplugin.h index c442a1ddec6..24e33648308 100644 --- a/src/plugins/qtestlib/qtestlibplugin.h +++ b/src/plugins/qtestlib/qtestlibplugin.h @@ -35,18 +35,19 @@ #define QTESTLIBPLUGIN_H #include -//#include +#include +#include #include +#include #include #include -#include QT_BEGIN_NAMESPACE -class QStandardItemModel; -class QTreeView; -class QTextEdit; class QComboBox; +class QStandardItemModel; +class QTextEdit; +class QTreeView; QT_END_NAMESPACE namespace QTestLib { @@ -101,7 +102,7 @@ public: class QTestOutputPane : public Core::IOutputPane { Q_OBJECT - //Q_INTERFACES(Core::IOutputPane) + public: QTestOutputPane(QTestLibPlugin *plugin); @@ -116,8 +117,13 @@ public: void show(); -Q_SIGNALS: -//signals + // FIXME: + virtual int priorityInStatusBar() const { return 0;} + virtual void setFocus() {} + virtual bool hasFocus() { return false;} + virtual bool canFocus() { return false;} + +signals: void showPage(); private: @@ -165,19 +171,15 @@ private: QTestOutputFilter *m_filterModel; }; -class QTestLibPlugin : public QObject, - public ExtensionSystem::PluginInterface, - public ProjectExplorer::IApplicationOutput +class QTestLibPlugin : public QObject { Q_OBJECT - Q_INTERFACES(ExtensionSystem::PluginInterface - ProjectExplorer::IApplicationOutput) public: QTestLibPlugin(); virtual ~QTestLibPlugin(); - bool init(ExtensionSystem::PluginManagerInterface *app, QString *error_message); + bool init(const QStringList &args, QString *error_message); void extensionsInitialized(); // IApplicationOutput From 1969b2ebc0fa6ac624e4fc1506a302a56a00516c Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 13:56:10 +0100 Subject: [PATCH 32/44] Fixes: some less caching of the ICore singleton pointer --- src/plugins/cpptools/cppcodecompletion.cpp | 14 +++++++------- src/plugins/cpptools/cppcodecompletion.h | 9 +-------- src/plugins/cpptools/cpptoolsplugin.cpp | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 824b7b4b1cb..df68e5778dc 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -74,9 +74,10 @@ using namespace CPlusPlus; namespace CppTools { namespace Internal { -class FunctionArgumentWidget : public QLabel { +class FunctionArgumentWidget : public QLabel +{ public: - FunctionArgumentWidget(Core::ICore *core); + FunctionArgumentWidget(); void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot); protected: @@ -183,10 +184,10 @@ protected: using namespace CppTools::Internal; -FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core) +FunctionArgumentWidget::FunctionArgumentWidget() : m_item(0) { - QObject *editorObject = core->editorManager()->currentEditor(); + QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor(); m_editor = qobject_cast(editorObject); m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint); @@ -311,9 +312,8 @@ void FunctionArgumentWidget::updateHintText() setText(text); } -CppCodeCompletion::CppCodeCompletion(CppModelManager *manager, Core::ICore *core) +CppCodeCompletion::CppCodeCompletion(CppModelManager *manager) : ICompletionCollector(manager), - m_core(core), m_manager(manager), m_caseSensitivity(Qt::CaseSensitive), m_autoInsertBraces(true), @@ -1030,7 +1030,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) Function *function = symbol->type()->asFunction(); QTC_ASSERT(function, return); - m_functionArgumentWidget = new FunctionArgumentWidget(m_core); + m_functionArgumentWidget = new FunctionArgumentWidget(); m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot()); } } else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) { diff --git a/src/plugins/cpptools/cppcodecompletion.h b/src/plugins/cpptools/cppcodecompletion.h index 6d4690babca..08a767ea6ce 100644 --- a/src/plugins/cpptools/cppcodecompletion.h +++ b/src/plugins/cpptools/cppcodecompletion.h @@ -34,23 +34,17 @@ #ifndef CPPCODECOMPLETION_H #define CPPCODECOMPLETION_H -// C++ front-end #include #include #include #include #include -// Qt Creator #include -// Qt #include #include -namespace Core { -class ICore; -} namespace TextEditor { class ITextEditor; @@ -66,7 +60,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector { Q_OBJECT public: - CppCodeCompletion(CppModelManager *manager, Core::ICore *core); + explicit CppCodeCompletion(CppModelManager *manager); bool triggersCompletion(TextEditor::ITextEditable *editor); int startCompletion(TextEditor::ITextEditable *editor); @@ -131,7 +125,6 @@ private: TextEditor::ITextEditable *m_editor; int m_startPosition; // Position of the cursor from which completion started - Core::ICore *m_core; CppModelManager *m_manager; Qt::CaseSensitivity m_caseSensitivity; bool m_autoInsertBraces; diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 3a8c271a098..f70a766a46b 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -87,7 +87,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) // Objects m_modelManager = new CppModelManager(this); addAutoReleasedObject(m_modelManager); - m_completion = new CppCodeCompletion(m_modelManager, core); + m_completion = new CppCodeCompletion(m_modelManager); addAutoReleasedObject(m_completion); CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager, core->editorManager()); From f6f1721a64d13c68f04a7180e5932de34ded74ab Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 13:57:42 +0100 Subject: [PATCH 33/44] Fixes: help: small refactoring --- src/plugins/help/helpplugin.cpp | 21 +++++++++++++-------- src/plugins/help/helpplugin.h | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 3eddaa5e0ec..4d48afd0b20 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -395,6 +395,11 @@ void HelpPlugin::rightPaneForward() m_helpViewerForSideBar->forward(); } +void HelpPlugin::activateHelpMode() +{ + m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); +} + void HelpPlugin::switchToHelpMode() { switchToHelpMode(m_helpViewerForSideBar->source()); @@ -403,14 +408,14 @@ void HelpPlugin::switchToHelpMode() void HelpPlugin::switchToHelpMode(const QUrl &source) { - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); m_centralWidget->setSource(source); m_centralWidget->setFocus(); } void HelpPlugin::switchToHelpMode(const QMap &urls, const QString &keyword) { - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); m_centralWidget->showTopicChooser(urls, keyword); } @@ -561,7 +566,7 @@ void HelpPlugin::activateContext() viewer = m_helpViewerForSideBar; } else { viewer = m_centralWidget->currentHelpViewer(); - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); } if (viewer) { @@ -579,7 +584,7 @@ void HelpPlugin::activateContext() viewer = m_helpViewerForSideBar; } else { viewer = m_centralWidget->currentHelpViewer(); - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); } if (viewer) { @@ -593,19 +598,19 @@ void HelpPlugin::activateContext() void HelpPlugin::activateIndex() { - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); m_sideBar->activateItem(m_indexItem); } void HelpPlugin::activateContents() { - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); m_sideBar->activateItem(m_contentItem); } void HelpPlugin::activateSearch() { - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); m_sideBar->activateItem(m_searchItem); } @@ -680,7 +685,7 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url) void HelpPlugin::openGettingStarted() { - m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); + activateHelpMode(); m_centralWidget->setSource( QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html") .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)); diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index ef56c7e3364..145981e16a2 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -134,6 +134,7 @@ private slots: private: QToolBar *createToolBar(); void createRightPaneSideBar(); + void activateHelpMode(); Core::ICore *m_core; QHelpEngine *m_helpEngine; From 8ef4f166e7c1373f5d4d2cf74879d00a3ae08ebf Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 14:04:39 +0100 Subject: [PATCH 34/44] Fixes: coreplugin: remove another cached core instance singleton pointer --- src/plugins/coreplugin/mainwindow.cpp | 2 +- .../coreplugin/scriptmanager/scriptmanager.cpp | 9 +++------ .../coreplugin/scriptmanager/scriptmanager_p.h | 14 ++++---------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 97648813d01..91c2756d315 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -120,7 +120,7 @@ MainWindow::MainWindow() : m_editorManager(0), m_fileManager(new FileManager(this)), m_progressManager(new ProgressManagerPrivate()), - m_scriptManager(new ScriptManagerPrivate(this, m_coreImpl)), + m_scriptManager(new ScriptManagerPrivate(this)), m_variableManager(new VariableManager(this)), m_vcsManager(new VCSManager()), m_viewManager(0), diff --git a/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp b/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp index 937af4f66a3..74f04c2a466 100644 --- a/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp +++ b/src/plugins/coreplugin/scriptmanager/scriptmanager.cpp @@ -181,10 +181,8 @@ static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine) namespace Core { namespace Internal { -ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent, ICore *core) : - ScriptManager(parent), - m_core(core), - m_initialized(false) +ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent) + : ScriptManager(parent), m_initialized(false) { } @@ -250,7 +248,6 @@ void ScriptManagerPrivate::ensureEngineInitialized() { if (m_initialized) return; - QTC_ASSERT(m_core, return); // register QObjects that occur as properties SharedTools::registerQObject(m_engine); SharedTools::registerQObject(m_engine); @@ -274,7 +271,7 @@ void ScriptManagerPrivate::ensureEngineInitialized() // SharedTools::registerQObjectInterface(m_engine); // Make "core" available - m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, m_core)); + m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, Core::ICore::instance())); // CLASSIC: registerInterfaceWithDefaultPrototype(m_engine); diff --git a/src/plugins/coreplugin/scriptmanager/scriptmanager_p.h b/src/plugins/coreplugin/scriptmanager/scriptmanager_p.h index e05778a832d..b8acddf90d9 100644 --- a/src/plugins/coreplugin/scriptmanager/scriptmanager_p.h +++ b/src/plugins/coreplugin/scriptmanager/scriptmanager_p.h @@ -37,13 +37,9 @@ #include #include -#include #include namespace Core { - -class ICore; - namespace Internal { class ScriptManagerPrivate : public Core::ScriptManager @@ -51,12 +47,11 @@ class ScriptManagerPrivate : public Core::ScriptManager Q_OBJECT public: - ScriptManagerPrivate(QObject *parent, ICore *core); + explicit ScriptManagerPrivate(QObject *parent); - virtual QScriptEngine &scriptEngine(); - - virtual bool runScript(const QString &script, QString *errorMessage, Stack *stack); - virtual bool runScript(const QString &script, QString *errorMessage); + QScriptEngine &scriptEngine(); + bool runScript(const QString &script, QString *errorMessage, Stack *stack); + bool runScript(const QString &script, QString *errorMessage); static QString engineError(QScriptEngine &scriptEngine); @@ -64,7 +59,6 @@ private: void ensureEngineInitialized(); QScriptEngine m_engine; - ICore *m_core; bool m_initialized; }; From c2c7c98d127ee2eadac9b6096c3abbcf83dd1227 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 14:09:28 +0100 Subject: [PATCH 35/44] Fixes: coreplugin: less singleton pointer caching --- .../coreplugin/editormanager/editormanager.cpp | 2 +- .../coreplugin/editormanager/editorsplitter.cpp | 17 ++++++++--------- .../coreplugin/editormanager/editorsplitter.h | 4 +--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 77092e343eb..e4bedc5bd05 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -361,7 +361,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) : this, SLOT(updateActions())); connect(this, SIGNAL(currentEditorChanged(Core::IEditor*)), this, SLOT(updateEditorHistory())); - m_d->m_splitter = new EditorSplitter(m_d->m_core); + m_d->m_splitter = new EditorSplitter; connect(m_d->m_splitter, SIGNAL(closeRequested(Core::IEditor *)), this, SLOT(closeEditor(Core::IEditor *))); connect(m_d->m_splitter, SIGNAL(editorGroupsChanged()), diff --git a/src/plugins/coreplugin/editormanager/editorsplitter.cpp b/src/plugins/coreplugin/editormanager/editorsplitter.cpp index 5ff9832ec02..0b02e14d731 100644 --- a/src/plugins/coreplugin/editormanager/editorsplitter.cpp +++ b/src/plugins/coreplugin/editormanager/editorsplitter.cpp @@ -51,10 +51,9 @@ using namespace Core; using namespace Core::Internal; -EditorSplitter::EditorSplitter(ICore *core, QWidget *parent) +EditorSplitter::EditorSplitter(QWidget *parent) : QWidget(parent), - m_curGroup(0), - m_core(core) + m_curGroup(0) { registerActions(); createRootGroup(); @@ -69,9 +68,9 @@ void EditorSplitter::registerActions() { QList gc = QList() << Constants::C_GLOBAL_ID; const QList editorManagerContext = - QList() << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER); + QList() << ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER); - ActionManager *am = m_core->actionManager(); + ActionManager *am = ICore::instance()->actionManager(); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); Command *cmd; @@ -538,13 +537,13 @@ QWidget *EditorSplitter::recreateGroupTree(QWidget *node) void EditorSplitter::saveCurrentLayout() { - QSettings *settings = m_core->settings(); + QSettings *settings = ICore::instance()->settings(); settings->setValue("EditorManager/Splitting", saveState()); } void EditorSplitter::restoreDefaultLayout() { - QSettings *settings = m_core->settings(); + QSettings *settings = ICore::instance()->settings(); if (settings->contains("EditorManager/Splitting")) restoreState(settings->value("EditorManager/Splitting").toByteArray()); } @@ -656,12 +655,12 @@ EditorGroup *EditorSplitter::createGroup() this, SLOT(updateActions())); connect(group, SIGNAL(editorAdded(Core::IEditor *)), this, SLOT(updateActions())); - m_core->addContextObject(group->contextObject()); + ICore::instance()->addContextObject(group->contextObject()); return group; } void EditorSplitter::deleteGroup(EditorGroup *group) { - m_core->removeContextObject(group->contextObject()); + ICore::instance()->removeContextObject(group->contextObject()); delete group; } diff --git a/src/plugins/coreplugin/editormanager/editorsplitter.h b/src/plugins/coreplugin/editormanager/editorsplitter.h index 94aac2df231..aeff22a2ed3 100644 --- a/src/plugins/coreplugin/editormanager/editorsplitter.h +++ b/src/plugins/coreplugin/editormanager/editorsplitter.h @@ -45,7 +45,6 @@ namespace Core { class EditorGroup; -class ICore; class IEditor; namespace Internal { @@ -55,7 +54,7 @@ class EditorSplitter : public QWidget Q_OBJECT public: - EditorSplitter(ICore *core, QWidget *parent = 0); + explicit EditorSplitter(QWidget *parent = 0); ~EditorSplitter(); void setCurrentGroup(Core::EditorGroup *group); @@ -114,7 +113,6 @@ private: QWidget *m_root; EditorGroup *m_curGroup; - ICore *m_core; QAction *m_horizontalSplitAction; QAction *m_verticalSplitAction; From 19637bd37f6b18f733639a8cf26d2a2cef61cec5 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 14:18:59 +0100 Subject: [PATCH 36/44] Fixes: debugger: remove cached projecte explorer singleton pointer --- src/plugins/debugger/debuggerplugin.cpp | 5 +---- src/plugins/debugger/debuggerplugin.h | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 3f9cfc6caaa..cb9f633d6ab 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -339,7 +339,6 @@ void GdbOptionPage::apply() DebuggerPlugin::DebuggerPlugin() { - m_pm = 0; m_generalOptionPage = 0; m_locationMark = 0; m_manager = 0; @@ -390,8 +389,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes m_manager = new DebuggerManager; - m_pm = ExtensionSystem::PluginManager::instance(); - ICore *core = ICore::instance(); QTC_ASSERT(core, return false); @@ -708,7 +705,7 @@ void DebuggerPlugin::extensionsInitialized() ProjectExplorer::ProjectExplorerPlugin *DebuggerPlugin::projectExplorer() const { - return m_pm->getObject(); + return ProjectExplorer::ProjectExplorerPlugin::instance(); } /*! Activates the previous mode when the current mode is the debug mode. */ diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 4ab9c5b89f8..06bdcbb656c 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -104,7 +104,6 @@ private: DebuggerManager *m_manager; DebugMode *m_debugMode; - ExtensionSystem::PluginManager *m_pm; GdbOptionPage *m_generalOptionPage; QString m_previousMode; From 718e8827597a64b83396ee8f519017b6070e4fc8 Mon Sep 17 00:00:00 2001 From: Patrick Star Date: Wed, 28 Jan 2009 14:28:29 +0100 Subject: [PATCH 37/44] Fixes: - error message after using 'Apply' and the 'OK' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task: - none RevBy: - Thorbjørn AutoTest: - manual Details: - the docs where unregistered, still the member had the files saved and tried to unregister again --- src/plugins/help/docsettingspage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/help/docsettingspage.cpp b/src/plugins/help/docsettingspage.cpp index 79e915557ac..4abc79a13ad 100644 --- a/src/plugins/help/docsettingspage.cpp +++ b/src/plugins/help/docsettingspage.cpp @@ -136,5 +136,11 @@ bool DocSettingsPage::applyChanges() } ++it; } - return m_registeredDocs || m_removeDocs.count(); + + bool success = m_registeredDocs || m_removeDocs.count(); + + m_removeDocs.clear(); + m_registeredDocs = false; + + return success; } From 97dfdebf078640460998bdd143216816f45358af Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 14:29:54 +0100 Subject: [PATCH 38/44] Fixes: debugger: reduce header dependencies --- src/plugins/debugger/debuggerplugin.cpp | 28 +++++++++++-------------- src/plugins/debugger/debuggerplugin.h | 17 +++++++++------ 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index cb9f633d6ab..2874911c56a 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -61,6 +61,7 @@ #include +#include #include #include @@ -85,8 +86,6 @@ #include -namespace ExtensionSystem { class PluginManager; } - using namespace Core; using namespace Debugger::Constants; using namespace Debugger::Internal; @@ -144,6 +143,11 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q"; } // namespace Debugger +static ProjectExplorer::SessionManager *sessionManager() +{ + return ProjectExplorer::ProjectExplorerPlugin::instance()->session(); +} + /////////////////////////////////////////////////////////////////////// // // DebugMode @@ -660,9 +664,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes // // ProjectExplorer - connect(projectExplorer()->session(), SIGNAL(sessionLoaded()), + connect(sessionManager(), SIGNAL(sessionLoaded()), m_manager, SLOT(sessionLoaded())); - connect(projectExplorer()->session(), SIGNAL(aboutToSaveSession()), + connect(sessionManager(), SIGNAL(aboutToSaveSession()), m_manager, SLOT(aboutToSaveSession())); // EditorManager @@ -703,11 +707,6 @@ void DebuggerPlugin::extensionsInitialized() { } -ProjectExplorer::ProjectExplorerPlugin *DebuggerPlugin::projectExplorer() const -{ - return ProjectExplorer::ProjectExplorerPlugin::instance(); -} - /*! Activates the previous mode when the current mode is the debug mode. */ void DebuggerPlugin::activatePreviousMode() { @@ -819,17 +818,14 @@ void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor, void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value) { //qDebug() << "SET SESSION VALUE" << name << value; - ProjectExplorerPlugin *pe = projectExplorer(); - if (pe->session()) - pe->session()->setValue(name, value); - else - qDebug() << "FIXME: Session does not exist yet"; + QTC_ASSERT(sessionManager(), return); + sessionManager()->setValue(name, value); } void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value) { - ProjectExplorerPlugin *pe = projectExplorer(); - *value = pe->session()->value(name); + QTC_ASSERT(sessionManager(), return); + *value = sessionManager()->value(name); //qDebug() << "GET SESSION VALUE: " << name << value; } diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 06bdcbb656c..4468740678d 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -34,19 +34,26 @@ #ifndef DEBUGGERPLUGIN_H #define DEBUGGERPLUGIN_H -#include #include #include QT_BEGIN_NAMESPACE +class QAbstractItemView; class QAction; class QCursor; -class QAbstractItemView; +class QMenu; +class QPoint; QT_END_NAMESPACE -namespace Core { class IEditor; } -namespace TextEditor { class ITextEditor; } +namespace Core { +class IEditor; +class IMode; +} + +namespace TextEditor { +class ITextEditor; +} namespace Debugger { namespace Internal { @@ -99,8 +106,6 @@ private: friend class GdbOptionPage; friend class DebugMode; // FIXME: Just a hack now so that it can access the views - ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const; - DebuggerManager *m_manager; DebugMode *m_debugMode; From 0ac615a101c96b4564a228f233698435cba8cccd Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 15:06:05 +0100 Subject: [PATCH 39/44] Fixes: debugger: fix dumping of QString used as hash key --- share/qtcreator/gdbmacros/gdbmacros.cpp | 36 ++++++++++++------------- src/plugins/debugger/gdbengine.cpp | 5 +++- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index c70e3b75a43..f6cc8f95ede 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -311,7 +311,7 @@ static bool isSimpleType(const char *type) static bool isShortKey(const char *type) { - return isSimpleType(type) || isEqual(type, "QString"); + return isSimpleType(type) || isEqual(type, NS"QString"); } static bool isMovableType(const char *type) @@ -704,44 +704,44 @@ static void qDumpUnknown(QDumper &d) } static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr, - const char *key = "value") + const char *field = "value") { type = stripNamespace(type); switch (type[1]) { case 'l': if (isEqual(type, "float")) - P(d, key, *(float*)addr); + P(d, field, *(float*)addr); return; case 'n': if (isEqual(type, "int")) - P(d, key, *(int*)addr); + P(d, field, *(int*)addr); else if (isEqual(type, "unsigned")) - P(d, key, *(unsigned int*)addr); + P(d, field, *(unsigned int*)addr); else if (isEqual(type, "unsigned int")) - P(d, key, *(unsigned int*)addr); + P(d, field, *(unsigned int*)addr); else if (isEqual(type, "unsigned long")) - P(d, key, *(unsigned long*)addr); + P(d, field, *(unsigned long*)addr); else if (isEqual(type, "unsigned long long")) - P(d, key, *(qulonglong*)addr); + P(d, field, *(qulonglong*)addr); return; case 'o': if (isEqual(type, "bool")) switch (*(bool*)addr) { - case 0: P(d, key, "false"); break; - case 1: P(d, key, "true"); break; - default: P(d, key, *(bool*)addr); break; + case 0: P(d, field, "false"); break; + case 1: P(d, field, "true"); break; + default: P(d, field, *(bool*)addr); break; } else if (isEqual(type, "double")) - P(d, key, *(double*)addr); + P(d, field, *(double*)addr); else if (isEqual(type, "long")) - P(d, key, *(long*)addr); + P(d, field, *(long*)addr); else if (isEqual(type, "long long")) - P(d, key, *(qulonglong*)addr); + P(d, field, *(qulonglong*)addr); return; case 'B': if (isEqual(type, "QByteArray")) { - d << key << "encoded=\"1\","; - P(d, key, *(QByteArray*)addr); + d << field << "encoded=\"1\","; + P(d, field, *(QByteArray*)addr); } return; case 'L': @@ -769,8 +769,8 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr return; case 'S': if (isEqual(type, "QString")) { - d << key << "encoded=\"1\","; - P(d, key, *(QString*)addr); + d << field << "encoded=\"1\","; + P(d, field, *(QString*)addr); } return; default: diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index c559bcb2c1c..177df2e2c59 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -3555,8 +3555,11 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, if (item.findChild("nameencoded").data()[0] == '1') data1.name = QByteArray::fromBase64(data1.name.toUtf8()); QString key = item.findChild("key").data(); - if (!key.isEmpty()) + if (!key.isEmpty()) { + if (item.findChild("keyencoded").data()[0] == '1') + key = QByteArray::fromBase64(key.toUtf8()); data1.name += " (" + key + ")"; + } setWatchDataType(data1, item.findChild("type")); setWatchDataExpression(data1, item.findChild("exp")); setWatchDataChildCount(data1, item.findChild("numchild")); From 2dac5e644796bbd5174a5d846c25950edec3b95e Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 28 Jan 2009 15:17:55 +0100 Subject: [PATCH 40/44] Fixes: debugger: display quotes around strings in locals view --- share/qtcreator/gdbmacros/gdbmacros.cpp | 2 +- src/plugins/debugger/gdbengine.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index f6cc8f95ede..5576b36c6f2 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -555,7 +555,7 @@ void QDumper::addCommaIfNeeded() put(','); } -void QDumper::putBase64Encoded(const char *buf, int n) +void QDumper::putBase64Encoded(const char *buf, int n, char delim) { const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef" "ghijklmn" "opqrstuv" "wxyz0123" "456789+/"; diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 177df2e2c59..1924de93038 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -2761,14 +2761,17 @@ static void setWatchDataValue(WatchData &data, const GdbMi &mi, break; case 1: // base64 encoded 8 bit data ba = QByteArray::fromBase64(mi.data()); + ba = '"' + ba + '"'; break; case 2: // base64 encoded 16 bit data ba = QByteArray::fromBase64(mi.data()); ba = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2).toUtf8(); + ba = '"' + ba + '"'; break; case 3: // base64 encoded 32 bit data ba = QByteArray::fromBase64(mi.data()); ba = QString::fromUcs4((uint *)ba.data(), ba.size() / 4).toUtf8(); + ba = '"' + ba + '"'; break; } data.setValue(ba); @@ -3550,14 +3553,10 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, data1.iname = data.iname + "." + data1.name; if (!data1.name.isEmpty() && data1.name.at(0).isDigit()) data1.name = '[' + data1.name + ']'; - //qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data() - // << item.findChild("nameencoded").data()[1]; - if (item.findChild("nameencoded").data()[0] == '1') - data1.name = QByteArray::fromBase64(data1.name.toUtf8()); QString key = item.findChild("key").data(); if (!key.isEmpty()) { if (item.findChild("keyencoded").data()[0] == '1') - key = QByteArray::fromBase64(key.toUtf8()); + key = '"' + QByteArray::fromBase64(key.toUtf8()) + '"'; data1.name += " (" + key + ")"; } setWatchDataType(data1, item.findChild("type")); From a71fcf633464300b39b1caa30f3534f90b5016fa Mon Sep 17 00:00:00 2001 From: con Date: Wed, 28 Jan 2009 15:50:19 +0100 Subject: [PATCH 41/44] Fixes: - Funny cursor positions in qrc editor. --- src/shared/qrceditor/qrceditor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/shared/qrceditor/qrceditor.cpp b/src/shared/qrceditor/qrceditor.cpp index e4f04c9762e..a353d738394 100644 --- a/src/shared/qrceditor/qrceditor.cpp +++ b/src/shared/qrceditor/qrceditor.cpp @@ -151,21 +151,28 @@ void QrcEditor::updateCurrent() const bool isValid = m_treeview->currentIndex().isValid(); const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid; const bool isFile = !isPrefix && isValid; + int cursorPosition; m_ui.aliasLabel->setEnabled(isFile); m_ui.aliasText->setEnabled(isFile); m_currentAlias = m_treeview->currentAlias(); + cursorPosition = m_ui.aliasText->cursorPosition(); m_ui.aliasText->setText(m_currentAlias); + m_ui.aliasText->setCursorPosition(cursorPosition); m_ui.prefixLabel->setEnabled(isPrefix); m_ui.prefixText->setEnabled(isPrefix); m_currentPrefix = m_treeview->currentPrefix(); + cursorPosition = m_ui.prefixText->cursorPosition(); m_ui.prefixText->setText(m_currentPrefix); + m_ui.prefixText->setCursorPosition(cursorPosition); m_ui.languageLabel->setEnabled(isPrefix); m_ui.languageText->setEnabled(isPrefix); m_currentLanguage = m_treeview->currentLanguage(); + cursorPosition = m_ui.languageText->cursorPosition(); m_ui.languageText->setText(m_currentLanguage); + m_ui.languageText->setCursorPosition(cursorPosition); m_ui.addButton->setEnabled(true); m_addFileAction->setEnabled(isValid); From 49b245aff1c6977082319824ba829eb7bfdb8f00 Mon Sep 17 00:00:00 2001 From: Patrick Star Date: Wed, 28 Jan 2009 16:04:09 +0100 Subject: [PATCH 42/44] Fixes: - wrong font settings for helpviewer, cleanup Task: - none RevBy: - me AutoTest: - manual --- src/plugins/help/centralwidget.cpp | 64 +++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/src/plugins/help/centralwidget.cpp b/src/plugins/help/centralwidget.cpp index f18795c3d39..a944efa29b3 100644 --- a/src/plugins/help/centralwidget.cpp +++ b/src/plugins/help/centralwidget.cpp @@ -61,6 +61,8 @@ #include +#include + using namespace Help::Internal; namespace { @@ -228,20 +230,23 @@ void CentralWidget::setSource(const QUrl &url) void CentralWidget::setLastShownPages() { - const QStringList lastShownPageList = helpEngine->customValue(QLatin1String("LastShownPages")). - toString().split(QLatin1Char('|'), QString::SkipEmptyParts); + const QStringList lastShownPageList = + helpEngine->customValue(QLatin1String("LastShownPages")). toString(). + split(QLatin1Char('|'), QString::SkipEmptyParts); if (!lastShownPageList.isEmpty()) { - foreach (const QString page, lastShownPageList) + foreach (const QString& page, lastShownPageList) setSourceInNewTab(page); - tabWidget->setCurrentIndex(helpEngine->customValue(QLatin1String("LastTabPage"), 0).toInt()); + tabWidget->setCurrentIndex(helpEngine-> + customValue(QLatin1String("LastTabPage"), 0).toInt()); } else { - QUrl url = helpEngine->findFile(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html")); - if (url.isValid()) - setSource(url); - else - setSource(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html")); + QUrl url(helpEngine->findFile(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html"))); + if (!url.isValid()) { + url.setUrl(QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html"). + arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)); + } + setSource(url); } updateBrowserFont(); @@ -392,19 +397,33 @@ void CentralWidget::setGlobalActions(const QList &actions) { globalActionList = actions; } + void CentralWidget::setSourceInNewTab(const QUrl &url) { HelpViewer* viewer = new HelpViewer(helpEngine, this); viewer->installEventFilter(this); viewer->setSource(url); viewer->setFocus(Qt::OtherFocusReason); - tabWidget->setCurrentIndex(tabWidget->addTab(viewer, viewer->documentTitle())); + tabWidget->setCurrentIndex(tabWidget->addTab(viewer, + quoteTabTitle(viewer->documentTitle()))); +#if defined(QT_NO_WEBIT) QFont font = qApp->font(); if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool()) font = qVariantValue(helpEngine->customValue(QLatin1String("browserFont"))); - viewer->setFont(font); +#else + QWebView* view = qobject_cast (viewer); + if (view) { + QWebSettings* settings = QWebSettings::globalSettings(); + int fontSize = settings->fontSize(QWebSettings::DefaultFontSize); + QString fontFamily = settings->fontFamily(QWebSettings::StandardFont); + + settings = view->settings(); + settings->setFontSize(QWebSettings::DefaultFontSize, fontSize); + settings->setFontFamily(QWebSettings::StandardFont, fontFamily); + } +#endif connectSignals(); } @@ -492,7 +511,7 @@ void CentralWidget::currentPageChanged(int index) bool enabled = false; if (viewer) enabled = tabWidget->count() > 1; - + tabWidget->setTabsClosable(enabled); tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true); @@ -595,6 +614,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e) void CentralWidget::updateBrowserFont() { +#if defined(QT_NO_WEBKIT) QFont font = qApp->font(); if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool()) font = qVariantValue(helpEngine->customValue(QLatin1String("browserFont"))); @@ -605,9 +625,25 @@ void CentralWidget::updateBrowserFont() if (widget->font() != font) widget->setFont(font); } +#else + QWebSettings* settings = QWebSettings::globalSettings(); + int fontSize = settings->fontSize(QWebSettings::DefaultFontSize); + QString fontFamily = settings->fontFamily(QWebSettings::StandardFont); + + QWebView* widget = 0; + for (int i = 0; i < tabWidget->count(); ++i) { + widget = qobject_cast (tabWidget->widget(i)); + if (widget) { + settings = widget->settings(); + settings->setFontSize(QWebSettings::DefaultFontSize, fontSize); + settings->setFontFamily(QWebSettings::StandardFont, fontFamily); + } + } +#endif } -bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags, bool incremental) +bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags, + bool incremental) { HelpViewer* viewer = currentHelpViewer(); @@ -666,7 +702,7 @@ bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags, } void CentralWidget::showTopicChooser(const QMap &links, - const QString &keyword) + const QString &keyword) { TopicChooser tc(this, keyword, links); if (tc.exec() == QDialog::Accepted) From d772ff2aa5c0c1d89dbf2073b835d9278fc44206 Mon Sep 17 00:00:00 2001 From: dt Date: Wed, 28 Jan 2009 16:04:20 +0100 Subject: [PATCH 43/44] Fixes: Copy share to the build directory. Task: Found while testing Details: Shadow builds and debugging didn't work. --- share/share.pri | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/share.pri b/share/share.pri index ece603de416..35c84568b9e 100644 --- a/share/share.pri +++ b/share/share.pri @@ -17,7 +17,7 @@ macx { QMAKE_INFO_PLIST = $$PWD/qtcreator/Info.plist } -win32 { +win32|linux-* { # make sure the resources are in place !exists($$OUT_PWD/app.pro) { unix:SEPARATOR = ; @@ -28,10 +28,11 @@ win32 { designer \ schemes \ gdbmacros - COPYDEST = $${OUT_PWD}/../../bin + COPYDEST = $${OUT_PWD}/../../share/qtcreator win32:COPYDEST ~= s|/+|\| + QMAKE_POST_LINK += $${QMAKE_MKDIR} $$COPYDEST $$SEPARATOR for(tmp,COPYSRC) { - REALSRC = $$PWD/$$tmp + REALSRC = $$PWD/qtcreator/$$tmp REALDEST = $$COPYDEST/$$tmp win32:tmp ~= s|/+|\| win32:REALSRC ~= s|/+|\| From 7ff8d61a2f12afbc70bbbb58876fd8b705742afd Mon Sep 17 00:00:00 2001 From: dt Date: Wed, 28 Jan 2009 16:33:16 +0100 Subject: [PATCH 44/44] Fixes: Graphical glitches in the modebar. Details: Hide the widgets which are about to be deleted. --- src/plugins/coreplugin/progressmanager/progressview.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/coreplugin/progressmanager/progressview.cpp b/src/plugins/coreplugin/progressmanager/progressview.cpp index cee81c697b0..6d9f6e952c0 100644 --- a/src/plugins/coreplugin/progressmanager/progressview.cpp +++ b/src/plugins/coreplugin/progressmanager/progressview.cpp @@ -99,6 +99,7 @@ void ProgressView::deleteTask(FutureProgress *progress) m_type.remove(progress); m_keep.remove(progress); layout()->removeWidget(progress); + progress->hide(); progress->deleteLater(); }