Merge remote-tracking branch 'origin/2.3'

This commit is contained in:
con
2011-06-30 09:13:40 +02:00
39 changed files with 564 additions and 600 deletions

View File

@@ -294,6 +294,9 @@ void GraphicsObjectNodeInstance::paintUpdate()
bool GraphicsObjectNodeInstance::isMovable() const
{
if (isRootNodeInstance())
return false;
return m_isMovable && graphicsObject() && graphicsObject()->parentItem();
}

View File

@@ -204,6 +204,9 @@ void QmlGraphicsItemNodeInstance::doComponentComplete()
bool QmlGraphicsItemNodeInstance::isResizable() const
{
if (isRootNodeInstance())
return false;
return m_isResizable && qmlGraphicsItem() && qmlGraphicsItem()->parentItem();
}

View File

@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
new QmlDesigner::Qt4NodeInstanceClientProxy(&application);
#if defined(Q_OS_WIN) && defined(QT_NO_DEBUG)
#if defined(Q_OS_WIN) && defined(QT_NO_DEBUG) && !defined(ENABLE_QT_BREAKPAD)
SetErrorMode(SEM_NOGPFAULTERRORBOX); //We do not want to see any message boxes
#endif

View File

@@ -23368,7 +23368,7 @@ a = a +
</message>
<message>
<source>Would you like to delete the remote &quot;%1&quot;?</source>
<translation>Möchten Sie den &apos;%1&apos; löschen?</translation>
<translation>Möchten Sie &apos;%1&apos; löschen?</translation>
</message>
</context>
<context>

View File

