forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: qtcreator.qbp src/libs/QtcLibrary.qbs src/plugins/QtcPlugin.qbs src/tools/QtcTool.qbs Change-Id: I3acea26888febe8f96d2131932266ed88b9f55f5
This commit is contained in:
@@ -1174,9 +1174,10 @@ Core::Id EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
bool *isExternalEditor) const
|
||||
{
|
||||
// Collect editors that can open the file
|
||||
const MimeType mt = ICore::mimeDatabase()->findByFile(fileName);
|
||||
MimeType mt = ICore::mimeDatabase()->findByFile(fileName);
|
||||
//Unable to determine mime type of fileName. Falling back to text/plain",
|
||||
if (!mt)
|
||||
return Id();
|
||||
mt = ICore::mimeDatabase()->findByType(QLatin1String("text/plain"));
|
||||
QStringList allEditorIds;
|
||||
QStringList allEditorDisplayNames;
|
||||
QList<Id> externalEditorIds;
|
||||
|
||||
@@ -88,7 +88,7 @@ struct IdCache : public QHash<StringHolder, int>
|
||||
~IdCache()
|
||||
{
|
||||
for (IdCache::iterator it = begin(); it != end(); ++it)
|
||||
free(const_cast<char *>(it.key().str));
|
||||
delete[](const_cast<char *>(it.key().str));
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -75,21 +75,22 @@ public:
|
||||
virtual void goToNext() = 0;
|
||||
virtual void goToPrev() = 0;
|
||||
|
||||
enum Flag { NoModeSwitch = 0, ModeSwitch = 1, WithFocus = 2, EnsureSizeHint = 4};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
|
||||
public slots:
|
||||
void popup() { popup(true, false); }
|
||||
void popup(bool withFocus) { popup(withFocus, false); }
|
||||
void popup(bool withFocus, bool ensureSizeHint) { emit showPage(withFocus, ensureSizeHint); }
|
||||
void popup(int flags) { emit showPage(flags); }
|
||||
|
||||
void hide() { emit hidePage(); }
|
||||
void toggle() { toggle(true); }
|
||||
void toggle(bool withFocusIfShown) { emit togglePage(withFocusIfShown); }
|
||||
void toggle(int flags) { emit togglePage(flags); }
|
||||
void navigateStateChanged() { emit navigateStateUpdate(); }
|
||||
void flash() { emit flashButton(); }
|
||||
void setIconBadgeNumber(int number) { emit setBadgeNumber(number); }
|
||||
|
||||
signals:
|
||||
void showPage(bool withFocus, bool ensureSizeHint);
|
||||
void showPage(int flags);
|
||||
void hidePage();
|
||||
void togglePage(bool withFocusIfShown);
|
||||
void togglePage(int flags);
|
||||
void navigateStateUpdate();
|
||||
void flashButton();
|
||||
void setBadgeNumber(int number);
|
||||
@@ -97,4 +98,6 @@ signals:
|
||||
|
||||
} // namespace Core
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Core::IOutputPane::Flags)
|
||||
|
||||
#endif // IOUTPUTPANE_H
|
||||
|
||||
@@ -65,7 +65,7 @@ void MessageManager::init()
|
||||
void MessageManager::showOutputPane()
|
||||
{
|
||||
if (m_messageOutputWindow)
|
||||
m_messageOutputWindow->popup(false);
|
||||
m_messageOutputWindow->popup(IOutputPane::ModeSwitch);
|
||||
}
|
||||
|
||||
void MessageManager::printToOutputPane(const QString &text, bool bringToForeground)
|
||||
@@ -73,7 +73,7 @@ void MessageManager::printToOutputPane(const QString &text, bool bringToForegrou
|
||||
if (!m_messageOutputWindow)
|
||||
return;
|
||||
if (bringToForeground)
|
||||
m_messageOutputWindow->popup(false);
|
||||
m_messageOutputWindow->popup(IOutputPane::ModeSwitch);
|
||||
m_messageOutputWindow->append(text + QLatin1Char('\n'));
|
||||
}
|
||||
|
||||
|
||||
@@ -254,9 +254,9 @@ void OutputPaneManager::init()
|
||||
const int idx = m_outputWidgetPane->addWidget(outPane->outputWidget(this));
|
||||
QTC_CHECK(idx == i);
|
||||
|
||||
connect(outPane, SIGNAL(showPage(bool,bool)), this, SLOT(showPage(bool,bool)));
|
||||
connect(outPane, SIGNAL(showPage(int)), this, SLOT(showPage(int)));
|
||||
connect(outPane, SIGNAL(hidePage()), this, SLOT(slotHide()));
|
||||
connect(outPane, SIGNAL(togglePage(bool)), this, SLOT(togglePage(bool)));
|
||||
connect(outPane, SIGNAL(togglePage(int)), this, SLOT(togglePage(int)));
|
||||
connect(outPane, SIGNAL(navigateStateUpdate()), this, SLOT(updateNavigateState()));
|
||||
connect(outPane, SIGNAL(flashButton()), this, SLOT(flashButton()));
|
||||
connect(outPane, SIGNAL(setBadgeNumber(int)), this, SLOT(setBadgeNumber(int)));
|
||||
@@ -361,7 +361,7 @@ void OutputPaneManager::buttonTriggered(int idx)
|
||||
// we should toggle and the page is already visible and we are actually closeable
|
||||
slotHide();
|
||||
} else {
|
||||
showPage(idx, true);
|
||||
showPage(idx, IOutputPane::ModeSwitch | IOutputPane::WithFocus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,45 +459,47 @@ void OutputPaneManager::setBadgeNumber(int number)
|
||||
}
|
||||
|
||||
// Slot connected to showPage signal of each page
|
||||
void OutputPaneManager::showPage(bool focus, bool ensureSizeHint)
|
||||
void OutputPaneManager::showPage(int flags)
|
||||
{
|
||||
int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender()));
|
||||
OutputPanePlaceHolder *ph = OutputPanePlaceHolder::getCurrent();
|
||||
if (!ph)
|
||||
m_buttons.value(idx)->flash();
|
||||
else
|
||||
showPage(idx, focus);
|
||||
|
||||
if (ensureSizeHint && ph)
|
||||
ph->ensureSizeHintAsMinimum();
|
||||
showPage(idx, flags);
|
||||
}
|
||||
|
||||
void OutputPaneManager::showPage(int idx, bool focus)
|
||||
void OutputPaneManager::showPage(int idx, int flags)
|
||||
{
|
||||
QTC_ASSERT(idx >= 0, return);
|
||||
if (!OutputPanePlaceHolder::getCurrent()) {
|
||||
OutputPanePlaceHolder *ph = OutputPanePlaceHolder::getCurrent();
|
||||
|
||||
if (!ph && flags & IOutputPane::ModeSwitch) {
|
||||
// In this mode we don't have a placeholder
|
||||
// switch to the output mode and switch the page
|
||||
ModeManager::activateMode(Id(Constants::MODE_EDIT));
|
||||
ph = OutputPanePlaceHolder::getCurrent();
|
||||
}
|
||||
if (OutputPanePlaceHolder *ph = OutputPanePlaceHolder::getCurrent()) {
|
||||
|
||||
if (ph) {
|
||||
// make the page visible
|
||||
ph->setVisible(true);
|
||||
ensurePageVisible(idx);
|
||||
IOutputPane *out = m_panes.at(idx);
|
||||
out->visibilityChanged(true);
|
||||
if (focus && out->canFocus())
|
||||
if (flags & IOutputPane::WithFocus && out->canFocus())
|
||||
out->setFocus();
|
||||
|
||||
if (flags & IOutputPane::EnsureSizeHint)
|
||||
ph->ensureSizeHintAsMinimum();
|
||||
} else {
|
||||
m_buttons.value(idx)->flash();
|
||||
}
|
||||
}
|
||||
|
||||
void OutputPaneManager::togglePage(bool focus)
|
||||
void OutputPaneManager::togglePage(int flags)
|
||||
{
|
||||
int idx = findIndexForPage(qobject_cast<IOutputPane*>(sender()));
|
||||
if (OutputPanePlaceHolder::isCurrentVisible() && currentIndex() == idx)
|
||||
slotHide();
|
||||
else
|
||||
showPage(idx, focus);
|
||||
showPage(idx, flags);
|
||||
}
|
||||
|
||||
void OutputPaneManager::focusInEvent(QFocusEvent *e)
|
||||
@@ -555,7 +557,7 @@ void OutputPaneManager::popupMenu()
|
||||
button->hide();
|
||||
} else {
|
||||
button->show();
|
||||
showPage(idx, false);
|
||||
showPage(idx, IOutputPane::ModeSwitch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,8 +79,8 @@ protected:
|
||||
void focusInEvent(QFocusEvent *e);
|
||||
|
||||
private slots:
|
||||
void showPage(bool focus, bool ensureSizeHint);
|
||||
void togglePage(bool focus);
|
||||
void showPage(int flags);
|
||||
void togglePage(int flags);
|
||||
void clearPage();
|
||||
void buttonTriggered();
|
||||
void updateNavigateState();
|
||||
@@ -100,7 +100,7 @@ private:
|
||||
explicit OutputPaneManager(QWidget *parent = 0);
|
||||
~OutputPaneManager();
|
||||
|
||||
void showPage(int idx, bool focus);
|
||||
void showPage(int idx, int flags);
|
||||
void ensurePageVisible(int idx);
|
||||
int findIndexForPage(IOutputPane *out);
|
||||
int currentIndex() const;
|
||||
|
||||
Reference in New Issue
Block a user