| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2018 The Qt Company Ltd. |
| 4 | ** Contact: https://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the QtSCriptTools module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General |
| 28 | ** Public license version 3 or any later version approved by the KDE Free |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
| 31 | ** included in the packaging of this file. Please review the following |
| 32 | ** information to ensure the GNU General Public License requirements will |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
| 35 | ** |
| 36 | ** $QT_END_LICENSE$ |
| 37 | ** |
| 38 | ****************************************************************************/ |
| 39 | |
| 40 | #include "qscriptdebuggerstackmodel_p.h"cxx . . $ `<file>/src/scripttools/debugging/qscriptdebuggerstackmodel_p.h`/ |
| 41 | |
| 42 | #include "private/qabstractitemmodel_p.h" |
| 43 | |
| 44 | #include <QtScript/qscriptcontextinfo.h>cxx . . $ `<file>/include/QtScript/qscriptcontextinfo.h`/ |
| 45 | #include <QtCore/qfileinfo.h> |
| 46 | #include <QtCore/qcoreapplication.h> |
| 47 | |
| 48 | QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`! |
| 49 | |
| 50 | class QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate# |
| 51 | : public QAbstractItemModelPrivatecxx . . $ QAbstractItemModelPrivate# |
| 52 | { |
| 53 | Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(QScriptDebuggerStackModel) |
| 54 | public: |
| 55 | QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate#QScriptDebuggerStackModelPrivate(49f6e7a06ebc5aa8).(); |
| 56 | ~cxx . . $ QScriptDebuggerStackModelPrivate#`~QScriptDebuggerStackModelPrivate`(ced63f7c635d850d).QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate#(); |
| 57 | |
| 58 | QListcxx . . $ QList#<QScriptContextInfocxx . . $ QScriptContextInfo#> contextInfoscxx . . $ QScriptDebuggerStackModelPrivate#contextInfos.; |
| 59 | }; |
| 60 | |
| 61 | QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate#::QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate#QScriptDebuggerStackModelPrivate(49f6e7a06ebc5aa8).() |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate#::~cxx . . $ QScriptDebuggerStackModelPrivate#`~QScriptDebuggerStackModelPrivate`(ced63f7c635d850d).QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate#() |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#QScriptDebuggerStackModel(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent) |
| 70 | : QAbstractTableModelcxx . . $ QAbstractTableModel#(*new QScriptDebuggerStackModelPrivatecxx . . $ QScriptDebuggerStackModelPrivate#QScriptDebuggerStackModelPrivate(49f6e7a06ebc5aa8)., parent) |
| 71 | { |
| 72 | } |
| 73 | |
| 74 | QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::~cxx . . $ QScriptDebuggerStackModel#`~QScriptDebuggerStackModel`(ced63f7c635d850d).QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#() |
| 75 | { |
| 76 | } |
| 77 | |
| 78 | QListcxx . . $ QList#<QScriptContextInfocxx . . $ QScriptContextInfo#> QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::contextInfoscxx . . $ QScriptDebuggerStackModel#contextInfos(374f7c8c2ed5b3d3).() const |
| 79 | { |
| 80 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptDebuggerStackModel); |
| 81 | return d->contextInfos; |
| 82 | } |
| 83 | |
| 84 | void QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::setContextInfoscxx . . $ QScriptDebuggerStackModel#setContextInfos(13644bcec1b7148d).(const QListcxx . . $ QList#<QScriptContextInfocxx . . $ QScriptContextInfo#> &infos) |
| 85 | { |
| 86 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(QScriptDebuggerStackModel); |
| 87 | layoutAboutToBeChangedcxx . . $ QAbstractItemModel#layoutAboutToBeChanged(17ff3201f1a6fa68).(); |
| 88 | d->contextInfos = infos; |
| 89 | layoutChangedcxx . . $ QAbstractItemModel#layoutChanged(17ff3201f1a6fa68).(); |
| 90 | } |
| 91 | |
| 92 | /*! |
| 93 | \reimp |
| 94 | */ |
| 95 | int QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::columnCountcxx . . $ QScriptDebuggerStackModel#columnCount(e3878d4d6cd9529c).(const QModelIndexcxx . . $ QModelIndex# &parent) const |
| 96 | { |
| 97 | if (!parent.isValidcxx . . $ QModelIndex#isValid(3482b152b9333168).()) |
| 98 | return 3; |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | /*! |
| 103 | \reimp |
| 104 | */ |
| 105 | int QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::rowCountcxx . . $ QScriptDebuggerStackModel#rowCount(e3878d4d6cd9529c).(const QModelIndexcxx . . $ QModelIndex# &parent) const |
| 106 | { |
| 107 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptDebuggerStackModel); |
| 108 | if (!parent.isValidcxx . . $ QModelIndex#isValid(3482b152b9333168).()) |
| 109 | return d->contextInfos.count(); |
| 110 | return 0; |
| 111 | } |
| 112 | |
| 113 | /*! |
| 114 | \reimp |
| 115 | */ |
| 116 | QVariantcxx . . $ QVariant# QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::datacxx . . $ QScriptDebuggerStackModel#data(69b5b18a001c0029).(const QModelIndexcxx . . $ QModelIndex# &index, int role) const |
| 117 | { |
| 118 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptDebuggerStackModel); |
| 119 | if (!index.isValidcxx . . $ QModelIndex#isValid(3482b152b9333168).()) |
| 120 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 121 | if (index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).() >=cxx . . $ `operator>=`(489f5a20d57ffae2). d->contextInfos.count()) |
| 122 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 123 | const QScriptContextInfocxx . . $ QScriptContextInfo# &info = d->contextInfos.at(index.rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).()); |
| 124 | if (role == Qtcxx . . $ Qt/::DisplayRolecxx . . $ Qt/DisplayRole.) { |
| 125 | if (index.columncxx . . $ QModelIndex#column(ea6fe5115c70a13f).() == 0) { |
| 126 | return indexcxx . . $ QVariant#QVariant(d4f767463ce0a6b3)..rowcxx . . $ QModelIndex#row(ea6fe5115c70a13f).(); |
| 127 | } else if (index.columncxx . . $ QModelIndex#column(ea6fe5115c70a13f).() == 1) { |
| 128 | QStringcxx . . $ QString# name = info.functionNamecxx . . $ QScriptContextInfo#functionName(6ef7b6c27b00b43d).(); |
| 129 | if (name.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 130 | name =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).("<anonymous>"); |
| 131 | return namecxx . . $ QVariant#QVariant(3520e46b33348bf6).; |
| 132 | } else if (index.columncxx . . $ QModelIndex#column(ea6fe5115c70a13f).() == 2) { |
| 133 | QStringcxx . . $ QString# fn = QFileInfocxx . . $ QFileInfo#(info.fileNamecxx . . $ QScriptContextInfo#fileName(6ef7b6c27b00b43d).()).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).(); |
| 134 | if (fn.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) { |
| 135 | if (info.functionTypecxx . . $ QScriptContextInfo#functionType(7ddefc5da19f9f80).() == QScriptContextInfocxx . . $ QScriptContextInfo#::ScriptFunctioncxx . . $ QScriptContextInfo#ScriptFunction.) |
| 136 | fn =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).("<anonymous script, id=%0>").argcxx . . $ QString#arg(bc2efffa9f9cbddb).(info.scriptIdcxx . . $ QScriptContextInfo#scriptId(98833e9ab7de59a4).()); |
| 137 | else |
| 138 | fn =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).("<native>"); |
| 139 | |
| 140 | } |
| 141 | return QStringcxx . . $ QVariant#QVariant(3520e46b33348bf6).::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).("%0:%1").argcxx . . $ QString#arg(bc823072288cbbb5).(fn).argcxx . . $ QString#arg(64ab2ed17cc11715).(info.lineNumbercxx . . $ QScriptContextInfo#lineNumber(455f465bc33b4cdf).()); |
| 142 | } |
| 143 | } else if (role == Qtcxx . . $ Qt/::ToolTipRolecxx . . $ Qt/ToolTipRole.) { |
| 144 | if (QFileInfocxx . . $ QFileInfo#(info.fileNamecxx . . $ QScriptContextInfo#fileName(6ef7b6c27b00b43d).()).fileNamecxx . . $ QFileInfo#fileName(6ef7b6c27b00b43d).() !=cxx . . $ `operator!=`(5bc2975d2d751687). info.fileNamecxx . . $ QScriptContextInfo#fileName(6ef7b6c27b00b43d).()) |
| 145 | return infocxx . . $ QVariant#QVariant(3520e46b33348bf6)..fileNamecxx . . $ QScriptContextInfo#fileName(6ef7b6c27b00b43d).(); |
| 146 | } |
| 147 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 148 | } |
| 149 | |
| 150 | /*! |
| 151 | \reimp |
| 152 | */ |
| 153 | QVariantcxx . . $ QVariant# QScriptDebuggerStackModelcxx . . $ QScriptDebuggerStackModel#::headerDatacxx . . $ QScriptDebuggerStackModel#headerData(b8cfec0985494997).(int section, Qtcxx . . $ Qt/::Orientationcxx . . $ Qt/Orientation# orient, int role) const |
| 154 | { |
| 155 | if (orient != Qtcxx . . $ Qt/::Horizontalcxx . . $ Qt/Horizontal.) |
| 156 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 157 | if (role == Qtcxx . . $ Qt/::DisplayRolecxx . . $ Qt/DisplayRole.) { |
| 158 | if (section == 0) |
| 159 | return QCoreApplicationcxx . . $ QVariant#QVariant(3520e46b33348bf6).::translatecxx . . $ QCoreApplication#translate(699330408c757f1b).("QScriptDebuggerStackModel", "Level"); |
| 160 | else if (section == 1) |
| 161 | return QCoreApplicationcxx . . $ QVariant#QVariant(3520e46b33348bf6).::translatecxx . . $ QCoreApplication#translate(699330408c757f1b).("QScriptDebuggerStackModel", "Name"); |
| 162 | else if (section == 2) |
| 163 | return QCoreApplicationcxx . . $ QVariant#QVariant(3520e46b33348bf6).::translatecxx . . $ QCoreApplication#translate(699330408c757f1b).("QScriptDebuggerStackModel", "Location"); |
| 164 | } |
| 165 | return QVariantcxx . . $ QVariant#QVariant(ced63f7c635d850d).(); |
| 166 | } |
| 167 | |
| 168 | QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`! |