@@ -830,7 +830,11 @@ bool QStyleItem::eventFilter(QObject *o, QEvent *e) {
void QStyleItem::showToolTip(const QString &str)
{
QPointF scene = mapToScene(width() - 20, 0);
QPoint global = qApp->focusWidget()->mapToGlobal(scene.toPoint());
QWidget *focusWidget = qApp->focusWidget();
if (!focusWidget)
return;
QPoint global = focusWidget->mapToGlobal(scene.toPoint());
QToolTip::showText(QPoint(global.x(), global.y()), str);
}

View File

@@ -1,7 +0,0 @@
import QtQuick 1.0
Rectangle {
width: 200; height: 200
color: "blue"
}

View File

@@ -1,4 +1,5 @@
import Qt 4.7
import "../components/" as Components
Item {
id: root
@@ -50,10 +51,17 @@ Item {
Image { id: icon; source: blogIcon; asynchronous: true }
Text { id: heading2; text: blogName; font.italic: true; wrapMode: Text.WrapAtWordBoundaryOrAnywhere; textFormat: Text.RichText; width: parent.width-icon.width-5 }
}
Text { id: text; text: description; wrapMode: Text.WrapAtWordBoundaryOrAnywhere; textFormat: Text.RichText ; width: parent.width-10 }
Text {
id: text;
text: description;
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
textFormat: Text.RichText
width: parent.width-10
}
Text { visible: link !== ""; id: readmore; text: qsTr("Click to read more..."); font.italic: true; wrapMode: Text.WrapAtWordBoundaryOrAnywhere; textFormat: Text.RichText }
}
MouseArea { anchors.fill: parent; onClicked: Qt.openUrlExternally(link); hoverEnabled: true; id: mouseArea }
Components.QStyleItem { id: styleItem; cursor: "pointinghandcursor"; anchors.fill: column }
MouseArea { anchors.fill: column; onClicked: Qt.openUrlExternally(link); hoverEnabled: true; id: mouseArea }
StateGroup {
id: activeState

View File

@@ -35,7 +35,7 @@ HeaderItemView {
anchors.leftMargin: 10
}
Timer { id: timer; interval: 500; onTriggered: { styleItem.showToolTip(sessionName); print("triggered")} }
Timer { id: timer; interval: 500; onTriggered: styleItem.showToolTip(sessionName) }
MouseArea {
anchors.fill: parent

View File

@@ -57,14 +57,9 @@ const char * const C_ANALYZEMODE = "Analyzer.AnalyzeMode";
// menu
const char * const M_DEBUG_ANALYZER = "Analyzer.Menu.StartAnalyzer";
const char * const G_ANALYZER_STARTSTOP = "Menu.Group.Analyzer.StartStop";
const char * const G_ANALYZER_TOOLS = "Menu.Group.Analyzer.Tools";
const char * const START = "Analyzer.Start";
const char * const STARTREMOTE = "Analyzer.StartRemote";
const char * const STOP = "Analyzer.Stop";
const char * const ANALYZER_TOOLS = "Menu.Action.Analyzer.Tools.";
const char * const ANALYZER_TOOLS_SEPARATOR = "Menu.Action.Analyzer.Tools.Separator";
// options dialog
const char * const ANALYZER_SETTINGS_CATEGORY = "T.Analyzer";

View File

@@ -104,32 +104,10 @@ using namespace Analyzer::Internal;
namespace Analyzer {
namespace Internal {
class DockWidgetEventFilter : public QObject
{
Q_OBJECT
public:
explicit DockWidgetEventFilter(QObject *parent = 0) : QObject(parent) {}
signals:
void widgetResized();
protected:
virtual bool eventFilter(QObject *obj, QEvent *event);
};
bool DockWidgetEventFilter::eventFilter(QObject *obj, QEvent *event)
{
switch (event->type()) {
case QEvent::Resize:
case QEvent::ZOrderChange:
emit widgetResized();
break;
default:
break;
}
return QObject::eventFilter(obj, event);
}
const char lastActiveToolC[] = "Analyzer.Plugin.LastActiveTool";
const char G_ANALYZER_TOOLS[] = "Menu.Group.Analyzer.Tools";
const char G_ANALYZER_REMOTE_TOOLS[] = "Menu.Group.Analyzer.RemoteTools";
const char INITIAL_DOCK_AREA[] = "initial_dock_area";
// AnalyzerMode ////////////////////////////////////////////////////
@@ -163,15 +141,19 @@ public:
}
};
const char * const INITIAL_DOCK_AREA = "initial_dock_area";
} // namespace Internal
} // namespace Analyzer
// AnalyzerManagerPrivate ////////////////////////////////////////////////////
class AnalyzerManager::AnalyzerManagerPrivate
////////////////////////////////////////////////////////////////////
//
// AnalyzerManagerPrivate
//
////////////////////////////////////////////////////////////////////
class AnalyzerManager::AnalyzerManagerPrivate : public QObject
{
Q_OBJECT
public:
typedef QHash<QString, QVariant> FancyMainWindowSettings;
@@ -179,7 +161,7 @@ public:
~AnalyzerManagerPrivate();
/**
* After calling this, a proper instance of Core::IMore is initialized
* After calling this, a proper instance of Core::IMode is initialized
* It is delayed since an analyzer mode makes no sense without analyzer tools
*
* \note Call this before adding a tool to the manager
@@ -189,24 +171,50 @@ public:
void setupActions();
QWidget *createModeContents();
QWidget *createModeMainWindow();
bool showPromptDialog(const QString &title,
const QString &text,
const QString &stopButtonText,
const QString &cancelButtonText) const;
bool showPromptDialog(const QString &title, const QString &text,
const QString &stopButtonText, const QString &cancelButtonText) const;
void addDock(Qt::DockWidgetArea area, QDockWidget *dockWidget);
void startTool();
void startAction(int tool);
void addTool(IAnalyzerTool *tool);
void addToolAction(IAnalyzerTool *tool, bool local);
int indexOf(IAnalyzerTool *tool) const;
int indexOf(QAction *action) const;
IAnalyzerTool *toolAt(int idx) const;
public slots:
void startAction() { startAction(m_currentIndex); }
void startToolRemote();
void stopTool();
void handleToolFinished();
void selectAction();
void selectAction(int);
void selectAction(QAction *);
void modeChanged(Core::IMode *mode);
void runControlCreated(Analyzer::AnalyzerRunControl *);
void resetLayout();
void saveToolSettings(Analyzer::IAnalyzerTool *tool);
void loadToolSettings(Analyzer::IAnalyzerTool *tool);
void updateRunActions();
void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory);
public:
struct ToolData {
IAnalyzerTool *tool;
QAction *action;
bool local;
};
AnalyzerManager *q;
AnalyzerMode *m_mode;
AnalyzerRunControlFactory *m_runControlFactory;
ProjectExplorer::RunControl *m_currentRunControl;
Utils::FancyMainWindow *m_mainWindow;
IAnalyzerTool *m_currentTool;
int m_currentIndex;
QList<ToolData> m_actions;
QList<IAnalyzerTool *> m_tools;
QActionGroup *m_toolGroup;
QAction *m_startAction;
QAction *m_startRemoteAction;
QAction *m_stopAction;
ActionContainer *m_menu;
QComboBox *m_toolBox;
@@ -215,8 +223,6 @@ public:
Utils::StatusLabel *m_statusLabel;
typedef QMap<IAnalyzerTool *, FancyMainWindowSettings> MainWindowSettingsMap;
QMap<IAnalyzerTool *, QList<QDockWidget *> > m_toolWidgets;
DockWidgetEventFilter *m_resizeEventFilter;
MainWindowSettingsMap m_defaultSettings;
// list of dock widgets to prevent memory leak
@@ -233,29 +239,30 @@ AnalyzerManager::AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager
m_runControlFactory(0),
m_currentRunControl(0),
m_mainWindow(0),
m_currentTool(0),
m_toolGroup(0),
m_currentIndex(-1),
m_startAction(0),
m_startRemoteAction(0),
m_stopAction(0),
m_menu(0),
m_toolBox(new QComboBox),
m_controlsWidget(new QStackedWidget),
m_viewsMenu(0),
m_statusLabel(new Utils::StatusLabel),
m_resizeEventFilter(new DockWidgetEventFilter(qq)),
m_restartOnStop(false),
m_initialized(false)
{
m_toolBox->setObjectName(QLatin1String("AnalyzerManagerToolBox"));
connect(m_toolBox, SIGNAL(currentIndexChanged(int)), SLOT(selectAction(int)));
m_runControlFactory = new AnalyzerRunControlFactory();
q->registerRunControlFactory(m_runControlFactory);
connect(m_toolBox, SIGNAL(currentIndexChanged(int)),
q, SLOT(toolSelected(int)));
registerRunControlFactory(m_runControlFactory);
setupActions();
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(modeChanged(Core::IMode*)));
ProjectExplorer::ProjectExplorerPlugin *pe =
ProjectExplorer::ProjectExplorerPlugin::instance();
connect(pe, SIGNAL(updateRunActions()), SLOT(updateRunActions()));
}
AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
@@ -268,11 +275,12 @@ AnalyzerManager::AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
}
}
void AnalyzerManager::registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory)
void AnalyzerManager::AnalyzerManagerPrivate::registerRunControlFactory
(ProjectExplorer::IRunControlFactory *factory)
{
AnalyzerPlugin::instance()->addAutoReleasedObject(factory);
connect(factory, SIGNAL(runControlCreated(Analyzer::AnalyzerRunControl *)),
this, SLOT(runControlCreated(Analyzer::AnalyzerRunControl *)));
connect(factory, SIGNAL(runControlCreated(Analyzer::AnalyzerRunControl*)),
this, SLOT(runControlCreated(Analyzer::AnalyzerRunControl*)));
}
void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
@@ -282,14 +290,13 @@ void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
const Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::Command *command = 0;
m_menu = am->createMenu(Constants::M_DEBUG_ANALYZER);
// Menus
m_menu = am->createMenu(Constants::M_DEBUG_ANALYZER);
m_menu->menu()->setTitle(tr("&Analyze"));
m_menu->menu()->setEnabled(true);
m_menu->appendGroup(Constants::G_ANALYZER_STARTSTOP);
m_menu->appendGroup(Constants::G_ANALYZER_TOOLS);
m_menu->appendGroup(G_ANALYZER_TOOLS);
m_menu->appendGroup(G_ANALYZER_REMOTE_TOOLS);
Core::ActionContainer *menubar =
am->actionContainer(Core::Constants::MENU_BAR);
@@ -297,37 +304,22 @@ void AnalyzerManager::AnalyzerManagerPrivate::setupActions()
am->actionContainer(Core::Constants::M_TOOLS);
menubar->addMenu(mtools, m_menu);
m_toolGroup = new QActionGroup(m_menu);
connect(m_toolGroup, SIGNAL(triggered(QAction*)),
q, SLOT(toolSelected(QAction*)));
m_startAction = new QAction(tr("Start"), m_menu);
m_startAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_START_ICON));
command = am->registerAction(m_startAction, Constants::START, globalcontext);
m_menu->addAction(command, Constants::G_ANALYZER_STARTSTOP);
connect(m_startAction, SIGNAL(triggered()), q, SLOT(startTool()));
m_startRemoteAction = new QAction(tr("Start Remote"), m_menu);
m_startRemoteAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_START_ICON));
///FIXME: get an icon for this
// m_startRemoteAction->setIcon(QIcon(QLatin1String(":/images/analyzer_start_remote_small.png")));
command = am->registerAction(m_startRemoteAction,
Constants::STARTREMOTE, globalcontext);
m_menu->addAction(command, Constants::G_ANALYZER_STARTSTOP);
connect(m_startRemoteAction, SIGNAL(triggered()), q, SLOT(startToolRemote()));
connect(m_startAction, SIGNAL(triggered()), this, SLOT(startAction()));
m_stopAction = new QAction(tr("Stop"), m_menu);
m_stopAction->setEnabled(false);
m_stopAction->setIcon(QIcon(Constants::ANALYZER_CONTROL_STOP_ICON));
command = am->registerAction(m_stopAction, Constants::STOP, globalcontext);
m_menu->addAction(command, Constants::G_ANALYZER_STARTSTOP);
connect(m_stopAction, SIGNAL(triggered()), q, SLOT(stopTool()));
connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stopTool()));
QAction *separatorAction = new QAction(m_menu);
separatorAction->setSeparator(true);
command = am->registerAction(separatorAction, Constants::ANALYZER_TOOLS_SEPARATOR, globalcontext);
m_menu->addAction(command, Constants::G_ANALYZER_TOOLS);
command = am->registerAction(separatorAction,
"Menu.Action.Analyzer.Tools.Separator", globalcontext);
m_menu->addAction(command, G_ANALYZER_REMOTE_TOOLS);
m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
}
@@ -374,12 +366,11 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow()
{
m_mainWindow = new Utils::FancyMainWindow();
m_mainWindow->setObjectName(QLatin1String("AnalyzerManagerMainWindow"));
connect(m_mainWindow, SIGNAL(resetLayout()),
q, SLOT(resetLayout()));
m_mainWindow->setDocumentMode(true);
m_mainWindow->setDockNestingEnabled(true);
m_mainWindow->setDockActionsVisible(ModeManager::instance()->currentMode()->id() ==
Constants::MODE_ANALYZE);
connect(m_mainWindow, SIGNAL(resetLayout()), SLOT(resetLayout()));
QBoxLayout *editorHolderLayout = new QVBoxLayout;
editorHolderLayout->setMargin(0);
@@ -402,7 +393,6 @@ QWidget *AnalyzerManager::AnalyzerManagerPrivate::createModeMainWindow()
analyzeToolBarLayout->setMargin(0);
analyzeToolBarLayout->setSpacing(0);
analyzeToolBarLayout->addWidget(toolButton(m_startAction));
analyzeToolBarLayout->addWidget(toolButton(m_startRemoteAction));
analyzeToolBarLayout->addWidget(toolButton(m_stopAction));
analyzeToolBarLayout->addWidget(new Utils::StyledSeparator);
analyzeToolBarLayout->addWidget(m_toolBox);
@@ -487,9 +477,37 @@ bool AnalyzerManager::AnalyzerManagerPrivate::showPromptDialog(const QString &ti
return messageBox.clickedStandardButton() == QDialogButtonBox::Yes;
}
void AnalyzerManager::AnalyzerManagerPrivate::startTool()
void AnalyzerManager::AnalyzerManagerPrivate::startToolRemote()
{
QTC_ASSERT(q->currentTool(), return);
StartRemoteDialog dlg;
if (dlg.exec() != QDialog::Accepted)
return;
AnalyzerStartParameters sp;
sp.connParams = dlg.sshParams();
sp.debuggee = dlg.executable();
sp.debuggeeArgs = dlg.arguments();
sp.displayName = dlg.executable();
sp.startMode = StartRemote;
sp.workingDirectory = dlg.workingDirectory();
AnalyzerRunControl *runControl = m_runControlFactory->create(sp, 0);
QTC_ASSERT(runControl, return);
ProjectExplorer::ProjectExplorerPlugin::instance()
->startRunControl(runControl, Constants::MODE_ANALYZE);
}
void AnalyzerManager::AnalyzerManagerPrivate::startAction(int index)
{
QTC_ASSERT(index >= 0, return);
QTC_ASSERT(index < m_actions.size(), return);
QTC_ASSERT(index == m_currentIndex, return);
if (!m_actions.at(index).local) {
startToolRemote();
return;
}
// make sure mode is shown
q->showMode();
@@ -511,11 +529,13 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
if (!runConfig || !runConfig->isEnabled())
return;
// check if there already is an analyzer run
// Check if there already is an analyzer run.
if (m_currentRunControl) {
// ask if user wants to restart the analyzer
const QString msg = tr("<html><head/><body><center><i>%1</i> is still running. You have to quit the Analyzer before being able to run another instance.<center/>"
"<center>Force it to quit?</center></body></html>").arg(m_currentRunControl->displayName());
const QString msg = tr("<html><head/><body><center><i>%1</i> is still running. "
"You have to quit the Analyzer before being able to run another instance."
"<center/><center>Force it to quit?</center></body></html>")
.arg(m_currentRunControl->displayName());
bool stopRequested = showPromptDialog(tr("Analyzer Still Running"), msg,
tr("Stop Active Run"), tr("Keep Running"));
if (!stopRequested)
@@ -523,18 +543,18 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
// user selected to stop the active run. stop it, activate restart on stop
m_restartOnStop = true;
q->stopTool();
stopTool();
return;
}
IAnalyzerTool::ToolMode toolMode = q->currentTool()->mode();
IAnalyzerTool *tool = toolAt(index);
IAnalyzerTool::ToolMode toolMode = tool->mode();
// check the project for whether the build config is in the correct mode
// if not, notify the user and urge him to use the correct mode
if (!buildTypeAccepted(toolMode, buildType))
{
const QString &toolName = q->currentTool()->displayName();
const QString &toolMode = IAnalyzerTool::modeString(q->currentTool()->mode());
// Check the project for whether the build config is in the correct mode
// if not, notify the user and urge him to use the correct mode.
if (!buildTypeAccepted(toolMode, buildType)) {
const QString &toolName = tool->displayName();
const QString &toolMode = IAnalyzerTool::modeString(tool->mode());
const QString currentMode = buildType == ProjectExplorer::BuildConfiguration::Debug ? tr("Debug") : tr("Release");
QSettings *settings = Core::ICore::instance()->settings();
@@ -565,84 +585,48 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool()
pe->runProject(pro, Constants::MODE_ANALYZE);
q->updateRunActions();
updateRunActions();
}
// AnalyzerManager ////////////////////////////////////////////////////
AnalyzerManager *AnalyzerManager::m_instance = 0;
AnalyzerManager::AnalyzerManager(QObject *parent)
: QObject(parent),
d(new AnalyzerManagerPrivate(this))
void AnalyzerManager::AnalyzerManagerPrivate::stopTool()
{
m_instance = this;
if (m_currentRunControl)
return;
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(modeChanged(Core::IMode*)));
ProjectExplorer::ProjectExplorerPlugin *pe =
ProjectExplorer::ProjectExplorerPlugin::instance();
connect(pe, SIGNAL(updateRunActions()),
this, SLOT(updateRunActions()));
// be sure to call handleToolFinished only once, and only when the engine is really finished
if (m_currentRunControl->stop() == ProjectExplorer::RunControl::StoppedSynchronously)
handleToolFinished();
// else: wait for the finished() signal to trigger handleToolFinished()
}
AnalyzerManager::~AnalyzerManager()
void AnalyzerManager::AnalyzerManagerPrivate::modeChanged(IMode *mode)
{
delete d;
}
bool AnalyzerManager::isInitialized() const
{
return d->m_initialized;
}
void AnalyzerManager::shutdown()
{
saveToolSettings(currentTool());
}
AnalyzerManager * AnalyzerManager::instance()
{
return m_instance;
}
void AnalyzerManager::modeChanged(IMode *mode)
{
if (!d->m_mainWindow)
if (!m_mainWindow)
return;
const bool makeVisible = mode->id() == Constants::MODE_ANALYZE;
if (!makeVisible)
return;
d->m_mainWindow->setDockActionsVisible(makeVisible);
m_mainWindow->setDockActionsVisible(makeVisible);
}
void AnalyzerManager::selectTool(IAnalyzerTool *tool)
void AnalyzerManager::AnalyzerManagerPrivate::selectAction(int idx)
{
QTC_ASSERT(d->m_tools.contains(tool), return);
toolSelected(d->m_tools.indexOf(tool));
}
void AnalyzerManager::toolSelected(int idx)
{
static bool selectingTool = false;
IAnalyzerTool *oldTool = currentTool();
IAnalyzerTool *newTool = d->m_tools.at(idx);
if (selectingTool || oldTool == newTool)
QTC_ASSERT(idx >= 0, return);
if (m_currentIndex == idx)
return;
selectingTool = true;
if (oldTool != 0) {
if (m_currentIndex != -1) {
IAnalyzerTool *oldTool = toolAt(m_currentIndex);
saveToolSettings(oldTool);
ActionManager *am = ICore::instance()->actionManager();
foreach (QDockWidget *widget, d->m_toolWidgets.value(oldTool)) {
foreach (QDockWidget *widget, m_toolWidgets.value(oldTool)) {
QAction *toggleViewAction = widget->toggleViewAction();
am->unregisterAction(toggleViewAction,
QString("Analyzer." + widget->objectName()));
d->m_mainWindow->removeDockWidget(widget);
m_mainWindow->removeDockWidget(widget);
///NOTE: QMainWindow (and FancyMainWindow) just look at
/// @c findChildren<QDockWidget*>()
///if we don't do this, all kind of havoc might happen, including:
@@ -651,68 +635,225 @@ void AnalyzerManager::toolSelected(int idx)
///- ...
widget->setParent(0);
}
oldTool->toolDeselected();
}
d->m_currentTool = newTool;
m_currentIndex = idx;
d->m_toolGroup->actions().at(idx)->setChecked(true);
d->m_toolBox->setCurrentIndex(idx);
d->m_controlsWidget->setCurrentIndex(idx);
m_toolBox->setCurrentIndex(idx);
m_controlsWidget->setCurrentIndex(idx);
const bool firstTime = !d->m_defaultSettings.contains(newTool);
IAnalyzerTool *newTool = toolAt(idx);
const bool firstTime = !m_defaultSettings.contains(newTool);
if (firstTime) {
newTool->initializeDockWidgets();
d->m_defaultSettings.insert(newTool, d->m_mainWindow->saveSettings());
m_defaultSettings.insert(newTool, m_mainWindow->saveSettings());
} else {
foreach (QDockWidget *widget, d->m_toolWidgets.value(newTool))
d->addDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget);
foreach (QDockWidget *widget, m_toolWidgets.value(newTool))
addDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget);
}
loadToolSettings(newTool);
updateRunActions();
selectingTool = false;
emit currentToolChanged(newTool);
}
void AnalyzerManager::toolSelected(QAction *action)
void AnalyzerManager::AnalyzerManagerPrivate::selectAction()
{
toolSelected(d->m_toolGroup->actions().indexOf(action));
selectAction(qobject_cast<QAction *>(sender()));
}
void AnalyzerManager::AnalyzerManagerPrivate::selectAction(QAction *action)
{
selectAction(indexOf(action));
}
int AnalyzerManager::AnalyzerManagerPrivate::indexOf(QAction *action) const
{
for (int i = 0; i != m_actions.size(); ++i)
if (m_actions.at(i).action == action)
return i;
return -1;
}
int AnalyzerManager::AnalyzerManagerPrivate::indexOf(IAnalyzerTool *tool) const
{
for (int i = 0; i != m_actions.size(); ++i)
if (toolAt(i) == tool)
return i;
return -1;
}
IAnalyzerTool *AnalyzerManager::AnalyzerManagerPrivate::toolAt(int idx) const
{
QTC_ASSERT(idx >= 0, return 0);
QTC_ASSERT(idx < m_actions.size(), return 0);
return m_actions.at(idx).tool;
}
void AnalyzerManager::AnalyzerManagerPrivate::addToolAction(IAnalyzerTool *tool, bool local)
{
ActionManager *am = Core::ICore::instance()->actionManager();
QString actionId = QString("Action.Analyzer.Tools.%1").arg(m_actions.size());
QString displayName = tool->displayName() + (local ? QString() : tr(" (Remote)"));
QAction *action = new QAction(displayName, 0);
ToolData data;
data.tool = tool;
data.local = local;
data.action = action;
m_actions.append(data);
Core::Command *command = am->registerAction(action, actionId,
Core::Context(Core::Constants::C_GLOBAL));
m_menu->addAction(command, local ? G_ANALYZER_TOOLS : G_ANALYZER_REMOTE_TOOLS);
connect(action, SIGNAL(triggered()), SLOT(selectAction()));
const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
m_toolBox->addItem(displayName);
m_toolBox->blockSignals(blocked);
m_toolBox->setEnabled(true);
}
void AnalyzerManager::AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool)
{
delayedInit(); // be sure that there is a valid IMode instance
m_tools.append(tool);
if (tool->canRunLocally())
addToolAction(tool, true);
if (tool->canRunRemotely())
addToolAction(tool, false);
// Populate controls widget.
QWidget *controlWidget = tool->createControlWidget(); // might be 0
m_controlsWidget->addWidget(controlWidget
? controlWidget : AnalyzerUtils::createDummyWidget());
tool->initialize();
}
void AnalyzerManager::AnalyzerManagerPrivate::runControlCreated(AnalyzerRunControl *rc)
{
QTC_ASSERT(!m_currentRunControl, /**/);
m_currentRunControl = rc;
connect(rc, SIGNAL(finished()), this, SLOT(handleToolFinished()));
}
void AnalyzerManager::AnalyzerManagerPrivate::handleToolFinished()
{
m_currentRunControl = 0;
updateRunActions();
if (m_restartOnStop) {
startAction(m_currentIndex);
m_restartOnStop = false;
}
}
void AnalyzerManager::AnalyzerManagerPrivate::loadToolSettings(IAnalyzerTool *tool)
{
QTC_ASSERT(m_mainWindow, return);
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id());
if (settings->value("ToolSettingsSaved", false).toBool())
m_mainWindow->restoreSettings(settings);
settings->endGroup();
}
void AnalyzerManager::AnalyzerManagerPrivate::saveToolSettings(IAnalyzerTool *tool)
{
if (!tool)
return; // no active tool, do nothing
QTC_ASSERT(m_mainWindow, return);
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id());
m_mainWindow->saveSettings(settings);
settings->setValue("ToolSettingsSaved", true);
settings->endGroup();
settings->setValue(QLatin1String(lastActiveToolC), tool->id());
}
void AnalyzerManager::AnalyzerManagerPrivate::updateRunActions()
{
ProjectExplorer::ProjectExplorerPlugin *pe =
ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Project *project = pe->startupProject();
bool startEnabled = !m_currentRunControl
&& pe->canRun(project, Constants::MODE_ANALYZE)
&& m_currentIndex >= 0;
QString disabledReason;
if (m_currentRunControl)
disabledReason = tr("An analysis is still in progress.");
else if (m_currentIndex == -1)
disabledReason = tr("No analyzer tool selected.");
else
disabledReason = pe->cannotRunReason(project, Constants::MODE_ANALYZE);
m_startAction->setEnabled(startEnabled);
m_startAction->setToolTip(disabledReason);
m_toolBox->setEnabled(!m_currentRunControl);
m_stopAction->setEnabled(m_currentRunControl);
}
////////////////////////////////////////////////////////////////////
//
// AnalyzerManager
//
////////////////////////////////////////////////////////////////////
static AnalyzerManager *m_instance = 0;
AnalyzerManager::AnalyzerManager(QObject *parent)
: QObject(parent),
d(new AnalyzerManagerPrivate(this))
{
m_instance = this;
}
AnalyzerManager::~AnalyzerManager()
{
delete d;
}
void AnalyzerManager::extensionsInitialized()
{
if (d->m_tools.isEmpty())
return;
const QSettings *settings = Core::ICore::instance()->settings();
const QString lastActiveToolId =
settings->value(QLatin1String(lastActiveToolC), QString()).toString();
int lastAction = 0;
foreach (IAnalyzerTool *tool, d->m_tools) {
tool->extensionsInitialized();
if (tool->id() == lastActiveToolId)
lastAction = d->indexOf(tool);
}
d->selectAction(lastAction);
}
void AnalyzerManager::shutdown()
{
d->saveToolSettings(d->m_actions[d->m_currentIndex].tool);
}
AnalyzerManager *AnalyzerManager::instance()
{
return m_instance;
}
void AnalyzerManager::registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory)
{
d->registerRunControlFactory(factory);
}
void AnalyzerManager::addTool(IAnalyzerTool *tool)
{
d->delayedInit(); // be sure that there is a valid IMode instance
QAction *action = new QAction(tool->displayName(), d->m_toolGroup);
action->setData(d->m_tools.count());
action->setCheckable(true);
action->setChecked(false);
ActionManager *am = Core::ICore::instance()->actionManager();
QString actionId = QString(Constants::ANALYZER_TOOLS)
+ QString::number(d->m_toolGroup->actions().count());
Core::Command *command = am->registerAction(action, actionId,
Core::Context(Core::Constants::C_GLOBAL));
d->m_menu->addAction(command, Constants::G_ANALYZER_TOOLS);
d->m_toolGroup->setVisible(d->m_toolGroup->actions().count() > 1);
d->m_tools.append(tool);
const bool blocked = d->m_toolBox->blockSignals(true); // Do not make current.
d->m_toolBox->addItem(tool->displayName());
d->m_toolBox->blockSignals(blocked);
// Populate controls widget.
QWidget *controlWidget = tool->createControlWidget(); // might be 0
d->m_controlsWidget->addWidget(controlWidget
? controlWidget : AnalyzerUtils::createDummyWidget());
d->m_toolBox->setEnabled(d->m_toolBox->count() > 1);
tool->initialize();
d->addTool(tool);
}
QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QString &title,
@@ -722,76 +863,29 @@ QDockWidget *AnalyzerManager::createDockWidget(IAnalyzerTool *tool, const QStrin
QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget);
dockWidget->setProperty(INITIAL_DOCK_AREA, int(area));
d->m_dockWidgets << AnalyzerManagerPrivate::DockPtr(dockWidget);
d->m_dockWidgets.append(AnalyzerManagerPrivate::DockPtr(dockWidget));
dockWidget->setWindowTitle(title);
d->m_toolWidgets[tool].push_back(dockWidget);
d->addDock(area, dockWidget);
dockWidget->installEventFilter(d->m_resizeEventFilter);
return dockWidget;
}
IAnalyzerTool *AnalyzerManager::currentTool() const
IAnalyzerEngine *AnalyzerManager::createEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
{
return d->m_currentTool;
IAnalyzerTool *tool = d->toolAt(d->m_currentIndex);
QTC_ASSERT(tool, return 0);
return tool->createEngine(sp, runConfiguration);
}
QList<IAnalyzerTool *> AnalyzerManager::tools() const
void AnalyzerManager::selectTool(IAnalyzerTool *tool)
{
return d->m_tools;
d->selectAction(d->indexOf(tool));
}
void AnalyzerManager::startTool()
void AnalyzerManager::startTool(IAnalyzerTool *tool)
{
d->startTool();
}
void AnalyzerManager::startToolRemote()
{
StartRemoteDialog dlg;
if (dlg.exec() != QDialog::Accepted)
return;
AnalyzerStartParameters params;
params.connParams = dlg.sshParams();
params.debuggee = dlg.executable();
params.debuggeeArgs = dlg.arguments();
params.displayName = dlg.executable();
params.startMode = StartRemote;
params.workingDirectory = dlg.workingDirectory();
AnalyzerRunControl *rc = createAnalyzer(params);
QTC_ASSERT(rc, return);
ProjectExplorer::ProjectExplorerPlugin::instance()->startRunControl(rc, Constants::MODE_ANALYZE);
}
void AnalyzerManager::runControlCreated(AnalyzerRunControl *rc)
{
QTC_ASSERT(!d->m_currentRunControl, qt_noop());
d->m_currentRunControl = rc;
connect(rc, SIGNAL(finished()), this, SLOT(handleToolFinished()));
}
void AnalyzerManager::stopTool()
{
if (!d->m_currentRunControl)
return;
// be sure to call handleToolFinished only once, and only when the engine is really finished
if (d->m_currentRunControl->stop() == ProjectExplorer::RunControl::StoppedSynchronously)
handleToolFinished();
// else: wait for the finished() signal to trigger handleToolFinished()
}
void AnalyzerManager::handleToolFinished()
{
d->m_currentRunControl = 0;
updateRunActions();
if (d->m_restartOnStop) {
startTool();
d->m_restartOnStop = false;
}
d->startAction(d->indexOf(tool));
}
Utils::FancyMainWindow *AnalyzerManager::mainWindow() const
@@ -799,64 +893,9 @@ Utils::FancyMainWindow *AnalyzerManager::mainWindow() const
return d->m_mainWindow;
}
void AnalyzerManager::resetLayout()
void AnalyzerManager::AnalyzerManagerPrivate::resetLayout()
{
d->m_mainWindow->restoreSettings(d->m_defaultSettings.value(currentTool()));
}
void AnalyzerManager::loadToolSettings(IAnalyzerTool *tool)
{
QTC_ASSERT(d->m_mainWindow, return; )
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id());
if (settings->value("ToolSettingsSaved", false).toBool()) {
d->m_mainWindow->restoreSettings(settings);
}
settings->endGroup();
}
void AnalyzerManager::saveToolSettings(IAnalyzerTool *tool)
{
if (!tool)
return; // no active tool, do nothing
QTC_ASSERT(d->m_mainWindow, return ; )
QSettings *settings = Core::ICore::instance()->settings();
settings->beginGroup(QLatin1String("AnalyzerViewSettings_") + tool->id());
d->m_mainWindow->saveSettings(settings);
settings->setValue("ToolSettingsSaved", true);
settings->endGroup();
}
void AnalyzerManager::updateRunActions()
{
ProjectExplorer::ProjectExplorerPlugin *pe =
ProjectExplorer::ProjectExplorerPlugin::instance();
ProjectExplorer::Project *project = pe->startupProject();
bool startEnabled = !d->m_currentRunControl
&& pe->canRun(project, Constants::MODE_ANALYZE)
&& currentTool();
QString disabledReason;
if (d->m_currentRunControl)
disabledReason = tr("An analysis is still in progress.");
else if (!currentTool())
disabledReason = tr("No analyzer tool selected.");
else
disabledReason = pe->cannotRunReason(project, Constants::MODE_ANALYZE);
d->m_startAction->setEnabled(startEnabled);
d->m_startAction->setToolTip(disabledReason);
if (currentTool() && !currentTool()->canRunRemotely())
disabledReason = tr("Current analyzer tool cannot be run remotely.");
d->m_startRemoteAction->setEnabled(!d->m_currentRunControl && currentTool()
&& currentTool()->canRunRemotely());
d->m_startRemoteAction->setToolTip(disabledReason);
d->m_toolBox->setEnabled(!d->m_currentRunControl);
d->m_toolGroup->setEnabled(!d->m_currentRunControl);
d->m_stopAction->setEnabled(d->m_currentRunControl);
m_mainWindow->restoreSettings(m_defaultSettings.value(toolAt(m_currentIndex)));
}
void AnalyzerManager::showStatusMessage(const QString &message, int timeoutMS)
@@ -881,16 +920,15 @@ QString AnalyzerManager::msgToolFinished(const QString &name, int issuesFound)
tr("Tool \"%1\" finished, no issues were found.").arg(name);
}
AnalyzerRunControl *AnalyzerManager::createAnalyzer(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *rc)
{
return d->m_runControlFactory->create(sp, rc);
}
void AnalyzerManager::showMode()
{
if (d->m_mode)
ModeManager::instance()->activateMode(d->m_mode->id());
}
void AnalyzerManager::stopTool()
{
d->stopTool();
}
#include "analyzermanager.moc"

