ActivityWidget::ActivityWidget(QASActivity* a, bool fullObject, QWidget* parent) : ObjectWidgetWithSignals(parent), m_objectWidget(NULL), m_activity(NULL) { #ifdef DEBUG_WIDGETS qDebug() << "Creating ActivityWidget"; #endif m_textLabel = new RichTextLabel(this); connect(m_textLabel, SIGNAL(linkHovered(const QString&)), this, SIGNAL(linkHovered(const QString&))); m_objectWidget = new ObjectWidget(NULL, this); ObjectWidgetWithSignals::connectSignals(m_objectWidget, this); connect(m_objectWidget, SIGNAL(showContext(QASObject*)), this, SIGNAL(showContext(QASObject*))); QVBoxLayout* layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(m_textLabel, 0, Qt::AlignTop); layout->addWidget(m_objectWidget, 0, Qt::AlignTop); layout->addWidget(new QLabel("<hr />")); changeObject(a, fullObject); setLayout(layout); }
ObjectWidget::ObjectWidget(QASObject* obj, QWidget* parent) : ObjectWidgetWithSignals(parent), m_objectWidget(NULL), m_shortObjectWidget(NULL), m_contextLabel(NULL), m_contextButton(NULL), m_topLayout(NULL), m_object(NULL), m_irtObject(NULL), m_short(false) { #ifdef DEBUG_WIDGETS qDebug() << "Creating ObjectWidget"; #endif m_layout = new QVBoxLayout; m_layout->setContentsMargins(0, 0, 0, 0); m_layout->setSpacing(0); // Add label with context "Re:" text and "show context" button for // replies. m_topLayout = new QHBoxLayout; m_topLayout->setContentsMargins(0, 0, 0, 0); m_contextLabel = new RichTextLabel(this, true); m_topLayout->addWidget(m_contextLabel, 0, Qt::AlignVCenter); m_topLayout->addSpacing(10); m_contextButton = new TextToolButton(this); connect(m_contextButton, SIGNAL(clicked()), this, SLOT(onShowContext())); m_topLayout->addWidget(m_contextButton, 0, Qt::AlignVCenter); m_layout->addLayout(m_topLayout); m_objectWidget = new FullObjectWidget(m_object, this); ObjectWidgetWithSignals::connectSignals(m_objectWidget, this); connect(m_objectWidget, SIGNAL(lessClicked()), this, SLOT(showLess())); m_layout->addWidget(m_objectWidget); m_shortObjectWidget = new ShortObjectWidget(m_object, this); connect(m_shortObjectWidget, SIGNAL(follow(QString, bool)), this, SIGNAL(follow(QString, bool))); connect(m_shortObjectWidget, SIGNAL(moreClicked()), this, SLOT(showMore())); m_layout->addWidget(m_shortObjectWidget); changeObject(obj); setLayout(m_layout); }
toProfiler::toProfiler(QWidget *parent, toConnection &connection) : toToolWidget(ProfilerTool, "toprofiler.html", parent, connection, "toProfiler") { QToolBar *toolbar = toAllocBar(this, tr("PL/SQL Profiler")); layout()->addWidget(toolbar); toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(refresh_xpm))), tr("Refresh list"), this, SLOT(refresh())); toolbar->addSeparator(); toolbar->addWidget( new QLabel(tr("Repeat run") + " ", toolbar)); Repeat = new QSpinBox(toolbar); Repeat->setValue(5); Repeat->setMaximum(1000); toolbar->addWidget(Repeat); toolbar->addSeparator(); toolbar->addWidget(new QLabel(tr("Comment") + " ", toolbar)); Comment = new QLineEdit(toolbar); Comment->setText(tr("Unknown")); toolbar->addWidget(Comment); toolbar->addSeparator(); #if 0 Background = new QToolButton(toolbar); Background->setToggleButton(true); Background->setIconSet(QIcon(QPixmap(const_cast<const char**>(background_xpm)))); QToolTip::add (Background, tr("Run profiling in background")); toolbar->addSeparator(); #endif toolbar->addAction(QIcon(QPixmap(const_cast<const char**>(execute_xpm))), tr("Execute current profiling"), this, SLOT(execute())); toolbar->addWidget(new toSpacer()); new toChangeConnection(toolbar, TO_TOOLBAR_WIDGET_NAME); Tabs = new QTabWidget(this); layout()->addWidget(Tabs); Script = new toWorksheetWidget(Tabs, NULL, connection); Tabs->addTab(Script, tr("Script")); Result = new QSplitter(Tabs); Tabs->addTab(Result, tr("Result")); QWidget *box = new QWidget(Result); QVBoxLayout *vbox = new QVBoxLayout; vbox->setSpacing(0); vbox->setContentsMargins(0, 0, 0, 0); box->setLayout(vbox); Run = new QComboBox(box); vbox->addWidget(Run); QSplitter *vsplit = new QSplitter(Qt::Vertical, box); vbox->addWidget(vsplit); Info = new toResultItem(2, vsplit); Info->setSQL(SQLRunInfo); connect(Run, SIGNAL(activated(int)), this, SLOT(changeRun())); Units = new toProfilerUnits(vsplit); Units->setReadAll(true); Units->setSelectionMode(toTreeWidget::Single); connect(Units, SIGNAL(selectionChanged()), this, SLOT(changeObject())); Lines = new toProfilerSource(Result); Lines->setReadAll(true); connect(Lines, SIGNAL(done()), this, SLOT(calcTotals())); LastUnit = CurrentRun = 0; // show(); try { toQuery query(connection, SQLProfilerDetect); } catch (const QString &) { int ret = TOMessageBox::warning(this, tr("Profiler tables doesn't exist"), tr("Profiler tables doesn't exist. Should TOra\n" "try to create them in the current schema?"), tr("&Yes"), tr("&No"), QString::null, 0, 1); if (ret == 0) { try { connection.execute(SQLProfilerRuns); connection.execute(SQLProfilerUnits); connection.execute(SQLProfilerData); connection.execute(SQLProfilerNumber); } catch (const QString &str) { toStatusMessage(str); QTimer::singleShot(1, this, SLOT(noTables())); return ; } } else { QTimer::singleShot(1, this, SLOT(noTables())); return ; } } refresh(); }