~ubuntu-branches/ubuntu/wily/tora/wily-proposed

« back to all changes in this revision

Viewing changes to src/todebugtext.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michael Meskes
  • Date: 2009-04-07 13:16:05 UTC
  • mfrom: (1.2.7 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20090407131605-u422yigfv7jgg0l0
Tags: 2.0.0-3
* Cleaned up packaging a little bit.
* Added homepage information to control file.
* Bumped Standards-Version to 3.8.1.
* Released to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****
2
 
*
3
 
* TOra - An Oracle Toolkit for DBA's and developers
4
 
* Copyright (C) 2003-2005 Quest Software, Inc
5
 
* Portions Copyright (C) 2005 Other Contributors
6
 
7
 
* This program is free software; you can redistribute it and/or
8
 
* modify it under the terms of the GNU General Public License
9
 
* as published by the Free Software Foundation;  only version 2 of
10
 
* the License is valid for this program.
11
 
12
 
* This program is distributed in the hope that it will be useful,
13
 
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
* GNU General Public License for more details.
16
 
17
 
* You should have received a copy of the GNU General Public License
18
 
* along with this program; if not, write to the Free Software
19
 
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20
 
*
21
 
*      As a special exception, you have permission to link this program
22
 
*      with the Oracle Client libraries and distribute executables, as long
23
 
*      as you follow the requirements of the GNU GPL in regard to all of the
24
 
*      software in the executable aside from Oracle client libraries.
25
 
*
26
 
*      Specifically you are not permitted to link this program with the
27
 
*      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
28
 
*      And you are not permitted to distribute binaries compiled against
29
 
*      these libraries without written consent from Quest Software, Inc.
30
 
*      Observe that this does not disallow linking to the Qt Free Edition.
31
 
*
32
 
*      You may link this product with any GPL'd Qt library such as Qt/Free
33
 
*
34
 
* All trademarks belong to their respective owners.
35
 
*
36
 
*****/
 
1
 
 
2
/* BEGIN_COMMON_COPYRIGHT_HEADER
 
3
 *
 
4
 * TOra - An Oracle Toolkit for DBA's and developers
 
5
 * 
 
6
 * Shared/mixed copyright is held throughout files in this product
 
7
 * 
 
8
 * Portions Copyright (C) 2000-2001 Underscore AB
 
9
 * Portions Copyright (C) 2003-2005 Quest Software, Inc.
 
10
 * Portions Copyright (C) 2004-2008 Numerous Other Contributors
 
11
 * 
 
12
 * This program is free software; you can redistribute it and/or
 
13
 * modify it under the terms of the GNU General Public License
 
14
 * as published by the Free Software Foundation;  only version 2 of
 
15
 * the License is valid for this program.
 
16
 * 
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 * 
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; if not, write to the Free Software
 
24
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
25
 * 
 
26
 *      As a special exception, you have permission to link this program
 
27
 *      with the Oracle Client libraries and distribute executables, as long
 
28
 *      as you follow the requirements of the GNU GPL in regard to all of the
 
29
 *      software in the executable aside from Oracle client libraries.
 
30
 * 
 
31
 *      Specifically you are not permitted to link this program with the
 
32
 *      Qt/UNIX, Qt/Windows or Qt Non Commercial products of TrollTech.
 
33
 *      And you are not permitted to distribute binaries compiled against
 
34
 *      these libraries. 
 
35
 * 
 
36
 *      You may link this product with any GPL'd Qt library.
 
37
 * 
 
38
 * All trademarks belong to their respective owners.
 
39
 *
 
40
 * END_COMMON_COPYRIGHT_HEADER */
37
41
 
38
42
#include "utils.h"
39
43
 
41
45
#include "todebug.h"
42
46
#include "todebugtext.h"
43
47
#include "tosql.h"
44
 
#include "todebugtext.moc"
45
48
 
46
49
#include <qapplication.h>
47
50
#include <qpainter.h>
48
51
#include <qpixmap.h>
 
52
//Added by qt3to4:
 
53
#include <QString>
 
54
#include <QMouseEvent>
49
55
 
50
56
#include "icons/breakpoint.xpm"
51
57
#include "icons/disbreakpoint.xpm"
54
60
 
55
61
int toDebugText::ID = 0;
56
62
 
57
 
toBreakpointItem::toBreakpointItem(QListView *parent, QListViewItem *after,
 
63
toBreakpointItem::toBreakpointItem(toTreeWidget *parent, toTreeWidgetItem *after,
58
64
                                   const QString &schema, const QString &type,
59
65
                                   const QString &object, int line)
60
 
        : QListViewItem(parent, after)
 
66
        : toTreeWidgetItem(parent, after)
61
67
{
62
68
    if (schema.isNull())
63
69
        setText(2, QString::null);
198
204
    try
199
205
    {
200
206
        toQuery errors(conn, SQLReadErrors, Schema, Object, Type);
201
 
        std::map<int, QString> Errors;
 
207
        QMap<int, QString> Errors;
202
208
 
203
209
        while (!errors.eof())
204
210
        {
212
218
    TOCATCH
213
219
    return false;
214
220
}
215
 
bool toDebugText::readData(toConnection &conn, QListView *Stack)
 
221
bool toDebugText::readData(toConnection &conn, toTreeWidget *Stack)
216
222
{
217
 
    QListViewItem *item = NULL;
 
223
    toTreeWidgetItem *item = NULL;
218
224
    if (Stack && Stack->firstChild())
219
225
        for (item = Stack->firstChild();item->firstChild();item = item->firstChild())
220
226
            ;
256
262
    update();
257
263
}
258
264
 
259
 
toDebugText::toDebugText(QListView *breakpoints,
 
265
toDebugText::toDebugText(toTreeWidget *breakpoints,
260
266
                         QWidget *parent,
261
267
                         toDebug *debugger)
262
 
        : toHighlightedText(parent, QString::number(++ID).latin1()),
 
268
        : toHighlightedText(parent, QString::number(++ID).toLatin1()),
263
269
        Debugger(debugger),
264
270
        Breakpoints(breakpoints)
265
271
{
266
272
    //setLeftIgnore(DEBUG_INDENT);
267
273
    setMarginWidth(0, 25);
268
274
    setMarginWidth(1, 10);
269
 
    setMarginSensitivity(0,true);
270
 
    setMarginSensitivity(1,true);
 
275
    setMarginSensitivity(0, true);
 
276
    setMarginSensitivity(1, true);
271
277
    CurrentItem = FirstItem = NULL;
272
278
    NoBreakpoints = false;
273
 
    connect(this,SIGNAL(marginClicked(int, int, Qt::ButtonState)),this, SLOT(toggleBreakpoint(int, int, Qt::ButtonState)));
274
 
    breakMarker=markerDefine(new QPixmap(const_cast<const char**>(breakpoint_xpm)));
275
 
    disabledBreakMarker=markerDefine(new QPixmap(const_cast<const char**>(disbreakpoint_xpm)));
276
 
    setMarginMarkerMask(1,2^breakMarker|2^disabledBreakMarker);
 
279
    connect(this,
 
280
            SIGNAL(marginClicked(int, int, Qt::KeyboardModifiers)),
 
281
            this,
 
282
            SLOT(toggleBreakpoint(int, int, Qt::KeyboardModifiers)));
 
283
//     breakMarker=markerDefine(new QPixmap(const_cast<const char**>(breakpoint_xpm)));
 
284
//     disabledBreakMarker=markerDefine(new QPixmap(const_cast<const char**>(disbreakpoint_xpm)));
 
285
    breakMarker = markerDefine(QPixmap(breakpoint_xpm));
 
286
    disabledBreakMarker = markerDefine(QPixmap(disbreakpoint_xpm));
 
287
    setMarginMarkerMask(1, (2 ^ breakMarker) | (2 ^ disabledBreakMarker));
277
288
}
278
289
 
279
290
bool toDebugText::checkItem(toBreakpointItem *item)
344
355
    if (me->x() > DEBUG_INDENT + view.left())
345
356
    {
346
357
        if (LastX <= DEBUG_INDENT + view.left())
347
 
            setCursor(Qt::ibeamCursor);
348
 
        if (me->state() != 0)
 
358
            setCursor(Qt::IBeamCursor);
 
359
        if (me->buttons() != 0)
349
360
            toHighlightedText::mouseMoveEvent(me);
350
361
    }
351
362
    else
352
363
    {
353
364
        if (LastX > DEBUG_INDENT + view.left())
354
 
            setCursor(Qt::ibeamCursor);
355
 
        setCursor(Qt::arrowCursor);
 
365
            setCursor(Qt::IBeamCursor);
 
366
        setCursor(Qt::ArrowCursor);
356
367
    }
357
368
    LastX = me->x();
358
369
}
375
386
            {
376
387
                if (enable)
377
388
                {
378
 
                    if (CurrentItem->text(4) == qApp->translate("toDebug", "DISABLED")){
 
389
                    if (CurrentItem->text(4) == qApp->translate("toDebug", "DISABLED"))
 
390
                    {
379
391
                        CurrentItem->setText(4, qApp->translate("toDebug", "DEFERED"));
380
 
                        markerDelete(row,disabledBreakMarker);
381
 
                        markerAdd(row,breakMarker);
382
 
                    }else{
 
392
                        markerDelete(row, disabledBreakMarker);
 
393
                        markerAdd(row, breakMarker);
 
394
                    }
 
395
                    else
 
396
                    {
383
397
                        CurrentItem->clearBreakpoint();
384
 
                        markerDelete(row,breakMarker);
385
 
                        markerAdd(row,disabledBreakMarker);
 
398
                        markerDelete(row, breakMarker);
 
399
                        markerAdd(row, disabledBreakMarker);
386
400
                    }
387
401
                }
388
402
                else
389
403
                {
390
404
                    CurrentItem->clearBreakpoint();
391
405
                    delete CurrentItem;
392
 
                    markerDelete(row,breakMarker);
393
 
                    markerDelete(row,disabledBreakMarker);
 
406
                    markerDelete(row, breakMarker);
 
407
                    markerDelete(row, disabledBreakMarker);
394
408
                    if (FirstItem == CurrentItem)
395
409
                    {
396
410
                        NoBreakpoints = false;
405
419
        }
406
420
        else if (!enable)
407
421
        {
408
 
            markerAdd(row,breakMarker);
 
422
            markerAdd(row, breakMarker);
409
423
            if (CurrentItem && CurrentItem->line() > row)
410
424
                new toBreakpointItem(Breakpoints, NULL,
411
425
                                     Schema, Type, Object, row);
420
434
}
421
435
 
422
436
 
423
 
void toDebugText::toggleBreakpoint(int margin, int line, Qt::ButtonState   state){
424
 
  if(margin<=1) 
425
 
    toggleBreakpoint(line);
 
437
void toDebugText::toggleBreakpoint(int margin, int line, Qt::KeyboardModifiers state)
 
438
{
 
439
    if (margin <= 1)
 
440
        toggleBreakpoint(line);
426
441
}
427
442
 
428
443
 
429
 
void toDebugText::exportData(std::map<QCString, QString> &data, const QCString &prefix)
 
444
void toDebugText::exportData(std::map<QString, QString> &data, const QString &prefix)
430
445
{
431
446
    toHighlightedText::exportData(data, prefix);
432
447
    data[prefix + ":Schema"] = Schema;
434
449
    data[prefix + ":Type"] = Type;
435
450
}
436
451
 
437
 
void toDebugText::importData(std::map<QCString, QString> &data, const QCString &prefix)
 
452
void toDebugText::importData(std::map<QString, QString> &data, const QString &prefix)
438
453
{
439
454
    toHighlightedText::importData(data, prefix);
440
455
    Schema = data[prefix + ":Schema"];