View File

@@ -41,14 +41,9 @@
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
class QAction;
class QDockWidget;
QT_END_NAMESPACE
namespace Core {
class IMode;
}
namespace Utils {
class FancyMainWindow;
}
@@ -59,7 +54,7 @@ class RunConfiguration;
namespace Analyzer {
class IAnalyzerTool;
class AnalyzerRunControl;
class IAnalyzerEngine;
class AnalyzerStartParameters;
class ANALYZER_EXPORT AnalyzerManager : public QObject
@@ -73,15 +68,13 @@ public:
static AnalyzerManager *instance();
void registerRunControlFactory(ProjectExplorer::IRunControlFactory *factory);
bool isInitialized() const;
void extensionsInitialized();
void shutdown();
/**
* Register a tool and initialize it.
*/
void addTool(Analyzer::IAnalyzerTool *tool);
IAnalyzerTool *currentTool() const;
QList<IAnalyzerTool *> tools() const;
// Dockwidgets are registered to the main window.
QDockWidget *createDockWidget(IAnalyzerTool *tool, const QString &title,
@@ -89,44 +82,25 @@ public:
Utils::FancyMainWindow *mainWindow() const;
void showMode();
void selectTool(IAnalyzerTool *tool);
void startTool(IAnalyzerTool *tool);
void stopTool();
static QString msgToolStarted(const QString &name);
static QString msgToolFinished(const QString &name, int issuesFound);
// Used by Maemo analyzer support.
AnalyzerRunControl *createAnalyzer(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *rc = 0);
void showMode();
IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration);
public slots:
void startTool();
void startToolRemote();
void stopTool();
void showStatusMessage(const QString &message, int timeoutMS = 10000);
void showPermanentStatusMessage(const QString &message);
private slots:
void handleToolFinished();
void toolSelected(int);
void toolSelected(QAction *);
void modeChanged(Core::IMode *mode);
void runControlCreated(Analyzer::AnalyzerRunControl *);
void resetLayout();
void saveToolSettings(Analyzer::IAnalyzerTool *tool);
void loadToolSettings(Analyzer::IAnalyzerTool *tool);
void updateRunActions();
signals:
void currentToolChanged(Analyzer::IAnalyzerTool *tool);
private:
class AnalyzerManagerPrivate;
friend class AnalyzerManagerPrivate;
AnalyzerManagerPrivate *const d;
static AnalyzerManager *m_instance;
};
} // namespace Analyzer

