Commit 5cbd0679 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

remove dead files

parent 46a7fdd6
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "gdboptionpage.h"
#include "gdbengine.h"
#include "imports.h"
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
#include <QtCore/QByteArray>
#include <QtGui/QFileDialog>
using namespace Debugger::Internal;
TypeMacroPage::TypeMacroPage(GdbSettings *settings)
{
m_pm = ExtensionSystem::PluginManager::instance();
m_settings = settings;
Core::ICore *coreIFace = ICore::instance();
QSettings *s = coreIFace->settings();
s->beginGroup("GdbOptions");
if (!s->contains("ScriptFile") && !s->contains("TypeMacros")) {
//insert qt4 defaults
m_settings->m_scriptFile = coreIFace->resourcePath() +
QLatin1String("/gdb/qt4macros");
for (int i = 0; i < 3; ++i) {
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
switch (i) {
case 0:
stream << QString("printqstring") << (int)1;
m_settings->m_typeMacros.insert(QLatin1String("QString"), data);
break;
case 1:
stream << QString("printqcolor") << (int)0;
m_settings->m_typeMacros.insert(QLatin1String("QColor"), data);
break;
case 2:
stream << QString("printqfont") << (int)1;
m_settings->m_typeMacros.insert(QLatin1String("QFont"), data);
break;
}
}
s->setValue("ScriptFile", m_settings->m_scriptFile);
s->setValue("TypeMacros", m_settings->m_typeMacros);
} else {
m_settings->m_scriptFile = s->value("ScriptFile", QString()).toString();
m_settings->m_typeMacros = s->value("TypeMacros", QMap<QString,QVariant>()).toMap();
}
s->endGroup();
}
QString TypeMacroPage::name() const
{
return tr("Type Macros");
}
QString TypeMacroPage::category() const
{
return "Debugger|Gdb";
}
QString TypeMacroPage::trCategory() const
{
return tr("Debugger|Gdb");
}
QWidget *TypeMacroPage::createPage(QWidget *parent)
{
QString macro;
int index;
m_widget = new QWidget(parent);
m_ui.setupUi(m_widget);
m_ui.scriptFile->setPromptDialogTitle(tr("Select Gdb Script"));
m_ui.scriptFile->setExpectedKind(Core::Utils::PathChooser::File);
connect(m_ui.addButton, SIGNAL(clicked()),
this, SLOT(onAddButton()));
connect(m_ui.delButton, SIGNAL(clicked()),
this, SLOT(onDelButton()));
connect(m_ui.scriptFile, SIGNAL(validChanged()),
this, SLOT(updateButtonState()));
connect(m_ui.treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
this, SLOT(currentItemChanged(QTreeWidgetItem *)));
connect(m_ui.typeEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(updateButtonState()));
connect(m_ui.macroEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(updateButtonState()));
QMap<QString, QVariant>::const_iterator i = m_settings->m_typeMacros.constBegin();
while (i != m_settings->m_typeMacros.constEnd()) {
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget);
QDataStream stream(i.value().toByteArray());
stream >> macro >> index;
item->setText(0, i.key());
item->setText(1, macro);
item->setData(0, Qt::UserRole, index);
++i;
}
m_ui.scriptFile->setPath(m_settings->m_scriptFile);
updateButtonState();
return m_widget;
}
void TypeMacroPage::finished(bool accepted)
{
if (!accepted)
return;
m_settings->m_typeMacros.clear();
m_settings->m_scriptFile = m_ui.scriptFile->path();
for (int i = 0; i < m_ui.treeWidget->topLevelItemCount(); ++i) {
QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
QByteArray data;
QDataStream stream(&data, QIODevice::WriteOnly);
stream << item->text(1) << item->data(0, Qt::UserRole).toInt();
m_settings->m_typeMacros.insert(item->text(0), data);
}
QSettings *s = ICore::instance()->settings();
s->beginGroup("GdbOptions");
s->setValue("ScriptFile", m_settings->m_scriptFile);
s->setValue("TypeMacros", m_settings->m_typeMacros);
s->endGroup();
}
void TypeMacroPage::onAddButton()
{
if (m_ui.typeEdit->text().isEmpty() || m_ui.macroEdit->text().isEmpty())
return;
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget);
item->setText(0, m_ui.typeEdit->text());
item->setText(1, m_ui.macroEdit->text());
item->setData(0, Qt::UserRole, m_ui.parseAsBox->currentIndex());
updateButtonState();
}
void TypeMacroPage::onDelButton()
{
if (QTreeWidgetItem *item = m_ui.treeWidget->currentItem())
delete item;
updateButtonState();
}
void TypeMacroPage::currentItemChanged(QTreeWidgetItem *item)
{
m_ui.typeEdit->setText(item ? item->text(0) : QString());
m_ui.macroEdit->setText(item ? item->text(1) : QString());
m_ui.parseAsBox->setCurrentIndex(item ? item->data(0, Qt::UserRole).toInt() : 0);
updateButtonState();
}
void TypeMacroPage::updateButtonState()
{
m_ui.delButton->setEnabled(m_ui.treeWidget->currentItem() != 0);
m_ui.addButton->setDisabled(m_ui.typeEdit->text().isEmpty()
|| m_ui.macroEdit->text().isEmpty());
}
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TypeMacroPage</class>
<widget class="QWidget" name="TypeMacroPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>519</width>
<height>263</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<layout class="QGridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="treeWidget">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Macro</string>
</property>
</column>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="addButton">
<property name="minimumSize">
<size>
<width>21</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>+</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/gdbdebugger/images/newitem.png</normaloff>:/gdbdebugger/images/newitem.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Macro Name:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Parse as:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="macroEdit"/>
</item>
<item row="0" column="2">
<layout class="QVBoxLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="delButton">
<property name="minimumSize">
<size>
<width>21</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>-</string>
</property>
<property name="icon">
<iconset>
<normaloff>:/gdbdebugger/images/delete.png</normaloff>:/gdbdebugger/images/delete.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="typeEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="parseAsBox">
<item>
<property name="text">
<string>ASCII (char *)</string>
</property>
</item>
<item>
<property name="text">
<string>Unicode (short)</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="gdbdebugger.qrc"/>
</resources>
<connections/>
</ui>
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#include "buildoptionspage.h"
#include <QtCore/QSettings>
#include <QtGui/QLineEdit>
BuildOptionsPage::BuildOptionsPage(QWorkbench::PluginManager *app)
{
core = app;
QWorkbench::ICore *coreIFace = core->interface<QWorkbench::ICore>();
if (coreIFace && coreIFace->settings()) {
QSettings *s = coreIFace->settings();
s->beginGroup("BuildOptions");
m_qmakeCmd = s->value("QMake", "qmake").toString();
m_makeCmd = s->value("Make", "make").toString();
m_makeCleanCmd = s->value("MakeClean", "make clean").toString();
s->endGroup();
}
}
QString BuildOptionsPage::name() const
{
return tr("Commands");
}
QString BuildOptionsPage::category() const
{
return "Qt4|Build";
}
QString BuildOptionsPage::trCategory() const
{
return tr("Qt4|Build");
}
QWidget *BuildOptionsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui.setupUi(w);
m_ui.qmakeLineEdit->setText(m_qmakeCmd);
m_ui.makeLineEdit->setText(m_makeCmd);
m_ui.makeCleanLineEdit->setText(m_makeCleanCmd);
return w;
}
void BuildOptionsPage::finished(bool accepted)
{
if (!accepted)
return;
m_qmakeCmd = m_ui.qmakeLineEdit->text();
m_makeCmd = m_ui.makeLineEdit->text();
m_makeCleanCmd = m_ui.makeCleanLineEdit->text();
QWorkbench::ICore *coreIFace = core->interface<QWorkbench::ICore>();
if (coreIFace && coreIFace->settings()) {
QSettings *s = coreIFace->settings();
s->beginGroup("BuildOptions");
s->setValue("QMake", m_qmakeCmd);
s->setValue("Make", m_makeCmd);
s->setValue("MakeClean", m_makeCleanCmd);
s->endGroup();
}
}
QWorkbench::Plugin *BuildOptionsPage::plugin()
{
return 0;
}
QObject *BuildOptionsPage::qObject()
{
return this;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment