forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<plugin name="BinEditor" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="BinEditor" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Binary editor component.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="Bookmarks" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Bookmarks" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Bookmarks in text editors.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<plugin name="CMakeProjectManager" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="CMakeProjectManager" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>### TODO</license>
|
||||
<description>CMake support</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="CppTools" version="0.9.1"/>
|
||||
<dependency name="CppEditor" version="0.9.1"/>
|
||||
<dependency name="Help" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="CppTools" version="0.9.2"/>
|
||||
<dependency name="CppEditor" version="0.9.2"/>
|
||||
<dependency name="Help" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -99,7 +99,7 @@ QString CMakeBuildStepConfigWidget::displayName() const
|
||||
return "CMake";
|
||||
}
|
||||
|
||||
void CMakeBuildStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void CMakeBuildStepConfigWidget::init(const QString & /*buildConfiguration */)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -121,12 +121,12 @@ ProjectExplorer::BuildStep *CMakeBuildStepFactory::create(ProjectExplorer::Proje
|
||||
return new CMakeStep(pro);
|
||||
}
|
||||
|
||||
QStringList CMakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
QStringList CMakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString CMakeBuildStepFactory::displayNameForName(const QString &name) const
|
||||
QString CMakeBuildStepFactory::displayNameForName(const QString & /* name */) const
|
||||
{
|
||||
return "CMake";
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ QString MakeBuildStepConfigWidget::displayName() const
|
||||
return "Make";
|
||||
}
|
||||
|
||||
void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
|
||||
void MakeBuildStepConfigWidget::init(const QString & /* buildConfiguration */)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -115,12 +115,12 @@ ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Projec
|
||||
return new MakeStep(pro);
|
||||
}
|
||||
|
||||
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString MakeBuildStepFactory::displayNameForName(const QString &name) const
|
||||
QString MakeBuildStepFactory::displayNameForName(const QString & /* name */) const
|
||||
{
|
||||
return "Make";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<plugin name="Core" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Core" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Constants {
|
||||
|
||||
#define IDE_VERSION_MAJOR 0
|
||||
#define IDE_VERSION_MINOR 9
|
||||
#define IDE_VERSION_RELEASE 1
|
||||
#define IDE_VERSION_RELEASE 2
|
||||
|
||||
#define STRINGIFY_INTERNAL(x) #x
|
||||
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
|
||||
@@ -52,7 +52,7 @@ namespace Constants {
|
||||
|
||||
const char * const IDE_VERSION_LONG = IDE_VERSION;
|
||||
const char * const IDE_AUTHOR = "Nokia Corporation";
|
||||
const char * const IDE_YEAR = "2008";
|
||||
const char * const IDE_YEAR = "2009";
|
||||
|
||||
#ifdef IDE_REVISION
|
||||
const char * const IDE_REVISION_STR = STRINGIFY(IDE_REVISION);
|
||||
|
||||
@@ -47,6 +47,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
||||
setupUi(this);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
|
||||
connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
|
||||
|
||||
splitter->setCollapsible(1, false);
|
||||
pageTree->header()->setVisible(false);
|
||||
|
||||
@@ -135,3 +137,9 @@ void SettingsDialog::reject()
|
||||
page->finished(false);
|
||||
done(QDialog::Rejected);
|
||||
}
|
||||
|
||||
void SettingsDialog::apply()
|
||||
{
|
||||
foreach (IOptionsPage *page, m_pages)
|
||||
page->finished(true);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ private slots:
|
||||
void pageSelected(QTreeWidgetItem *cat);
|
||||
void accept();
|
||||
void reject();
|
||||
void apply();
|
||||
|
||||
private:
|
||||
QList<Core::IOptionsPage*> m_pages;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SettingsDialog</class>
|
||||
<widget class="QDialog" name="SettingsDialog" >
|
||||
<property name="geometry" >
|
||||
<widget class="QDialog" name="SettingsDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
@@ -9,50 +10,48 @@
|
||||
<height>476</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter" >
|
||||
<property name="orientation" >
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTreeWidget" name="pageTree" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<widget class="QTreeWidget" name="pageTree">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="columnCount" >
|
||||
<property name="columnCount">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<property name="text">
|
||||
<string>0</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedPages" >
|
||||
<property name="minimumSize" >
|
||||
<widget class="QStackedWidget" name="stackedPages">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>350</width>
|
||||
<height>250</height>
|
||||
@@ -61,8 +60,8 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line" >
|
||||
<property name="orientation" >
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -72,12 +71,12 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -91,11 +90,11 @@
|
||||
<receiver>SettingsDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>297</x>
|
||||
<y>361</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>297</x>
|
||||
<y>193</y>
|
||||
</hint>
|
||||
@@ -107,11 +106,11 @@
|
||||
<receiver>SettingsDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>297</x>
|
||||
<y>361</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>297</x>
|
||||
<y>193</y>
|
||||
</hint>
|
||||
|
||||
@@ -319,6 +319,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
||||
IActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED);
|
||||
medit->addMenu(advancedMenu, Constants::G_EDIT_FORMAT);
|
||||
advancedMenu->menu()->setTitle(tr("&Advanced"));
|
||||
|
||||
cmd = am->registerAction(m_d->m_openInExternalEditorAction, Constants::OPEN_IN_EXTERNAL_EDITOR, editManagerContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Alt+V,Alt+I")));
|
||||
advancedMenu->addAction(cmd);
|
||||
|
||||
@@ -65,6 +65,7 @@ enum MakeWritableResult {
|
||||
};
|
||||
|
||||
struct EditorManagerPrivate;
|
||||
|
||||
namespace Internal {
|
||||
class OpenEditorsWindow;
|
||||
class EditorSplitter;
|
||||
@@ -224,7 +225,8 @@ private:
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class EditorClosingCoreListener : public ICoreListener {
|
||||
class EditorClosingCoreListener : public ICoreListener
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
@@ -323,6 +323,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
|
||||
QPainter p(this);
|
||||
|
||||
QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0);
|
||||
rect = style()->visualRect(layoutDirection(), geometry(), rect);
|
||||
StyleHelper::verticalGradient(&p, rect, rect);
|
||||
p.setPen(StyleHelper::borderColor());
|
||||
p.drawLine(rect.topRight(), rect.bottomRight());
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string>R</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="core.qrc">
|
||||
@@ -114,7 +114,7 @@
|
||||
<string>Reset to default</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
<string>R</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="core.qrc">
|
||||
|
||||
@@ -49,12 +49,12 @@ QKeySequence INavigationWidgetFactory::activationSequence()
|
||||
}
|
||||
|
||||
|
||||
void INavigationWidgetFactory::saveSettings(int position, QWidget *widget)
|
||||
void INavigationWidgetFactory::saveSettings(int /* position */, QWidget * /* widget */)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void INavigationWidgetFactory::restoreSettings(int position, QWidget *widget)
|
||||
void INavigationWidgetFactory::restoreSettings(int /* position */, QWidget * /* widget */)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -625,6 +625,7 @@ void MainWindow::registerDefaultActions()
|
||||
// Toggle Sidebar Action
|
||||
m_toggleSideBarAction = new QAction(QIcon(Constants::ICON_TOGGLE_SIDEBAR),
|
||||
tr("Toggle Sidebar"), this);
|
||||
m_toggleSideBarAction->setCheckable(true);
|
||||
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, m_globalContext);
|
||||
#ifdef Q_OS_MAC
|
||||
cmd->setDefaultKeySequence(QKeySequence("Ctrl+0"));
|
||||
|
||||
@@ -822,10 +822,12 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
}
|
||||
|
||||
State mflags = bflags;
|
||||
if (toolbutton->activeSubControls & SC_ToolButton)
|
||||
bflags |= State_Sunken;
|
||||
if (toolbutton->activeSubControls & SC_ToolButtonMenu)
|
||||
mflags |= State_Sunken;
|
||||
if (toolbutton->state & State_Sunken) {
|
||||
if (toolbutton->activeSubControls & SC_ToolButton)
|
||||
bflags |= State_Sunken;
|
||||
if (toolbutton->activeSubControls & SC_ToolButtonMenu)
|
||||
mflags |= State_Sunken;
|
||||
}
|
||||
|
||||
QStyleOption tool(0);
|
||||
tool.palette = toolbutton->palette;
|
||||
@@ -894,11 +896,12 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
|
||||
tool.rect = tool.rect.adjusted(2, 2, -2, -2);
|
||||
drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
|
||||
} else if (toolbutton->features & QStyleOptionToolButton::HasMenu) {
|
||||
int mbi = pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
|
||||
int arrowSize = 6;
|
||||
QRect ir = toolbutton->rect.adjusted(1, 1, -1, -1);
|
||||
QStyleOptionToolButton newBtn = *toolbutton;
|
||||
newBtn.palette = panelPalette(option->palette);
|
||||
newBtn.rect = QRect(ir.right() + 5 - mbi, ir.height() - mbi + 4, mbi - 6, mbi - 6);
|
||||
newBtn.rect = QRect(ir.right() - arrowSize - 1,
|
||||
ir.height() - arrowSize - 2, arrowSize, arrowSize);
|
||||
QWindowsStyle::drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ int NavigationWidget::storedWidth()
|
||||
void NavigationWidget::placeHolderChanged(NavigationWidgetPlaceHolder *holder)
|
||||
{
|
||||
m_toggleSideBarAction->setEnabled(holder);
|
||||
m_toggleSideBarAction->setChecked(holder && isShown());
|
||||
}
|
||||
|
||||
void NavigationWidget::resizeEvent(QResizeEvent *re)
|
||||
@@ -281,8 +282,12 @@ void NavigationWidget::setShown(bool b)
|
||||
if (m_shown == b)
|
||||
return;
|
||||
m_shown = b;
|
||||
if (NavigationWidgetPlaceHolder::m_current)
|
||||
if (NavigationWidgetPlaceHolder::m_current) {
|
||||
NavigationWidgetPlaceHolder::m_current->setVisible(m_shown && !m_suppressed);
|
||||
m_toggleSideBarAction->setChecked(m_shown);
|
||||
} else {
|
||||
m_toggleSideBarAction->setChecked(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool NavigationWidget::isShown() const
|
||||
|
||||
@@ -488,13 +488,13 @@ OutputPaneToggleButton::OutputPaneToggleButton(int number, const QString &text,
|
||||
setFocusPolicy(Qt::NoFocus);
|
||||
setCheckable(true);
|
||||
setStyleSheet(
|
||||
"QPushButton { border-image: url(:/qworkbench/images/panel_button.png) 2 2 2 19 repeat;"
|
||||
"QPushButton { border-image: url(:/qworkbench/images/panel_button.png) 2 2 2 19;"
|
||||
" border-width: 2px 2px 2px 19px; padding-left: -17; padding-right: 4 } "
|
||||
"QPushButton:checked { border-image: url(:/qworkbench/images/panel_button_checked.png) 2 2 2 19 repeat } "
|
||||
"QPushButton:checked { border-image: url(:/qworkbench/images/panel_button_checked.png) 2 2 2 19 } "
|
||||
#ifndef Q_WS_MAC // Mac UI's dont usually do hover
|
||||
"QPushButton:checked:hover { border-image: url(:/qworkbench/images/panel_button_checked_hover.png) 2 2 2 19 repeat } "
|
||||
"QPushButton:pressed:hover { border-image: url(:/qworkbench/images/panel_button_pressed.png) 2 2 2 19 repeat } "
|
||||
"QPushButton:hover { border-image: url(:/qworkbench/images/panel_button_hover.png) 2 2 2 19 repeat } "
|
||||
"QPushButton:checked:hover { border-image: url(:/qworkbench/images/panel_button_checked_hover.png) 2 2 2 19 } "
|
||||
"QPushButton:pressed:hover { border-image: url(:/qworkbench/images/panel_button_pressed.png) 2 2 2 19 } "
|
||||
"QPushButton:hover { border-image: url(:/qworkbench/images/panel_button_hover.png) 2 2 2 19 } "
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="CodePaster" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="CodePaster" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Codepaster plugin for pushing/fetching diff from server</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="CppEditor" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="CppEditor" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>C/C++ editor component.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="CppTools" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="CppTools" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -543,8 +543,8 @@ void CPPEditor::jumpToDefinition()
|
||||
foreach (const Document::MacroUse use, doc->macroUses()) {
|
||||
if (use.contains(endOfName - 1)) {
|
||||
const Macro ¯o = use.macro();
|
||||
const QString fileName = QString::fromUtf8(macro.fileName);
|
||||
if (openCppEditorAt(fileName, macro.line, 0))
|
||||
const QString fileName = QString::fromUtf8(macro.fileName());
|
||||
if (openCppEditorAt(fileName, macro.line(), 0))
|
||||
return; // done
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,10 +72,16 @@ CppHoverHandler::CppHoverHandler(QObject *parent)
|
||||
m_modelManager = m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>();
|
||||
|
||||
QFileInfo fi(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings()->fileName());
|
||||
m_helpEngine = new QHelpEngineCore(fi.absolutePath()
|
||||
// FIXME shouldn't the help engine create the directory if it doesn't exist?
|
||||
QDir directory(fi.absolutePath()+"/qtcreator");
|
||||
if (!directory.exists())
|
||||
directory.mkpath(directory.absolutePath());
|
||||
|
||||
m_helpEngine = new QHelpEngineCore(directory.absolutePath()
|
||||
+ QLatin1String("/helpcollection.qhc"), this);
|
||||
//m_helpEngine->setAutoSaveFilter(false);
|
||||
m_helpEngine->setupData();
|
||||
if (!m_helpEngine->setupData())
|
||||
qWarning() << "Could not initialize help engine:" << m_helpEngine->error();
|
||||
m_helpEngine->setCurrentFilter(tr("Unfiltered"));
|
||||
m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0;
|
||||
|
||||
@@ -271,8 +277,9 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
if (m_toolTip.isEmpty()) {
|
||||
foreach (const Document::MacroUse &use, doc->macroUses()) {
|
||||
if (use.contains(pos)) {
|
||||
m_toolTip = use.macro().toString();
|
||||
m_helpId = use.macro().name;
|
||||
const Macro m = use.macro();
|
||||
m_toolTip = m.toString();
|
||||
m_helpId = m.name();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="CppTools" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="CppTools" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Tools for analyzing C/C++ code.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="QuickOpen" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="QuickOpen" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -180,8 +180,6 @@ protected:
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
||||
|
||||
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core)
|
||||
@@ -515,9 +513,9 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
if (m_completionOperator == T_LPAREN && completeFunction(exprTy, resolvedTypes, context)) {
|
||||
return m_startPosition;
|
||||
} if ((m_completionOperator == T_DOT || m_completionOperator == T_ARROW) &&
|
||||
completeMember(exprTy, resolvedTypes, context)) {
|
||||
completeMember(resolvedTypes, context)) {
|
||||
return m_startPosition;
|
||||
} else if (m_completionOperator == T_COLON_COLON && completeScope(exprTy, resolvedTypes, context)) {
|
||||
} else if (m_completionOperator == T_COLON_COLON && completeScope(resolvedTypes, context)) {
|
||||
return m_startPosition;
|
||||
} else if (m_completionOperator == T_SIGNAL && completeSignal(exprTy, resolvedTypes, context)) {
|
||||
return m_startPosition;
|
||||
@@ -577,32 +575,42 @@ bool CppCodeCompletion::completeFunction(FullySpecifiedType exprTy,
|
||||
return ! m_completions.isEmpty();
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeMember(FullySpecifiedType,
|
||||
const QList<TypeOfExpression::Result> &results,
|
||||
bool CppCodeCompletion::completeMember(const QList<TypeOfExpression::Result> &results,
|
||||
const LookupContext &context)
|
||||
{
|
||||
QTC_ASSERT(!results.isEmpty(), return false);
|
||||
if (results.isEmpty())
|
||||
return false;
|
||||
|
||||
TypeOfExpression::Result result = results.first();
|
||||
QList<Symbol *> classObjectCandidates;
|
||||
|
||||
TypeOfExpression::Result p = results.first();
|
||||
|
||||
if (m_completionOperator == T_ARROW) {
|
||||
FullySpecifiedType ty = p.first;
|
||||
FullySpecifiedType ty = result.first;
|
||||
|
||||
if (ReferenceType *refTy = ty->asReferenceType())
|
||||
ty = refTy->elementType();
|
||||
|
||||
if (NamedType *namedTy = ty->asNamedType()) {
|
||||
// ### This code is pretty slow.
|
||||
const QList<Symbol *> candidates = context.resolve(namedTy->name());
|
||||
foreach (Symbol *candidate, candidates) {
|
||||
if (candidate->isTypedef()) {
|
||||
ty = candidate->type();
|
||||
const ResolveExpression::Result r(ty, candidate);
|
||||
result = r;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NamedType *namedTy = ty->asNamedType()) {
|
||||
ResolveExpression resolveExpression(context);
|
||||
ResolveClass resolveClass;
|
||||
|
||||
Name *className = namedTy->name();
|
||||
const QList<Symbol *> candidates =
|
||||
context.resolveClass(className, context.visibleScopes(p));
|
||||
|
||||
const QList<Symbol *> candidates = resolveClass(result, context);
|
||||
foreach (Symbol *classObject, candidates) {
|
||||
const QList<TypeOfExpression::Result> overloads =
|
||||
resolveExpression.resolveArrowOperator(p, namedTy,
|
||||
resolveExpression.resolveArrowOperator(result, namedTy,
|
||||
classObject->asClass());
|
||||
|
||||
foreach (TypeOfExpression::Result r, overloads) {
|
||||
@@ -619,8 +627,7 @@ bool CppCodeCompletion::completeMember(FullySpecifiedType,
|
||||
if (PointerType *ptrTy = ty->asPointerType()) {
|
||||
if (NamedType *namedTy = ptrTy->elementType()->asNamedType()) {
|
||||
const QList<Symbol *> classes =
|
||||
context.resolveClass(namedTy->name(),
|
||||
context.visibleScopes(p));
|
||||
resolveClass(namedTy, result, context);
|
||||
|
||||
foreach (Symbol *c, classes) {
|
||||
if (! classObjectCandidates.contains(c))
|
||||
@@ -632,29 +639,53 @@ bool CppCodeCompletion::completeMember(FullySpecifiedType,
|
||||
}
|
||||
} else if (PointerType *ptrTy = ty->asPointerType()) {
|
||||
if (NamedType *namedTy = ptrTy->elementType()->asNamedType()) {
|
||||
const QList<Symbol *> classes =
|
||||
context.resolveClass(namedTy->name(),
|
||||
context.visibleScopes(p));
|
||||
ResolveClass resolveClass;
|
||||
|
||||
const QList<Symbol *> classes = resolveClass(namedTy, result,
|
||||
context);
|
||||
|
||||
foreach (Symbol *c, classes) {
|
||||
if (! classObjectCandidates.contains(c))
|
||||
classObjectCandidates.append(c);
|
||||
}
|
||||
} else if (Class *classTy = ptrTy->elementType()->asClass()) {
|
||||
// typedef struct { int x } *Ptr;
|
||||
// Ptr p;
|
||||
// p->
|
||||
classObjectCandidates.append(classTy);
|
||||
}
|
||||
}
|
||||
} else if (m_completionOperator == T_DOT) {
|
||||
FullySpecifiedType ty = p.first;
|
||||
FullySpecifiedType ty = result.first;
|
||||
|
||||
if (ReferenceType *refTy = ty->asReferenceType())
|
||||
ty = refTy->elementType();
|
||||
|
||||
NamedType *namedTy = 0;
|
||||
|
||||
if (ArrayType *arrayTy = ty->asArrayType()) {
|
||||
// Replace . with [0]. when `ty' is an array type.
|
||||
FullySpecifiedType elementTy = arrayTy->elementType();
|
||||
|
||||
if (ReferenceType *refTy = elementTy->asReferenceType())
|
||||
elementTy = refTy->elementType();
|
||||
|
||||
if (elementTy->isNamedType() || elementTy->isPointerType()) {
|
||||
ty = elementTy;
|
||||
|
||||
const int length = m_editor->position() - m_startPosition + 1;
|
||||
m_editor->setCurPos(m_startPosition - 1);
|
||||
m_editor->replace(length, QLatin1String("[0]."));
|
||||
m_startPosition += 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (PointerType *ptrTy = ty->asPointerType()) {
|
||||
// Replace . with ->
|
||||
int length = m_editor->position() - m_startPosition + 1;
|
||||
m_editor->setCurPos(m_startPosition - 1);
|
||||
m_editor->replace(length, QLatin1String("->"));
|
||||
m_startPosition++;
|
||||
++m_startPosition;
|
||||
namedTy = ptrTy->elementType()->asNamedType();
|
||||
} else {
|
||||
namedTy = ty->asNamedType();
|
||||
@@ -666,13 +697,14 @@ bool CppCodeCompletion::completeMember(FullySpecifiedType,
|
||||
}
|
||||
|
||||
if (namedTy) {
|
||||
const QList<Symbol *> classes =
|
||||
context.resolveClass(namedTy->name(),
|
||||
context.visibleScopes(p));
|
||||
|
||||
foreach (Symbol *c, classes) {
|
||||
if (! classObjectCandidates.contains(c))
|
||||
classObjectCandidates.append(c);
|
||||
ResolveClass resolveClass;
|
||||
const QList<Symbol *> symbols = resolveClass(namedTy, result,
|
||||
context);
|
||||
foreach (Symbol *symbol, symbols) {
|
||||
if (classObjectCandidates.contains(symbol))
|
||||
continue;
|
||||
if (Class *klass = symbol->asClass())
|
||||
classObjectCandidates.append(klass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -684,32 +716,45 @@ bool CppCodeCompletion::completeMember(FullySpecifiedType,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CppCodeCompletion::completeScope(FullySpecifiedType exprTy,
|
||||
const QList<TypeOfExpression::Result> &resolvedTypes,
|
||||
bool CppCodeCompletion::completeScope(const QList<TypeOfExpression::Result> &results,
|
||||
const LookupContext &context)
|
||||
{
|
||||
if (results.isEmpty())
|
||||
return false; // nothing to do.
|
||||
|
||||
// Search for a class or a namespace.
|
||||
foreach (TypeOfExpression::Result p, resolvedTypes) {
|
||||
if (p.first->isClass() || p.first->isNamespace()) {
|
||||
exprTy = p.first;
|
||||
TypeOfExpression::Result result(FullySpecifiedType(), 0);
|
||||
foreach (result, results) {
|
||||
FullySpecifiedType ty = result.first;
|
||||
|
||||
if (ty->isClass() || ty->isNamespace())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (exprTy->asNamespace()) {
|
||||
FullySpecifiedType exprTy = result.first;
|
||||
if (! exprTy) {
|
||||
return false;
|
||||
} else if (exprTy->asNamespace()) {
|
||||
QList<Symbol *> candidates;
|
||||
foreach (TypeOfExpression::Result p, resolvedTypes) {
|
||||
foreach (TypeOfExpression::Result p, results) {
|
||||
if (Namespace *ns = p.first->asNamespace())
|
||||
candidates.append(ns);
|
||||
}
|
||||
completeNamespace(candidates, context);
|
||||
} else if (exprTy->isClass()) {
|
||||
QList<Symbol *> candidates;
|
||||
foreach (TypeOfExpression::Result p, resolvedTypes) {
|
||||
foreach (TypeOfExpression::Result p, results) {
|
||||
if (Class *k = p.first->asClass())
|
||||
candidates.append(k);
|
||||
}
|
||||
completeClass(candidates, context);
|
||||
} else if (Symbol *symbol = result.second) {
|
||||
if (symbol->isTypedef()) {
|
||||
ResolveClass resolveClass;
|
||||
const QList<Symbol *> candidates = resolveClass(result,
|
||||
context);
|
||||
completeClass(candidates, context);
|
||||
}
|
||||
}
|
||||
|
||||
return ! m_completions.isEmpty();
|
||||
@@ -741,7 +786,7 @@ void CppCodeCompletion::addMacros(const LookupContext &context)
|
||||
processed.insert(fn);
|
||||
if (Document::Ptr doc = context.document(fn)) {
|
||||
foreach (const Macro ¯o, doc->definedMacros()) {
|
||||
macroNames.insert(macro.name);
|
||||
macroNames.insert(macro.name());
|
||||
}
|
||||
todo += doc->includedFiles();
|
||||
}
|
||||
@@ -749,7 +794,7 @@ void CppCodeCompletion::addMacros(const LookupContext &context)
|
||||
|
||||
foreach (const QByteArray ¯oName, macroNames) {
|
||||
TextEditor::CompletionItem item(this);
|
||||
item.m_text = QString::fromLatin1(macroName.constData(), macroName.length());
|
||||
item.m_text = QString::fromUtf8(macroName.constData(), macroName.length());
|
||||
item.m_icon = m_icons.macroIcon();
|
||||
m_completions.append(item);
|
||||
}
|
||||
@@ -819,6 +864,8 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
|
||||
if (results.isEmpty())
|
||||
return false;
|
||||
|
||||
ResolveClass resolveClass;
|
||||
|
||||
ConvertToCompletionItem toCompletionItem(this);
|
||||
Overview o;
|
||||
o.setShowReturnTypes(false);
|
||||
@@ -839,10 +886,8 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
|
||||
if (! namedTy) // not a class name.
|
||||
continue;
|
||||
|
||||
const QList<Scope *> visibleScopes = context.visibleScopes(p);
|
||||
|
||||
const QList<Symbol *> classObjects =
|
||||
context.resolveClass(namedTy->name(), visibleScopes);
|
||||
resolveClass(namedTy, p, context);
|
||||
|
||||
if (classObjects.isEmpty())
|
||||
continue;
|
||||
@@ -850,6 +895,7 @@ bool CppCodeCompletion::completeQtMethod(CPlusPlus::FullySpecifiedType,
|
||||
Class *klass = classObjects.first()->asClass();
|
||||
|
||||
QList<Scope *> todo;
|
||||
const QList<Scope *> visibleScopes = context.visibleScopes(p);
|
||||
context.expand(klass->members(), visibleScopes, &todo);
|
||||
|
||||
foreach (Scope *scope, todo) {
|
||||
|
||||
@@ -96,12 +96,10 @@ private:
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
|
||||
bool completeMember(CPlusPlus::FullySpecifiedType exprTy,
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
bool completeMember(const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
|
||||
bool completeScope(CPlusPlus::FullySpecifiedType exprTy,
|
||||
const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
bool completeScope(const QList<CPlusPlus::TypeOfExpression::Result> &,
|
||||
const CPlusPlus::LookupContext &context);
|
||||
|
||||
void completeNamespace(const QList<CPlusPlus::Symbol *> &candidates,
|
||||
|
||||
@@ -144,7 +144,7 @@ private:
|
||||
QPointer<CppModelManager> m_modelManager;
|
||||
Snapshot m_snapshot;
|
||||
Environment env;
|
||||
pp m_proc;
|
||||
Preprocessor m_proc;
|
||||
QStringList m_includePaths;
|
||||
QStringList m_systemIncludePaths;
|
||||
QMap<QString, QByteArray> m_workingCopy;
|
||||
|
||||
@@ -163,7 +163,8 @@ QFileInfo CppToolsPlugin::findFile(const QDir &dir, const QString &name,
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << dir << name;
|
||||
|
||||
if (project) {
|
||||
QFileInfo fileInSameDir(dir, name);
|
||||
if (project && !fileInSameDir.isFile()) {
|
||||
QString pattern = QString(1, QLatin1Char('/'));
|
||||
pattern += name;
|
||||
const QStringList projectFiles = project->files(ProjectExplorer::Project::AllFiles);
|
||||
@@ -173,7 +174,7 @@ QFileInfo CppToolsPlugin::findFile(const QDir &dir, const QString &name,
|
||||
return QFileInfo(*it);
|
||||
return QFileInfo();
|
||||
}
|
||||
return QFileInfo(dir, name);
|
||||
return fileInSameDir;
|
||||
}
|
||||
|
||||
// Figure out file type
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<plugin name="Debugger" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Debugger" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Debugger integration.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="CppEditor" version="0.9.1"/><!-- Debugger plugin adds items to the editor's context menu -->
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Find" version="0.9.1"/>
|
||||
<dependency name="CppEditor" version="0.9.2"/><!-- Debugger plugin adds items to the editor's context menu -->
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="Find" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -49,12 +49,11 @@
|
||||
|
||||
using namespace Debugger::Internal;
|
||||
|
||||
AttachExternalDialog::AttachExternalDialog(QWidget *parent, const QString &pid)
|
||||
AttachExternalDialog::AttachExternalDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
m_defaultPID = pid;
|
||||
m_model = new QStandardItemModel(this);
|
||||
|
||||
procView->setSortingEnabled(true);
|
||||
@@ -65,8 +64,6 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent, const QString &pid)
|
||||
connect(procView, SIGNAL(activated(const QModelIndex &)),
|
||||
this, SLOT(procSelected(const QModelIndex &)));
|
||||
|
||||
|
||||
pidLineEdit->setText(m_defaultPID);
|
||||
rebuildProcessList();
|
||||
}
|
||||
|
||||
@@ -91,7 +88,7 @@ static void insertItem(QStandardItem *root, const QString &pid,
|
||||
//qDebug() << "HANDLING " << pid;
|
||||
QStandardItem *parent = 0;
|
||||
const ProcData &proc = procs[pid];
|
||||
if (1 || pid == "0") {
|
||||
if (1 || pid == "0") { // FIXME: a real tree is not-so-nice to search
|
||||
parent = root;
|
||||
} else {
|
||||
if (!known.contains(proc.ppid))
|
||||
@@ -148,189 +145,9 @@ void AttachExternalDialog::rebuildProcessList()
|
||||
procView->expandAll();
|
||||
procView->resizeColumnToContents(0);
|
||||
procView->resizeColumnToContents(1);
|
||||
procView->sortByColumn(1, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
BOOL GetProcessList();
|
||||
BOOL ListProcessModules(DWORD dwPID);
|
||||
BOOL ListProcessThreads(DWORD dwOwnerPID);
|
||||
void printError(TCHAR *msg);
|
||||
|
||||
BOOL GetProcessList()
|
||||
{
|
||||
HANDLE hProcessSnap;
|
||||
HANDLE hProcess;
|
||||
PROCESSENTRY32 pe32;
|
||||
DWORD dwPriorityClass;
|
||||
|
||||
// Take a snapshot of all processes in the system.
|
||||
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
||||
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Set the size of the structure before using it.
|
||||
pe32.dwSize = sizeof( PROCESSENTRY32 );
|
||||
|
||||
// Retrieve information about the first process,
|
||||
// and exit if unsuccessful
|
||||
if (!Process32First( hProcessSnap, &pe32 ))
|
||||
{
|
||||
printError( TEXT("Process32First") ); // show cause of failure
|
||||
CloseHandle( hProcessSnap ); // clean the snapshot object
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Now walk the snapshot of processes, and
|
||||
// display information about each process in turn
|
||||
do
|
||||
{
|
||||
printf( "\n\n=====================================================" );
|
||||
_tprintf( TEXT("\nPROCESS NAME: %s"), pe32.szExeFile );
|
||||
printf( "\n-----------------------------------------------------" );
|
||||
|
||||
// Retrieve the priority class.
|
||||
dwPriorityClass = 0;
|
||||
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
||||
if (hProcess == NULL)
|
||||
printError( TEXT("OpenProcess") );
|
||||
else
|
||||
{
|
||||
dwPriorityClass = GetPriorityClass( hProcess );
|
||||
if (!dwPriorityClass)
|
||||
printError( TEXT("GetPriorityClass") );
|
||||
CloseHandle( hProcess );
|
||||
}
|
||||
|
||||
printf( "\n Process ID = 0x%08X", pe32.th32ProcessID );
|
||||
printf( "\n Thread count = %d", pe32.cntThreads );
|
||||
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
||||
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
||||
if (dwPriorityClass)
|
||||
printf( "\n Priority class = %d", dwPriorityClass );
|
||||
|
||||
// List the modules and threads associated with this process
|
||||
ListProcessModules( pe32.th32ProcessID );
|
||||
ListProcessThreads( pe32.th32ProcessID );
|
||||
|
||||
} while (Process32Next(hProcessSnap, &pe32));
|
||||
|
||||
CloseHandle(hProcessSnap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL ListProcessModules(DWORD dwPID)
|
||||
{
|
||||
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
|
||||
MODULEENTRY32 me32;
|
||||
|
||||
// Take a snapshot of all modules in the specified process.
|
||||
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
||||
if (hModuleSnap == INVALID_HANDLE_VALUE) {
|
||||
printError(TEXT("CreateToolhelp32Snapshot (of modules)"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Set the size of the structure before using it.
|
||||
me32.dwSize = sizeof( MODULEENTRY32 );
|
||||
|
||||
// Retrieve information about the first module,
|
||||
// and exit if unsuccessful
|
||||
if (!Module32First( hModuleSnap, &me32))
|
||||
{
|
||||
printError( TEXT("Module32First") ); // show cause of failure
|
||||
CloseHandle( hModuleSnap ); // clean the snapshot object
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Now walk the module list of the process,
|
||||
// and display information about each module
|
||||
do
|
||||
{
|
||||
_tprintf( TEXT("\n\n MODULE NAME: %s"), me32.szModule );
|
||||
_tprintf( TEXT("\n Executable = %s"), me32.szExePath );
|
||||
printf( "\n Process ID = 0x%08X", me32.th32ProcessID );
|
||||
printf( "\n Ref count (g) = 0x%04X", me32.GlblcntUsage );
|
||||
printf( "\n Ref count (p) = 0x%04X", me32.ProccntUsage );
|
||||
printf( "\n Base address = 0x%08X", (DWORD) me32.modBaseAddr );
|
||||
printf( "\n Base size = %d", me32.modBaseSize );
|
||||
|
||||
} while (Module32Next(hModuleSnap, &me32));
|
||||
|
||||
CloseHandle(hModuleSnap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
{
|
||||
HANDLE hThreadSnap = INVALID_HANDLE_VALUE;
|
||||
THREADENTRY32 te32;
|
||||
|
||||
// Take a snapshot of all running threads
|
||||
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
||||
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||
return( FALSE );
|
||||
|
||||
// Fill in the size of the structure before using it.
|
||||
te32.dwSize = sizeof(THREADENTRY32 );
|
||||
|
||||
// Retrieve information about the first thread,
|
||||
// and exit if unsuccessful
|
||||
if (!Thread32First( hThreadSnap, &te32 ))
|
||||
{
|
||||
printError( TEXT("Thread32First") ); // show cause of failure
|
||||
CloseHandle( hThreadSnap ); // clean the snapshot object
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Now walk the thread list of the system,
|
||||
// and display information about each thread
|
||||
// associated with the specified process
|
||||
do
|
||||
{
|
||||
if (te32.th32OwnerProcessID == dwOwnerPID)
|
||||
{
|
||||
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
||||
printf( "\n Base priority = %d", te32.tpBasePri );
|
||||
printf( "\n Delta priority = %d", te32.tpDeltaPri );
|
||||
}
|
||||
} while (Thread32Next(hThreadSnap, &te32));
|
||||
|
||||
CloseHandle( hThreadSnap );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
void printError( TCHAR* msg )
|
||||
{
|
||||
DWORD eNum;
|
||||
TCHAR sysMsg[256];
|
||||
TCHAR* p;
|
||||
|
||||
eNum = GetLastError( );
|
||||
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, eNum,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
sysMsg, 256, NULL );
|
||||
|
||||
// Trim the end of the line and terminate it with a null
|
||||
p = sysMsg;
|
||||
while (*p > 31 || *p == 9 )
|
||||
++p;
|
||||
|
||||
do {
|
||||
*p-- = 0;
|
||||
} while( p >= sysMsg && (*p == '.' || *p < 33));
|
||||
|
||||
// Display the message
|
||||
_tprintf( TEXT("\n WARNING: %s failed with error %d (%s)"), msg, eNum, sysMsg );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void AttachExternalDialog::procSelected(const QModelIndex &index0)
|
||||
{
|
||||
QModelIndex index = index0.sibling(index0.row(), 0);
|
||||
|
||||
@@ -48,7 +48,7 @@ class AttachExternalDialog : public QDialog, Ui::AttachExternalDialog
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AttachExternalDialog(QWidget *parent, const QString &pid);
|
||||
explicit AttachExternalDialog(QWidget *parent);
|
||||
int attachPID() const;
|
||||
|
||||
private slots:
|
||||
@@ -56,7 +56,6 @@ private slots:
|
||||
void procSelected(const QModelIndex &);
|
||||
|
||||
private:
|
||||
QString m_defaultPID;
|
||||
QStandardItemModel *m_model;
|
||||
};
|
||||
|
||||
|
||||
@@ -142,193 +142,6 @@ void AttachRemoteDialog::rebuildProcessList()
|
||||
procView->resizeColumnToContents(1);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
#include <windows.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <tchar.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// Forward declarations:
|
||||
BOOL GetProcessList();
|
||||
BOOL ListProcessModules(DWORD dwPID);
|
||||
BOOL ListProcessThreads(DWORD dwOwnerPID);
|
||||
void printError(TCHAR* msg);
|
||||
|
||||
BOOL GetProcessList( )
|
||||
{
|
||||
HANDLE hProcessSnap;
|
||||
HANDLE hProcess;
|
||||
PROCESSENTRY32 pe32;
|
||||
DWORD dwPriorityClass;
|
||||
|
||||
// Take a snapshot of all processes in the system.
|
||||
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
||||
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Set the size of the structure before using it.
|
||||
pe32.dwSize = sizeof( PROCESSENTRY32 );
|
||||
|
||||
// Retrieve information about the first process,
|
||||
// and exit if unsuccessful
|
||||
if (!Process32First( hProcessSnap, &pe32 ))
|
||||
{
|
||||
printError( TEXT("Process32First") ); // show cause of failure
|
||||
CloseHandle( hProcessSnap ); // clean the snapshot object
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Now walk the snapshot of processes, and
|
||||
// display information about each process in turn
|
||||
do
|
||||
{
|
||||
printf( "\n\n=====================================================" );
|
||||
_tprintf( TEXT("\nPROCESS NAME: %s"), pe32.szExeFile );
|
||||
printf( "\n-----------------------------------------------------" );
|
||||
|
||||
// Retrieve the priority class.
|
||||
dwPriorityClass = 0;
|
||||
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
||||
if (hProcess == NULL)
|
||||
printError( TEXT("OpenProcess") );
|
||||
else
|
||||
{
|
||||
dwPriorityClass = GetPriorityClass( hProcess );
|
||||
if (!dwPriorityClass)
|
||||
printError( TEXT("GetPriorityClass") );
|
||||
CloseHandle( hProcess );
|
||||
}
|
||||
|
||||
printf( "\n Process ID = 0x%08X", pe32.th32ProcessID );
|
||||
printf( "\n Thread count = %d", pe32.cntThreads );
|
||||
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
||||
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
||||
if (dwPriorityClass)
|
||||
printf( "\n Priority class = %d", dwPriorityClass );
|
||||
|
||||
// List the modules and threads associated with this process
|
||||
ListProcessModules( pe32.th32ProcessID );
|
||||
ListProcessThreads( pe32.th32ProcessID );
|
||||
|
||||
} while( Process32Next( hProcessSnap, &pe32 ) );
|
||||
|
||||
CloseHandle( hProcessSnap );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
|
||||
BOOL ListProcessModules( DWORD dwPID )
|
||||
{
|
||||
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
|
||||
MODULEENTRY32 me32;
|
||||
|
||||
// Take a snapshot of all modules in the specified process.
|
||||
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
||||
if (hModuleSnap == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printError( TEXT("CreateToolhelp32Snapshot (of modules)") );
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Set the size of the structure before using it.
|
||||
me32.dwSize = sizeof( MODULEENTRY32 );
|
||||
|
||||
// Retrieve information about the first module,
|
||||
// and exit if unsuccessful
|
||||
if (!Module32First( hModuleSnap, &me32 ))
|
||||
{
|
||||
printError( TEXT("Module32First") ); // show cause of failure
|
||||
CloseHandle( hModuleSnap ); // clean the snapshot object
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Now walk the module list of the process,
|
||||
// and display information about each module
|
||||
do
|
||||
{
|
||||
_tprintf( TEXT("\n\n MODULE NAME: %s"), me32.szModule );
|
||||
_tprintf( TEXT("\n Executable = %s"), me32.szExePath );
|
||||
printf( "\n Process ID = 0x%08X", me32.th32ProcessID );
|
||||
printf( "\n Ref count (g) = 0x%04X", me32.GlblcntUsage );
|
||||
printf( "\n Ref count (p) = 0x%04X", me32.ProccntUsage );
|
||||
printf( "\n Base address = 0x%08X", (DWORD) me32.modBaseAddr );
|
||||
printf( "\n Base size = %d", me32.modBaseSize );
|
||||
|
||||
} while( Module32Next( hModuleSnap, &me32 ) );
|
||||
|
||||
CloseHandle( hModuleSnap );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
{
|
||||
HANDLE hThreadSnap = INVALID_HANDLE_VALUE;
|
||||
THREADENTRY32 te32;
|
||||
|
||||
// Take a snapshot of all running threads
|
||||
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
||||
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||
return( FALSE );
|
||||
|
||||
// Fill in the size of the structure before using it.
|
||||
te32.dwSize = sizeof(THREADENTRY32 );
|
||||
|
||||
// Retrieve information about the first thread,
|
||||
// and exit if unsuccessful
|
||||
if (!Thread32First( hThreadSnap, &te32 ))
|
||||
{
|
||||
printError( TEXT("Thread32First") ); // show cause of failure
|
||||
CloseHandle( hThreadSnap ); // clean the snapshot object
|
||||
return( FALSE );
|
||||
}
|
||||
|
||||
// Now walk the thread list of the system,
|
||||
// and display information about each thread
|
||||
// associated with the specified process
|
||||
do
|
||||
{
|
||||
if (te32.th32OwnerProcessID == dwOwnerPID)
|
||||
{
|
||||
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
||||
printf( "\n Base priority = %d", te32.tpBasePri );
|
||||
printf( "\n Delta priority = %d", te32.tpDeltaPri );
|
||||
}
|
||||
} while( Thread32Next(hThreadSnap, &te32 ) );
|
||||
|
||||
CloseHandle( hThreadSnap );
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
void printError( TCHAR* msg )
|
||||
{
|
||||
DWORD eNum;
|
||||
TCHAR sysMsg[256];
|
||||
TCHAR* p;
|
||||
|
||||
eNum = GetLastError( );
|
||||
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, eNum,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
sysMsg, 256, NULL );
|
||||
|
||||
// Trim the end of the line and terminate it with a null
|
||||
p = sysMsg;
|
||||
while( ( *p > 31 ) || ( *p == 9 ) )
|
||||
++p;
|
||||
do { *p-- = 0; } while( ( p >= sysMsg ) &&
|
||||
( ( *p == '.' ) || ( *p < 33 ) ) );
|
||||
|
||||
// Display the message
|
||||
_tprintf( TEXT("\n WARNING: %s failed with error %d (%s)"), msg, eNum, sysMsg );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void AttachRemoteDialog::procSelected(const QModelIndex &index0)
|
||||
{
|
||||
QModelIndex index = index0.sibling(index0.row(), 0);
|
||||
|
||||
@@ -76,7 +76,6 @@ FORMS += attachexternaldialog.ui \
|
||||
attachremotedialog.ui \
|
||||
breakbyfunction.ui \
|
||||
breakcondition.ui \
|
||||
mode.ui \
|
||||
gdboptionpage.ui \
|
||||
startexternaldialog.ui \
|
||||
|
||||
|
||||
@@ -804,8 +804,7 @@ bool DebuggerManager::startNewDebugger(StartMode mode)
|
||||
m_workingDir = QString();
|
||||
m_attachedPID = -1;
|
||||
} else if (startMode() == attachExternal) {
|
||||
QString pid;
|
||||
AttachExternalDialog dlg(mainWindow(), pid);
|
||||
AttachExternalDialog dlg(mainWindow());
|
||||
if (dlg.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
m_executable = QString();
|
||||
|
||||
@@ -63,10 +63,10 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPoint>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QtPlugin>
|
||||
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QTextBlock>
|
||||
|
||||
@@ -650,7 +650,7 @@ void GdbEngine::interruptInferior()
|
||||
if (m_gdbProc.state() == QProcess::NotRunning)
|
||||
return;
|
||||
|
||||
if (q->m_attachedPID) {
|
||||
if (q->m_attachedPID > 0) {
|
||||
if (interruptProcess(q->m_attachedPID))
|
||||
qq->notifyInferiorStopped();
|
||||
return;
|
||||
@@ -660,6 +660,7 @@ void GdbEngine::interruptInferior()
|
||||
sendCommand("-exec-interrupt", GdbExecInterrupt);
|
||||
qq->notifyInferiorStopped();
|
||||
#else
|
||||
qDebug() << "CANNOT STOP INFERIOR" << m_gdbProc.pid();
|
||||
if (interruptChildProcess(m_gdbProc.pid()))
|
||||
qq->notifyInferiorStopped();
|
||||
#endif
|
||||
@@ -672,9 +673,9 @@ void GdbEngine::maybeHandleInferiorPidChanged(const QString &pid0)
|
||||
qDebug() << "Cannot parse PID from " << pid0;
|
||||
return;
|
||||
}
|
||||
if (pid == m_inferiorPid)
|
||||
if (pid == q->m_attachedPID)
|
||||
return;
|
||||
m_inferiorPid = pid;
|
||||
q->m_attachedPID = pid;
|
||||
qq->notifyInferiorPidChanged(pid);
|
||||
}
|
||||
|
||||
@@ -1514,7 +1515,6 @@ int GdbEngine::currentFrame() const
|
||||
|
||||
bool GdbEngine::startDebugger()
|
||||
{
|
||||
m_inferiorPid = 0;
|
||||
QStringList gdbArgs;
|
||||
|
||||
QFileInfo fi(q->m_executable);
|
||||
@@ -1616,7 +1616,7 @@ bool GdbEngine::startDebugger()
|
||||
sendCommand("attach " + QString::number(q->m_attachedPID));
|
||||
}
|
||||
|
||||
if (q->startMode() == q->startInternal) {
|
||||
if (q->startMode() == q->startInternal || q->startMode() == q->startExternal) {
|
||||
sendCommand("-file-exec-and-symbols " + fileName, GdbFileExecAndSymbols);
|
||||
#ifdef Q_OS_MAC
|
||||
sendCommand("sharedlibrary apply-load-rules all");
|
||||
@@ -2401,7 +2401,7 @@ void GdbEngine::handleStackListFrames(const GdbResultRecord &record)
|
||||
if (usable)
|
||||
q->gotoLocation(frame.file, frame.line, true);
|
||||
else
|
||||
qDebug() << "FULL NAME NOT USABLE 0: " << frame.file;
|
||||
qDebug() << "FULL NAME NOT USABLE 0: " << frame.file << topFrame;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2944,8 +2944,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
||||
|
||||
QString outertype = isTemplate ? tmplate : data.type;
|
||||
// adjust the data extract
|
||||
if (outertype == "QWidget")
|
||||
outertype = "QObject";
|
||||
if (outertype == m_namespace + "QWidget")
|
||||
outertype = m_namespace + "QObject";
|
||||
|
||||
QString extraArgs[4];
|
||||
extraArgs[0] = "0";
|
||||
@@ -2961,11 +2961,11 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
||||
|
||||
// in rare cases we need more or less:
|
||||
if (outertype == m_namespace + "QObject") {
|
||||
extraArgs[extraArgCount++] = "(char*)&((('"
|
||||
extraArgs[0] = "(char*)&((('"
|
||||
+ m_namespace + "QObjectPrivate'*)&"
|
||||
+ data.exp + ")->children)-(char*)&" + data.exp;
|
||||
} else if (outertype == m_namespace + "QVector") {
|
||||
extraArgs[extraArgCount++] = "(char*)&(("
|
||||
extraArgs[1] = "(char*)&(("
|
||||
+ data.exp + ").d->array)-(char*)" + data.exp + ".d";
|
||||
} else if (outertype == m_namespace + "QObjectSlot"
|
||||
|| outertype == m_namespace + "QObjectSignal") {
|
||||
@@ -2976,16 +2976,23 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
||||
QString slotNumber = "-1";
|
||||
if (lastOpened != -1 && lastClosed != -1)
|
||||
slotNumber = data.iname.mid(lastOpened + 1, lastClosed - lastOpened - 1);
|
||||
extraArgs[extraArgCount++] = slotNumber;
|
||||
} else if (outertype == m_namespace + "QMap") {
|
||||
QString nodetype = m_namespace + "QMapNode";
|
||||
nodetype += data.type.mid(m_namespace.size() + 4);
|
||||
//qDebug() << "OUTERTYPE: " << outertype << " NODETYPE: " << nodetype;
|
||||
extraArgs[extraArgCount++] = sizeofTypeExpression(nodetype);
|
||||
extraArgs[extraArgCount++] = "(size_t)&(('" + nodetype + "'*)0)->value";
|
||||
extraArgs[0] = slotNumber;
|
||||
} else if (outertype == m_namespace + "QMap" || outertype == m_namespace + "QMultiMap") {
|
||||
QString nodetype;
|
||||
if (m_qtVersion >= (4 << 16) + (5 << 8) + 0) {
|
||||
nodetype = m_namespace + "QMapNode";
|
||||
nodetype += data.type.mid(outertype.size());
|
||||
} else {
|
||||
// FIXME: doesn't work for QMultiMap
|
||||
nodetype = data.type + "::Node";
|
||||
}
|
||||
//qDebug() << "OUTERTYPE: " << outertype << " NODETYPE: " << nodetype
|
||||
// << "QT VERSION" << m_qtVersion << ((4 << 16) + (5 << 8) + 0);
|
||||
extraArgs[2] = sizeofTypeExpression(nodetype);
|
||||
extraArgs[3] = "(size_t)&(('" + nodetype + "'*)0)->value";
|
||||
} else if (outertype == m_namespace + "QMapNode") {
|
||||
extraArgs[extraArgCount++] = sizeofTypeExpression(data.type);
|
||||
extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value";
|
||||
extraArgs[2] = sizeofTypeExpression(data.type);
|
||||
extraArgs[3] = "(size_t)&(('" + data.type + "'*)0)->value";
|
||||
} else if (outertype == "std::vector") {
|
||||
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
|
||||
if (inners.at(0) == "bool") {
|
||||
@@ -3311,6 +3318,16 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
|
||||
GdbMi contents(output.data());
|
||||
GdbMi simple = contents.findChild("dumpers");
|
||||
m_namespace = contents.findChild("namespace").data();
|
||||
GdbMi qtversion = contents.findChild("qtversion");
|
||||
if (qtversion.children().size() == 3) {
|
||||
m_qtVersion = (qtversion.childAt(0).data().toInt() << 16)
|
||||
+ (qtversion.childAt(1).data().toInt() << 8)
|
||||
+ qtversion.childAt(2).data().toInt();
|
||||
//qDebug() << "FOUND QT VERSION: " << qtversion.toString() << m_qtVersion;
|
||||
} else {
|
||||
m_qtVersion = 0;
|
||||
}
|
||||
|
||||
//qDebug() << "OUTPUT: " << output.toString();
|
||||
//qDebug() << "CONTENTS: " << contents.toString();
|
||||
//qDebug() << "SIMPLE DUMPERS: " << simple.toString();
|
||||
@@ -3536,8 +3553,9 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
||||
// << item.findChild("nameencoded").data()[1];
|
||||
if (item.findChild("nameencoded").data()[0] == '1')
|
||||
data1.name = QByteArray::fromBase64(data1.name.toUtf8());
|
||||
if (item.findChild("nameisindex").data()[0] == '1')
|
||||
data1.name = '[' + data1.name + ']';
|
||||
QString key = item.findChild("key").data();
|
||||
if (!key.isEmpty())
|
||||
data1.name += " (" + key + ")";
|
||||
setWatchDataType(data1, item.findChild("type"));
|
||||
setWatchDataExpression(data1, item.findChild("exp"));
|
||||
setWatchDataChildCount(data1, item.findChild("numchild"));
|
||||
@@ -3945,10 +3963,15 @@ void GdbEngine::tryLoadCustomDumpers()
|
||||
if (qq->useFastStart())
|
||||
sendCommand("set stop-on-solib-events 0");
|
||||
QString flag = QString::number(RTLD_NOW);
|
||||
sendCommand("call dlopen(\"" + lib + "\", " + flag + ")");
|
||||
sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")");
|
||||
// some older systems like CentOS 4.6 prefer this:
|
||||
sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")");
|
||||
sendCommand("sharedlibrary " + dotEscape(lib));
|
||||
if (qq->useFastStart())
|
||||
sendCommand("set stop-on-solib-events 1");
|
||||
} else {
|
||||
qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: "
|
||||
<< lib << QFileInfo(lib).isExecutable();
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_MAC)
|
||||
@@ -3962,6 +3985,9 @@ void GdbEngine::tryLoadCustomDumpers()
|
||||
sendCommand("sharedlibrary " + dotEscape(lib));
|
||||
if (qq->useFastStart())
|
||||
sendCommand("set stop-on-solib-events 1");
|
||||
} else {
|
||||
qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: "
|
||||
<< lib << QFileInfo(lib).isExecutable();
|
||||
}
|
||||
#endif
|
||||
#if defined(Q_OS_WIN)
|
||||
@@ -3975,6 +4001,9 @@ void GdbEngine::tryLoadCustomDumpers()
|
||||
sendCommand("sharedlibrary " + dotEscape(lib));
|
||||
if (qq->useFastStart())
|
||||
sendCommand("set stop-on-solib-events 1");
|
||||
} else {
|
||||
qDebug() << "DEBUG HELPER LIBRARY IS NOT USABLE: "
|
||||
<< lib << QFileInfo(lib).isExecutable();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -330,10 +330,10 @@ private:
|
||||
|
||||
QString m_editedData;
|
||||
int m_pendingRequests;
|
||||
int m_inferiorPid;
|
||||
|
||||
QStringList m_availableSimpleDumpers;
|
||||
QString m_namespace; // namespace used in "namespaced Qt";
|
||||
int m_qtVersion; // Qt version used in the debugged program
|
||||
|
||||
DataDumperState m_dataDumperState; // state of qt creator dumpers
|
||||
QList<GdbMi> m_currentFunctionArgs;
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<class>DebugMode</class>
|
||||
<widget class="QWidget" name="DebugMode" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>558</width>
|
||||
<height>353</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="vSplitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QWidget" native="1" name="editorHolder" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<horstretch>10</horstretch>
|
||||
<verstretch>10</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="toolbarLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="hSplitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTabWidget" name="bottomTabWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="tabPosition" >
|
||||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="tabShape" >
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -42,6 +42,8 @@ StartExternalDialog::StartExternalDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
execFile->setExpectedKind(Core::Utils::PathChooser::File);
|
||||
execFile->setPromptDialogTitle(tr("Select Executable"));
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
|
||||
//execLabel->setHidden(false);
|
||||
@@ -53,14 +55,11 @@ StartExternalDialog::StartExternalDialog(QWidget *parent)
|
||||
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
connect(browseButton, SIGNAL(clicked()),
|
||||
this, SLOT(onBrowseButton()));
|
||||
}
|
||||
|
||||
void StartExternalDialog::setExecutableFile(const QString &str)
|
||||
{
|
||||
execEdit->setText(str);
|
||||
execFile->setPath(str);
|
||||
}
|
||||
|
||||
void StartExternalDialog::setExecutableArguments(const QString &str)
|
||||
@@ -70,7 +69,7 @@ void StartExternalDialog::setExecutableArguments(const QString &str)
|
||||
|
||||
QString StartExternalDialog::executableFile() const
|
||||
{
|
||||
return execEdit->text();
|
||||
return execFile->path();
|
||||
}
|
||||
|
||||
QString StartExternalDialog::executableArguments() const
|
||||
@@ -116,10 +115,3 @@ QString StartExternalDialog::executableArguments() const
|
||||
return result;
|
||||
*/
|
||||
}
|
||||
|
||||
void StartExternalDialog::onBrowseButton()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Executable"),
|
||||
execEdit->text());
|
||||
execEdit->setText(fileName);
|
||||
}
|
||||
|
||||
@@ -53,9 +53,6 @@ public:
|
||||
|
||||
QString executableFile() const;
|
||||
QString executableArguments() const;
|
||||
|
||||
private slots:
|
||||
void onBrowseButton();
|
||||
};
|
||||
|
||||
} // namespace Debugger
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StartExternalDialog</class>
|
||||
<widget class="QDialog" name="StartExternalDialog" >
|
||||
<property name="geometry" >
|
||||
<widget class="QDialog" name="StartExternalDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
@@ -9,59 +10,52 @@
|
||||
<height>127</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Start Debugger</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<layout class="QVBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="margin" >
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLineEdit" name="argsEdit" />
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLineEdit" name="execEdit" />
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="execLabel" >
|
||||
<property name="text" >
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="execLabel">
|
||||
<property name="text">
|
||||
<string>Executable:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QToolButton" name="browseButton" >
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="argLabel" >
|
||||
<property name="text" >
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="argLabel">
|
||||
<property name="text">
|
||||
<string>Arguments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="argsEdit"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Core::Utils::PathChooser" name="execFile" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>407</width>
|
||||
<height>16</height>
|
||||
@@ -70,24 +64,32 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line" >
|
||||
<property name="orientation" >
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Core::Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1204,13 +1204,13 @@ void WatchHandler::loadWatchers()
|
||||
QVariant value;
|
||||
sessionValueRequested("Watchers", &value);
|
||||
m_watchers = value.toStringList();
|
||||
qDebug() << "LOAD WATCHERS: " << m_watchers;
|
||||
//qDebug() << "LOAD WATCHERS: " << m_watchers;
|
||||
reinitializeWatchersHelper();
|
||||
}
|
||||
|
||||
void WatchHandler::saveWatchers()
|
||||
{
|
||||
qDebug() << "SAVE WATCHERS: " << m_watchers;
|
||||
//qDebug() << "SAVE WATCHERS: " << m_watchers;
|
||||
setSessionValueRequested("Watchers", m_watchers);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,8 @@ enum { INameRole = Qt::UserRole, VisualRole, ExpandedRole };
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
WatchWindow::WatchWindow(Type type, QWidget *parent)
|
||||
: QTreeView(parent), m_type(type)
|
||||
: QTreeView(parent), m_type(type)
|
||||
, m_alwaysResizeColumnsToContents(true)
|
||||
{
|
||||
setWindowTitle(tr("Locals and Watchers"));
|
||||
setAlternatingRowColors(true);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="Designer" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Designer" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Qt Designer integration.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<!-- For compiling with CPP support enabled -->
|
||||
<dependency name="CppEditor" version="0.9.1"/>
|
||||
<dependency name="CppEditor" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -62,8 +62,15 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build the ui class (Ui::Foo) name relative to the namespace (which is the same):
|
||||
const QString colonColon = QLatin1String("::");
|
||||
const int lastSeparator = uiClassName.lastIndexOf(colonColon);
|
||||
if (lastSeparator != -1)
|
||||
uiClassName.remove(0, lastSeparator + colonColon.size());
|
||||
uiClassName.insert(0, QLatin1String(uiNamespaceC) + colonColon);
|
||||
|
||||
// Do we have namespaces?
|
||||
QStringList namespaceList = className.split(QLatin1String("::"));
|
||||
QStringList namespaceList = className.split(colonColon);
|
||||
if (namespaceList.empty()) // Paranoia!
|
||||
return false;
|
||||
|
||||
@@ -94,18 +101,21 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
|
||||
}
|
||||
}
|
||||
|
||||
const QString namespaceIndent = Core::Utils::writeOpeningNameSpaces(namespaceList, indent, headerStr);
|
||||
|
||||
// Forward-declare the UI class
|
||||
if (embedding == PointerAggregatedUiClass) {
|
||||
headerStr << "\nnamespace " << uiNamespaceC << " {\n"
|
||||
<< indent << "class " << uiClassName << ";\n}\n";
|
||||
headerStr << '\n'
|
||||
<< namespaceIndent << "namespace " << uiNamespaceC << " {\n"
|
||||
<< namespaceIndent << indent << "class " << FormTemplateWizardPagePage::stripNamespaces(uiClassName) << ";\n"
|
||||
<< namespaceIndent << "}\n";
|
||||
}
|
||||
|
||||
const QString namespaceIndent = Core::Utils::writeOpeningNameSpaces(namespaceList, indent, headerStr);
|
||||
// Class declaration
|
||||
headerStr << '\n' << namespaceIndent << "class " << unqualifiedClassName
|
||||
<< " : public " << formBaseClass;
|
||||
if (embedding == InheritedUiClass) {
|
||||
headerStr << ", private " << uiNamespaceC << "::" << uiClassName;
|
||||
headerStr << ", private " << uiClassName;
|
||||
}
|
||||
headerStr << " {\n" << namespaceIndent << indent << "Q_OBJECT\n"
|
||||
<< namespaceIndent << indent << "Q_DISABLE_COPY(" << unqualifiedClassName << ")\n"
|
||||
@@ -120,7 +130,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
|
||||
// Member variable
|
||||
if (embedding != InheritedUiClass) {
|
||||
headerStr << '\n' << namespaceIndent << "private:\n"
|
||||
<< namespaceIndent << indent << uiNamespaceC << "::" << uiClassName << ' ';
|
||||
<< namespaceIndent << indent << uiClassName << ' ';
|
||||
if (embedding == PointerAggregatedUiClass)
|
||||
headerStr << '*';
|
||||
headerStr << uiMemberC << ";\n";
|
||||
@@ -140,7 +150,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
|
||||
sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName << "(QWidget *parent) :\n"
|
||||
<< namespaceIndent << indent << formBaseClass << "(parent)";
|
||||
if (embedding == PointerAggregatedUiClass)
|
||||
sourceStr << ",\n" << namespaceIndent << indent << uiMemberC << "(new " << uiNamespaceC << "::" << uiClassName << ")\n";
|
||||
sourceStr << ",\n" << namespaceIndent << indent << uiMemberC << "(new " << uiClassName << ")\n";
|
||||
sourceStr << namespaceIndent << "{\n" << namespaceIndent << indent;
|
||||
if (embedding != InheritedUiClass)
|
||||
sourceStr << uiMemberC << (embedding == PointerAggregatedUiClass ? "->" : ".");
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
enum { debugSlotNavigation = 0 };
|
||||
enum { indentation = 4 };
|
||||
|
||||
using namespace Designer::Internal;
|
||||
using namespace CPlusPlus;
|
||||
@@ -75,6 +76,12 @@ static QString msgClassNotFound(const QString &uiClassName, const QList<Document
|
||||
return WorkbenchIntegration::tr("The class definition of '%1' could not be found in %2.").arg(uiClassName, files);
|
||||
}
|
||||
|
||||
static inline CppTools::CppModelManagerInterface *cppModelManagerInstance()
|
||||
{
|
||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
return core->pluginManager()->getObject<CppTools::CppModelManagerInterface>();
|
||||
}
|
||||
|
||||
WorkbenchIntegration::WorkbenchIntegration(QDesignerFormEditorInterface *core, FormEditorW *parent) :
|
||||
qdesigner_internal::QDesignerIntegration(core, ::qobject_cast<QObject*>(parent)),
|
||||
m_few(parent)
|
||||
@@ -101,18 +108,13 @@ QWidget *WorkbenchIntegration::containerWindow(QWidget * /*widget*/) const
|
||||
return fw->integrationContainer();
|
||||
}
|
||||
|
||||
static QList<Document::Ptr> findDocumentsIncluding(const QString &fileName, bool checkFileNameOnly)
|
||||
static QList<Document::Ptr> findDocumentsIncluding(const CPlusPlus::Snapshot &docTable,
|
||||
const QString &fileName, bool checkFileNameOnly)
|
||||
{
|
||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
CppTools::CppModelManagerInterface *cppModelManager =
|
||||
core->pluginManager()->getObject<CppTools::CppModelManagerInterface>();
|
||||
|
||||
QList<Document::Ptr> docList;
|
||||
// take all docs
|
||||
CPlusPlus::Snapshot docTable = cppModelManager->snapshot();
|
||||
foreach (Document::Ptr doc, docTable) { // we go through all documents
|
||||
QStringList includes = doc->includedFiles();
|
||||
foreach (QString include, includes) {
|
||||
foreach (const Document::Ptr &doc, docTable) { // we go through all documents
|
||||
const QStringList includes = doc->includedFiles();
|
||||
foreach (const QString &include, includes) {
|
||||
if (checkFileNameOnly) {
|
||||
const QFileInfo fi(include);
|
||||
if (fi.fileName() == fileName) { // we are only interested in docs which includes fileName only
|
||||
@@ -127,78 +129,79 @@ static QList<Document::Ptr> findDocumentsIncluding(const QString &fileName, bool
|
||||
return docList;
|
||||
}
|
||||
|
||||
static Class *findClass(Namespace *parentNameSpace, const QString &uiClassName, QString *namespaceName)
|
||||
// Check for a class name where haystack is a member class of an object.
|
||||
// So, haystack can be shorter (can have some namespaces omitted because of a
|
||||
// "using namespace" declaration, for example, comparing
|
||||
// "foo::Ui::form", against "using namespace foo; Ui::form".
|
||||
|
||||
static bool matchMemberClassName(const QString &needle, const QString &hayStack)
|
||||
{
|
||||
// construct proper ui class name, take into account namespaced ui class name
|
||||
QString className1;
|
||||
QString className2;
|
||||
int indexOfScope = uiClassName.lastIndexOf(QLatin1String("::"));
|
||||
if (indexOfScope < 0) {
|
||||
className1 = QLatin1String("Ui::") + uiClassName;
|
||||
className2 = QLatin1String("Ui_") + uiClassName;
|
||||
} else {
|
||||
className1 = uiClassName.left(indexOfScope + 2) + QLatin1String("Ui::") + uiClassName.mid(indexOfScope + 2);
|
||||
className2 = uiClassName.left(indexOfScope + 2) + QLatin1String("Ui_") + uiClassName.mid(indexOfScope + 2);
|
||||
}
|
||||
if (needle == hayStack)
|
||||
return true;
|
||||
if (!needle.endsWith(hayStack))
|
||||
return false;
|
||||
// Check if there really is a separator "::"
|
||||
const int separatorPos = needle.size() - hayStack.size() - 1;
|
||||
return separatorPos > 1 && needle.at(separatorPos) == QLatin1Char(':');
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < parentNameSpace->memberCount(); i++) { // we go through all namespace members
|
||||
if (Class *cl = parentNameSpace->memberAt(i)->asClass()) { // we have found a class - we are interested in classes only
|
||||
Overview o;
|
||||
QString className = o.prettyName(cl->name());
|
||||
for (unsigned j = 0; j < cl->memberCount(); j++) { // we go through class members
|
||||
const Declaration *decl = cl->memberAt(j)->asDeclaration();
|
||||
if (decl) { // we want to know if the class contains a member (so we look into a declaration) of uiClassName type
|
||||
NamedType *nt = decl->type()->asNamedType();
|
||||
// Find class definition in namespace
|
||||
static const Class *findClass(const Namespace *parentNameSpace, const QString &className, QString *namespaceName)
|
||||
{
|
||||
if (debugSlotNavigation)
|
||||
qDebug() << Q_FUNC_INFO << className;
|
||||
|
||||
const Overview o;
|
||||
const unsigned namespaceMemberCount = parentNameSpace->memberCount();
|
||||
for (unsigned i = 0; i < namespaceMemberCount; i++) { // we go through all namespace members
|
||||
const Symbol *sym = parentNameSpace->memberAt(i);
|
||||
// we have found a class - we are interested in classes only
|
||||
if (const Class *cl = sym->asClass()) {
|
||||
const unsigned classMemberCount = cl->memberCount();
|
||||
for (unsigned j = 0; j < classMemberCount; j++) // we go through class members
|
||||
if (const Declaration *decl = cl->memberAt(j)->asDeclaration()) {
|
||||
// we want to know if the class contains a member (so we look into
|
||||
// a declaration) of uiClassName type
|
||||
const NamedType *nt = decl->type()->asNamedType();
|
||||
// handle pointers to member variables
|
||||
if (PointerType *pt = decl->type()->asPointerType())
|
||||
nt = pt->elementType()->asNamedType();
|
||||
|
||||
if (nt) {
|
||||
Overview typeOverview;
|
||||
const QString memberClass = typeOverview.prettyName(nt->name());
|
||||
if (memberClass == className1 || memberClass == className2) // names match
|
||||
if (nt && matchMemberClassName(className, o.prettyName(nt->name())))
|
||||
return cl;
|
||||
// memberClass can be shorter (can have some namespaces cut because of e.g. "using namespace" declaration)
|
||||
if (memberClass == className1.right(memberClass.length())) { // memberClass lenght <= className length
|
||||
const QString namespacePrefix = className1.left(className1.length() - memberClass.length());
|
||||
if (namespacePrefix.right(2) == QLatin1String("::"))
|
||||
return cl;
|
||||
}
|
||||
// the same as above but for className2
|
||||
if (memberClass == className2.right(memberClass.length())) { // memberClass lenght <= className length
|
||||
const QString namespacePrefix = className2.left(className1.length() - memberClass.length());
|
||||
if (namespacePrefix.right(2) == QLatin1String("::"))
|
||||
return cl;
|
||||
}
|
||||
}
|
||||
} // decl
|
||||
} else {
|
||||
// Check namespaces
|
||||
if (const Namespace *ns = sym->asNamespace()) {
|
||||
QString tempNS = *namespaceName;
|
||||
tempNS += o.prettyName(ns->name());
|
||||
tempNS += QLatin1String("::");
|
||||
if (const Class *cl = findClass(ns, className, &tempNS)) {
|
||||
*namespaceName = tempNS;
|
||||
return cl;
|
||||
}
|
||||
}
|
||||
} else if (Namespace *ns = parentNameSpace->memberAt(i)->asNamespace()) {
|
||||
Overview o;
|
||||
QString tempNS = *namespaceName + o.prettyName(ns->name()) + QLatin1String("::");
|
||||
Class *cl = findClass(ns, uiClassName, &tempNS);
|
||||
if (cl) {
|
||||
*namespaceName = tempNS;
|
||||
return cl;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // member is namespave
|
||||
} // member is no class
|
||||
} // for members
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Function *findDeclaration(Class *cl, const QString &functionName)
|
||||
static const Function *findDeclaration(const Class *cl, const QString &functionName)
|
||||
{
|
||||
const QString funName = QString::fromUtf8(QMetaObject::normalizedSignature(functionName.toUtf8()));
|
||||
for (unsigned j = 0; j < cl->memberCount(); j++) { // go through all members
|
||||
const Declaration *decl = cl->memberAt(j)->asDeclaration();
|
||||
if (decl) { // we are interested only in declarations (can be decl of method or of a field)
|
||||
Function *fun = decl->type()->asFunction();
|
||||
if (fun) { // we are only interested in declarations of methods
|
||||
Overview overview;
|
||||
QString memberFunction = overview.prettyName(fun->name()) + QLatin1Char('(');
|
||||
for (uint i = 0; i < fun->argumentCount(); i++) { // we build argument types string
|
||||
Argument *arg = fun->argumentAt(i)->asArgument();
|
||||
const unsigned mCount = cl->memberCount();
|
||||
// we are interested only in declarations (can be decl of method or of a field)
|
||||
// we are only interested in declarations of methods
|
||||
const Overview overview;
|
||||
for (unsigned j = 0; j < mCount; j++) { // go through all members
|
||||
if (const Declaration *decl = cl->memberAt(j)->asDeclaration())
|
||||
if (const Function *fun = decl->type()->asFunction()) {
|
||||
// Format signature
|
||||
QString memberFunction = overview.prettyName(fun->name());
|
||||
memberFunction += QLatin1Char('(');
|
||||
const uint aCount = fun->argumentCount();
|
||||
for (uint i = 0; i < aCount; i++) { // we build argument types string
|
||||
const Argument *arg = fun->argumentAt(i)->asArgument();
|
||||
if (i > 0)
|
||||
memberFunction += QLatin1Char(',');
|
||||
memberFunction += overview.prettyType(arg->type());
|
||||
@@ -209,19 +212,18 @@ static Function *findDeclaration(Class *cl, const QString &functionName)
|
||||
if (memberFunction == funName) // we match function names and argument lists
|
||||
return fun;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: remove me, see below
|
||||
static bool isCompatible(Name *name, Name *otherName)
|
||||
static bool isCompatible(const Name *name, const Name *otherName)
|
||||
{
|
||||
if (NameId *nameId = name->asNameId()) {
|
||||
if (TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
||||
if (const NameId *nameId = name->asNameId()) {
|
||||
if (const TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
||||
return nameId->identifier()->isEqualTo(otherTemplId->identifier());
|
||||
} else if (TemplateNameId *templId = name->asTemplateNameId()) {
|
||||
if (NameId *otherNameId = otherName->asNameId())
|
||||
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
|
||||
if (const NameId *otherNameId = otherName->asNameId())
|
||||
return templId->identifier()->isEqualTo(otherNameId->identifier());
|
||||
}
|
||||
|
||||
@@ -229,7 +231,7 @@ static bool isCompatible(Name *name, Name *otherName)
|
||||
}
|
||||
|
||||
// TODO: remove me, see below
|
||||
static bool isCompatible(Function *definition, Symbol *declaration, QualifiedNameId *declarationName)
|
||||
static bool isCompatible(const Function *definition, const Symbol *declaration, const QualifiedNameId *declarationName)
|
||||
{
|
||||
Function *declTy = declaration->type()->asFunction();
|
||||
if (! declTy)
|
||||
@@ -269,11 +271,9 @@ static bool isCompatible(Function *definition, Symbol *declaration, QualifiedNam
|
||||
}
|
||||
|
||||
// TODO: remove me, this is taken from cppeditor.cpp. Find some common place for this method
|
||||
static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
|
||||
static Document::Ptr findDefinition(const Function *functionDeclaration, int *line)
|
||||
{
|
||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
CppTools::CppModelManagerInterface *cppModelManager =
|
||||
core->pluginManager()->getObject<CppTools::CppModelManagerInterface>();
|
||||
CppTools::CppModelManagerInterface *cppModelManager = cppModelManagerInstance();
|
||||
if (!cppModelManager)
|
||||
return Document::Ptr();
|
||||
|
||||
@@ -286,7 +286,8 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
|
||||
if (QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
qualifiedName.prepend(q->nameAt(i));
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
qualifiedName.prepend(scopeOwnerName);
|
||||
}
|
||||
@@ -299,7 +300,6 @@ static Document::Ptr findDefinition(Function *functionDeclaration, int *line)
|
||||
Control control;
|
||||
QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
||||
LookupContext context(&control);
|
||||
|
||||
const Snapshot documents = cppModelManager->snapshot();
|
||||
foreach (Document::Ptr doc, documents) {
|
||||
QList<Scope *> visibleScopes;
|
||||
@@ -368,71 +368,80 @@ static int findClassEndPosition(const QString &headerContents, int classStartPos
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void addDeclaration(const QString &docFileName, Class *cl, const QString &functionName)
|
||||
static inline ITextEditable *editableAt(const QString &fileName, int line, int column)
|
||||
{
|
||||
// functionName comes already with argument names (if designer managed to do that)
|
||||
for (unsigned j = 0; j < cl->memberCount(); j++) { // go through all members
|
||||
const Declaration *decl = cl->memberAt(j)->asDeclaration();
|
||||
if (decl) { // we want to find any method which is a private slot (then we don't need to add "private slots:" statement)
|
||||
Function *fun = decl->type()->asFunction();
|
||||
if (fun) { // we are only interested in declarations of methods
|
||||
return qobject_cast<ITextEditable *>(TextEditor::BaseTextEditor::openEditorAt(fileName, line, column));
|
||||
}
|
||||
|
||||
static void addDeclaration(const QString &docFileName, const Class *cl, const QString &functionName)
|
||||
{
|
||||
QString declaration = QLatin1String("void ");
|
||||
declaration += functionName;
|
||||
declaration += QLatin1String(";\n");
|
||||
|
||||
// functionName comes already with argument names (if designer managed to
|
||||
// do that). First, let's try to find any method which is a private slot
|
||||
// (then we don't need to add "private slots:" statement)
|
||||
const unsigned mCount = cl->memberCount();
|
||||
for (unsigned j = 0; j < mCount; j++) { // go through all members
|
||||
if (const Declaration *decl = cl->memberAt(j)->asDeclaration())
|
||||
if (const Function *fun = decl->type()->asFunction()) {
|
||||
// we are only interested in declarations of methods.
|
||||
// fun->column() returns always 0, what can cause trouble in case in one
|
||||
// line if there is: "private slots: void foo();"
|
||||
if (fun->isSlot() && fun->isPrivate()) {
|
||||
ITextEditable *editable = qobject_cast<ITextEditable *>(
|
||||
TextEditor::BaseTextEditor::openEditorAt(docFileName, fun->line(), fun->column()));
|
||||
// fun->column() raturns always 0, what can cause trouble in case in one
|
||||
// line there is: "private slots: void foo();"
|
||||
if (editable) {
|
||||
editable->insert(QLatin1String("void ") + functionName + QLatin1String(";\n "));
|
||||
}
|
||||
if (ITextEditable *editable = editableAt(docFileName, fun->line(), fun->column()))
|
||||
editable->insert(declaration + QLatin1String(" "));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We didn't find any method under "private slots:", let's add "private slots:". Below code
|
||||
// adds "private slots:" by the end of the class definition.
|
||||
|
||||
ITextEditable *editable = qobject_cast<ITextEditable *>(
|
||||
TextEditor::BaseTextEditor::openEditorAt(docFileName, cl->line(), cl->column()));
|
||||
if (editable) {
|
||||
if (ITextEditable *editable = editableAt(docFileName, cl->line(), cl->column())) {
|
||||
int classEndPosition = findClassEndPosition(editable->contents(), editable->position());
|
||||
if (classEndPosition >= 0) {
|
||||
int line, column;
|
||||
editable->convertPosition(classEndPosition, &line, &column); // converts back position into a line and column
|
||||
editable->gotoLine(line, column); // go to position (we should be just before closing } of the class)
|
||||
editable->insert(QLatin1String("\nprivate slots:\n ")
|
||||
+ QLatin1String("void ") + functionName + QLatin1String(";\n"));
|
||||
editable->insert(QLatin1String("\nprivate slots:\n ") + declaration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Document::Ptr addDefinition(const QString &headerFileName, const QString &className,
|
||||
const QString &functionName, int *line)
|
||||
static Document::Ptr addDefinition(const CPlusPlus::Snapshot &docTable,
|
||||
const QString &headerFileName, const QString &className,
|
||||
const QString &functionName, int *line)
|
||||
{
|
||||
QString definition = QLatin1String("\nvoid ");
|
||||
definition += className;
|
||||
definition += QLatin1String("::");
|
||||
definition += functionName;
|
||||
definition += QLatin1String("\n{\n");
|
||||
definition += QString(indentation, QLatin1Char(' '));
|
||||
definition += QLatin1String("\n}\n");
|
||||
|
||||
// we find all documents which include headerFileName
|
||||
QList<Document::Ptr> docList = findDocumentsIncluding(headerFileName, false);
|
||||
const QList<Document::Ptr> docList = findDocumentsIncluding(docTable, headerFileName, false);
|
||||
if (docList.isEmpty())
|
||||
return Document::Ptr();
|
||||
|
||||
QFileInfo headerFI(headerFileName);
|
||||
const QString headerBaseName = headerFI.baseName();
|
||||
const QString headerAbsolutePath = headerFI.absolutePath();
|
||||
foreach (Document::Ptr doc, docList) {
|
||||
QFileInfo sourceFI(doc->fileName());
|
||||
foreach (const Document::Ptr &doc, docList) {
|
||||
const QFileInfo sourceFI(doc->fileName());
|
||||
// we take only those documents which has the same filename and path (maybe we don't need to compare the path???)
|
||||
if (headerBaseName == sourceFI.baseName() && headerAbsolutePath == sourceFI.absolutePath()) {
|
||||
ITextEditable *editable = qobject_cast<ITextEditable *>(
|
||||
TextEditor::BaseTextEditor::openEditorAt(doc->fileName(), 0));
|
||||
if (editable) {
|
||||
if (ITextEditable *editable = editableAt(doc->fileName(), 0, 0)) {
|
||||
const QString contents = editable->contents();
|
||||
int column;
|
||||
editable->convertPosition(contents.length(), line, &column);
|
||||
editable->gotoLine(*line, column);
|
||||
editable->insert(QLatin1String("\nvoid ") + className + QLatin1String("::") +
|
||||
functionName + QLatin1String("\n {\n\n }\n"));
|
||||
editable->insert(definition);
|
||||
*line += 1;
|
||||
|
||||
}
|
||||
return doc;
|
||||
}
|
||||
@@ -440,33 +449,84 @@ static Document::Ptr addDefinition(const QString &headerFileName, const QString
|
||||
return Document::Ptr();
|
||||
}
|
||||
|
||||
// Insert the parameter names into a signature, "void foo(bool)" ->
|
||||
// "void foo(bool checked)"
|
||||
static QString addParameterNames(const QString &functionSignature, const QStringList ¶meterNames)
|
||||
{
|
||||
QString functionName = functionSignature.left(functionSignature.indexOf(QLatin1Char('(')) + 1);
|
||||
QString argumentsString = functionSignature.mid(functionSignature.indexOf(QLatin1Char('(')) + 1);
|
||||
argumentsString = argumentsString.left(argumentsString.indexOf(QLatin1Char(')')));
|
||||
const int firstParen = functionSignature.indexOf(QLatin1Char('('));
|
||||
QString functionName = functionSignature.left(firstParen + 1);
|
||||
QString argumentsString = functionSignature.mid(firstParen + 1);
|
||||
const int lastParen = argumentsString.lastIndexOf(QLatin1Char(')'));
|
||||
if (lastParen != -1)
|
||||
argumentsString.truncate(lastParen);
|
||||
const QStringList arguments = argumentsString.split(QLatin1Char(','), QString::SkipEmptyParts);
|
||||
for (int i = 0; i < arguments.count(); ++i) {
|
||||
const int pCount = parameterNames.count();
|
||||
const int aCount = arguments.count();
|
||||
for (int i = 0; i < aCount; ++i) {
|
||||
if (i > 0)
|
||||
functionName += QLatin1String(", ");
|
||||
functionName += arguments.at(i);
|
||||
if (i < parameterNames.count())
|
||||
functionName += QLatin1Char(' ') + parameterNames.at(i);
|
||||
if (i < pCount) {
|
||||
functionName += QLatin1Char(' ');
|
||||
functionName += parameterNames.at(i);
|
||||
}
|
||||
}
|
||||
functionName += QLatin1Char(')');
|
||||
return functionName;
|
||||
}
|
||||
|
||||
// Recursively find a class definition in the document passed on or in its
|
||||
// included files (going down [maxIncludeDepth] includes) and return a pair
|
||||
// of <Class*, Document>.
|
||||
|
||||
typedef QPair<const Class *, Document::Ptr> ClassDocumentPtrPair;
|
||||
|
||||
static ClassDocumentPtrPair
|
||||
findClassRecursively(const CPlusPlus::Snapshot &docTable,
|
||||
const Document::Ptr &doc, const QString &className,
|
||||
unsigned maxIncludeDepth, QString *namespaceName)
|
||||
{
|
||||
if (debugSlotNavigation)
|
||||
qDebug() << Q_FUNC_INFO << doc->fileName() << maxIncludeDepth;
|
||||
// Check document
|
||||
if (const Class *cl = findClass(doc->globalNamespace(), className, namespaceName))
|
||||
return ClassDocumentPtrPair(cl, doc);
|
||||
if (maxIncludeDepth) {
|
||||
// Check the includes
|
||||
const unsigned recursionMaxIncludeDepth = maxIncludeDepth - 1u;
|
||||
foreach (const QString &include, doc->includedFiles()) {
|
||||
const CPlusPlus::Snapshot::const_iterator it = docTable.constFind(include);
|
||||
if (it != docTable.constEnd()) {
|
||||
const Document::Ptr includeDoc = it.value();
|
||||
const ClassDocumentPtrPair irc = findClassRecursively(docTable, it.value(), className, recursionMaxIncludeDepth, namespaceName);
|
||||
if (irc.first)
|
||||
return irc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ClassDocumentPtrPair(0, Document::Ptr());
|
||||
}
|
||||
|
||||
void WorkbenchIntegration::slotNavigateToSlot(const QString &objectName, const QString &signalSignature,
|
||||
const QStringList ¶meterNames)
|
||||
{
|
||||
QString errorMessage;
|
||||
if (!navigateToSlot(objectName, signalSignature, parameterNames, &errorMessage) && !errorMessage.isEmpty()) {
|
||||
QMessageBox::critical(m_few->designerEditor()->topLevel(), tr("Error finding source file"), errorMessage);
|
||||
QMessageBox::warning(m_few->designerEditor()->topLevel(), tr("Error finding/adding a slot."), errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
// Build name of the class as generated by uic, insert Ui namespace
|
||||
// "foo::bar::form" -> "foo::bar::Ui::form"
|
||||
|
||||
static inline QString uiClassName(QString formObjectName)
|
||||
{
|
||||
const int indexOfScope = formObjectName.lastIndexOf(QLatin1String("::"));
|
||||
const int uiNameSpaceInsertionPos = indexOfScope >= 0 ? indexOfScope : 0;
|
||||
formObjectName.insert(uiNameSpaceInsertionPos, QLatin1String("Ui::"));
|
||||
return formObjectName;
|
||||
}
|
||||
|
||||
bool WorkbenchIntegration::navigateToSlot(const QString &objectName,
|
||||
const QString &signalSignature,
|
||||
const QStringList ¶meterNames,
|
||||
@@ -482,7 +542,10 @@ bool WorkbenchIntegration::navigateToSlot(const QString &objectName,
|
||||
const QFileInfo fi(currentUiFile);
|
||||
const QString uicedName = QLatin1String("ui_") + fi.baseName() + QLatin1String(".h");
|
||||
|
||||
QList<Document::Ptr> docList = findDocumentsIncluding(uicedName, true); // change to false when we know the absolute path to generated ui_<>.h file
|
||||
// take all docs
|
||||
|
||||
const CPlusPlus::Snapshot docTable = cppModelManagerInstance()->snapshot();
|
||||
QList<Document::Ptr> docList = findDocumentsIncluding(docTable, uicedName, true); // change to false when we know the absolute path to generated ui_<>.h file
|
||||
|
||||
if (debugSlotNavigation)
|
||||
qDebug() << objectName << signalSignature << "Looking for " << uicedName << " returned " << docList.size();
|
||||
@@ -493,44 +556,63 @@ bool WorkbenchIntegration::navigateToSlot(const QString &objectName,
|
||||
|
||||
QDesignerFormWindowInterface *fwi = m_few->activeFormWindow()->formWindow();
|
||||
|
||||
const QString uiClassName = fwi->mainContainer()->objectName();
|
||||
const QString uiClass = uiClassName(fwi->mainContainer()->objectName());
|
||||
|
||||
if (debugSlotNavigation)
|
||||
qDebug() << "Checking docs for " << uiClassName;
|
||||
qDebug() << "Checking docs for " << uiClass;
|
||||
|
||||
foreach (const Document::Ptr &doc, docList) {
|
||||
QString namespaceName; // namespace of the class found
|
||||
Class *cl = findClass(doc->globalNamespace(), uiClassName, &namespaceName);
|
||||
if (cl) {
|
||||
Overview o;
|
||||
const QString className = namespaceName + o.prettyName(cl->name());
|
||||
// Find the class definition in the file itself or in the directly
|
||||
// included files (order 1).
|
||||
QString namespaceName;
|
||||
const Class *cl;
|
||||
Document::Ptr doc;
|
||||
|
||||
QString functionName = QLatin1String("on_") + objectName + QLatin1Char('_') + signalSignature;
|
||||
QString functionNameWithParameterNames = addParameterNames(functionName, parameterNames);
|
||||
Function *fun = findDeclaration(cl, functionName);
|
||||
int line = 0;
|
||||
Document::Ptr sourceDoc;
|
||||
if (!fun) {
|
||||
// add function declaration to cl
|
||||
addDeclaration(doc->fileName(), cl, functionNameWithParameterNames);
|
||||
|
||||
// add function definition to cpp file
|
||||
sourceDoc = addDefinition(doc->fileName(), className, functionNameWithParameterNames, &line);
|
||||
} else {
|
||||
sourceDoc = findDefinition(fun, &line);
|
||||
if (!sourceDoc) {
|
||||
// add function definition to cpp file
|
||||
sourceDoc = addDefinition(doc->fileName(), className, functionNameWithParameterNames, &line);
|
||||
}
|
||||
}
|
||||
if (sourceDoc) {
|
||||
// jump to function definition
|
||||
TextEditor::BaseTextEditor::openEditorAt(sourceDoc->fileName(), line);
|
||||
}
|
||||
return true;
|
||||
foreach (const Document::Ptr &d, docList) {
|
||||
const ClassDocumentPtrPair cd = findClassRecursively(docTable, d, uiClass, 1u , &namespaceName);
|
||||
if (cd.first) {
|
||||
cl = cd.first;
|
||||
doc = cd.second;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*errorMessage = msgClassNotFound(uiClassName, docList);
|
||||
return false;
|
||||
}
|
||||
if (!cl) {
|
||||
*errorMessage = msgClassNotFound(uiClass, docList);
|
||||
return false;
|
||||
}
|
||||
|
||||
Overview o;
|
||||
const QString className = namespaceName + o.prettyName(cl->name());
|
||||
|
||||
const QString functionName = QLatin1String("on_") + objectName + QLatin1Char('_') + signalSignature;
|
||||
const QString functionNameWithParameterNames = addParameterNames(functionName, parameterNames);
|
||||
|
||||
if (debugSlotNavigation)
|
||||
qDebug() << "Found " << uiClass << doc->fileName() << " checking " << functionName << functionNameWithParameterNames;
|
||||
|
||||
int line = 0;
|
||||
Document::Ptr sourceDoc;
|
||||
|
||||
if (const Function *fun = findDeclaration(cl, functionName)) {
|
||||
sourceDoc = findDefinition(fun, &line);
|
||||
if (!sourceDoc) {
|
||||
// add function definition to cpp file
|
||||
sourceDoc = addDefinition(docTable, doc->fileName(), className, functionNameWithParameterNames, &line);
|
||||
}
|
||||
} else {
|
||||
// add function declaration to cl
|
||||
addDeclaration(doc->fileName(), cl, functionNameWithParameterNames);
|
||||
|
||||
// add function definition to cpp file
|
||||
sourceDoc = addDefinition(docTable, doc->fileName(), className, functionNameWithParameterNames, &line);
|
||||
}
|
||||
|
||||
if (!sourceDoc) {
|
||||
*errorMessage = tr("Unable to add the method definition.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// jump to function definition, position within code
|
||||
TextEditor::BaseTextEditor::openEditorAt(sourceDoc->fileName(), line + 2, indentation);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
12
src/plugins/fakevim/FakeVim.pluginspec
Normal file
12
src/plugins/fakevim/FakeVim.pluginspec
Normal file
@@ -0,0 +1,12 @@
|
||||
<plugin name="FakeVim" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>VI-style keyboard navigation.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="CppEditor" version="0.9.2"/><!-- Plugin adds items to the editor's context menu -->
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
19
src/plugins/fakevim/fakevim.pro
Normal file
19
src/plugins/fakevim/fakevim.pro
Normal file
@@ -0,0 +1,19 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = FakeVim
|
||||
|
||||
# CONFIG += single
|
||||
include(../../qworkbenchplugin.pri)
|
||||
include(../../plugins/projectexplorer/projectexplorer.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../plugins/texteditor/texteditor.pri)
|
||||
|
||||
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
|
||||
QT += gui
|
||||
|
||||
SOURCES += \
|
||||
handler.cpp \
|
||||
fakevimplugin.cpp
|
||||
|
||||
HEADERS += \
|
||||
handler.h \
|
||||
fakevimplugin.h
|
||||
177
src/plugins/fakevim/fakevimplugin.cpp
Normal file
177
src/plugins/fakevim/fakevimplugin.cpp
Normal file
@@ -0,0 +1,177 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "fakevimplugin.h"
|
||||
|
||||
#include "handler.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/basetextmark.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPoint>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QTextBlock>
|
||||
#include <QtGui/QTextCursor>
|
||||
|
||||
|
||||
using namespace FakeVim::Internal;
|
||||
//using namespace FakeVim::Constants;
|
||||
using namespace TextEditor;
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
|
||||
namespace FakeVim {
|
||||
namespace Constants {
|
||||
|
||||
const char * const INSTALL_HANDLER = "FakeVim.InstallHandler";
|
||||
const char * const MINI_BUFFER = "FakeVim.MiniBuffer";
|
||||
const char * const INSTALL_KEY = "Alt+V,Alt+V";
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace FakeVim
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// FakeVimPlugin
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
FakeVimPlugin::FakeVimPlugin()
|
||||
{
|
||||
m_core = 0;
|
||||
m_handler = 0;
|
||||
}
|
||||
|
||||
FakeVimPlugin::~FakeVimPlugin()
|
||||
{}
|
||||
|
||||
void FakeVimPlugin::shutdown()
|
||||
{
|
||||
delete m_handler;
|
||||
m_handler = 0;
|
||||
}
|
||||
|
||||
bool FakeVimPlugin::initialize(const QStringList &arguments, QString *error_message)
|
||||
{
|
||||
Q_UNUSED(arguments);
|
||||
Q_UNUSED(error_message);
|
||||
|
||||
m_handler = new FakeVimHandler;
|
||||
|
||||
m_core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
QTC_ASSERT(m_core, return false);
|
||||
|
||||
Core::ActionManagerInterface *actionManager = m_core->actionManager();
|
||||
QTC_ASSERT(actionManager, return false);
|
||||
|
||||
QList<int> globalcontext;
|
||||
globalcontext << Core::Constants::C_GLOBAL_ID;
|
||||
|
||||
m_installHandlerAction = new QAction(this);
|
||||
m_installHandlerAction->setText(tr("Set vi-Style Keyboard Action Handler"));
|
||||
|
||||
Core::ICommand *cmd = 0;
|
||||
cmd = actionManager->registerAction(m_installHandlerAction,
|
||||
Constants::INSTALL_HANDLER, globalcontext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(Constants::INSTALL_KEY));
|
||||
|
||||
IActionContainer *advancedMenu =
|
||||
actionManager->actionContainer(Core::Constants::M_EDIT_ADVANCED);
|
||||
advancedMenu->addAction(cmd);
|
||||
|
||||
connect(m_installHandlerAction, SIGNAL(triggered()),
|
||||
this, SLOT(installHandler()));
|
||||
return true;
|
||||
}
|
||||
|
||||
void FakeVimPlugin::extensionsInitialized()
|
||||
{
|
||||
}
|
||||
|
||||
void FakeVimPlugin::installHandler()
|
||||
{
|
||||
if (!m_core || !m_core->editorManager())
|
||||
return;
|
||||
Core::IEditor *editor = m_core->editorManager()->currentEditor();
|
||||
ITextEditor *textEditor = qobject_cast<ITextEditor*>(editor);
|
||||
if (!textEditor)
|
||||
return;
|
||||
|
||||
connect(m_handler, SIGNAL(commandBufferChanged(QString)),
|
||||
this, SLOT(showCommandBuffer(QString)));
|
||||
connect(m_handler, SIGNAL(quitRequested(QWidget *)),
|
||||
this, SLOT(removeHandler(QWidget *)));
|
||||
|
||||
m_handler->addWidget(textEditor->widget());
|
||||
}
|
||||
|
||||
void FakeVimPlugin::removeHandler(QWidget *widget)
|
||||
{
|
||||
m_handler->removeWidget(widget);
|
||||
Core::EditorManager::instance()->hideEditorInfoBar(
|
||||
QLatin1String(Constants::MINI_BUFFER));
|
||||
}
|
||||
|
||||
void FakeVimPlugin::showCommandBuffer(const QString &contents)
|
||||
{
|
||||
Core::EditorManager::instance()->showEditorInfoBar(
|
||||
QLatin1String(Constants::MINI_BUFFER), contents,
|
||||
tr("Quit FakeVim"), m_handler, SLOT(quit()));
|
||||
}
|
||||
|
||||
|
||||
//#include "fakevimplugin.moc"
|
||||
|
||||
Q_EXPORT_PLUGIN(FakeVimPlugin)
|
||||
95
src/plugins/fakevim/fakevimplugin.h
Normal file
95
src/plugins/fakevim/fakevimplugin.h
Normal file
@@ -0,0 +1,95 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FAKEVIMPLUGIN_H
|
||||
#define FAKEVIMPLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QCursor;
|
||||
class QAbstractItemView;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
namespace Core {
|
||||
|
||||
class ICore;
|
||||
class IEditor;
|
||||
|
||||
} // namespace Core
|
||||
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
class ITextEditor;
|
||||
|
||||
} // namespace TextEditor
|
||||
|
||||
|
||||
namespace FakeVim {
|
||||
namespace Internal {
|
||||
|
||||
class FakeVimHandler;
|
||||
|
||||
class FakeVimPlugin : public ExtensionSystem::IPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FakeVimPlugin();
|
||||
~FakeVimPlugin();
|
||||
|
||||
private:
|
||||
bool initialize(const QStringList &arguments, QString *error_message);
|
||||
void shutdown();
|
||||
void extensionsInitialized();
|
||||
|
||||
private slots:
|
||||
void installHandler();
|
||||
void removeHandler(QWidget *widget);
|
||||
void showCommandBuffer(const QString &contents);
|
||||
|
||||
private:
|
||||
FakeVimHandler *m_handler;
|
||||
QAction *m_installHandlerAction;
|
||||
Core::ICore *m_core;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace FakeVim
|
||||
|
||||
#endif // FAKEVIMPLUGIN_H
|
||||
1409
src/plugins/fakevim/handler.cpp
Normal file
1409
src/plugins/fakevim/handler.cpp
Normal file
File diff suppressed because it is too large
Load Diff
82
src/plugins/fakevim/handler.h
Normal file
82
src/plugins/fakevim/handler.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef FAKEVIM_HANDLER_H
|
||||
#define FAKEVIM_HANDLER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QString;
|
||||
class QEvent;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace FakeVim {
|
||||
namespace Internal {
|
||||
|
||||
class FakeVimHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FakeVimHandler(QObject *parent = 0);
|
||||
~FakeVimHandler();
|
||||
|
||||
public slots:
|
||||
// The same handler can be installed on several widgets
|
||||
// FIXME: good idea?
|
||||
void addWidget(QWidget *widget);
|
||||
void removeWidget(QWidget *widget);
|
||||
|
||||
// This executes an "ex" style command taking context
|
||||
// information from \p widget;
|
||||
void handleCommand(QWidget *widget, const QString &cmd);
|
||||
void quit();
|
||||
|
||||
signals:
|
||||
void commandBufferChanged(const QString &msg);
|
||||
void statusDataChanged(const QString &msg);
|
||||
void quitRequested(QWidget *);
|
||||
|
||||
private:
|
||||
bool eventFilter(QObject *ob, QEvent *ev);
|
||||
|
||||
class Private;
|
||||
friend class Private;
|
||||
Private *d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace FakeVim
|
||||
|
||||
#endif // FAKEVIM_H
|
||||
@@ -1,10 +1,10 @@
|
||||
<plugin name="Find" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Find" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Provides the find widget and the hooks for find implementations.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -147,9 +147,11 @@ void CurrentDocumentFind::updateCurrentFindFilter(QWidget *old, QWidget *now)
|
||||
if (!impl)
|
||||
candidate = candidate->parentWidget();
|
||||
}
|
||||
if (!impl)
|
||||
if (!impl || impl == m_currentFind)
|
||||
return;
|
||||
removeFindSupportConnections();
|
||||
if (m_currentFind)
|
||||
m_currentFind->highlightAll(QString(), 0);
|
||||
m_currentWidget = candidate;
|
||||
m_currentFind = impl;
|
||||
if (m_currentFind) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<plugin name="ScmGit" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="ScmGit" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Git integration.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="VCSBase" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="VCSBase" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
188
src/plugins/git/branchdialog.cpp
Normal file
188
src/plugins/git/branchdialog.cpp
Normal file
@@ -0,0 +1,188 @@
|
||||
#include "branchdialog.h"
|
||||
#include "branchmodel.h"
|
||||
#include "gitclient.h"
|
||||
#include "ui_branchdialog.h"
|
||||
|
||||
#include <QtGui/QItemSelectionModel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
// Single selection helper
|
||||
static inline int selectedRow(const QAbstractItemView *listView)
|
||||
{
|
||||
const QModelIndexList indexList = listView->selectionModel()->selectedIndexes();
|
||||
if (indexList.size() == 1)
|
||||
return indexList.front().row();
|
||||
return -1;
|
||||
}
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
BranchDialog::BranchDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_client(0),
|
||||
m_ui(new Ui::BranchDialog),
|
||||
m_checkoutButton(0),
|
||||
m_deleteButton(0),
|
||||
m_localModel(0),
|
||||
m_remoteModel(0)
|
||||
{
|
||||
setModal(true);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
m_ui->setupUi(this);
|
||||
m_checkoutButton = m_ui->buttonBox->addButton(tr("Checkout"), QDialogButtonBox::AcceptRole);
|
||||
connect(m_checkoutButton, SIGNAL(clicked()), this, SLOT(slotCheckoutSelectedBranch()));
|
||||
|
||||
m_deleteButton = m_ui->buttonBox->addButton(tr("Delete"), QDialogButtonBox::ActionRole);
|
||||
connect(m_deleteButton, SIGNAL(clicked()), this, SLOT(slotDeleteSelectedBranch()));
|
||||
|
||||
connect(m_ui->localBranchListView, SIGNAL(doubleClicked(QModelIndex)), this,
|
||||
SLOT(slotLocalBranchActivated()));
|
||||
}
|
||||
|
||||
BranchDialog::~BranchDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
bool BranchDialog::init(GitClient *client, const QString &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
// Find repository and populate models.
|
||||
m_client = client;
|
||||
m_repoDirectory = GitClient::findRepositoryForDirectory(workingDirectory);
|
||||
if (m_repoDirectory.isEmpty()) {
|
||||
*errorMessage = tr("Unable to find the repository directory for '%1'.").arg(workingDirectory);
|
||||
return false;
|
||||
}
|
||||
m_ui->repositoryFieldLabel->setText(m_repoDirectory);
|
||||
|
||||
m_localModel = new LocalBranchModel(client, this);
|
||||
connect(m_localModel, SIGNAL(newBranchCreated(QString)), this, SLOT(slotNewLocalBranchCreated(QString)));
|
||||
m_remoteModel = new RemoteBranchModel(client, this);
|
||||
if (!m_localModel->refresh(workingDirectory, errorMessage)
|
||||
|| !m_remoteModel->refresh(workingDirectory, errorMessage))
|
||||
return false;
|
||||
|
||||
m_ui->localBranchListView->setModel(m_localModel);
|
||||
m_ui->remoteBranchListView->setModel(m_remoteModel);
|
||||
// Selection model comes into existence only now
|
||||
connect(m_ui->localBranchListView->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(slotEnableButtons()));
|
||||
connect(m_ui->remoteBranchListView->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(slotEnableButtons()));
|
||||
slotEnableButtons();
|
||||
return true;
|
||||
}
|
||||
|
||||
int BranchDialog::selectedLocalBranchIndex() const
|
||||
{
|
||||
return selectedRow(m_ui->localBranchListView);
|
||||
}
|
||||
|
||||
int BranchDialog::selectedRemoteBranchIndex() const
|
||||
{
|
||||
return selectedRow(m_ui->remoteBranchListView);
|
||||
}
|
||||
|
||||
void BranchDialog::slotEnableButtons()
|
||||
{
|
||||
// We can switch to or delete branches that are not current.
|
||||
const int selectedLocalRow = selectedLocalBranchIndex();
|
||||
const int currentLocalBranch = m_localModel->currentBranch();
|
||||
|
||||
const bool hasSelection = selectedLocalRow != -1 && !m_localModel->isNewBranchRow(selectedLocalRow);
|
||||
const bool currentIsNotSelected = hasSelection && selectedLocalRow != currentLocalBranch;
|
||||
|
||||
m_checkoutButton->setEnabled(currentIsNotSelected);
|
||||
m_deleteButton->setEnabled(currentIsNotSelected);
|
||||
}
|
||||
|
||||
void BranchDialog::slotNewLocalBranchCreated(const QString &b)
|
||||
{
|
||||
// Select the newly created branch
|
||||
const int row = m_localModel->findBranchByName(b);
|
||||
if (row != -1) {
|
||||
const QModelIndex index = m_localModel->index(row);
|
||||
m_ui->localBranchListView->selectionModel()->select(index, QItemSelectionModel::Select);
|
||||
}
|
||||
}
|
||||
|
||||
bool BranchDialog::ask(const QString &title, const QString &what, bool defaultButton)
|
||||
{
|
||||
return QMessageBox::question(this, title, what, QMessageBox::Yes|QMessageBox::No,
|
||||
defaultButton ? QMessageBox::Yes : QMessageBox::No) == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
/* Prompt to delete a local branch and do so. */
|
||||
void BranchDialog::slotDeleteSelectedBranch()
|
||||
{
|
||||
const int idx = selectedLocalBranchIndex();
|
||||
if (idx == -1)
|
||||
return;
|
||||
const QString name = m_localModel->branchName(idx);
|
||||
if (!ask(tr("Delete Branch"), tr("Would you like to delete the branch '%1'?").arg(name), true))
|
||||
return;
|
||||
QString errorMessage;
|
||||
bool ok = false;
|
||||
do {
|
||||
QString output;
|
||||
QStringList args(QLatin1String("-D"));
|
||||
args << name;
|
||||
if (!m_client->synchronousBranchCmd(m_repoDirectory, args, &output, &errorMessage))
|
||||
break;
|
||||
if (!m_localModel->refresh(m_repoDirectory, &errorMessage))
|
||||
break;
|
||||
ok = true;
|
||||
} while (false);
|
||||
slotEnableButtons();
|
||||
if (!ok)
|
||||
QMessageBox::warning(this, tr("Failed to delete branch"), errorMessage);
|
||||
}
|
||||
|
||||
void BranchDialog::slotLocalBranchActivated()
|
||||
{
|
||||
if (m_checkoutButton->isEnabled())
|
||||
m_checkoutButton->animateClick();
|
||||
}
|
||||
|
||||
/* Ask to stash away changes and then close dialog and do an asynchronous
|
||||
* checkout. */
|
||||
void BranchDialog::slotCheckoutSelectedBranch()
|
||||
{
|
||||
const int idx = selectedLocalBranchIndex();
|
||||
if (idx == -1)
|
||||
return;
|
||||
const QString name = m_localModel->branchName(idx);
|
||||
QString errorMessage;
|
||||
switch (m_client->ensureStash(m_repoDirectory, &errorMessage)) {
|
||||
case GitClient::StashUnchanged:
|
||||
case GitClient::Stashed:
|
||||
case GitClient::NotStashed:
|
||||
break;
|
||||
case GitClient::StashCanceled:
|
||||
return;
|
||||
case GitClient::StashFailed:
|
||||
QMessageBox::warning(this, tr("Failed to stash"), errorMessage);
|
||||
return;
|
||||
}
|
||||
accept();
|
||||
m_client->checkoutBranch(m_repoDirectory, name);
|
||||
}
|
||||
|
||||
void BranchDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
m_ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
62
src/plugins/git/branchdialog.h
Normal file
62
src/plugins/git/branchdialog.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef BRANCHDIALOG_H
|
||||
#define BRANCHDIALOG_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
namespace Ui {
|
||||
class BranchDialog;
|
||||
}
|
||||
|
||||
class GitClient;
|
||||
class LocalBranchModel;
|
||||
class RemoteBranchModel;
|
||||
|
||||
/* Branch dialog: Display a list of local branches at the top
|
||||
* and remote branches below. Offers to checkout/delete local
|
||||
* branches.
|
||||
* TODO: Add new branch (optionally tracking a remote one).
|
||||
* How to find out that a local branch is a tracking one? */
|
||||
class BranchDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(BranchDialog)
|
||||
public:
|
||||
explicit BranchDialog(QWidget *parent = 0);
|
||||
|
||||
bool init(GitClient *client, const QString &workingDirectory, QString *errorMessage);
|
||||
|
||||
virtual ~BranchDialog();
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent *e);
|
||||
|
||||
private slots:
|
||||
void slotEnableButtons();
|
||||
void slotCheckoutSelectedBranch();
|
||||
void slotDeleteSelectedBranch();
|
||||
void slotLocalBranchActivated();
|
||||
void slotNewLocalBranchCreated(const QString &);
|
||||
|
||||
private:
|
||||
bool ask(const QString &title, const QString &what, bool defaultButton);
|
||||
|
||||
int selectedLocalBranchIndex() const;
|
||||
int selectedRemoteBranchIndex() const;
|
||||
|
||||
GitClient *m_client;
|
||||
Ui::BranchDialog *m_ui;
|
||||
QPushButton *m_checkoutButton;
|
||||
QPushButton *m_deleteButton;
|
||||
|
||||
LocalBranchModel *m_localModel;
|
||||
RemoteBranchModel *m_remoteModel;
|
||||
QString m_repoDirectory;
|
||||
};
|
||||
} // namespace Internal
|
||||
} // namespace Git
|
||||
#endif // BRANCHDIALOG_H
|
||||
95
src/plugins/git/branchdialog.ui
Normal file
95
src/plugins/git/branchdialog.ui
Normal file
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Git::Internal::BranchDialog</class>
|
||||
<widget class="QDialog" name="Git::Internal::BranchDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>544</width>
|
||||
<height>631</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Branches</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="infoGroupBox">
|
||||
<property name="title">
|
||||
<string>General information</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="repositoryLabel">
|
||||
<property name="text">
|
||||
<string>Repository:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="repositoryFieldLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="localBranchGroupBox">
|
||||
<property name="title">
|
||||
<string>Branches</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListView" name="localBranchListView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="remoteBranchGroupBox">
|
||||
<property name="title">
|
||||
<string>Remote branches</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QListView" name="remoteBranchListView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Git::Internal::BranchDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>466</x>
|
||||
<y>614</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>544</x>
|
||||
<y>23</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
252
src/plugins/git/branchmodel.cpp
Normal file
252
src/plugins/git/branchmodel.cpp
Normal file
@@ -0,0 +1,252 @@
|
||||
#include "branchmodel.h"
|
||||
#include "gitclient.h"
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
enum { debug = 0 };
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
// Parse a branch line: " *name sha description". Return true if it is
|
||||
// the current one
|
||||
bool RemoteBranchModel::Branch::parse(const QString &lineIn, bool *isCurrent)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << lineIn;
|
||||
|
||||
*isCurrent = lineIn.startsWith(QLatin1String("* "));
|
||||
if (lineIn.size() < 3)
|
||||
return false;
|
||||
|
||||
const QStringList tokens =lineIn.mid(2).split(QLatin1Char(' '), QString::SkipEmptyParts);
|
||||
if (tokens.size() < 2)
|
||||
return false;
|
||||
name = tokens.at(0);
|
||||
currentSHA= tokens.at(1);
|
||||
toolTip.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------ RemoteBranchModel
|
||||
RemoteBranchModel::RemoteBranchModel(GitClient *client, QObject *parent) :
|
||||
QAbstractListModel(parent),
|
||||
m_flags(Qt::ItemIsSelectable|Qt::ItemIsEnabled),
|
||||
m_client(client)
|
||||
{
|
||||
}
|
||||
|
||||
bool RemoteBranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
int currentBranch;
|
||||
return refreshBranches(workingDirectory, true, ¤tBranch, errorMessage);
|
||||
}
|
||||
|
||||
QString RemoteBranchModel::branchName(int row) const
|
||||
{
|
||||
return m_branches.at(row).name;
|
||||
}
|
||||
|
||||
QString RemoteBranchModel::workingDirectory() const
|
||||
{
|
||||
return m_workingDirectory;
|
||||
}
|
||||
|
||||
int RemoteBranchModel::branchCount() const
|
||||
{
|
||||
return m_branches.size();
|
||||
}
|
||||
|
||||
int RemoteBranchModel::rowCount(const QModelIndex & /* parent */) const
|
||||
{
|
||||
return branchCount();
|
||||
}
|
||||
|
||||
QVariant RemoteBranchModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
const int row = index.row();
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return branchName(row);
|
||||
case Qt::ToolTipRole:
|
||||
if (m_branches.at(row).toolTip.isEmpty())
|
||||
m_branches.at(row).toolTip = toolTip(m_branches.at(row).currentSHA);
|
||||
return m_branches.at(row).toolTip;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags RemoteBranchModel::flags(const QModelIndex & /* index */) const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
QString RemoteBranchModel::toolTip(const QString &sha) const
|
||||
{
|
||||
// Show the sha description excluding diff as toolTip
|
||||
QString output;
|
||||
QString errorMessage;
|
||||
if (!m_client->synchronousShow(m_workingDirectory, sha, &output, &errorMessage))
|
||||
return errorMessage;
|
||||
// Remove 'diff' output
|
||||
const int diffPos = output.indexOf(QLatin1String("\ndiff --"));
|
||||
if (diffPos != -1)
|
||||
output.remove(diffPos, output.size() - diffPos);
|
||||
return output;
|
||||
}
|
||||
|
||||
bool RemoteBranchModel::runGitBranchCommand(const QString &workingDirectory, const QStringList &additionalArgs, QString *output, QString *errorMessage)
|
||||
{
|
||||
return m_client->synchronousBranchCmd(workingDirectory, additionalArgs, output, errorMessage);
|
||||
}
|
||||
|
||||
bool RemoteBranchModel::refreshBranches(const QString &workingDirectory, bool remoteBranches,
|
||||
int *currentBranch, QString *errorMessage)
|
||||
{
|
||||
// Run branch command with verbose.
|
||||
QStringList branchArgs(QLatin1String("-v"));
|
||||
QString output;
|
||||
*currentBranch = -1;
|
||||
if (remoteBranches)
|
||||
branchArgs.push_back(QLatin1String("-r"));
|
||||
if (!runGitBranchCommand(workingDirectory, branchArgs, &output, errorMessage))
|
||||
return false;
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDirectory << output;
|
||||
// Parse output
|
||||
m_workingDirectory = workingDirectory;
|
||||
m_branches.clear();
|
||||
const QStringList branches = output.split(QLatin1Char('\n'));
|
||||
const int branchCount = branches.size();
|
||||
bool isCurrent;
|
||||
for (int b = 0; b < branchCount; b++) {
|
||||
Branch newBranch;
|
||||
if (newBranch.parse(branches.at(b), &isCurrent)) {
|
||||
m_branches.push_back(newBranch);
|
||||
if (isCurrent)
|
||||
*currentBranch = b;
|
||||
}
|
||||
}
|
||||
reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
int RemoteBranchModel::findBranchByName(const QString &name) const
|
||||
{
|
||||
const int count = branchCount();
|
||||
for (int i = 0; i < count; i++)
|
||||
if (branchName(i) == name)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// --- LocalBranchModel
|
||||
LocalBranchModel::LocalBranchModel(GitClient *client, QObject *parent) :
|
||||
RemoteBranchModel(client, parent),
|
||||
m_typeHere(tr("<New branch>")),
|
||||
m_typeHereToolTip(tr("Type to create a new branch")),
|
||||
m_currentBranch(-1)
|
||||
{
|
||||
}
|
||||
|
||||
int LocalBranchModel::currentBranch() const
|
||||
{
|
||||
return m_currentBranch;
|
||||
}
|
||||
|
||||
bool LocalBranchModel::isNewBranchRow(int row) const
|
||||
{
|
||||
return row >= branchCount();
|
||||
}
|
||||
|
||||
Qt::ItemFlags LocalBranchModel::flags(const QModelIndex & index) const
|
||||
{
|
||||
if (isNewBranchRow(index))
|
||||
return Qt::ItemIsEditable|Qt::ItemIsSelectable|Qt::ItemIsEnabled| Qt::ItemIsUserCheckable;
|
||||
return RemoteBranchModel::flags(index) | Qt::ItemIsUserCheckable;
|
||||
}
|
||||
|
||||
int LocalBranchModel::rowCount(const QModelIndex & /* parent */) const
|
||||
{
|
||||
return branchCount() + 1;
|
||||
}
|
||||
|
||||
QVariant LocalBranchModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (isNewBranchRow(index)) {
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return m_typeHere;
|
||||
case Qt::ToolTipRole:
|
||||
return m_typeHereToolTip;
|
||||
case Qt::CheckStateRole:
|
||||
return QVariant(false);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if (role == Qt::CheckStateRole)
|
||||
return index.row() == m_currentBranch ? Qt::Checked : Qt::Unchecked;
|
||||
return RemoteBranchModel::data(index, role);
|
||||
}
|
||||
|
||||
bool LocalBranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
return refreshBranches(workingDirectory, false, &m_currentBranch, errorMessage);
|
||||
}
|
||||
|
||||
bool LocalBranchModel::checkNewBranchName(const QString &name) const
|
||||
{
|
||||
// Syntax
|
||||
const QRegExp pattern(QLatin1String("[a-zA-Z0-9-_]+"));
|
||||
if (!pattern.exactMatch(name))
|
||||
return false;
|
||||
// existing
|
||||
if (findBranchByName(name) != -1)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LocalBranchModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
// Verify
|
||||
if (role != Qt::EditRole || index.row() < branchCount())
|
||||
return false;
|
||||
const QString branchName = value.toString();
|
||||
const bool ok = checkNewBranchName(branchName);
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO << branchName << ok;
|
||||
if (!ok)
|
||||
return false;
|
||||
// Create
|
||||
QString output;
|
||||
QString errorMessage;
|
||||
if (!runGitBranchCommand(workingDirectory(), QStringList(branchName), &output, &errorMessage))
|
||||
return false;
|
||||
m_newBranch = branchName;
|
||||
// Start a delayed complete refresh and return true for now.
|
||||
QTimer::singleShot(0, this, SLOT(slotNewBranchDelayedRefresh()));
|
||||
return true;
|
||||
}
|
||||
|
||||
void LocalBranchModel::slotNewBranchDelayedRefresh()
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
QString errorMessage;
|
||||
if (!refresh(workingDirectory(), &errorMessage)) {
|
||||
qWarning("%s", qPrintable(errorMessage));
|
||||
return;
|
||||
}
|
||||
emit newBranchCreated(m_newBranch);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
107
src/plugins/git/branchmodel.h
Normal file
107
src/plugins/git/branchmodel.h
Normal file
@@ -0,0 +1,107 @@
|
||||
#ifndef BRANCHMODEL_H
|
||||
#define BRANCHMODEL_H
|
||||
|
||||
#include <QtCore/QAbstractListModel>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QVariant>
|
||||
|
||||
namespace Git {
|
||||
namespace Internal {
|
||||
|
||||
class GitClient;
|
||||
|
||||
/* A read-only model to list git remote branches in a simple list of branch names.
|
||||
* The tooltip describes the latest commit (delayed creation).
|
||||
* Provides virtuals to be able to derive a local branch model with the notion
|
||||
* of a "current branch". */
|
||||
|
||||
class RemoteBranchModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RemoteBranchModel(GitClient *client, QObject *parent = 0);
|
||||
|
||||
virtual bool refresh(const QString &workingDirectory, QString *errorMessage);
|
||||
|
||||
QString branchName(int row) const;
|
||||
|
||||
// QAbstractListModel
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
int branchCount() const;
|
||||
|
||||
QString workingDirectory() const;
|
||||
int findBranchByName(const QString &name) const;
|
||||
|
||||
protected:
|
||||
struct Branch {
|
||||
bool parse(const QString &line, bool *isCurrent);
|
||||
|
||||
QString name;
|
||||
QString currentSHA;
|
||||
mutable QString toolTip;
|
||||
};
|
||||
typedef QList<Branch> BranchList;
|
||||
|
||||
/* Parse git output and populate m_branches. */
|
||||
bool refreshBranches(const QString &workingDirectory, bool remoteBranches,
|
||||
int *currentBranch, QString *errorMessage);
|
||||
bool runGitBranchCommand(const QString &workingDirectory, const QStringList &additionalArgs, QString *output, QString *errorMessage);
|
||||
|
||||
private:
|
||||
QString toolTip(const QString &sha) const;
|
||||
|
||||
const Qt::ItemFlags m_flags;
|
||||
|
||||
GitClient *m_client;
|
||||
QString m_workingDirectory;
|
||||
BranchList m_branches;
|
||||
};
|
||||
|
||||
/* LocalBranchModel: Extends RemoteBranchModel by a read-only
|
||||
* checkable column indicating the current branch. Provides an
|
||||
* editable "Type here" new-branch-row at the bottom to create
|
||||
* a new branch. */
|
||||
|
||||
class LocalBranchModel : public RemoteBranchModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
explicit LocalBranchModel(GitClient *client,
|
||||
QObject *parent = 0);
|
||||
|
||||
virtual bool refresh(const QString &workingDirectory, QString *errorMessage);
|
||||
|
||||
// is this the "type here" row?
|
||||
bool isNewBranchRow(int row) const;
|
||||
bool isNewBranchRow(const QModelIndex & index) const { return isNewBranchRow(index.row()); }
|
||||
|
||||
int currentBranch() const;
|
||||
|
||||
// QAbstractListModel
|
||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
||||
signals:
|
||||
void newBranchCreated(const QString &);
|
||||
|
||||
private slots:
|
||||
void slotNewBranchDelayedRefresh();
|
||||
|
||||
private:
|
||||
bool checkNewBranchName(const QString &name) const;
|
||||
|
||||
const QVariant m_typeHere;
|
||||
const QVariant m_typeHereToolTip;
|
||||
|
||||
int m_currentBranch;
|
||||
QString m_newBranch;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BRANCHMODEL_H
|
||||
@@ -6,7 +6,6 @@ include(../../plugins/texteditor/texteditor.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../plugins/vcsbase/vcsbase.pri)
|
||||
include(../../libs/utils/utils.pri)
|
||||
|
||||
HEADERS += gitplugin.h \
|
||||
gitconstants.h \
|
||||
gitoutputwindow.h \
|
||||
@@ -19,8 +18,9 @@ HEADERS += gitplugin.h \
|
||||
gitsubmiteditorwidget.h \
|
||||
gitsubmiteditor.h \
|
||||
gitversioncontrol.h \
|
||||
gitsettings.h
|
||||
|
||||
gitsettings.h \
|
||||
branchdialog.h \
|
||||
branchmodel.h
|
||||
SOURCES += gitplugin.cpp \
|
||||
gitoutputwindow.cpp \
|
||||
gitclient.cpp \
|
||||
@@ -32,8 +32,10 @@ SOURCES += gitplugin.cpp \
|
||||
gitsubmiteditorwidget.cpp \
|
||||
gitsubmiteditor.cpp \
|
||||
gitversioncontrol.cpp \
|
||||
gitsettings.cpp
|
||||
|
||||
gitsettings.cpp \
|
||||
branchdialog.cpp \
|
||||
branchmodel.cpp
|
||||
FORMS += changeselectiondialog.ui \
|
||||
settingspage.ui \
|
||||
gitsubmitpanel.ui
|
||||
gitsubmitpanel.ui \
|
||||
branchdialog.ui
|
||||
|
||||
@@ -276,6 +276,13 @@ void GitClient::blame(const QString &workingDirectory, const QString &fileName)
|
||||
executeGit(workingDirectory, arguments, editor);
|
||||
}
|
||||
|
||||
void GitClient::checkoutBranch(const QString &workingDirectory, const QString &branch)
|
||||
{
|
||||
QStringList arguments(QLatin1String("checkout"));
|
||||
arguments << branch;
|
||||
executeGit(workingDirectory, arguments, 0, true);
|
||||
}
|
||||
|
||||
void GitClient::checkout(const QString &workingDirectory, const QString &fileName)
|
||||
{
|
||||
// Passing an empty argument as the file name is very dangereous, since this makes
|
||||
@@ -379,6 +386,58 @@ bool GitClient::synchronousCheckout(const QString &workingDirectory,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousStash(const QString &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDirectory;
|
||||
QByteArray outputText;
|
||||
QByteArray errorText;
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("stash");
|
||||
const bool rc = synchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||
if (!rc) {
|
||||
*errorMessage = tr("Unable stash in %1: %2").arg(workingDirectory, QString::fromLocal8Bit(errorText));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
|
||||
QString *output, QString *errorMessage)
|
||||
{
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDirectory << branchArgs;
|
||||
branchArgs.push_front(QLatin1String("branch"));
|
||||
QByteArray outputText;
|
||||
QByteArray errorText;
|
||||
const bool rc = synchronousGit(workingDirectory, branchArgs, &outputText, &errorText);
|
||||
if (!rc) {
|
||||
*errorMessage = tr("Unable to run branch command: %1: %2").arg(workingDirectory, QString::fromLocal8Bit(errorText));
|
||||
return false;
|
||||
}
|
||||
*output = QString::fromLocal8Bit(outputText).remove(QLatin1Char('\r'));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousShow(const QString &workingDirectory, const QString &id,
|
||||
QString *output, QString *errorMessage)
|
||||
{
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDirectory << id;
|
||||
QStringList args(QLatin1String("show"));
|
||||
args << id;
|
||||
QByteArray outputText;
|
||||
QByteArray errorText;
|
||||
const bool rc = synchronousGit(workingDirectory, args, &outputText, &errorText);
|
||||
if (!rc) {
|
||||
*errorMessage = tr("Unable to run show: %1: %2").arg(workingDirectory, QString::fromLocal8Bit(errorText));
|
||||
return false;
|
||||
}
|
||||
*output = QString::fromLocal8Bit(outputText).remove(QLatin1Char('\r'));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void GitClient::executeGit(const QString &workingDirectory, const QStringList &arguments,
|
||||
VCSBase::VCSBaseEditor* editor,
|
||||
bool outputToWindow)
|
||||
@@ -467,6 +526,60 @@ bool GitClient::synchronousGit(const QString &workingDirectory,
|
||||
return process.exitCode() == 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
askWithDetailedText(QWidget *parent,
|
||||
const QString &title, const QString &msg,
|
||||
const QString &inf,
|
||||
QMessageBox::StandardButton defaultButton,
|
||||
QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No)
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Question, title, msg, buttons, parent);
|
||||
msgBox.setDetailedText(inf);
|
||||
msgBox.setDefaultButton(defaultButton);
|
||||
return msgBox.exec();
|
||||
}
|
||||
|
||||
// Convenience that pops up an msg box.
|
||||
GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory)
|
||||
{
|
||||
QString errorMessage;
|
||||
const StashResult sr = ensureStash(workingDirectory, &errorMessage);
|
||||
if (sr == StashFailed) {
|
||||
m_plugin->outputWindow()->append(errorMessage);
|
||||
m_plugin->outputWindow()->popup();
|
||||
}
|
||||
return sr;
|
||||
}
|
||||
|
||||
// Ensure that changed files are stashed before a pull or similar
|
||||
GitClient::StashResult GitClient::ensureStash(const QString &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
QString statusOutput;
|
||||
switch (gitStatus(workingDirectory, false, &statusOutput, errorMessage)) {
|
||||
case StatusChanged:
|
||||
break;
|
||||
case StatusUnchanged:
|
||||
return StashUnchanged;
|
||||
case StatusFailed:
|
||||
return StashFailed;
|
||||
}
|
||||
|
||||
const int answer = askWithDetailedText(m_core->mainWindow(), tr("Changes"),
|
||||
tr("You have modified files. Would you like to stash your changes?"),
|
||||
statusOutput, QMessageBox::Yes, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
|
||||
switch (answer) {
|
||||
case QMessageBox::Cancel:
|
||||
return StashCanceled;
|
||||
case QMessageBox::Yes:
|
||||
if (!synchronousStash(workingDirectory, errorMessage))
|
||||
return StashFailed;
|
||||
break;
|
||||
case QMessageBox::No: // At your own risk, so.
|
||||
return NotStashed;
|
||||
}
|
||||
|
||||
return Stashed;
|
||||
}
|
||||
|
||||
// Trim a git status file spec: "modified: foo .cpp" -> "modified: foo .cpp"
|
||||
static inline QString trimFileSpecification(QString fileSpec)
|
||||
@@ -476,7 +589,7 @@ static inline QString trimFileSpecification(QString fileSpec)
|
||||
// Collapse the sequence of spaces
|
||||
const int filePos = colonIndex + 2;
|
||||
int nonBlankPos = filePos;
|
||||
for ( ; fileSpec.at(nonBlankPos).isSpace(); nonBlankPos++);
|
||||
for ( ; fileSpec.at(nonBlankPos).isSpace(); nonBlankPos++) ;
|
||||
if (nonBlankPos > filePos)
|
||||
fileSpec.remove(filePos, nonBlankPos - filePos);
|
||||
}
|
||||
@@ -703,18 +816,6 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static inline bool askWithInformativeText(QWidget *parent,
|
||||
const QString &title,
|
||||
const QString &msg,
|
||||
const QString &inf,
|
||||
bool defaultValue)
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Question, title, msg, QMessageBox::Yes|QMessageBox::No, parent);
|
||||
msgBox.setInformativeText(inf);
|
||||
msgBox.setDefaultButton(defaultValue ? QMessageBox::Yes : QMessageBox::No);
|
||||
return msgBox.exec() == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
/* Revert: This function can be called with a file list (to revert single
|
||||
* files) or a single directory (revert all). Qt Creator currently has only
|
||||
* 'revert single' in its VCS menus, but the code is prepared to deal with
|
||||
|
||||
@@ -86,12 +86,19 @@ public:
|
||||
void blame(const QString &workingDirectory, const QString &fileName);
|
||||
void showCommit(const QString &workingDirectory, const QString &commit);
|
||||
void checkout(const QString &workingDirectory, const QString &file);
|
||||
void checkoutBranch(const QString &workingDirectory, const QString &branch);
|
||||
void hardReset(const QString &workingDirectory, const QString &commit);
|
||||
void addFile(const QString &workingDirectory, const QString &fileName);
|
||||
bool synchronousAdd(const QString &workingDirectory, const QStringList &files);
|
||||
bool synchronousReset(const QString &workingDirectory, const QStringList &files);
|
||||
bool synchronousReset(const QString &workingDirectory, const QStringList &files, QString *errorMessage);
|
||||
bool synchronousCheckout(const QString &workingDirectory, const QStringList &files, QString *errorMessage);
|
||||
bool synchronousStash(const QString &workingDirectory, QString *errorMessage);
|
||||
bool synchronousBranchCmd(const QString &workingDirectory, QStringList branchArgs,
|
||||
QString *output, QString *errorMessage);
|
||||
bool synchronousShow(const QString &workingDirectory, const QString &id,
|
||||
QString *output, QString *errorMessage);
|
||||
|
||||
void pull(const QString &workingDirectory);
|
||||
void push(const QString &workingDirectory);
|
||||
|
||||
@@ -105,6 +112,11 @@ public:
|
||||
|
||||
QString readConfigValue(const QString &workingDirectory, const QString &configVar);
|
||||
|
||||
enum StashResult { StashUnchanged, StashCanceled, StashFailed,
|
||||
Stashed, NotStashed /* User did not want it */ };
|
||||
StashResult ensureStash(const QString &workingDirectory, QString *errorMessage);
|
||||
StashResult ensureStash(const QString &workingDirectory);
|
||||
|
||||
bool getCommitData(const QString &workingDirectory,
|
||||
QString *commitTemplate,
|
||||
CommitData *d,
|
||||
@@ -118,7 +130,7 @@ public:
|
||||
|
||||
enum StatusResult { StatusChanged, StatusUnchanged, StatusFailed };
|
||||
StatusResult gitStatus(const QString &workingDirectory,
|
||||
bool untracked,
|
||||
bool untracked = false,
|
||||
QString *output = 0,
|
||||
QString *errorMessage = 0);
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "giteditor.h"
|
||||
#include "gitsubmiteditor.h"
|
||||
#include "gitversioncontrol.h"
|
||||
#include "branchdialog.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -401,7 +402,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
|
||||
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Branch"), this));
|
||||
|
||||
m_branchListAction = new QAction(tr("List branches"), this);
|
||||
m_branchListAction = new QAction(tr("Branches..."), this);
|
||||
command = actionManager->registerAction(m_branchListAction, "Git.BranchList", globalcontext);
|
||||
command->setAttribute(Core::ICommand::CA_UpdateText);
|
||||
connect(m_branchListAction, SIGNAL(triggered()), this, SLOT(branchList()));
|
||||
@@ -494,7 +495,6 @@ QString GitPlugin::getWorkingDirectory()
|
||||
qDebug() << Q_FUNC_INFO << "file" << workingDirectory;
|
||||
|
||||
if (workingDirectory.isEmpty()) {
|
||||
m_outputWindow->clearContents();
|
||||
m_outputWindow->append(tr("Could not find working directory"));
|
||||
m_outputWindow->popup(false);
|
||||
return QString();
|
||||
@@ -703,8 +703,17 @@ bool GitPlugin::editorAboutToClose(Core::IEditor *iEditor)
|
||||
void GitPlugin::pull()
|
||||
{
|
||||
const QString workingDirectory = getWorkingDirectory();
|
||||
if (!workingDirectory.isEmpty())
|
||||
m_gitClient->pull(workingDirectory);
|
||||
if (workingDirectory.isEmpty())
|
||||
return;
|
||||
|
||||
switch (m_gitClient->ensureStash(workingDirectory)) {
|
||||
case GitClient::StashUnchanged:
|
||||
case GitClient::Stashed:
|
||||
case GitClient::NotStashed:
|
||||
m_gitClient->pull(workingDirectory);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::push()
|
||||
@@ -731,8 +740,21 @@ void GitPlugin::stashPop()
|
||||
void GitPlugin::branchList()
|
||||
{
|
||||
const QString workingDirectory = getWorkingDirectory();
|
||||
if (!workingDirectory.isEmpty())
|
||||
m_gitClient->branchList(workingDirectory);
|
||||
if (workingDirectory.isEmpty())
|
||||
return;
|
||||
#ifndef USE_BRANCHDIALOG
|
||||
QString errorMessage;
|
||||
BranchDialog dialog(m_core->mainWindow());
|
||||
|
||||
if (!dialog.init(m_gitClient, workingDirectory, &errorMessage)) {
|
||||
m_outputWindow->append(errorMessage);
|
||||
m_outputWindow->popup(false);
|
||||
return;
|
||||
}
|
||||
dialog.exec();
|
||||
#else
|
||||
m_gitClient->branchList(workingDirectory);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GitPlugin::stashList()
|
||||
|
||||
@@ -97,6 +97,7 @@ public:
|
||||
|
||||
GitOutputWindow *outputWindow() const;
|
||||
|
||||
|
||||
GitSettings settings() const;
|
||||
void setSettings(const GitSettings &s);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<plugin name="HelloWorld" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="HelloWorld" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Hello World sample plugin.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -33,26 +33,21 @@
|
||||
|
||||
#include "helloworldplugin.h"
|
||||
|
||||
#include "helloworldwindow.h"
|
||||
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/basemode.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
#include <coreplugin/CoreTools>
|
||||
|
||||
#include "helloworldplugin.h"
|
||||
|
||||
using namespace HelloWorld::Internal;
|
||||
|
||||
/*! Constructs the Hello World plugin. Normally plugins don't do anything in
|
||||
@@ -77,30 +72,20 @@ HelloWorldPlugin::~HelloWorldPlugin()
|
||||
\a error_message can be used to pass an error message to the plugin system,
|
||||
if there was any.
|
||||
*/
|
||||
bool HelloWorldPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
|
||||
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_message)
|
||||
{
|
||||
Q_UNUSED(arguments)
|
||||
Q_UNUSED(error_message)
|
||||
|
||||
// Get the primary access point to the workbench.
|
||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
|
||||
// Create our own widget that we want to show in a view in the IDE.
|
||||
HelloWorldWindow *window = new HelloWorldWindow;
|
||||
|
||||
// Create a unique context id for our own view, that will be used for the
|
||||
// menu entry later.
|
||||
QList<int> context = QList<int>()
|
||||
<< core->uniqueIDManager()->uniqueIdentifier(
|
||||
QLatin1String("HelloWorld.MainView"));
|
||||
|
||||
// Create a new view that contains our widget and register it with the
|
||||
// plugin manager. The view will have the id "HelloWorld.HelloWorldWindow",
|
||||
// and if it has focus it provides 'context' to the context list in
|
||||
// Qt Creator. It will be put into the right dock widget area.
|
||||
addAutoReleasedObject(new Core::BaseView("HelloWorld.HelloWorldWindow",
|
||||
window, context,
|
||||
Qt::RightDockWidgetArea));
|
||||
|
||||
// Create an action to be triggered by a menu entry
|
||||
QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this);
|
||||
connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));
|
||||
@@ -126,13 +111,15 @@ bool HelloWorldPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
||||
actionManager->actionContainer(Core::Constants::M_TOOLS);
|
||||
toolsMenu->addMenu(helloWorldMenu);
|
||||
|
||||
// Add a mode with a push button based on BaseMode. Like the BaseView, it will unregister
|
||||
// itself from the plugin manager when it is deleted.
|
||||
addAutoReleasedObject(new Core::BaseMode(tr("Hello world!"),
|
||||
"HelloWorld.HelloWorldMode",
|
||||
QIcon(),
|
||||
0, // priority
|
||||
new QPushButton(tr("Hello World PushButton!"))));
|
||||
// Add a mode with a push button based on BaseMode. Like the BaseView,
|
||||
// it will unregister itself from the plugin manager when it is deleted.
|
||||
Core::BaseMode *baseMode = new Core::BaseMode;
|
||||
baseMode->setUniqueModeName("HelloWorld.HelloWorldMode");
|
||||
baseMode->setName(tr("Hello world!"));
|
||||
baseMode->setIcon(QIcon());
|
||||
baseMode->setPriority(0);
|
||||
baseMode->setWidget(new QPushButton(tr("Hello World PushButton!")));
|
||||
addAutoReleasedObject(baseMode);
|
||||
|
||||
// Add the Hello World action command to the mode manager (with 0 priority)
|
||||
Core::ModeManager *modeManager = core->modeManager();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="Help" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Help" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Help system.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Find" version="0.9.1"/>
|
||||
<dependency name="QuickOpen" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="Find" version="0.9.2"/>
|
||||
<dependency name="QuickOpen" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -83,7 +83,8 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
|
||||
bool needsSetup = false;
|
||||
{
|
||||
QHelpEngineCore hc(m_helpEngine->collectionFile());
|
||||
hc.setupData();
|
||||
if (!hc.setupData())
|
||||
qWarning() << "Could not initialize help engine:" << hc.error();
|
||||
foreach (const QString &fileName, fileNames) {
|
||||
if (!QFile::exists(fileName))
|
||||
continue;
|
||||
@@ -132,7 +133,7 @@ bool HelpPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
||||
|
||||
// FIXME shouldn't the help engine create the directory if it doesn't exist?
|
||||
QFileInfo fi(m_core->settings()->fileName());
|
||||
QDir directory(fi.absolutePath());
|
||||
QDir directory(fi.absolutePath()+"/qtcreator");
|
||||
if (!directory.exists())
|
||||
directory.mkpath(directory.absolutePath());
|
||||
m_helpEngine = new QHelpEngine(directory.absolutePath()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<plugin name="Perforce" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Perforce" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Perforce integration.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="VCSBase" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="VCSBase" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -151,7 +151,7 @@ QString PerforceEditor::fileNameFromDiffSpecification(const QTextBlock &inBlock)
|
||||
// Ask plugin to map back
|
||||
const QString fileName = m_plugin->fileNameFromPerforceName(diffFileName.trimmed(), &errorMessage);
|
||||
if (fileName.isEmpty())
|
||||
qWarning(errorMessage.toUtf8().constData());
|
||||
qWarning("%s", qPrintable(errorMessage));
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ SUBDIRS = plugin_coreplugin \
|
||||
# plugin_regexp \ # don't know what to do with this
|
||||
plugin_qtscripteditor \
|
||||
plugin_cpaster \
|
||||
plugin_cmakeprojectmanager
|
||||
plugin_cmakeprojectmanager \
|
||||
plugin_fakevim
|
||||
|
||||
# These two plugins require private headers from Qt and therefore don't work
|
||||
# with an installed/released version of Qt.
|
||||
@@ -115,6 +116,11 @@ plugin_debugger.depends = plugin_projectexplorer
|
||||
plugin_debugger.depends += plugin_coreplugin
|
||||
plugin_debugger.depends += plugin_cppeditor
|
||||
|
||||
plugin_fakevim.subdir = fakevim
|
||||
plugin_fakevim.depends = plugin_projectexplorer
|
||||
plugin_fakevim.depends += plugin_coreplugin
|
||||
plugin_fakevim.depends += plugin_cppeditor
|
||||
|
||||
plugin_qtestlib.subdir = qtestlib
|
||||
plugin_qtestlib.depends = plugin_projectexplorer
|
||||
plugin_qtestlib.depends += plugin_coreplugin
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<plugin name="ProjectExplorer" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="ProjectExplorer" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>ProjectExplorer framework that can be extended with different kind of project types.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Find" version="0.9.1"/>
|
||||
<dependency name="QuickOpen" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="Find" version="0.9.2"/>
|
||||
<dependency name="QuickOpen" version="0.9.2"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<plugin name="Qt4ProjectManager" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Qt4ProjectManager" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Provides project type for Qt 4 pro files and tools.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="CppTools" version="0.9.1"/>
|
||||
<dependency name="CppEditor" version="0.9.1"/>
|
||||
<dependency name="Help" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="CppTools" version="0.9.2"/>
|
||||
<dependency name="CppEditor" version="0.9.2"/>
|
||||
<dependency name="Help" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -207,7 +207,8 @@ int FileWatcher::m_objectCount = 0;
|
||||
QHash<QString,int> FileWatcher::m_fileCount;
|
||||
QFileSystemWatcher *FileWatcher::m_watcher = 0;
|
||||
|
||||
FileWatcher::FileWatcher(QObject *parent)
|
||||
FileWatcher::FileWatcher(QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
if (!m_watcher)
|
||||
m_watcher = new QFileSystemWatcher();
|
||||
|
||||
@@ -54,6 +54,8 @@ Qt4BuildConfigWidget::Qt4BuildConfigWidget(Qt4Project *project)
|
||||
{
|
||||
m_ui = new Ui::Qt4BuildConfigWidget();
|
||||
m_ui->setupUi(this);
|
||||
m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory"));
|
||||
m_ui->shadowBuildDirEdit->setExpectedKind(Core::Utils::PathChooser::Directory);
|
||||
m_ui->invalidQtWarningLabel->setVisible(false);
|
||||
|
||||
connect(m_ui->nameLineEdit, SIGNAL(textEdited(QString)),
|
||||
@@ -62,10 +64,10 @@ Qt4BuildConfigWidget::Qt4BuildConfigWidget(Qt4Project *project)
|
||||
connect(m_ui->shadowBuildCheckBox, SIGNAL(clicked(bool)),
|
||||
this, SLOT(shadowBuildCheckBoxClicked(bool)));
|
||||
|
||||
connect(m_ui->shadowBuildButton, SIGNAL(clicked(bool)),
|
||||
this, SLOT(shadowBuildButtonClicked()));
|
||||
connect(m_ui->shadowBuildDirEdit, SIGNAL(beforeBrowsing()),
|
||||
this, SLOT(onBeforeBeforeShadowBuildDirBrowsed()));
|
||||
|
||||
connect(m_ui->shadowBuildLineEdit, SIGNAL(textEdited(QString)),
|
||||
connect(m_ui->shadowBuildDirEdit, SIGNAL(changed()),
|
||||
this, SLOT(shadowBuildLineEditTextChanged()));
|
||||
|
||||
connect(m_ui->qtVersionComboBox, SIGNAL(currentIndexChanged(QString)),
|
||||
@@ -102,10 +104,9 @@ void Qt4BuildConfigWidget::init(const QString &buildConfiguration)
|
||||
|
||||
bool shadowBuild = m_pro->value(buildConfiguration, "useShadowBuild").toBool();
|
||||
m_ui->shadowBuildCheckBox->setChecked(shadowBuild);
|
||||
m_ui->shadowBuildLineEdit->setEnabled(shadowBuild);
|
||||
m_ui->shadowBuildLineEdit->setText(m_pro->buildDirectory(buildConfiguration));
|
||||
m_ui->shadowBuildDirEdit->setEnabled(shadowBuild);
|
||||
m_ui->shadowBuildDirEdit->setPath(m_pro->buildDirectory(buildConfiguration));
|
||||
shadowBuildLineEditTextChanged(); // Update the import label
|
||||
m_ui->shadowBuildButton->setEnabled(shadowBuild);
|
||||
}
|
||||
|
||||
void Qt4BuildConfigWidget::changeConfigName(const QString &newName)
|
||||
@@ -145,47 +146,39 @@ void Qt4BuildConfigWidget::setupQtVersionsComboBox()
|
||||
this, SLOT(qtVersionComboBoxCurrentIndexChanged(QString)));
|
||||
}
|
||||
|
||||
void Qt4BuildConfigWidget::shadowBuildButtonClicked()
|
||||
void Qt4BuildConfigWidget::onBeforeBeforeShadowBuildDirBrowsed()
|
||||
{
|
||||
QString initialDirectory = m_ui->shadowBuildLineEdit->text();
|
||||
if (initialDirectory.isEmpty())
|
||||
initialDirectory = QFileInfo(m_pro->file()->fileName()).absolutePath();
|
||||
|
||||
QString shadowBuildDirectory =
|
||||
QFileDialog::getExistingDirectory(this, tr("Shadow Build Directory"), initialDirectory );
|
||||
|
||||
if (shadowBuildDirectory != QString::null)
|
||||
m_ui->shadowBuildLineEdit->setText(shadowBuildDirectory);
|
||||
shadowBuildLineEditTextChanged();
|
||||
QString initialDirectory = QFileInfo(m_pro->file()->fileName()).absolutePath();
|
||||
if (!initialDirectory.isEmpty())
|
||||
m_ui->shadowBuildDirEdit->setInitialBrowsePathBackup(initialDirectory);
|
||||
}
|
||||
|
||||
void Qt4BuildConfigWidget::shadowBuildCheckBoxClicked(bool checked)
|
||||
{
|
||||
m_ui->shadowBuildLineEdit->setEnabled(checked);
|
||||
m_ui->shadowBuildButton->setEnabled(checked);
|
||||
m_ui->shadowBuildDirEdit->setEnabled(checked);
|
||||
bool b = m_ui->shadowBuildCheckBox->isChecked();
|
||||
m_pro->setValue(m_buildConfiguration, "useShadowBuild", b);
|
||||
if (b)
|
||||
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildLineEdit->text());
|
||||
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildDirEdit->path());
|
||||
else
|
||||
m_pro->setValue(m_buildConfiguration, "buildDirectory", QVariant(QString::null));
|
||||
}
|
||||
|
||||
void Qt4BuildConfigWidget::shadowBuildLineEditTextChanged()
|
||||
{
|
||||
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildLineEdit->text());
|
||||
m_pro->setValue(m_buildConfiguration, "buildDirectory", m_ui->shadowBuildDirEdit->path());
|
||||
// if the directory already exists
|
||||
// check if we have a build in there and
|
||||
// offer to import it
|
||||
m_ui->importLabel->setVisible(false);
|
||||
if (m_ui->shadowBuildCheckBox->isChecked()) {
|
||||
QString qtPath = m_pro->qt4ProjectManager()->versionManager()->findQtVersionFromMakefile(m_ui->shadowBuildLineEdit->text());
|
||||
QString qtPath = m_pro->qt4ProjectManager()->versionManager()->findQtVersionFromMakefile(m_ui->shadowBuildDirEdit->path());
|
||||
if (!qtPath.isEmpty()) {
|
||||
m_ui->importLabel->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
// QFileInfo fi(m_ui->shadowBuildLineEdit->text());
|
||||
// QFileInfo fi(m_ui->shadowBuildDirEdit->path());
|
||||
// if (fi.exists()) {
|
||||
// m_ui->shadowBuildLineEdit->setStyleSheet("");
|
||||
// m_ui->shadowBuildLineEdit->setToolTip("");
|
||||
@@ -198,7 +191,7 @@ void Qt4BuildConfigWidget::shadowBuildLineEditTextChanged()
|
||||
void Qt4BuildConfigWidget::importLabelClicked()
|
||||
{
|
||||
if (m_ui->shadowBuildCheckBox->isChecked()) {
|
||||
QString directory = m_ui->shadowBuildLineEdit->text();
|
||||
QString directory = m_ui->shadowBuildDirEdit->path();
|
||||
if (!directory.isEmpty()) {
|
||||
QtVersionManager *vm = m_pro->qt4ProjectManager()->versionManager();
|
||||
QString qtPath = vm->findQtVersionFromMakefile(directory);
|
||||
|
||||
@@ -60,7 +60,7 @@ private slots:
|
||||
void changeConfigName(const QString &newName);
|
||||
void setupQtVersionsComboBox();
|
||||
void shadowBuildCheckBoxClicked(bool checked);
|
||||
void shadowBuildButtonClicked();
|
||||
void onBeforeBeforeShadowBuildDirBrowsed();
|
||||
void shadowBuildLineEditTextChanged();
|
||||
void importLabelClicked();
|
||||
void qtVersionComboBoxCurrentIndexChanged(const QString &);
|
||||
|
||||
@@ -110,39 +110,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="shadowBuildLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>100</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="shadowBuildButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="importLabel">
|
||||
<property name="text">
|
||||
@@ -153,6 +120,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="Core::Utils::PathChooser" name="shadowBuildDirEdit" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
@@ -186,6 +163,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Core::Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -566,7 +566,6 @@ QStringList Qt4Project::files(FilesMode fileMode) const
|
||||
if (fileMode == AllFiles)
|
||||
files += m_projectFiles->generatedFiles[i];
|
||||
}
|
||||
files += m_projectFiles->proFiles;
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
@@ -368,6 +368,10 @@ QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defau
|
||||
, m_specifyPathString(tr("<specify a path>"))
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.qtPath->setExpectedKind(Core::Utils::PathChooser::Directory);
|
||||
m_ui.qtPath->setPromptDialogTitle(tr("Select QTDIR"));
|
||||
m_ui.mingwPath->setExpectedKind(Core::Utils::PathChooser::Directory);
|
||||
m_ui.qtPath->setPromptDialogTitle(tr("Select MinGW Directory"));
|
||||
|
||||
m_ui.addButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
|
||||
m_ui.delButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
||||
@@ -385,19 +389,22 @@ QtDirWidget::QtDirWidget(QWidget *parent, QList<QtVersion *> versions, int defau
|
||||
|
||||
connect(m_ui.nameEdit, SIGNAL(textEdited(const QString &)),
|
||||
this, SLOT(updateCurrentQtName()));
|
||||
connect(m_ui.pathEdit, SIGNAL(textEdited(const QString &)),
|
||||
|
||||
|
||||
connect(m_ui.qtPath, SIGNAL(changed()),
|
||||
this, SLOT(updateCurrentQtPath()));
|
||||
connect(m_ui.mingwLineEdit, SIGNAL(textEdited(const QString &)),
|
||||
connect(m_ui.mingwPath, SIGNAL(changed()),
|
||||
this, SLOT(updateCurrentMingwDirectory()));
|
||||
|
||||
connect(m_ui.addButton, SIGNAL(clicked()),
|
||||
this, SLOT(addQtDir()));
|
||||
connect(m_ui.delButton, SIGNAL(clicked()),
|
||||
this, SLOT(removeQtDir()));
|
||||
connect(m_ui.browseButton, SIGNAL(clicked()),
|
||||
this, SLOT(browse()));
|
||||
connect(m_ui.mingwBrowseButton, SIGNAL(clicked()),
|
||||
this, SLOT(mingwBrowse()));
|
||||
|
||||
connect(m_ui.qtPath, SIGNAL(browsingFinished()),
|
||||
this, SLOT(onQtBrowsed()));
|
||||
connect(m_ui.mingwPath, SIGNAL(browsingFinished()),
|
||||
this, SLOT(onMingwBrowsed()));
|
||||
|
||||
connect(m_ui.qtdirList, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
||||
this, SLOT(versionChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
|
||||
@@ -421,11 +428,11 @@ void QtDirWidget::addQtDir()
|
||||
item->setText(1, newVersion->path());
|
||||
item->setData(0, Qt::UserRole, newVersion->uniqueId());
|
||||
|
||||
m_ui.nameEdit->setText(newVersion->name());
|
||||
m_ui.pathEdit->setText(newVersion->path());
|
||||
|
||||
m_ui.defaultCombo->addItem(newVersion->name());
|
||||
m_ui.qtdirList->setCurrentItem(item);
|
||||
|
||||
m_ui.nameEdit->setText(newVersion->name());
|
||||
m_ui.qtPath->setPath(newVersion->path());
|
||||
m_ui.defaultCombo->addItem(newVersion->name());
|
||||
m_ui.nameEdit->setFocus();
|
||||
m_ui.nameEdit->selectAll();
|
||||
}
|
||||
@@ -459,10 +466,14 @@ void QtDirWidget::updateState()
|
||||
&& m_versions.at(m_ui.qtdirList->indexOfTopLevelItem(m_ui.qtdirList->currentItem()))->isSystemVersion());
|
||||
m_ui.delButton->setEnabled(enabled && !isSystemVersion);
|
||||
m_ui.nameEdit->setEnabled(enabled && !isSystemVersion);
|
||||
m_ui.pathEdit->setEnabled(enabled && !isSystemVersion);
|
||||
m_ui.browseButton->setEnabled(enabled && !isSystemVersion);
|
||||
m_ui.mingwBrowseButton->setEnabled(enabled);
|
||||
m_ui.mingwLineEdit->setEnabled(enabled);
|
||||
m_ui.qtPath->setEnabled(enabled && !isSystemVersion);
|
||||
m_ui.mingwPath->setEnabled(enabled);
|
||||
}
|
||||
|
||||
void QtDirWidget::makeMingwVisible(bool visible)
|
||||
{
|
||||
m_ui.mingwLabel->setVisible(visible);
|
||||
m_ui.mingwPath->setVisible(visible);
|
||||
}
|
||||
|
||||
void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
||||
@@ -475,16 +486,12 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
||||
if (t == QtVersion::MinGW) {
|
||||
m_ui.msvcComboBox->setVisible(false);
|
||||
m_ui.msvcLabel->setVisible(false);
|
||||
m_ui.mingwLineEdit->setVisible(true);
|
||||
m_ui.mingwLabel->setVisible(true);
|
||||
m_ui.mingwBrowseButton->setVisible(true);
|
||||
m_ui.mingwLineEdit->setText(m_versions.at(index)->mingwDirectory());
|
||||
makeMingwVisible(true);
|
||||
m_ui.mingwPath->setPath(m_versions.at(index)->mingwDirectory());
|
||||
} else if (t == QtVersion::MSVC || t == QtVersion::WINCE){
|
||||
m_ui.msvcComboBox->setVisible(false);
|
||||
m_ui.msvcLabel->setVisible(true);
|
||||
m_ui.mingwLineEdit->setVisible(false);
|
||||
m_ui.mingwLabel->setVisible(false);
|
||||
m_ui.mingwBrowseButton->setVisible(false);
|
||||
makeMingwVisible(false);
|
||||
QList<MSVCEnvironment> msvcenvironments = MSVCEnvironment::availableVersions();
|
||||
if (msvcenvironments.count() == 0) {
|
||||
m_ui.msvcLabel->setText(tr("No Visual Studio Installation found"));
|
||||
@@ -506,9 +513,7 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
||||
} else if (t == QtVersion::INVALID) {
|
||||
m_ui.msvcComboBox->setVisible(false);
|
||||
m_ui.msvcLabel->setVisible(false);
|
||||
m_ui.mingwLineEdit->setVisible(false);
|
||||
m_ui.mingwLabel->setVisible(false);
|
||||
m_ui.mingwBrowseButton->setVisible(false);
|
||||
makeMingwVisible(false);
|
||||
if (!m_versions.at(index)->isInstalled())
|
||||
m_ui.errorLabel->setText(tr("The Qt Version is not installed. Run make install")
|
||||
.arg(m_versions.at(index)->path()));
|
||||
@@ -517,9 +522,7 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
||||
} else { //QtVersion::Other
|
||||
m_ui.msvcComboBox->setVisible(false);
|
||||
m_ui.msvcLabel->setVisible(false);
|
||||
m_ui.mingwLineEdit->setVisible(false);
|
||||
m_ui.mingwLabel->setVisible(false);
|
||||
m_ui.mingwBrowseButton->setVisible(false);
|
||||
makeMingwVisible(false);
|
||||
m_ui.errorLabel->setText("Found Qt version "
|
||||
+ m_versions.at(index)->qtVersionString()
|
||||
+ " using mkspec "
|
||||
@@ -528,9 +531,7 @@ void QtDirWidget::showEnvironmentPage(QTreeWidgetItem *item)
|
||||
} else {
|
||||
m_ui.msvcComboBox->setVisible(false);
|
||||
m_ui.msvcLabel->setVisible(false);
|
||||
m_ui.mingwLineEdit->setVisible(false);
|
||||
m_ui.mingwLabel->setVisible(false);
|
||||
m_ui.mingwBrowseButton->setVisible(false);
|
||||
makeMingwVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,24 +542,21 @@ void QtDirWidget::versionChanged(QTreeWidgetItem *item, QTreeWidgetItem *old)
|
||||
}
|
||||
if (item) {
|
||||
m_ui.nameEdit->setText(item->text(0));
|
||||
m_ui.pathEdit->setText(item->text(1));
|
||||
m_ui.qtPath->setPath(item->text(1));
|
||||
} else {
|
||||
m_ui.nameEdit->clear();
|
||||
m_ui.pathEdit->clear();
|
||||
m_ui.qtPath->setPath(""); // clear()
|
||||
}
|
||||
showEnvironmentPage(item);
|
||||
updateState();
|
||||
}
|
||||
|
||||
void QtDirWidget::browse()
|
||||
void QtDirWidget::onQtBrowsed()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select QTDIR"));
|
||||
|
||||
const QString dir = m_ui.qtPath->path();
|
||||
if (dir.isEmpty())
|
||||
return;
|
||||
|
||||
dir = QDir::toNativeSeparators(dir);
|
||||
m_ui.pathEdit->setText(dir);
|
||||
updateCurrentQtPath();
|
||||
if (m_ui.nameEdit->text().isEmpty() || m_ui.nameEdit->text() == m_specifyNameString) {
|
||||
QStringList dirSegments = dir.split(QDir::separator(), QString::SkipEmptyParts);
|
||||
@@ -569,14 +567,12 @@ void QtDirWidget::browse()
|
||||
updateState();
|
||||
}
|
||||
|
||||
void QtDirWidget::mingwBrowse()
|
||||
void QtDirWidget::onMingwBrowsed()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select MinGW Directory"));
|
||||
const QString dir = m_ui.mingwPath->path();
|
||||
if (dir.isEmpty())
|
||||
return;
|
||||
|
||||
dir = QDir::toNativeSeparators(dir);
|
||||
m_ui.mingwLineEdit->setText(dir);
|
||||
updateCurrentMingwDirectory();
|
||||
updateState();
|
||||
}
|
||||
@@ -647,7 +643,7 @@ void QtDirWidget::updateCurrentQtPath()
|
||||
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
|
||||
Q_ASSERT(currentItem);
|
||||
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
|
||||
m_versions[currentItemIndex]->setPath(m_ui.pathEdit->text());
|
||||
m_versions[currentItemIndex]->setPath(m_ui.qtPath->path());
|
||||
currentItem->setText(1, m_versions[currentItemIndex]->path());
|
||||
|
||||
showEnvironmentPage(currentItem);
|
||||
@@ -658,7 +654,7 @@ void QtDirWidget::updateCurrentMingwDirectory()
|
||||
QTreeWidgetItem *currentItem = m_ui.qtdirList->currentItem();
|
||||
Q_ASSERT(currentItem);
|
||||
int currentItemIndex = m_ui.qtdirList->indexOfTopLevelItem(currentItem);
|
||||
m_versions[currentItemIndex]->setMingwDirectory(m_ui.mingwLineEdit->text());
|
||||
m_versions[currentItemIndex]->setMingwDirectory(m_ui.mingwPath->path());
|
||||
}
|
||||
|
||||
void QtDirWidget::msvcVersionChanged()
|
||||
@@ -1075,7 +1071,7 @@ void QtVersion::updateMkSpec() const
|
||||
if (line.startsWith("QMAKESPEC_ORIGINAL")) {
|
||||
const QList<QByteArray> &temp = line.split('=');
|
||||
if (temp.size() == 2) {
|
||||
mkspec = temp.at(1);
|
||||
mkspec = temp.at(1).trimmed();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -149,8 +149,9 @@ private slots:
|
||||
void addQtDir();
|
||||
void removeQtDir();
|
||||
void updateState();
|
||||
void browse();
|
||||
void mingwBrowse();
|
||||
void makeMingwVisible(bool visible);
|
||||
void onQtBrowsed();
|
||||
void onMingwBrowsed();
|
||||
void defaultChanged(int index);
|
||||
void updateCurrentQtName();
|
||||
void updateCurrentQtPath();
|
||||
|
||||
@@ -109,16 +109,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="pathEdit"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QToolButton" name="browseButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="mingwLabel">
|
||||
<property name="text">
|
||||
@@ -126,16 +116,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="mingwLineEdit"/>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QToolButton" name="mingwBrowseButton">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QLabel" name="msvcLabel">
|
||||
<property name="text">
|
||||
@@ -153,6 +133,12 @@
|
||||
<item row="5" column="1" colspan="2">
|
||||
<widget class="QComboBox" name="msvcComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="Core::Utils::PathChooser" name="qtPath" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
<widget class="Core::Utils::PathChooser" name="mingwPath" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -179,34 +165,20 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Core::Utils::PathChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">utils/pathchooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>qtdirList</tabstop>
|
||||
<tabstop>delButton</tabstop>
|
||||
<tabstop>nameEdit</tabstop>
|
||||
<tabstop>pathEdit</tabstop>
|
||||
<tabstop>defaultCombo</tabstop>
|
||||
<tabstop>browseButton</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../libs/cplusplus/cplusplus.qrc"/>
|
||||
<include location="../../libs/extensionsystem/pluginview.qrc"/>
|
||||
<include location="../bookmarks/bookmarks.qrc"/>
|
||||
<include location="../coreplugin/core.qrc"/>
|
||||
<include location="../coreplugin/fancyactionbar.qrc"/>
|
||||
<include location="../cppeditor/cppeditor.qrc"/>
|
||||
<include location="../cpptools/cpptools.qrc"/>
|
||||
<include location="../designer/designer.qrc"/>
|
||||
<include location="../find/find.qrc"/>
|
||||
<include location="../gdbdebugger/gdbdebugger.qrc"/>
|
||||
<include location="../help/help.qrc"/>
|
||||
<include location="../perforce/perforce.qrc"/>
|
||||
<include location="../projectexplorer/projectexplorer.qrc"/>
|
||||
<include location="../../../shared/proparser/proparser.qrc"/>
|
||||
<include location="qt4projectmanager.qrc"/>
|
||||
<include location="wizards/wizards.qrc"/>
|
||||
<include location="../quickopen/quickopen.qrc"/>
|
||||
<include location="../resourceeditor/resourceeditor.qrc"/>
|
||||
<include location="../texteditor/texteditor.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<plugin name="QtScriptEditor" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="QtScriptEditor" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Editor for QtScript.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<plugin name="QuickOpen" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="QuickOpen" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Provides the QuickOpen widget and the hooks for QuickOpen filter implementations.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -451,14 +451,25 @@ void QuickOpenToolWindow::show(const QString &text, int selectionStart, int sele
|
||||
|
||||
void QuickOpenToolWindow::filterSelected()
|
||||
{
|
||||
const char * const TEXT = "<type here>";
|
||||
QString searchText = "<type here>";
|
||||
QAction *action = qobject_cast<QAction*>(sender());
|
||||
QTC_ASSERT(action, return);
|
||||
IQuickOpenFilter *filter = action->data().value<IQuickOpenFilter*>();
|
||||
QTC_ASSERT(filter, return);
|
||||
show(filter->shortcutString() + " " + TEXT,
|
||||
QString currentText = m_fileLineEdit->text().trimmed();
|
||||
// add shortcut string at front or replace existing shortcut string
|
||||
if (!currentText.isEmpty()) {
|
||||
searchText = currentText;
|
||||
foreach (IQuickOpenFilter *otherfilter, m_quickOpenPlugin->filter()) {
|
||||
if (currentText.startsWith(otherfilter->shortcutString() + " ")) {
|
||||
searchText = currentText.mid(otherfilter->shortcutString().length()+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
show(filter->shortcutString() + " " + searchText,
|
||||
filter->shortcutString().length() + 1,
|
||||
QString(TEXT).length());
|
||||
searchText.length());
|
||||
updateCompletionList(m_fileLineEdit->text());
|
||||
m_fileLineEdit->setFocus();
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<plugin name="RegExp" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="RegExp" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Regular Expression test widget.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<plugin name="ResourceEditor" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="ResourceEditor" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Editor for qrc files.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="Snippets" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Snippets" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Code snippet plugin.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<plugin name="Subversion" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="Subversion" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Subversion integration.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="VCSBase" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="VCSBase" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="TextEditor" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="TextEditor" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Text editor framework and the implementation of the basic text editor.</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="Find" version="0.9.1"/>
|
||||
<dependency name="QuickOpen" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="Find" version="0.9.2"/>
|
||||
<dependency name="QuickOpen" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
@@ -1603,7 +1603,6 @@ namespace TextEditor {
|
||||
int firstColumn;
|
||||
int lastColumn;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,9 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QDesktopWidget>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
#include <limits.h>
|
||||
@@ -130,6 +131,8 @@ CompletionWidget::CompletionWidget(CompletionSupport *support, ITextEditable *ed
|
||||
layout->addWidget(this);
|
||||
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_popupFrame->setMinimumSize(1, 1);
|
||||
setMinimumSize(1, 1);
|
||||
}
|
||||
|
||||
bool CompletionWidget::event(QEvent *e)
|
||||
@@ -227,20 +230,15 @@ void CompletionWidget::setCompletionItems(const QList<TextEditor::CompletionItem
|
||||
|
||||
void CompletionWidget::showCompletions(int startPos)
|
||||
{
|
||||
const QPoint &pos = m_editor->cursorRect(startPos).bottomLeft();
|
||||
m_popupFrame->move(pos.x() - 16, pos.y());
|
||||
m_popupFrame->setMinimumSize(1, 1);
|
||||
setMinimumSize(1, 1);
|
||||
|
||||
updateSize();
|
||||
|
||||
updatePositionAndSize(startPos);
|
||||
m_popupFrame->show();
|
||||
show();
|
||||
setFocus();
|
||||
}
|
||||
|
||||
void CompletionWidget::updateSize()
|
||||
void CompletionWidget::updatePositionAndSize(int startPos)
|
||||
{
|
||||
// Determine size by calculating the space of the visible items
|
||||
int visibleItems = m_model->rowCount();
|
||||
if (visibleItems > NUMBER_OF_VISIBLE_ITEMS)
|
||||
visibleItems = NUMBER_OF_VISIBLE_ITEMS;
|
||||
@@ -254,10 +252,29 @@ void CompletionWidget::updateSize()
|
||||
shint = tmp;
|
||||
}
|
||||
|
||||
const int width = (shint.width() + (m_popupFrame->frameWidth() * 2) + 30);
|
||||
const int height = (shint.height() * visibleItems) + m_popupFrame->frameWidth() * 2;
|
||||
const int frameWidth = m_popupFrame->frameWidth();
|
||||
const int width = shint.width() + frameWidth * 2 + 30;
|
||||
const int height = shint.height() * visibleItems + frameWidth * 2;
|
||||
|
||||
m_popupFrame->resize(width, height);
|
||||
// Determine the position, keeping the popup on the screen
|
||||
const QRect cursorRect = m_editor->cursorRect(startPos);
|
||||
const QDesktopWidget *desktop = QApplication::desktop();
|
||||
#ifdef Q_OS_MAC
|
||||
const QRect screen = desktop->availableGeometry(desktop->screenNumber(m_editorWidget));
|
||||
#else
|
||||
const QRect screen = desktop->screenGeometry(desktop->screenNumber(m_editorWidget));
|
||||
#endif
|
||||
|
||||
QPoint pos = cursorRect.bottomLeft();
|
||||
pos.rx() -= 16 + frameWidth; // Space for the icons
|
||||
|
||||
if (pos.y() + height > screen.bottom())
|
||||
pos.setY(cursorRect.top() - height);
|
||||
|
||||
if (pos.x() + width > screen.right())
|
||||
pos.setX(screen.right() - width);
|
||||
|
||||
m_popupFrame->setGeometry(pos.x(), pos.y(), width, height);
|
||||
}
|
||||
|
||||
void CompletionWidget::completionActivated(const QModelIndex &index)
|
||||
|
||||
@@ -74,7 +74,7 @@ private slots:
|
||||
void completionActivated(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
void updateSize();
|
||||
void updatePositionAndSize(int startPos);
|
||||
|
||||
QPointer<QFrame> m_popupFrame;
|
||||
bool m_blockFocusOut;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<plugin name="VCSBase" version="0.9.1" compatVersion="0.9.1">
|
||||
<plugin name="VCSBase" version="0.9.2" compatVersion="0.9.2">
|
||||
<vendor>Nokia Corporation</vendor>
|
||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||
<license>Nokia Beta Version License</license>
|
||||
<description>Version Control System Base Plugin</description>
|
||||
<url>http://www.trolltech.com/</url>
|
||||
<dependencyList>
|
||||
<dependency name="Core" version="0.9.1"/>
|
||||
<dependency name="TextEditor" version="0.9.1"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.1"/>
|
||||
<dependency name="Core" version="0.9.2"/>
|
||||
<dependency name="TextEditor" version="0.9.2"/>
|
||||
<dependency name="ProjectExplorer" version="0.9.2"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
||||
Reference in New Issue
Block a user