View File

@@ -54,9 +54,7 @@
using namespace Analyzer;
using namespace Analyzer::Internal;
static const char lastActiveToolC[] = "Analyzer.Plugin.LastActiveTool";
AnalyzerPlugin *AnalyzerPlugin::m_instance = 0;
static AnalyzerPlugin *m_instance = 0;
////////////////////////////////////////////////////////////////////////
@@ -113,34 +111,11 @@ bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorStri
void AnalyzerPlugin::extensionsInitialized()
{
const QList<IAnalyzerTool *> tools = d->m_manager->tools();
if (tools.isEmpty())
return;
const QSettings *settings = Core::ICore::instance()->settings();
const QString lastActiveToolId =
settings->value(QLatin1String(lastActiveToolC), QString()).toString();
IAnalyzerTool *lastActiveTool = 0;
foreach (IAnalyzerTool *tool, tools) {
tool->extensionsInitialized();
if (tool->id() == lastActiveToolId)
lastActiveTool = tool;
}
if (!lastActiveTool)
lastActiveTool = tools.back();
if (lastActiveTool)
d->m_manager->selectTool(lastActiveTool);
d->m_manager->extensionsInitialized();
}
ExtensionSystem::IPlugin::ShutdownFlag AnalyzerPlugin::aboutToShutdown()
{
if (const IAnalyzerTool *tool = d->m_manager->currentTool()) {
QSettings *settings = Core::ICore::instance()->settings();
settings->setValue(QLatin1String(lastActiveToolC), tool->id());
}
d->m_manager->shutdown();
return SynchronousShutdown;
}

