forked from qt-creator/qt-creator
Merge branch 'master' of ../mainline into dui-editor
This commit is contained in:
@@ -1364,6 +1364,7 @@
|
||||
|
||||
Since Qt Creator 1.1, support for \c CMake project files is available.
|
||||
|
||||
|
||||
\section1 Opening CMake Projects
|
||||
|
||||
To open a \c CMake project select \gui Open from the \gui File menu and
|
||||
@@ -1389,18 +1390,18 @@
|
||||
depending on your platform. The build errors and warnings are parsed and
|
||||
displayed in the \gui{Build Issues} output pane.
|
||||
|
||||
By default Qt Creator builds the "all" target. You can change which
|
||||
targets get build in the Project/Build Settings.
|
||||
By default Qt Creator builds the \e{all} target. You can specify which
|
||||
targets to build in \gui{Project} mode, under \gui{Build Settings}.
|
||||
|
||||
\image qtcreator-cmake-build-settings.png
|
||||
|
||||
Currently only one build configuration is supported and the
|
||||
build directory can't be changed after the initial import. This
|
||||
limitation will be fixed for the next version.
|
||||
Qt Creator supports multiple build configurations. Also, the build
|
||||
directory can be modified after the initial import.
|
||||
|
||||
|
||||
\section1 Running CMake Projects
|
||||
Qt Creator automatically adds Run Configurations for all the
|
||||
targets specified in the \c CMake project file.
|
||||
Qt Creator automatically adds \gui{Run Configurations} for all targets
|
||||
specified in the \c CMake project file.
|
||||
|
||||
Known issues for the current version can be found
|
||||
\l{Known Issues of Version 1.1.80}{here}.
|
||||
|
||||
@@ -51,63 +51,98 @@ using namespace Core::Internal;
|
||||
|
||||
\brief The ActionContainer class represents a menu or menu bar in Qt Creator.
|
||||
|
||||
|
||||
*/
|
||||
You don't create instances of this class directly, but instead use the
|
||||
\l{ActionManager::createMenu()}
|
||||
and \l{ActionManager::createMenuBar()} methods.
|
||||
Retrieve existing action containers for an ID with
|
||||
\l{ActionManager::actionContainer()}.
|
||||
|
||||
/*!
|
||||
\enum ActionContainer::ContainerType
|
||||
Within a menu or menu bar you can group menus and items together by defining groups
|
||||
(the order of the groups is defined by the order of the \l{ActionContainer::appendGroup()} calls), and
|
||||
adding menus/actions to these groups. If no custom groups are defined, an action container
|
||||
has three default groups \c{Core::Constants::G_DEFAULT_ONE}, \c{Core::Constants::G_DEFAULT_TWO}
|
||||
and \c{Core::Constants::G_DEFAULT_THREE}.
|
||||
|
||||
You can define if the menu represented by this action container should automatically disable
|
||||
or hide whenever it only contains disabled items and submenus by setting the corresponding
|
||||
\l{ActionContainer::setEmptyAction()}{EmptyAction}.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum ActionContainer::EmptyAction
|
||||
Defines what happens when the represented menu is empty or contains only disabled/invisible items.
|
||||
\omitvalue EA_Mask
|
||||
\value EA_None
|
||||
The menu will still be visible and active.
|
||||
\value EA_Disable
|
||||
The menu will be visible but disabled.
|
||||
\value EA_Hide
|
||||
The menu will not be visible until the state of the subitems change.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ActionContainer::setEmptyAction(EmptyAction ea)
|
||||
\fn ActionContainer::setEmptyAction(EmptyAction disableOrHide)
|
||||
Defines if the menu represented by this action container should automatically \a disableOrHide
|
||||
whenever it only contains disabled items and submenus.
|
||||
\sa ActionContainer::EmptyAction
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual int ActionContainer::id() const
|
||||
\fn int ActionContainer::id() const
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ContainerType ActionContainer::type() const
|
||||
\fn QMenu *ActionContainer::menu() const
|
||||
Returns the QMenu instance that is represented by this action container, or
|
||||
0 if this action container represents a menu bar.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QMenu *ActionContainer::menu() const
|
||||
\fn QMenuBar *ActionContainer::menuBar() const
|
||||
Returns the QMenuBar instance that is represented by this action container, or
|
||||
0 if this action container represents a menu.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QToolBar *ActionContainer::toolBar() const
|
||||
\fn QAction *ActionContainer::insertLocation(const QString &group) const
|
||||
Returns an action representing the \a group,
|
||||
that could be used with \c{QWidget::insertAction}.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QMenuBar *ActionContainer::menuBar() const
|
||||
\fn void ActionContainer::appendGroup(const QString &identifier)
|
||||
Adds a group with the given \a identifier to the action container. Using groups
|
||||
you can segment your action container into logical parts and add actions and
|
||||
menus directly to these parts.
|
||||
\sa addAction()
|
||||
\sa addMenu()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual QAction *ActionContainer::insertLocation(const QString &group) const
|
||||
\fn void ActionContainer::addAction(Core::Command *action, const QString &group)
|
||||
Add the \a action as a menu item to this action container. The action is added as the
|
||||
last item of the specified \a group.
|
||||
\sa appendGroup()
|
||||
\sa addMenu()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::appendGroup(const QString &group, bool global)
|
||||
\fn void ActionContainer::addMenu(Core::ActionContainer *menu, const QString &group)
|
||||
Add the \a menu as a submenu to this action container. The menu is added as the
|
||||
last item of the specified \a group.
|
||||
\sa appendGroup()
|
||||
\sa addAction()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::addAction(Core::Command *action, const QString &group)
|
||||
\fn bool ActionContainer::update()
|
||||
\internal
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual void ActionContainer::addMenu(Core::ActionContainer *menu, const QString &group)
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual bool ActionContainer::update()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn virtual ActionContainer::~ActionContainer()
|
||||
\fn ActionContainer::~ActionContainer()
|
||||
\internal
|
||||
*/
|
||||
|
||||
// ---------- ActionContainerPrivate ------------
|
||||
|
||||
@@ -64,16 +64,32 @@ namespace {
|
||||
can specify all his keyboard shortcuts, and to provide a solution for actions that should
|
||||
behave differently in different contexts (like the copy/replace/undo/redo actions).
|
||||
|
||||
All actions that are registered with the same string id (but different context lists)
|
||||
\section1 Contexts
|
||||
|
||||
All actions that are registered with the same string ID (but different context lists)
|
||||
are considered to be overloads of the same command, represented by an instance
|
||||
of the Command class.
|
||||
Exactly only one of the registered actions with the same ID is active at any time.
|
||||
Which action this is, is defined by the context list that the actions were registered
|
||||
with:
|
||||
|
||||
If the current focus widget was registered via \l{ICore::addContextObject()},
|
||||
all the contexts returned by its IContext object are active. In addition all
|
||||
contexts set via \l{ICore::addAdditionalContext()} are active as well. If one
|
||||
of the actions was registered for one of these active contexts, it is the one
|
||||
active action, and receives \c triggered and \c toggled signals. Also the
|
||||
appearance of the visible action for this ID might be adapted to this
|
||||
active action (depending on the settings of the corresponding \l{Command} object).
|
||||
|
||||
The action that is visible to the user is the one returned by Command::action().
|
||||
If you provide yourself a user visible representation of your action you need
|
||||
to use Command::action() for this.
|
||||
When this action is invoked by the user,
|
||||
the signal is forwarded to the registered action that is valid for the current context.
|
||||
|
||||
So to register a globally active action "My Action"
|
||||
\section1 Registering Actions
|
||||
|
||||
To register a globally active action "My Action"
|
||||
put the following in your plugin's IPlugin::initialize method:
|
||||
\code
|
||||
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
||||
@@ -96,7 +112,7 @@ namespace {
|
||||
Also use the ActionManager to add items to registered
|
||||
action containers like the applications menu bar or menus in that menu bar.
|
||||
To do this, you register your action via the
|
||||
registerAction methods, get the action container for a specific id (like specified in
|
||||
registerAction methods, get the action container for a specific ID (like specified in
|
||||
the Core::Constants namespace) with a call of
|
||||
actionContainer(const QString&) and add your command to this container.
|
||||
|
||||
@@ -105,15 +121,15 @@ namespace {
|
||||
am->actionContainer(Core::M_TOOLS)->addAction(cmd);
|
||||
\endcode
|
||||
|
||||
Important guidelines:
|
||||
\section1 Important Guidelines:
|
||||
\list
|
||||
\o Always register your actions and shortcuts!
|
||||
\o Register your actions and shortcuts during your plugin's IPlugin::initialize
|
||||
or IPlugin::extensionsInitialized methods, otherwise the shortcuts won't appear
|
||||
\o Register your actions and shortcuts during your plugin's \l{ExtensionSystem::IPlugin::initialize()}
|
||||
or \l{ExtensionSystem::IPlugin::extensionsInitialized()} methods, otherwise the shortcuts won't appear
|
||||
in the keyboard settings dialog from the beginning.
|
||||
\o When registering an action with cmd=registerAction(action, id, contexts) be sure to connect
|
||||
your own action connect(action, SIGNAL...) but make cmd->action() visible to the user, i.e.
|
||||
widget->addAction(cmd->action()).
|
||||
\o When registering an action with \c{cmd=registerAction(action, id, contexts)} be sure to connect
|
||||
your own action \c{connect(action, SIGNAL...)} but make \c{cmd->action()} visible to the user, i.e.
|
||||
\c{widget->addAction(cmd->action())}.
|
||||
\o Use this class to add actions to the applications menus
|
||||
\endlist
|
||||
|
||||
|
||||
@@ -37,9 +37,8 @@
|
||||
\class Core::Command
|
||||
\mainclass
|
||||
|
||||
\brief The class...
|
||||
\brief The class Command represents an action like a menu item, tool button, or shortcut.
|
||||
|
||||
The Command interface...
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#define GENERALSETTINGS_H
|
||||
|
||||
#include <coreplugin/dialogs/ioptionspage.h>
|
||||
#include <QtCore/QPointer>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
namespace Core {
|
||||
@@ -65,7 +66,7 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::GeneralSettings *m_page;
|
||||
QWidget *m_dialog;
|
||||
QPointer<QWidget> m_dialog;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>561</width>
|
||||
<height>866</height>
|
||||
<width>310</width>
|
||||
<height>224</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -22,58 +22,35 @@
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="pidLabel">
|
||||
<widget class="QLabel" name="channelLabel">
|
||||
<property name="text">
|
||||
<string>Attach to Process ID:</string>
|
||||
<string>Host and Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="pidLineEdit"/>
|
||||
<widget class="QLineEdit" name="channelLineEdit">
|
||||
<property name="text">
|
||||
<string>localhost:5115</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="architectureLabel">
|
||||
<property name="text">
|
||||
<string>Filter:</string>
|
||||
<string>Architecture:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="filterWidget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="filterLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="filterClearToolButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="architectureComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="procView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
namespace Internal {
|
||||
|
||||
bool operator<(const ProcData &p1, const ProcData &p2)
|
||||
{
|
||||
@@ -59,7 +59,8 @@ bool operator<(const ProcData &p1, const ProcData &p2)
|
||||
}
|
||||
|
||||
// A filterable process list model
|
||||
class ProcessListFilterModel : public QSortFilterProxyModel {
|
||||
class ProcessListFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
public:
|
||||
explicit ProcessListFilterModel(QObject *parent);
|
||||
QString processIdAt(const QModelIndex &index) const;
|
||||
@@ -69,9 +70,9 @@ private:
|
||||
QStandardItemModel *m_model;
|
||||
};
|
||||
|
||||
ProcessListFilterModel::ProcessListFilterModel(QObject *parent) :
|
||||
QSortFilterProxyModel(parent),
|
||||
m_model(new QStandardItemModel(this))
|
||||
ProcessListFilterModel::ProcessListFilterModel(QObject *parent)
|
||||
: QSortFilterProxyModel(parent),
|
||||
m_model(new QStandardItemModel(this))
|
||||
{
|
||||
QStringList columns;
|
||||
columns << AttachExternalDialog::tr("Process ID")
|
||||
@@ -116,6 +117,7 @@ void ProcessListFilterModel::populate(QList<ProcData> processes, const QString &
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AttachCoreDialog
|
||||
@@ -164,9 +166,10 @@ void AttachCoreDialog::setCoreFile(const QString &fileName)
|
||||
m_ui->coreFileName->setPath(fileName);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// process model helpers
|
||||
// Process model helpers
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -224,11 +227,11 @@ static QList<ProcData> processList()
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
AttachExternalDialog::AttachExternalDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_selfPid(QString::number(QCoreApplication::applicationPid())),
|
||||
m_ui(new Ui::AttachExternalDialog),
|
||||
m_model(new ProcessListFilterModel(this))
|
||||
AttachExternalDialog::AttachExternalDialog(QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_selfPid(QString::number(QCoreApplication::applicationPid())),
|
||||
m_ui(new Ui::AttachExternalDialog),
|
||||
m_model(new ProcessListFilterModel(this))
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
okButton()->setDefault(true);
|
||||
@@ -292,48 +295,26 @@ int AttachExternalDialog::attachPID() const
|
||||
|
||||
void AttachExternalDialog::pidChanged(const QString &pid)
|
||||
{
|
||||
okButton()->setEnabled(!pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid);
|
||||
bool enabled = !pid.isEmpty() && pid != QLatin1String("0") && pid != m_selfPid;;
|
||||
okButton()->setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// AttachRemoteDialog
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
AttachRemoteDialog::AttachRemoteDialog(QWidget *parent, const QString &pid) :
|
||||
QDialog(parent),
|
||||
m_ui(new Ui::AttachRemoteDialog),
|
||||
m_model(new ProcessListFilterModel(this))
|
||||
AttachRemoteDialog::AttachRemoteDialog(QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_ui(new Ui::AttachRemoteDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
m_defaultPID = pid;
|
||||
|
||||
m_ui->procView->setModel(m_model);
|
||||
m_ui->procView->setSortingEnabled(true);
|
||||
|
||||
|
||||
connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
// Do not use activated, will be single click in Oxygen
|
||||
connect(m_ui->procView, SIGNAL(doubleClicked(QModelIndex)),
|
||||
this, SLOT(procSelected(QModelIndex)));
|
||||
|
||||
QPushButton *refreshButton = new QPushButton(tr("Refresh"));
|
||||
connect(refreshButton, SIGNAL(clicked()), this, SLOT(rebuildProcessList()));
|
||||
m_ui->buttonBox->addButton(refreshButton, QDialogButtonBox::ActionRole);
|
||||
|
||||
connect(m_ui->pidLineEdit, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(pidChanged(QString)));
|
||||
|
||||
connect(m_ui->filterClearToolButton, SIGNAL(clicked()),
|
||||
m_ui->filterLineEdit, SLOT(clear()));
|
||||
connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)),
|
||||
m_model, SLOT(setFilterFixedString(QString)));
|
||||
|
||||
m_ui->pidLineEdit->setText(m_defaultPID);
|
||||
rebuildProcessList();
|
||||
}
|
||||
|
||||
AttachRemoteDialog::~AttachRemoteDialog()
|
||||
@@ -341,37 +322,36 @@ AttachRemoteDialog::~AttachRemoteDialog()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
QPushButton *AttachRemoteDialog::okButton() const
|
||||
void AttachRemoteDialog::setRemoteChannel(const QString &channel)
|
||||
{
|
||||
return m_ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
m_ui->channelLineEdit->setText(channel);
|
||||
}
|
||||
|
||||
void AttachRemoteDialog::rebuildProcessList()
|
||||
QString AttachRemoteDialog::remoteChannel() const
|
||||
{
|
||||
m_model->populate(processList());
|
||||
m_ui->procView->expandAll();
|
||||
m_ui->procView->resizeColumnToContents(0);
|
||||
m_ui->procView->resizeColumnToContents(1);
|
||||
return m_ui->channelLineEdit->text();
|
||||
}
|
||||
|
||||
void AttachRemoteDialog::procSelected(const QModelIndex &index0)
|
||||
{
|
||||
const QString proccessId = m_model->processIdAt(index0);
|
||||
if (!proccessId.isEmpty()) {
|
||||
m_ui->pidLineEdit->setText(proccessId);
|
||||
if (okButton()->isEnabled())
|
||||
okButton()->animateClick();
|
||||
void AttachRemoteDialog::setRemoteArchitectures(const QStringList &list)
|
||||
{
|
||||
m_ui->architectureComboBox->clear();
|
||||
if (!list.isEmpty()) {
|
||||
m_ui->architectureComboBox->insertItems(0, list);
|
||||
m_ui->architectureComboBox->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
|
||||
int AttachRemoteDialog::attachPID() const
|
||||
void AttachRemoteDialog::setRemoteArchitecture(const QString &arch)
|
||||
{
|
||||
return m_ui->pidLineEdit->text().toInt();
|
||||
int index = m_ui->architectureComboBox->findText(arch);
|
||||
if (index != -1)
|
||||
m_ui->architectureComboBox->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void AttachRemoteDialog::pidChanged(const QString &pid)
|
||||
QString AttachRemoteDialog::remoteArchitecture() const
|
||||
{
|
||||
okButton()->setEnabled(!pid.isEmpty() && pid != QLatin1String("0"));
|
||||
int index = m_ui->architectureComboBox->currentIndex();
|
||||
return m_ui->architectureComboBox->itemText(index);
|
||||
}
|
||||
|
||||
|
||||
@@ -426,5 +406,5 @@ QString StartExternalDialog::executableArguments() const
|
||||
return m_ui->argsEdit->text();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
@@ -101,30 +101,24 @@ private:
|
||||
ProcessListFilterModel *m_model;
|
||||
};
|
||||
|
||||
|
||||
class AttachRemoteDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AttachRemoteDialog(QWidget *parent, const QString &pid);
|
||||
explicit AttachRemoteDialog(QWidget *parent);
|
||||
~AttachRemoteDialog();
|
||||
|
||||
int attachPID() const;
|
||||
|
||||
private slots:
|
||||
void rebuildProcessList();
|
||||
void procSelected(const QModelIndex &);
|
||||
void pidChanged(const QString &);
|
||||
void setRemoteChannel(const QString &host);
|
||||
void setRemoteArchitecture(const QString &arch);
|
||||
void setRemoteArchitectures(const QStringList &arches);
|
||||
QString remoteChannel() const;
|
||||
QString remoteArchitecture() const;
|
||||
|
||||
private:
|
||||
inline QPushButton *okButton() const;
|
||||
Ui::AttachRemoteDialog *m_ui;
|
||||
QString m_defaultPID;
|
||||
ProcessListFilterModel *m_model;
|
||||
};
|
||||
|
||||
|
||||
class StartExternalDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -89,6 +89,7 @@ using namespace Debugger::Constants;
|
||||
|
||||
static const QString tooltipIName = "tooltip";
|
||||
|
||||
#define _(s) QString::fromLatin1(s)
|
||||
|
||||
static const char *stateName(int s)
|
||||
{
|
||||
@@ -304,6 +305,11 @@ void DebuggerManager::init()
|
||||
m_attachCoreAction->setText(tr("Attach to Core..."));
|
||||
connect(m_attachCoreAction, SIGNAL(triggered()), this, SLOT(attachCore()));
|
||||
|
||||
m_attachRemoteAction = new QAction(this);
|
||||
m_attachRemoteAction->setText(tr("Attach to Running Remote Application..."));
|
||||
connect(m_attachRemoteAction, SIGNAL(triggered()),
|
||||
this, SLOT(attachRemoteApplication()));
|
||||
|
||||
m_continueAction = new QAction(this);
|
||||
m_continueAction->setText(tr("Continue"));
|
||||
m_continueAction->setIcon(QIcon(":/gdbdebugger/images/debugger_continue_small.png"));
|
||||
@@ -437,7 +443,7 @@ QList<Core::IOptionsPage*> DebuggerManager::initializeEngines(const QStringList
|
||||
{
|
||||
QList<Core::IOptionsPage*> rc;
|
||||
gdbEngine = createGdbEngine(this, &rc);
|
||||
const bool cdbDisabled = arguments.contains(QLatin1String("-disable-cdb"));
|
||||
const bool cdbDisabled = arguments.contains(_("-disable-cdb"));
|
||||
winEngine = createWinEngine(this, cdbDisabled, &rc);
|
||||
scriptEngine = createScriptEngine(this, &rc);
|
||||
setDebuggerType(GdbDebugger);
|
||||
@@ -810,12 +816,18 @@ void DebuggerManager::attachCore()
|
||||
emit debuggingFinished();
|
||||
}
|
||||
|
||||
void DebuggerManager::attachRemoteApplication()
|
||||
{
|
||||
if (!startNewDebugger(AttachRemote))
|
||||
emit debuggingFinished();
|
||||
}
|
||||
|
||||
// Figure out the debugger type of an executable
|
||||
static bool determineDebuggerType(const QString &executable,
|
||||
DebuggerManager::DebuggerType *dt,
|
||||
QString *errorMessage)
|
||||
{
|
||||
if (executable.endsWith(QLatin1String(".js"))) {
|
||||
if (executable.endsWith(_(".js"))) {
|
||||
*dt = DebuggerManager::ScriptDebugger;
|
||||
return true;
|
||||
}
|
||||
@@ -869,21 +881,21 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
|
||||
case StartExternal: {
|
||||
StartExternalDialog dlg(mainWindow());
|
||||
dlg.setExecutableFile(
|
||||
configValue(QLatin1String("LastExternalExecutableFile")).toString());
|
||||
configValue(_("LastExternalExecutableFile")).toString());
|
||||
dlg.setExecutableArguments(
|
||||
configValue(QLatin1String("LastExternalExecutableArguments")).toString());
|
||||
configValue(_("LastExternalExecutableArguments")).toString());
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
setConfigValue(QLatin1String("LastExternalExecutableFile"),
|
||||
setConfigValue(_("LastExternalExecutableFile"),
|
||||
dlg.executableFile());
|
||||
setConfigValue(QLatin1String("LastExternalExecutableArguments"),
|
||||
setConfigValue(_("LastExternalExecutableArguments"),
|
||||
dlg.executableArguments());
|
||||
m_executable = dlg.executableFile();
|
||||
m_processArgs = dlg.executableArguments().split(' ');
|
||||
m_workingDir = QString();
|
||||
m_attachedPID = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AttachExternal: {
|
||||
AttachExternalDialog dlg(mainWindow());
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
@@ -897,9 +909,9 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
|
||||
tr("Cannot attach to PID 0"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case StartInternal:
|
||||
}
|
||||
case StartInternal: {
|
||||
if (m_executable.isEmpty()) {
|
||||
QString startDirectory = m_executable;
|
||||
if (m_executable.isEmpty()) {
|
||||
@@ -920,30 +932,46 @@ bool DebuggerManager::startNewDebugger(DebuggerStartMode mode)
|
||||
m_attachedPID = 0;
|
||||
} else {
|
||||
//m_executable = QDir::convertSeparators(m_executable);
|
||||
//m_processArgs = sd.processArgs.join(QLatin1String(" "));
|
||||
//m_processArgs = sd.processArgs.join(_(" "));
|
||||
m_attachedPID = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AttachCore: {
|
||||
AttachCoreDialog dlg(mainWindow());
|
||||
dlg.setExecutableFile(
|
||||
configValue(QLatin1String("LastExternalExecutableFile")).toString());
|
||||
configValue(_("LastExternalExecutableFile")).toString());
|
||||
dlg.setCoreFile(
|
||||
configValue(QLatin1String("LastExternalCoreFile")).toString());
|
||||
configValue(_("LastExternalCoreFile")).toString());
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
setConfigValue(QLatin1String("LastExternalExecutableFile"),
|
||||
setConfigValue(_("LastExternalExecutableFile"),
|
||||
dlg.executableFile());
|
||||
setConfigValue(QLatin1String("LastExternalCoreFile"),
|
||||
setConfigValue(_("LastExternalCoreFile"),
|
||||
dlg.coreFile());
|
||||
m_executable = dlg.executableFile();
|
||||
m_coreFile = dlg.coreFile();
|
||||
m_processArgs.clear();
|
||||
m_workingDir = QString();
|
||||
m_attachedPID = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AttachRemote: {
|
||||
AttachRemoteDialog dlg(mainWindow());
|
||||
QStringList arches;
|
||||
arches.append(_("i386:x86-64:intel"));
|
||||
dlg.setRemoteArchitectures(arches);
|
||||
dlg.setRemoteChannel(configValue(_("LastRemoteChannel")).toString());
|
||||
dlg.setRemoteArchitecture(configValue(_("LastRemoteArchtecture")).toString());
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
setConfigValue(_("LastRemoteChannel"), dlg.remoteChannel());
|
||||
setConfigValue(_("LastRemoteArchitecture"), dlg.remoteArchitecture());
|
||||
m_remoteChannel = dlg.remoteChannel();
|
||||
m_remoteArchitecture = dlg.remoteArchitecture();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
emit debugModeRequested();
|
||||
|
||||
@@ -1218,7 +1246,7 @@ void DebuggerManager::setStatus(int status)
|
||||
|
||||
if (0 && !isAllowedTransition(m_status, status)) {
|
||||
const QString msg = QString::fromLatin1("%1: UNEXPECTED TRANSITION: %2 -> %3").
|
||||
arg(QLatin1String(Q_FUNC_INFO), QLatin1String(stateName(m_status)), QLatin1String(stateName(status)));
|
||||
arg(_(Q_FUNC_INFO), _(stateName(m_status)), _(stateName(status)));
|
||||
qWarning("%s", qPrintable(msg));
|
||||
}
|
||||
|
||||
@@ -1242,6 +1270,7 @@ void DebuggerManager::setStatus(int status)
|
||||
#else
|
||||
m_attachCoreAction->setEnabled(!started && !starting);
|
||||
#endif
|
||||
m_attachRemoteAction->setEnabled(!started && !starting);
|
||||
m_watchAction->setEnabled(ready);
|
||||
m_breakAction->setEnabled(true);
|
||||
|
||||
@@ -1535,7 +1564,7 @@ void DebuggerManager::showQtDumperLibraryWarning(const QString &details)
|
||||
dialog.setDetailedText(details);
|
||||
dialog.exec();
|
||||
if (dialog.clickedButton() == qtPref) {
|
||||
Core::ICore::instance()->showOptionsDialog(QLatin1String("Qt4"), QLatin1String("Qt Versions"));
|
||||
Core::ICore::instance()->showOptionsDialog(_("Qt4"), _("Qt Versions"));
|
||||
} else if (dialog.clickedButton() == helperOff) {
|
||||
theDebuggerAction(UseDebuggingHelpers)->setValue(qVariantFromValue(false), false);
|
||||
}
|
||||
|
||||
@@ -111,7 +111,8 @@ enum DebuggerStartMode
|
||||
StartInternal, // Start current start project's binary
|
||||
StartExternal, // Start binary found in file system
|
||||
AttachExternal, // Attach to running process
|
||||
AttachCore // Attach to a core file
|
||||
AttachCore, // Attach to a core file
|
||||
AttachRemote // Attach to a remote process
|
||||
};
|
||||
|
||||
class IDebuggerEngine;
|
||||
@@ -225,6 +226,7 @@ public slots:
|
||||
void startExternalApplication();
|
||||
void attachExternalApplication();
|
||||
void attachCore();
|
||||
void attachRemoteApplication();
|
||||
|
||||
void jumpToLineExec();
|
||||
void runToLineExec();
|
||||
@@ -358,6 +360,8 @@ public:
|
||||
QString m_dumperLib;
|
||||
int m_attachedPID;
|
||||
bool m_useTerminal;
|
||||
QString m_remoteChannel;
|
||||
QString m_remoteArchitecture;
|
||||
|
||||
private:
|
||||
void init();
|
||||
@@ -404,6 +408,7 @@ private:
|
||||
QAction *m_startExternalAction;
|
||||
QAction *m_attachExternalAction;
|
||||
QAction *m_attachCoreAction;
|
||||
QAction *m_attachRemoteAction;
|
||||
QAction *m_continueAction;
|
||||
QAction *m_stopAction;
|
||||
QAction *m_resetAction; // FIXME: Should not be needed in a stable release
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace Constants {
|
||||
const char * const STARTEXTERNAL = "Debugger.StartExternal";
|
||||
const char * const ATTACHEXTERNAL = "Debugger.AttachExternal";
|
||||
const char * const ATTACHCORE = "Debugger.AttachCore";
|
||||
const char * const ATTACHREMOTE = "Debugger.AttachRemote";
|
||||
|
||||
const char * const RUN_TO_LINE = "Debugger.RunToLine";
|
||||
const char * const RUN_TO_FUNCTION = "Debugger.RunToFunction";
|
||||
@@ -478,6 +479,15 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
|
||||
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// FIXME: not yet functional
|
||||
if (m_manager->m_attachRemoteAction) {
|
||||
cmd = am->registerAction(m_manager->m_attachRemoteAction,
|
||||
Constants::ATTACHREMOTE, globalcontext);
|
||||
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
||||
}
|
||||
#endif
|
||||
|
||||
cmd = am->registerAction(m_manager->m_continueAction,
|
||||
ProjectExplorer::Constants::DEBUG, QList<int>() << m_gdbRunningContext);
|
||||
|
||||
|
||||
@@ -92,7 +92,14 @@ Q_DECLARE_METATYPE(Debugger::Internal::GdbMi);
|
||||
#define STRINGIFY_INTERNAL(x) #x
|
||||
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
|
||||
|
||||
#define _c(s) QLatin1Char(s)
|
||||
struct _c
|
||||
{
|
||||
inline _c(char c) : m_c(c) {}
|
||||
inline operator QChar() const { return QLatin1Char(m_c); }
|
||||
char m_c;
|
||||
};
|
||||
|
||||
#define _c(c) QLatin1Char(c)
|
||||
#define __(s) QLatin1String(s)
|
||||
#define _(s) QString::fromLatin1(s)
|
||||
|
||||
@@ -1601,6 +1608,8 @@ bool GdbEngine::startDebugger()
|
||||
|
||||
if (q->startMode() == AttachCore || q->startMode() == AttachExternal) {
|
||||
// nothing to do
|
||||
} else if (q->startMode() == AttachRemote) {
|
||||
// nothing to do
|
||||
} else if (q->m_useTerminal) {
|
||||
m_stubProc.stop(); // We leave the console open, so recycle it now.
|
||||
|
||||
@@ -1726,6 +1735,7 @@ bool GdbEngine::startDebugger()
|
||||
|
||||
if (q->startMode() == AttachExternal) {
|
||||
sendCommand(_("attach ") + QString::number(q->m_attachedPID), GdbAttached);
|
||||
qq->breakHandler()->removeAllBreakpoints();
|
||||
} else if (q->startMode() == AttachCore) {
|
||||
QFileInfo fi(q->m_executable);
|
||||
QString fileName = _c('"') + fi.absoluteFilePath() + _c('"');
|
||||
@@ -1733,9 +1743,17 @@ bool GdbEngine::startDebugger()
|
||||
// quoting core name below fails in gdb 6.8-debian
|
||||
QString coreName = fi2.absoluteFilePath();
|
||||
sendCommand(_("-file-exec-and-symbols ") + fileName);
|
||||
sendCommand(_("target core ") + coreName, GdbTargetCore);
|
||||
sendCommand(_("target core %1").arg(coreName), GdbTargetCore);
|
||||
qq->breakHandler()->removeAllBreakpoints();
|
||||
} else if (q->startMode() == AttachRemote) {
|
||||
sendCommand(_("set architecture %1").arg(q->m_remoteArchitecture));
|
||||
sendCommand(_("target remote %1").arg(q->m_remoteChannel));
|
||||
qq->breakHandler()->setAllPending();
|
||||
//sendCommand(_("info target"), GdbStart);
|
||||
qq->notifyInferiorRunningRequested();
|
||||
sendCommand(_("-exec-continue"), GdbExecContinue);
|
||||
} else if (q->m_useTerminal) {
|
||||
// nothing needed, stub takes care
|
||||
qq->breakHandler()->setAllPending();
|
||||
} else if (q->startMode() == StartInternal || q->startMode() == StartExternal) {
|
||||
QFileInfo fi(q->m_executable);
|
||||
QString fileName = _c('"') + fi.absoluteFilePath() + _c('"');
|
||||
@@ -1756,13 +1774,8 @@ bool GdbEngine::startDebugger()
|
||||
qq->notifyInferiorRunningRequested();
|
||||
sendCommand(_("-exec-run"));
|
||||
#endif
|
||||
}
|
||||
|
||||
// set all to "pending"
|
||||
if (q->startMode() == AttachExternal || q->startMode() == AttachCore)
|
||||
qq->breakHandler()->removeAllBreakpoints();
|
||||
else if (q->startMode() == StartInternal || q->startMode() == StartExternal)
|
||||
qq->breakHandler()->setAllPending();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -342,23 +342,23 @@ QString decodeData(const QByteArray &ba, int encoding)
|
||||
}
|
||||
case 2: { // base64 encoded 16 bit data, used for QString
|
||||
const QChar doubleQuote(QLatin1Char('"'));
|
||||
const QByteArray ba = QByteArray::fromBase64(ba);
|
||||
const QByteArray decodedBa = QByteArray::fromBase64(ba);
|
||||
QString rc = doubleQuote;
|
||||
rc += QString::fromUtf16(reinterpret_cast<const ushort *>(ba.data()), ba.size() / 2);
|
||||
rc += QString::fromUtf16(reinterpret_cast<const ushort *>(decodedBa.data()), decodedBa.size() / 2);
|
||||
rc += doubleQuote;
|
||||
return rc;
|
||||
}
|
||||
case 3: { // base64 encoded 32 bit data
|
||||
const QByteArray ba = QByteArray::fromBase64(ba);
|
||||
const QByteArray decodedBa = QByteArray::fromBase64(ba);
|
||||
const QChar doubleQuote(QLatin1Char('"'));
|
||||
QString rc = doubleQuote;
|
||||
rc += QString::fromUcs4(reinterpret_cast<const uint *>(ba.data()), ba.size() / 4);
|
||||
rc += QString::fromUcs4(reinterpret_cast<const uint *>(decodedBa.data()), decodedBa.size() / 4);
|
||||
rc += doubleQuote;
|
||||
return rc;
|
||||
}
|
||||
case 4: { // base64 encoded 16 bit data, without quotes (see 2)
|
||||
const QByteArray ba = QByteArray::fromBase64(ba);
|
||||
return QString::fromUtf16(reinterpret_cast<const ushort *>(ba.data()), ba.size() / 2);
|
||||
const QByteArray decodedBa = QByteArray::fromBase64(ba);
|
||||
return QString::fromUtf16(reinterpret_cast<const ushort *>(decodedBa.data()), decodedBa.size() / 2);
|
||||
}
|
||||
}
|
||||
return QCoreApplication::translate("Debugger", "<Encoding error>");
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "codecselector.h"
|
||||
|
||||
#ifndef TEXTEDITOR_STANDALONE
|
||||
#include <coreplugin/manhattanstyle.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -1499,10 +1498,8 @@ QRect BaseTextEditor::collapseBox()
|
||||
|
||||
QTextBlock begin = document()->findBlockByNumber(d->m_highlightBlocksInfo.open.last());
|
||||
|
||||
if (true || !d->m_displaySettings.m_fancyFoldingBar) {
|
||||
if (TextBlockUserData::hasCollapseAfter(begin.previous()))
|
||||
begin = begin.previous();
|
||||
}
|
||||
if (TextBlockUserData::hasCollapseAfter(begin.previous()))
|
||||
begin = begin.previous();
|
||||
|
||||
QTextBlock end = document()->findBlockByNumber(d->m_highlightBlocksInfo.close.first());
|
||||
if (!begin.isValid() || !end.isValid())
|
||||
@@ -1695,13 +1692,6 @@ void BaseTextEditorPrivate::moveCursorVisible(bool ensureVisible)
|
||||
q->ensureCursorVisible();
|
||||
}
|
||||
|
||||
static QColor calcMixColor(const QColor &one, const QColor &two)
|
||||
{
|
||||
return QColor((one.red() + two.red()) / 2,
|
||||
(one.green() + two.green()) / 2,
|
||||
(one.blue() + two.blue()) / 2);
|
||||
}
|
||||
|
||||
static QColor calcBlendColor(const QColor &baseColor, int factor = 1)
|
||||
{
|
||||
const int blendBase = (baseColor.value() > 128) ? 0 : 255;
|
||||
@@ -1763,17 +1753,21 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
|
||||
|
||||
QPointF offset(contentOffset());
|
||||
|
||||
bool hasMainSelection = textCursor().hasSelection();
|
||||
|
||||
QRect er = e->rect();
|
||||
QRect viewportRect = viewport()->rect();
|
||||
|
||||
const QColor baseColor = palette().base().color();
|
||||
const QColor blendColor = calcBlendColor(baseColor);
|
||||
|
||||
qreal lineX = 0;
|
||||
|
||||
if (d->m_visibleWrapColumn > 0) {
|
||||
qreal lineX = fontMetrics().averageCharWidth() * d->m_visibleWrapColumn + offset.x() + 4;
|
||||
lineX = fontMetrics().averageCharWidth() * d->m_visibleWrapColumn + offset.x() + 4;
|
||||
painter.fillRect(QRectF(lineX, 0, viewportRect.width() - lineX, viewportRect.height()), blendColor);
|
||||
}
|
||||
|
||||
|
||||
// // keep right margin clean from full-width selection
|
||||
// int maxX = offset.x() + qMax((qreal)viewportRect.width(), documentLayout->documentSize().width())
|
||||
// - doc->documentMargin();
|
||||
@@ -1834,7 +1828,9 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
|
||||
if (count) {
|
||||
QRectF rr = r;
|
||||
rr.setWidth(viewport()->width());
|
||||
for(int i = 0; i <= depth; ++i) {
|
||||
if (lineX > 0)
|
||||
rr.setRight(qMin(lineX, rr.right()));
|
||||
for (int i = 0; i <= depth; ++i) {
|
||||
int vi = i > 0 ? d->m_highlightBlocksInfo.visualIndent.at(i-1) : 0;
|
||||
painter.fillRect(rr.adjusted(vi, 0, -8*i, 0), calcBlendColor(baseColor, i, count));
|
||||
}
|
||||
@@ -1859,7 +1855,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
|
||||
int bllen = block.length();
|
||||
|
||||
QVector<QTextLayout::FormatRange> selections;
|
||||
QVector<QTextLayout::FormatRange> selectionsWithText;
|
||||
QVector<QTextLayout::FormatRange> prioritySelections;
|
||||
|
||||
for (int i = 0; i < context.selections.size(); ++i) {
|
||||
const QAbstractTextDocumentLayout::Selection &range = context.selections.at(i);
|
||||
@@ -1875,8 +1871,11 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
|
||||
o.start = qMin(blockSelection->firstColumn, bllen-1);
|
||||
o.length = qMin(blockSelection->lastColumn, bllen-1) - o.start;
|
||||
}
|
||||
if (o.format.foreground().style() != Qt::NoBrush)
|
||||
selectionsWithText.append(o);
|
||||
if ((hasMainSelection && i == context.selections.size()-1)
|
||||
|| (o.format.foreground().style() == Qt::NoBrush
|
||||
&& o.format.underlineStyle() != QTextCharFormat::NoUnderline
|
||||
&& o.format.background() == Qt::NoBrush))
|
||||
prioritySelections.append(o);
|
||||
else
|
||||
selections.append(o);
|
||||
} else if (!range.cursor.hasSelection() && range.format.hasProperty(QTextFormat::FullWidthSelection)
|
||||
@@ -1890,14 +1889,11 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
|
||||
if (o.start + o.length == bllen - 1)
|
||||
++o.length; // include newline
|
||||
o.format = range.format;
|
||||
if (o.format.foreground().style() != Qt::NoBrush)
|
||||
selectionsWithText.append(o);
|
||||
else
|
||||
selections.append(o);
|
||||
selections.append(o);
|
||||
}
|
||||
}
|
||||
d->highlightSearchResults(block, &selections);
|
||||
selections += selectionsWithText;
|
||||
selections += prioritySelections;
|
||||
|
||||
bool drawCursor = ((editable || true) // we want the cursor in read-only mode
|
||||
&& context.cursorPosition >= blpos
|
||||
@@ -2132,8 +2128,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e)
|
||||
}
|
||||
|
||||
|
||||
if (d->m_visibleWrapColumn > 0) {
|
||||
qreal lineX = fontMetrics().width('x') * d->m_visibleWrapColumn + offset.x() + 4;
|
||||
if (lineX > 0) {
|
||||
const QColor bg = palette().base().color();
|
||||
QColor col = (bg.value() > 128) ? Qt::black : Qt::white;
|
||||
col.setAlpha(32);
|
||||
@@ -2197,6 +2192,34 @@ void BaseTextEditor::slotUpdateExtraAreaWidth()
|
||||
setViewportMargins(0, 0, extraAreaWidth(), 0);
|
||||
}
|
||||
|
||||
static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool end,
|
||||
const QPalette &pal)
|
||||
{
|
||||
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||
const QColor c = pal.highlight().color();
|
||||
|
||||
QLinearGradient grad(rect.topRight(), rect.topLeft());
|
||||
grad.setColorAt(0, c.lighter(110));
|
||||
grad.setColorAt(1, c);
|
||||
|
||||
painter->fillRect(rect, grad);
|
||||
|
||||
QColor white = Qt::white;
|
||||
white.setAlpha(128);
|
||||
QColor black = Qt::black;
|
||||
black.setAlpha(32);
|
||||
|
||||
painter->setPen(white);
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
if (start)
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
|
||||
painter->setPen(black);
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
if (end)
|
||||
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
}
|
||||
|
||||
void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
{
|
||||
QTextDocument *doc = document();
|
||||
@@ -2228,7 +2251,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
|
||||
QTextBlock block = firstVisibleBlock();
|
||||
int blockNumber = block.blockNumber();
|
||||
int top = (int)blockBoundingGeometry(block).translated(contentOffset()).top();
|
||||
int top = (int) blockBoundingGeometry(block).translated(contentOffset()).top();
|
||||
int bottom = top;
|
||||
|
||||
while (block.isValid() && top <= e->rect().bottom()) {
|
||||
@@ -2283,71 +2306,7 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
if (d->m_codeFoldingVisible && d->m_displaySettings.m_fancyFoldingBar) {
|
||||
QRect r(extraAreaWidth+2, top, collapseBoxWidth-4, bottom - top);
|
||||
bool drawBox = !nextBlock.isVisible();
|
||||
|
||||
int extraAreaHighlightCollapseBlockNumber = -1;
|
||||
int extraAreaHighlightCollapseEndBlockNumber = -1;
|
||||
if (!d->m_highlightBlocksInfo.isEmpty()) {
|
||||
extraAreaHighlightCollapseBlockNumber = d->m_highlightBlocksInfo.open.last();
|
||||
extraAreaHighlightCollapseEndBlockNumber = d->m_highlightBlocksInfo.close.first();
|
||||
|
||||
QTextBlock before = doc->findBlockByNumber(extraAreaHighlightCollapseBlockNumber-1);
|
||||
if (TextBlockUserData::hasCollapseAfter(before)) {
|
||||
extraAreaHighlightCollapseBlockNumber--;
|
||||
}
|
||||
}
|
||||
int minBraceDepth = qMax(braceDepth, previousBraceDepth);
|
||||
QColor color = calcBlendColor(baseColor, minBraceDepth);
|
||||
if (!d->m_highlightBlocksInfo.isEmpty()
|
||||
&& blockNumber >= extraAreaHighlightCollapseBlockNumber
|
||||
&& blockNumber <= extraAreaHighlightCollapseEndBlockNumber)
|
||||
color = calcMixColor(pal.highlight().color(), color);
|
||||
painter.fillRect(r, color);
|
||||
|
||||
bool drawDown = !d->m_highlightBlocksInfo.isEmpty()
|
||||
&& blockNumber == extraAreaHighlightCollapseBlockNumber;
|
||||
bool drawUp = !d->m_highlightBlocksInfo.isEmpty()
|
||||
&& blockNumber == extraAreaHighlightCollapseEndBlockNumber;
|
||||
|
||||
if (drawBox || drawDown || drawUp) {
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.translate(.5, .5);
|
||||
painter.setPen(pal.text().color());
|
||||
painter.setBrush(pal.text().color());
|
||||
|
||||
if (drawBox) {
|
||||
QPointF points1[3] = { QPointF(r.left(), r.center().y()-1),
|
||||
QPointF(r.center().x(), r.top()),
|
||||
QPointF(r.right(), r.center().y()-1) };
|
||||
QPointF points2[3] = { QPointF(r.left(), r.center().y()+1),
|
||||
QPointF(r.center().x(), r.bottom()-1),
|
||||
QPointF(r.right(), r.center().y()+1) };
|
||||
painter.drawPolygon(points1, 3);
|
||||
painter.drawPolygon(points2, 3);
|
||||
} else if (drawUp) {
|
||||
|
||||
// check that we are not collapsed
|
||||
QTextBlock open = doc->findBlockByNumber(extraAreaHighlightCollapseBlockNumber);
|
||||
if (open.next().isVisible()) {
|
||||
|
||||
QPointF points[3] = { QPointF(r.left(), r.bottom()-1),
|
||||
QPointF(r.center().x(), r.center().y()),
|
||||
QPointF(r.right(), r.bottom()-1) };
|
||||
painter.drawPolygon(points, 3);
|
||||
}
|
||||
} else if(drawDown) {
|
||||
QPointF points[3] = { QPointF(r.left(), r.top()),
|
||||
QPointF(r.center().x(), r.center().y()),
|
||||
QPointF(r.right(), r.top()) };
|
||||
painter.drawPolygon(points, 3);
|
||||
}
|
||||
painter.translate(-.5, -.5);
|
||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
}
|
||||
|
||||
} else if (d->m_codeFoldingVisible) {
|
||||
if (d->m_codeFoldingVisible) {
|
||||
|
||||
bool collapseThis = false;
|
||||
bool collapseAfter = false;
|
||||
@@ -2361,7 +2320,6 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int extraAreaHighlightCollapseBlockNumber = -1;
|
||||
int extraAreaHighlightCollapseEndBlockNumber = -1;
|
||||
bool endIsVisible = false;
|
||||
@@ -2372,27 +2330,14 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
|
||||
QTextBlock before = doc->findBlockByNumber(extraAreaHighlightCollapseBlockNumber-1);
|
||||
if (TextBlockUserData::hasCollapseAfter(before)) {
|
||||
extraAreaHighlightCollapseBlockNumber--;
|
||||
extraAreaHighlightCollapseBlockNumber--;
|
||||
}
|
||||
}
|
||||
|
||||
const QRect box(extraAreaWidth + collapseBoxWidth/4, top + collapseBoxWidth/4,
|
||||
2 * (collapseBoxWidth/4) + 1, 2 * (collapseBoxWidth/4) + 1);
|
||||
const QPoint boxCenter = box.center();
|
||||
|
||||
|
||||
QColor textColorInactive = pal.text().color();
|
||||
textColorInactive.setAlpha(100);
|
||||
QColor textColor = pal.text().color();
|
||||
|
||||
QPen activePen(textColor);
|
||||
QPen inactivePen(textColorInactive);
|
||||
|
||||
TextBlockUserData *nextBlockUserData = TextEditDocumentLayout::testUserData(nextBlock);
|
||||
|
||||
bool collapseNext = nextBlockUserData
|
||||
&& nextBlockUserData->collapseMode()
|
||||
== TextBlockUserData::CollapseThis
|
||||
&& nextBlockUserData->collapseMode() == TextBlockUserData::CollapseThis
|
||||
&& !nextBlockUserData->ifdefedOut();
|
||||
|
||||
bool nextHasClosingCollapse = nextBlockUserData
|
||||
@@ -2400,36 +2345,25 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
&& nextBlockUserData->ifdefedOut();
|
||||
|
||||
bool drawBox = ((collapseAfter || collapseNext) && !nextHasClosingCollapse);
|
||||
bool active = blockNumber == extraAreaHighlightCollapseBlockNumber;
|
||||
bool drawStart = drawBox && active;
|
||||
bool drawEnd = blockNumber == extraAreaHighlightCollapseEndBlockNumber || (drawStart && !endIsVisible);
|
||||
|
||||
if (blockNumber > extraAreaHighlightCollapseBlockNumber
|
||||
&& blockNumber < extraAreaHighlightCollapseEndBlockNumber) {
|
||||
painter.setPen(activePen);
|
||||
painter.drawLine(boxCenter.x(), top, boxCenter.x(), bottom - 1);
|
||||
} else if (blockNumber == extraAreaHighlightCollapseBlockNumber
|
||||
&& nextVisibleBlockNumber <= extraAreaHighlightCollapseEndBlockNumber) {
|
||||
painter.setPen(activePen);
|
||||
painter.drawLine(boxCenter.x(), boxCenter.y(), boxCenter.x(), bottom - 1);
|
||||
} else if (blockNumber == extraAreaHighlightCollapseEndBlockNumber) {
|
||||
painter.setPen(activePen);
|
||||
painter.drawLine(boxCenter.x(), top, boxCenter.x(), boxCenter.y());
|
||||
if ( blockNumber >= extraAreaHighlightCollapseBlockNumber
|
||||
&& blockNumber <= extraAreaHighlightCollapseEndBlockNumber) {
|
||||
|
||||
QRect box = QRect(extraAreaWidth + 1, top, collapseBoxWidth - 2, collapseBoxWidth);
|
||||
drawRectBox(&painter, box, drawStart, drawEnd, pal);
|
||||
}
|
||||
|
||||
if (drawBox) {
|
||||
painter.setPen(blockNumber == extraAreaHighlightCollapseBlockNumber ?
|
||||
activePen : inactivePen);
|
||||
painter.setBrush(pal.base());
|
||||
painter.drawRect(box.adjusted(0, 0, -1, -1));
|
||||
if (!nextBlock.isVisible())
|
||||
painter.drawLine(boxCenter.x(), box.top() + 2, boxCenter.x(), box.bottom() - 2);
|
||||
painter.drawLine(box.left() + 2, boxCenter.y(), box.right() - 2, boxCenter.y());
|
||||
} else if (blockNumber == extraAreaHighlightCollapseEndBlockNumber) {
|
||||
painter.setPen(activePen);
|
||||
painter.drawLine(boxCenter.x() + 1, boxCenter.y(), box.right() - 1, boxCenter.y());
|
||||
bool expanded = nextBlock.isVisible();
|
||||
QRect box(extraAreaWidth + collapseBoxWidth/4, top + collapseBoxWidth/4,
|
||||
2 * (collapseBoxWidth/4) + 1, 2 * (collapseBoxWidth/4) + 1);
|
||||
drawFoldingMarker(&painter, box, expanded, active);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
@@ -2468,13 +2402,22 @@ void BaseTextEditor::extraAreaPaintEvent(QPaintEvent *e)
|
||||
block = nextVisibleBlock;
|
||||
blockNumber = nextVisibleBlockNumber;
|
||||
}
|
||||
}
|
||||
|
||||
if (d->m_codeFoldingVisible && d->m_displaySettings.m_fancyFoldingBar) {
|
||||
painter.drawLine(extraAreaWidth, 0,
|
||||
extraAreaWidth, viewport()->height());
|
||||
painter.drawLine(extraAreaWidth + collapseBoxWidth - 1, 0,
|
||||
extraAreaWidth + collapseBoxWidth - 1, viewport()->height());
|
||||
}
|
||||
void BaseTextEditor::drawFoldingMarker(QPainter *painter, const QRect &rect,
|
||||
bool expanded, bool hovered) const
|
||||
{
|
||||
QStyleOptionViewItemV2 opt;
|
||||
opt.rect = rect;
|
||||
opt.state = QStyle::State_Active | QStyle::State_Item | QStyle::State_Children;
|
||||
|
||||
if (expanded)
|
||||
opt.state |= QStyle::State_Open;
|
||||
|
||||
if (hovered)
|
||||
opt.state |= QStyle::State_MouseOver | QStyle::State_Enabled | QStyle::State_Selected;
|
||||
|
||||
style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this);
|
||||
}
|
||||
|
||||
void BaseTextEditor::slotModificationChanged(bool m)
|
||||
@@ -2686,25 +2629,28 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
|
||||
d->extraAreaHighlightCollapseBlockNumber = -1;
|
||||
d->extraAreaHighlightCollapseColumn = -1;
|
||||
|
||||
|
||||
int collapseBoxWidth = fontMetrics().lineSpacing() + 1;
|
||||
if (e->pos().x() > extraArea()->width() - collapseBoxWidth) {
|
||||
d->extraAreaHighlightCollapseBlockNumber = cursor.blockNumber();
|
||||
if (TextBlockUserData::canCollapse(cursor.block())
|
||||
|| !TextBlockUserData::hasClosingCollapse(cursor.block()))
|
||||
d->extraAreaHighlightCollapseColumn = cursor.block().length()-1;
|
||||
if ((true || !d->m_displaySettings.m_fancyFoldingBar)
|
||||
&& TextBlockUserData::hasCollapseAfter(cursor.block())) {
|
||||
if (TextBlockUserData::hasCollapseAfter(cursor.block())) {
|
||||
d->extraAreaHighlightCollapseBlockNumber++;
|
||||
d->extraAreaHighlightCollapseColumn = -1;
|
||||
if (TextBlockUserData::canCollapse(cursor.block().next())
|
||||
|| !TextBlockUserData::hasClosingCollapse(cursor.block().next()))
|
||||
d->extraAreaHighlightCollapseColumn = cursor.block().next().length()-1;
|
||||
}
|
||||
} else if (d->m_displaySettings.m_highlightBlocks) {
|
||||
QTextCursor cursor = textCursor();
|
||||
d->extraAreaHighlightCollapseBlockNumber = cursor.blockNumber();
|
||||
d->extraAreaHighlightCollapseColumn = cursor.position() - cursor.block().position();
|
||||
}
|
||||
|
||||
if (highlightBlockNumber != d->extraAreaHighlightCollapseBlockNumber
|
||||
|| highlightColumn != d->extraAreaHighlightCollapseColumn)
|
||||
d->m_highlightBlocksTimer->start(40);
|
||||
d->m_highlightBlocksTimer->start(d->m_highlightBlocksInfo.isEmpty() ? 40 : 10);
|
||||
}
|
||||
|
||||
if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) {
|
||||
@@ -3460,12 +3406,12 @@ BaseTextEditorAnimator::BaseTextEditorAnimator(QObject *parent)
|
||||
|
||||
void BaseTextEditorAnimator::setData(QFont f, QPalette pal, const QString &text)
|
||||
{
|
||||
m_font = f;
|
||||
m_palette = pal;
|
||||
m_text = text;
|
||||
QFontMetrics fm(m_font);
|
||||
m_size = QSizeF(fm.width(m_text), fm.height());
|
||||
}
|
||||
m_font = f;
|
||||
m_palette = pal;
|
||||
m_text = text;
|
||||
QFontMetrics fm(m_font);
|
||||
m_size = QSizeF(fm.width(m_text), fm.height());
|
||||
}
|
||||
|
||||
void BaseTextEditorAnimator::draw(QPainter *p, const QPointF &pos)
|
||||
{
|
||||
|
||||
@@ -511,6 +511,9 @@ private:
|
||||
void moveLineUpDown(bool up);
|
||||
void saveCurrentCursorPositionForNavigation();
|
||||
|
||||
void drawFoldingMarker(QPainter *painter, const QRect &rect,
|
||||
bool expanded, bool hovered) const;
|
||||
|
||||
void toggleBlockVisible(const QTextBlock &block);
|
||||
QRect collapseBox();
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ static const char * const displayFoldingMarkersKey = "DisplayFoldingMarkers";
|
||||
static const char * const highlightCurrentLineKey = "HighlightCurrentLineKeyV2";
|
||||
static const char * const highlightBlocksKey = "HighlightBlocksKey";
|
||||
static const char * const animateMatchingParenthesesKey= "AnimateMatchingParenthesesKey";
|
||||
static const char * const fancyFoldingBarKey= "FancyFoldingBarKey";
|
||||
static const char * const groupPostfix = "DisplaySettings";
|
||||
|
||||
namespace TextEditor {
|
||||
@@ -57,8 +56,7 @@ DisplaySettings::DisplaySettings() :
|
||||
m_displayFoldingMarkers(true),
|
||||
m_highlightCurrentLine(false),
|
||||
m_highlightBlocks(false),
|
||||
m_animateMatchingParentheses(true),
|
||||
m_fancyFoldingBar(false)
|
||||
m_animateMatchingParentheses(true)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -77,7 +75,6 @@ void DisplaySettings::toSettings(const QString &category, QSettings *s) const
|
||||
s->setValue(QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine);
|
||||
s->setValue(QLatin1String(highlightBlocksKey), m_highlightBlocks);
|
||||
s->setValue(QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses);
|
||||
s->setValue(QLatin1String(fancyFoldingBarKey), m_fancyFoldingBar);
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
@@ -99,7 +96,6 @@ void DisplaySettings::fromSettings(const QString &category, const QSettings *s)
|
||||
m_highlightCurrentLine = s->value(group + QLatin1String(highlightCurrentLineKey), m_highlightCurrentLine).toBool();
|
||||
m_highlightBlocks = s->value(group + QLatin1String(highlightBlocksKey), m_highlightBlocks).toBool();
|
||||
m_animateMatchingParentheses = s->value(group + QLatin1String(animateMatchingParenthesesKey), m_animateMatchingParentheses).toBool();
|
||||
m_fancyFoldingBar = s->value(group + QLatin1String(fancyFoldingBarKey), m_fancyFoldingBar).toBool();
|
||||
}
|
||||
|
||||
bool DisplaySettings::equals(const DisplaySettings &ds) const
|
||||
@@ -113,7 +109,6 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const
|
||||
&& m_highlightCurrentLine == ds.m_highlightCurrentLine
|
||||
&& m_highlightBlocks == ds.m_highlightBlocks
|
||||
&& m_animateMatchingParentheses == ds.m_animateMatchingParentheses
|
||||
&& m_fancyFoldingBar == ds.m_fancyFoldingBar
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ struct TEXTEDITOR_EXPORT DisplaySettings
|
||||
bool m_highlightCurrentLine;
|
||||
bool m_highlightBlocks;
|
||||
bool m_animateMatchingParentheses;
|
||||
bool m_fancyFoldingBar;
|
||||
|
||||
bool equals(const DisplaySettings &ds) const;
|
||||
};
|
||||
|
||||
@@ -124,7 +124,6 @@ void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings) const
|
||||
displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
|
||||
displaySettings.m_highlightBlocks = m_d->m_page.highlightBlocks->isChecked();
|
||||
displaySettings.m_animateMatchingParentheses= m_d->m_page.animateMatchingParentheses->isChecked();
|
||||
displaySettings.m_fancyFoldingBar = m_d->m_page.fancyFoldingBar->isChecked();
|
||||
}
|
||||
|
||||
void DisplaySettingsPage::settingsToUI()
|
||||
@@ -139,7 +138,6 @@ void DisplaySettingsPage::settingsToUI()
|
||||
m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
|
||||
m_d->m_page.highlightBlocks->setChecked(displaySettings.m_highlightBlocks);
|
||||
m_d->m_page.animateMatchingParentheses->setChecked(displaySettings.m_animateMatchingParentheses);
|
||||
m_d->m_page.fancyFoldingBar->setChecked(displaySettings.m_fancyFoldingBar);
|
||||
}
|
||||
|
||||
DisplaySettings DisplaySettingsPage::displaySettings() const
|
||||
|
||||
@@ -47,36 +47,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="fancyFoldingBar">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use fancy style</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="visualizeWhitespace">
|
||||
<property name="toolTip">
|
||||
@@ -181,21 +151,5 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>displayFoldingMarkers</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>fancyFoldingBar</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>60</x>
|
||||
<y>161</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>87</x>
|
||||
<y>179</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
@@ -615,6 +615,9 @@ void testStdList()
|
||||
flist.push_back(3);
|
||||
flist.push_back(4);
|
||||
|
||||
foreach (Foo f, flist)
|
||||
{}
|
||||
|
||||
std::list<bool> vec;
|
||||
vec.push_back(true);
|
||||
vec.push_back(false);
|
||||
|
||||
Reference in New Issue
Block a user