View File

@@ -38,7 +38,6 @@
#include <extensionsystem/iplugin.h>
namespace Analyzer {
namespace Internal {
class AnalyzerPlugin : public ExtensionSystem::IPlugin
@@ -59,8 +58,6 @@ public:
private:
class AnalyzerPluginPrivate;
AnalyzerPluginPrivate *d;
static AnalyzerPlugin *m_instance;
};
} // namespace Internal

View File

@@ -62,7 +62,7 @@ public:
};
AnalyzerRunControl::Private::Private()
: m_isRunning(false) , m_engine(0)
: m_isRunning(false), m_engine(0)
{}
@@ -72,8 +72,7 @@ AnalyzerRunControl::AnalyzerRunControl(const AnalyzerStartParameters &sp,
: RunControl(runConfiguration, Constants::MODE_ANALYZE),
d(new Private)
{
IAnalyzerTool *tool = AnalyzerManager::instance()->currentTool();
d->m_engine = tool->createEngine(sp, runConfiguration);
d->m_engine = AnalyzerManager::instance()->createEngine(sp, runConfiguration);
if (!d->m_engine)
return;

View File

@@ -62,7 +62,7 @@ class ANALYZER_EXPORT IAnalyzerEngine : public QObject
public:
explicit IAnalyzerEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
ProjectExplorer::RunConfiguration *runConfiguration = 0);
/// start analyzation process
virtual void start() = 0;

View File

@@ -112,8 +112,17 @@ public:
virtual IAnalyzerEngine *createEngine(const AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0) = 0;
/// Returns true when this tool can be run on the loca machine.
virtual bool canRunLocally() const = 0;
/// Returns true when this tool can be run on a remote machine.
virtual bool canRunRemotely() const = 0;
/// Called when tools gets selected.
virtual void toolSelected() const {}
/// Called when tools gets deselected.
virtual void toolDeselected() const {}
};
} // namespace Analyzer

View File

@@ -239,4 +239,8 @@ void AbstractFormEditorTool::showContextMenu(QGraphicsSceneMouseEvent *event)
view()->showContextMenu(event->screenPos(), event->scenePos().toPoint(), true);
}
void AbstractFormEditorTool::clear()
{
m_itemList.clear();
}
}

View File

@@ -77,7 +77,7 @@ public:
// QGraphicsItem::GraphicsItemChange change,
// const QVariant &value ) = 0;
// virtual void update() = 0;
virtual void clear() = 0;
virtual void clear();
virtual void formEditorItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
@@ -94,10 +94,9 @@ public:
static FormEditorItem* topFormEditorItem(const QList<QGraphicsItem*> &itemList);
static FormEditorItem* topFormEditorItemWithRootItem(const QList<QGraphicsItem*> &itemList);
protected:
virtual void selectedItemsChanged(const QList<FormEditorItem*> &itemList) = 0;
virtual void showContextMenu(QGraphicsSceneMouseEvent *event);
FormEditorView *view() const;

View File

@@ -66,7 +66,6 @@ DragTool::DragTool(FormEditorView *editorView)
m_blockMove(false),
m_Aborted(false)
{
// view()->setCursor(Qt::SizeAllCursor);
}

View File

@@ -135,7 +135,7 @@ void FormEditorView::nodeCreated(const ModelNode &createdNode)
QmlModelView::nodeCreated(createdNode);
ModelNode node(createdNode);
//If the node has source for components/custom parsers we ignore it.
if (QmlItemNode(node).isValid() && nextNode.modelNode().nodeSourceType() == ModelNode::NodeWithoutSource) //only setup QmlItems
if (QmlItemNode(node).isValid() && node.nodeSourceType() == ModelNode::NodeWithoutSource) //only setup QmlItems
setupFormEditorItemTree(QmlItemNode(node));
}
@@ -296,7 +296,6 @@ bool FormEditorView::changeToMoveTool()
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::SizeAllCursor);
m_currentTool->clear();
m_currentTool = m_moveTool;
m_currentTool->clear();
@@ -311,7 +310,6 @@ void FormEditorView::changeToDragTool()
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::ArrowCursor);
m_currentTool->clear();
m_currentTool = m_dragTool;
m_currentTool->clear();
@@ -329,7 +327,6 @@ bool FormEditorView::changeToMoveTool(const QPointF &beginPoint)
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::SizeAllCursor);
m_currentTool->clear();
m_currentTool = m_moveTool;
m_currentTool->clear();
@@ -345,7 +342,6 @@ void FormEditorView::changeToSelectionTool()
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::ArrowCursor);
m_currentTool->clear();
m_currentTool = m_selectionTool;
m_currentTool->clear();
@@ -359,7 +355,6 @@ void FormEditorView::changeToItemCreatorTool()
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::CrossCursor);
m_currentTool->clear();
m_currentTool = m_itemCreatorTool;
m_currentTool->clear();
@@ -374,7 +369,6 @@ void FormEditorView::changeToSelectionTool(QGraphicsSceneMouseEvent *event)
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::ArrowCursor);
m_currentTool->clear();
m_currentTool = m_selectionTool;
m_currentTool->clear();
@@ -390,7 +384,6 @@ void FormEditorView::changeToResizeTool()
scene()->setPaintMode(FormEditorScene::NormalMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::ArrowCursor);
m_currentTool->clear();
m_currentTool = m_resizeTool;
m_currentTool->clear();
@@ -404,7 +397,6 @@ void FormEditorView::changeToAnchorTool()
scene()->setPaintMode(FormEditorScene::AnchorMode);
m_scene->updateAllFormEditorItems();
setCursor(Qt::ArrowCursor);
m_currentTool->clear();
m_currentTool = m_anchorTool;
m_currentTool->clear();
@@ -421,11 +413,6 @@ void FormEditorView::changeToTransformTools()
changeToSelectionTool();
}
void FormEditorView::setCursor(const QCursor &cursor)
{
m_formEditorWidget->setCursor(cursor);
}
void FormEditorView::nodeSlidedToIndex(const NodeListProperty &listProperty, int /*newIndex*/, int /*oldIndex*/)
{
QList<ModelNode> newOrderModelNodeList = listProperty.toModelNodeList();

View File

@@ -100,8 +100,6 @@ public:
void changeToAnchorTool();
void changeToTransformTools();
void setCursor(const QCursor &cursor);
void nodeSlidedToIndex(const NodeListProperty &listProperty, int newIndex, int oldIndex);
void auxiliaryDataChanged(const ModelNode &node, const QString &name, const QVariant &data);

View File

@@ -70,7 +70,6 @@ void ItemCreatorTool::mousePressEvent(const QList<QGraphicsItem*> &/*itemList*/,
void ItemCreatorTool::mouseMoveEvent(const QList<QGraphicsItem*> &/*itemList*/,
QGraphicsSceneMouseEvent *event)
{
view()->setCursor(Qt::CrossCursor);
if (m_rubberbandSelectionManipulator.isActive()) {
m_rubberbandSelectionManipulator.update(event->scenePos());
} else {

View File

@@ -54,7 +54,7 @@ MoveTool::MoveTool(FormEditorView *editorView)
m_selectionIndicator(editorView->scene()->manipulatorLayerItem()),
m_resizeIndicator(editorView->scene()->manipulatorLayerItem())
{
// view()->setCursor(Qt::SizeAllCursor);
m_selectionIndicator.setCursor(Qt::SizeAllCursor);
}
@@ -69,6 +69,8 @@ void MoveTool::clear()
m_movingItems.clear();
m_selectionIndicator.clear();
m_resizeIndicator.clear();
AbstractFormEditorTool::clear();
}
void MoveTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,

View File

@@ -102,6 +102,7 @@ void SelectionIndicator::setItems(const QList<FormEditorItem*> &itemList)
QPen pen;
pen.setColor(QColor(108, 141, 221));
newSelectionIndicatorGraphicsItem->setPen(pen);
newSelectionIndicatorGraphicsItem->setCursor(m_cursor);
}
}
@@ -120,5 +121,13 @@ void SelectionIndicator::updateItems(const QList<FormEditorItem*> &itemList)
}
}
void SelectionIndicator::setCursor(const QCursor &cursor)
{
m_cursor = cursor;
foreach (QGraphicsItem *item, m_indicatorShapeHash.values())
item->setCursor(cursor);
}
}

View File

@@ -37,7 +37,7 @@
#include <QGraphicsPolygonItem>
#include "layeritem.h"
#include "formeditoritem.h"
#include <QCursor>
namespace QmlDesigner {
@@ -57,9 +57,12 @@ public:
void setItems(const QList<FormEditorItem*> &itemList);
void updateItems(const QList<FormEditorItem*> &itemList);
void setCursor(const QCursor &cursor);
private:
QHash<FormEditorItem*, QGraphicsPolygonItem *> m_indicatorShapeHash;
QWeakPointer<LayerItem> m_layerItem;
QCursor m_cursor;
};

View File

@@ -56,7 +56,7 @@ SelectionTool::SelectionTool(FormEditorView *editorView)
m_resizeIndicator(editorView->scene()->manipulatorLayerItem()),
m_selectOnlyContentItems(false)
{
// view()->setCursor(Qt::CrossCursor);
m_selectionIndicator.setCursor(Qt::ArrowCursor);
}
@@ -99,6 +99,7 @@ void SelectionTool::mousePressEvent(const QList<QGraphicsItem*> &itemList,
}
}
}
AbstractFormEditorTool::mousePressEvent(itemList, event);
}
@@ -254,6 +255,8 @@ void SelectionTool::clear()
m_singleSelectionManipulator.clear();
m_selectionIndicator.clear();
m_resizeIndicator.clear();
AbstractFormEditorTool::clear();
}
void SelectionTool::selectedItemsChanged(const QList<FormEditorItem*> &itemList)

View File

@@ -85,6 +85,8 @@ public:
void setSelectOnlyContentItems(bool selectOnlyContentItems);
void setCursor(const QCursor &cursor);
private:
RubberBandSelectionManipulator m_rubberbandSelectionManipulator;
SingleSelectionManipulator m_singleSelectionManipulator;
@@ -92,6 +94,7 @@ private:
ResizeIndicator m_resizeIndicator;
QTime m_mousePressTimer;
bool m_selectOnlyContentItems;
QCursor m_cursor;
};
}

View File

@@ -277,13 +277,10 @@ void QmlProfilerTool::initializeDockWidgets()
Core::Command *command = am->registerAction(d->m_attachAction,
Constants::ATTACH, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText);
manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP);
//manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP);
connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach()));
connect(analyzerMgr, SIGNAL(currentToolChanged(Analyzer::IAnalyzerTool*)),
this, SLOT(updateAttachAction()));
updateAttachAction();
updateAttachAction(false);
QDockWidget *summaryDock =
analyzerMgr->createDockWidget(this, tr("Bindings"),
@@ -307,6 +304,15 @@ void QmlProfilerTool::initializeDockWidgets()
mw->tabifyDockWidget(calleeDock, callerDock);
}
void QmlProfilerTool::toolSelected()
{
updateAttachAction(true);
}
void QmlProfilerTool::toolDeselected()
{
updateAttachAction(false);
}
QWidget *QmlProfilerTool::createControlWidget()
{
@@ -447,6 +453,11 @@ bool QmlProfilerTool::canRunRemotely() const
return true;
}
bool QmlProfilerTool::canRunLocally() const
{
return true;
}
void QmlProfilerTool::clearDisplay()
{
d->m_traceWindow->clearDisplay();
@@ -469,26 +480,21 @@ void QmlProfilerTool::attach()
connectClient(d->m_tcpPort);
AnalyzerManager::instance()->showMode();
//AnalyzerManager::instance()->popupOutputPane();
} else {
stopRecording();
}
d->m_isAttached = !d->m_isAttached;
updateAttachAction();
updateAttachAction(true);
}
void QmlProfilerTool::updateAttachAction()
void QmlProfilerTool::updateAttachAction(bool isCurrentTool)
{
if (d->m_attachAction) {
if (d->m_isAttached) {
d->m_attachAction->setText(tr("Detach"));
} else {
d->m_attachAction->setText(tr("Attach..."));
}
}
d->m_attachAction->setEnabled(Analyzer::AnalyzerManager::instance()->currentTool() == this);
if (d->m_isAttached)
d->m_attachAction->setText(tr("Detach"));
else
d->m_attachAction->setText(tr("Attach..."));
d->m_attachAction->setEnabled(isCurrentTool);
}
void QmlProfilerTool::tryToConnect()

View File

@@ -56,6 +56,8 @@ public:
void initialize();
void extensionsInitialized();
void initializeDockWidgets();
void toolSelected();
void toolDeselected();
Analyzer::IAnalyzerEngine *createEngine(const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration = 0);
@@ -63,6 +65,7 @@ public:
QWidget *createControlWidget();
bool canRunRemotely() const;
bool canRunLocally() const;
public slots:
void connectClient(int port);
@@ -85,11 +88,11 @@ signals:
private slots:
void updateProjectFileList();
void attach();
void updateAttachAction();
void tryToConnect();
void connectionStateChanged();
private:
void updateAttachAction(bool isCurrentTool);
void connectToClient();
void updateRecordingState();

View File

@@ -132,7 +132,6 @@ FORMS += makestep.ui \
librarydetailswidget.ui \
wizards/testwizardpage.ui \
wizards/targetsetuppage.ui \
wizards/qtquickappwizardsourcespage.ui \
wizards/html5appwizardsourcespage.ui \
wizards/mobilelibrarywizardoptionpage.ui \
wizards/mobileappwizardgenericoptionspage.ui \

View File

@@ -57,7 +57,6 @@ protected:
bool validateCurrentPage();
private:
class QtQuickAppWizardSourcesPage *m_qmlSourcesPage;
class QtQuickComponentSetOptionsPage *m_componentOptionsPage;
int m_componentOptionsPageId;
@@ -68,22 +67,18 @@ private:
QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent)
: AbstractMobileAppWizardDialog(parent, QtSupport::QtVersionNumber(4, 7, 1))
, m_qmlSourcesPage(0)
{
setWindowTitle(tr("New Qt Quick Application"));
setIntroDescription(tr("This wizard generates a Qt Quick application project."));
m_componentOptionsPage = new Internal::QtQuickComponentSetOptionsPage;
m_componentOptionsPageId = addPageWithTitle(m_componentOptionsPage, tr("Component Set"));
m_componentOptionsPageId = addPageWithTitle(m_componentOptionsPage, tr("Application Type"));
m_componentItem = wizardProgress()->item(m_componentOptionsPageId);
AbstractMobileAppWizardDialog::addMobilePages();
m_componentItem->setNextItems(QList<Utils::WizardProgressItem *>()
<< targetsPageItem());
m_qmlSourcesPage = new QtQuickAppWizardSourcesPage;
addPageWithTitle(m_qmlSourcesPage, tr("QML Sources"));
}
bool QtQuickAppWizardDialog::validateCurrentPage()
@@ -163,10 +158,10 @@ void QtQuickAppWizard::prepareGenerateFiles(const QWizard *w,
{
Q_UNUSED(errorMessage)
const QtQuickAppWizardDialog *wizard = qobject_cast<const QtQuickAppWizardDialog*>(w);
if (wizard->m_qmlSourcesPage->mainQmlMode() == QtQuickApp::ModeGenerate) {
if (wizard->m_componentOptionsPage->mainQmlMode() == QtQuickApp::ModeGenerate) {
m_d->app->setMainQml(QtQuickApp::ModeGenerate);
} else {
const QString mainQmlFile = wizard->m_qmlSourcesPage->mainQmlFile();
const QString mainQmlFile = wizard->m_componentOptionsPage->mainQmlFile();
m_d->app->setMainQml(QtQuickApp::ModeImport, mainQmlFile);
}
m_d->app->setComponentSet(wizard->m_componentOptionsPage->componentSet());

View File

@@ -32,7 +32,6 @@
#include "qtquickappwizardpages.h"
#include "ui_qtquickcomponentsetoptionspage.h"
#include "ui_qtquickappwizardsourcespage.h"
#include <coreplugin/coreconstants.h>
#include <QtGui/QDesktopServices>
@@ -43,28 +42,32 @@
namespace Qt4ProjectManager {
namespace Internal {
class QtQuickComponentSetOptionsPagePrivate
{
Ui::QtQuickComponentSetOptionsPage ui;
friend class QtQuickComponentSetOptionsPage;
};
class QtQuickAppWizardSourcesPagePrivate
{
Ui::QtQuickAppWizardSourcesPage ui;
friend class QtQuickAppWizardSourcesPage;
};
QtQuickComponentSetOptionsPage::QtQuickComponentSetOptionsPage(QWidget *parent)
: QWizardPage(parent)
, m_d(new QtQuickComponentSetOptionsPagePrivate)
{
m_d->ui.setupUi(this);
m_d->ui.importLineEdit->setExpectedKind(Utils::PathChooser::File);
m_d->ui.importLineEdit->setPromptDialogFilter(QLatin1String("*.qml"));
m_d->ui.importLineEdit->setPromptDialogTitle(tr("Select QML File"));
connect(m_d->ui.importLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
connect(m_d->ui.importRadioButton,
SIGNAL(toggled(bool)), SIGNAL(completeChanged()));
connect(m_d->ui.importRadioButton, SIGNAL(toggled(bool)),
m_d->ui.importLineEdit, SLOT(setEnabled(bool)));
m_d->ui.buttonGroup->setId(m_d->ui.qtquick10RadioButton, 0);
m_d->ui.buttonGroup->setId(m_d->ui.symbian10RadioButton, 1);
m_d->ui.buttonGroup->setId(m_d->ui.meego10RadioButton, 2);
m_d->ui.buttonGroup->setId(m_d->ui.importRadioButton, 3);
connect(m_d->ui.buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(radioButtonChecked(int)));
}
@@ -98,40 +101,19 @@ void QtQuickComponentSetOptionsPage::radioButtonChecked(int index)
m_d->ui.descriptionStackedWidget->setCurrentIndex(index);
}
QtQuickAppWizardSourcesPage::QtQuickAppWizardSourcesPage(QWidget *parent)
: QWizardPage(parent)
, m_d(new QtQuickAppWizardSourcesPagePrivate)
QtQuickApp::Mode QtQuickComponentSetOptionsPage::mainQmlMode() const
{
m_d->ui.setupUi(this);
m_d->ui.importLineEdit->setExpectedKind(Utils::PathChooser::File);
m_d->ui.importLineEdit->setPromptDialogFilter(QLatin1String("*.qml"));
m_d->ui.importLineEdit->setPromptDialogTitle(tr("Select QML File"));
connect(m_d->ui.importLineEdit, SIGNAL(changed(QString)), SIGNAL(completeChanged()));
connect(m_d->ui.importRadioButton,
SIGNAL(toggled(bool)), SIGNAL(completeChanged()));
connect(m_d->ui.generateRadioButton, SIGNAL(toggled(bool)),
m_d->ui.importLineEdit, SLOT(setDisabled(bool)));
m_d->ui.generateRadioButton->setChecked(true);
return m_d->ui.importRadioButton->isChecked() ? QtQuickApp::ModeImport
: QtQuickApp::ModeGenerate;
}
QtQuickAppWizardSourcesPage::~QtQuickAppWizardSourcesPage()
{
delete m_d;
}
QtQuickApp::Mode QtQuickAppWizardSourcesPage::mainQmlMode() const
{
return m_d->ui.generateRadioButton->isChecked() ? QtQuickApp::ModeGenerate
: QtQuickApp::ModeImport;
}
QString QtQuickAppWizardSourcesPage::mainQmlFile() const
QString QtQuickComponentSetOptionsPage::mainQmlFile() const
{
return mainQmlMode() == QtQuickApp::ModeImport ?
m_d->ui.importLineEdit->path() : QString();
}
bool QtQuickAppWizardSourcesPage::isComplete() const
bool QtQuickComponentSetOptionsPage::isComplete() const
{
return mainQmlMode() != QtQuickApp::ModeImport
|| m_d->ui.importLineEdit->isValid();

View File

@@ -48,6 +48,10 @@ public:
explicit QtQuickComponentSetOptionsPage(QWidget *parent = 0);
virtual ~QtQuickComponentSetOptionsPage();
QtQuickApp::Mode mainQmlMode() const;
QString mainQmlFile() const;
virtual bool isComplete() const;
QtQuickApp::ComponentSet componentSet() const;
void setComponentSet(QtQuickApp::ComponentSet componentSet);
@@ -58,23 +62,6 @@ private:
class QtQuickComponentSetOptionsPagePrivate *m_d;
};
class QtQuickAppWizardSourcesPage : public QWizardPage
{
Q_OBJECT
Q_DISABLE_COPY(QtQuickAppWizardSourcesPage)
public:
explicit QtQuickAppWizardSourcesPage(QWidget *parent = 0);
virtual ~QtQuickAppWizardSourcesPage();
QtQuickApp::Mode mainQmlMode() const;
QString mainQmlFile() const;
virtual bool isComplete() const;
private:
class QtQuickAppWizardSourcesPagePrivate *m_d;
};
} // namespace Internal
} // namespace Qt4ProjectManager

View File

@@ -1,94 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QtQuickAppWizardSourcesPage</class>
<widget class="QWizardPage" name="QtQuickAppWizardSourcesPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>605</width>
<height>386</height>
</rect>
</property>
<property name="windowTitle">
<string>WizardPage</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="mainQmlFileGroupBox">
<property name="title">
<string>Main QML File</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="generateRadioButton">
<property name="text">
<string>Generate a main.qml file</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QRadioButton" name="importRadioButton">
<property name="text">
<string>Import an existing .qml file</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="importLineEdit"/>
</item>
<item row="2" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Note: All files and directories that reside in the same directory as the main QML file are deployed. You can modify the contents of the directory any time before deploying.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QLineEdit</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -20,7 +20,7 @@
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Qt Quick Component Set</string>
<string>Qt Quick Application Type</string>
</property>
<property name="flat">
<bool>false</bool>
@@ -38,7 +38,7 @@
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string>buttonGroup</string>
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
@@ -48,7 +48,7 @@
<string>Qt Quick Components for Symbian</string>
</property>
<attribute name="buttonGroup">
<string>buttonGroup</string>
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
@@ -58,10 +58,43 @@
<string>Qt Quick Components for Meego/Harmattan</string>
</property>
<attribute name="buttonGroup">
<string>buttonGroup</string>
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QRadioButton" name="importRadioButton">
<property name="text">
<string>Use an existing .qml file</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Maximum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>12</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Utils::PathChooser" name="importLineEdit"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@@ -81,7 +114,7 @@
<item>
<widget class="QStackedWidget" name="descriptionStackedWidget">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="qtquick10DescriptionWidget">
<layout class="QGridLayout" name="gridLayout">
@@ -140,6 +173,23 @@ Requires Qt 4.7.4 or newer, and the component set installed for your Qt version.
</item>
</layout>
</widget>
<widget class="QWidget" name="importDescriptionWidget">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="importDescriptionLabel">
<property name="text">
<string>All files and directories that reside in the same directory as the main QML file are deployed. You can modify the contents of the directory any time before deploying.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@@ -147,6 +197,18 @@ Requires Qt 4.7.4 or newer, and the component set installed for your Qt version.
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QLineEdit</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections/>
<buttongroups>

View File

@@ -939,7 +939,7 @@ void CallgrindToolPrivate::handleShowCostsOfFunction()
m_toggleCollectFunction = QString("%1()").arg(qualifiedFunctionName);
AnalyzerManager::instance()->selectTool(q);
AnalyzerManager::instance()->startTool();
AnalyzerManager::instance()->startTool(q);
}
void CallgrindToolPrivate::slotRequestDump()
@@ -999,6 +999,15 @@ void CallgrindToolPrivate::createTextMarks()
}
}
bool CallgrindTool::canRunLocally() const
{
#ifdef Q_OS_WINDOWS
return false;
#else
return true;
#endif
}
} // namespace Internal
} // namespace Valgrind

View File

@@ -62,6 +62,7 @@ public:
QWidget *createControlWidget();
bool canRunRemotely() const { return true; }
bool canRunLocally() const;
private:
CallgrindToolPrivate *d;

View File

@@ -564,5 +564,14 @@ bool MemcheckTool::canRunRemotely() const
return true;
}
bool MemcheckTool::canRunLocally() const
{
#ifdef Q_OS_WINDOWS
return false;
#else
return true;
#endif
}
} // namespace Internal
} // namespace Valgrind

View File

@@ -113,6 +113,7 @@ private slots:
private:
void ensureWidgets();
bool canRunRemotely() const;
bool canRunLocally() const;
void initializeDockWidgets();
void initialize() {}
void extensionsInitialized();