- enhancement: Size of icons in the completion popup changes with the editor font size.
This commit is contained in:
parent
e98fb56f8d
commit
8fb756da77
|
@ -3576,8 +3576,8 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete, CodeComple
|
||||||
mCompletionPopup->setHideSymbolsStartWithUnderline(pSettings->codeCompletion().hideSymbolsStartsWithUnderLine());
|
mCompletionPopup->setHideSymbolsStartWithUnderline(pSettings->codeCompletion().hideSymbolsStartsWithUnderLine());
|
||||||
mCompletionPopup->setHideSymbolsStartWithTwoUnderline(pSettings->codeCompletion().hideSymbolsStartsWithTwoUnderLine());
|
mCompletionPopup->setHideSymbolsStartWithTwoUnderline(pSettings->codeCompletion().hideSymbolsStartsWithTwoUnderLine());
|
||||||
mCompletionPopup->setIgnoreCase(pSettings->codeCompletion().ignoreCase());
|
mCompletionPopup->setIgnoreCase(pSettings->codeCompletion().ignoreCase());
|
||||||
mCompletionPopup->resize(pSettings->codeCompletion().width(),
|
QSize popSize = calcCompletionPopupSize();
|
||||||
pSettings->codeCompletion().height());
|
mCompletionPopup->resize(popSize);
|
||||||
|
|
||||||
// Position it at the top of the next line
|
// Position it at the top of the next line
|
||||||
QPoint popupPos = mapToGlobal(displayCoordToPixels(displayXY()));
|
QPoint popupPos = mapToGlobal(displayCoordToPixels(displayXY()));
|
||||||
|
@ -3674,10 +3674,10 @@ void Editor::showHeaderCompletion(bool autoComplete, bool forceShow)
|
||||||
p.setY(p.y() + textHeight() + 2);
|
p.setY(p.y() + textHeight() + 2);
|
||||||
mHeaderCompletionPopup->move(mapToGlobal(p));
|
mHeaderCompletionPopup->move(mapToGlobal(p));
|
||||||
|
|
||||||
|
|
||||||
mHeaderCompletionPopup->setIgnoreCase(pSettings->codeCompletion().ignoreCase());
|
mHeaderCompletionPopup->setIgnoreCase(pSettings->codeCompletion().ignoreCase());
|
||||||
mHeaderCompletionPopup->resize(pSettings->codeCompletion().width(),
|
|
||||||
pSettings->codeCompletion().height());
|
QSize popSize = calcCompletionPopupSize();
|
||||||
|
mHeaderCompletionPopup->resize(popSize);
|
||||||
//Set Font size;
|
//Set Font size;
|
||||||
mHeaderCompletionPopup->setFont(font());
|
mHeaderCompletionPopup->setFont(font());
|
||||||
mHeaderCompletionPopup->setLineHeightFactor(pSettings->editor().lineSpacing());
|
mHeaderCompletionPopup->setLineHeightFactor(pSettings->editor().lineSpacing());
|
||||||
|
@ -4575,6 +4575,22 @@ void Editor::cancelHoverLink()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSize Editor::calcCompletionPopupSize()
|
||||||
|
{
|
||||||
|
#if QT_VERSION_MAJOR==5 && QT_VERSION_MINOR < 15
|
||||||
|
int screenHeight = qApp->primaryScreen()->size().height();
|
||||||
|
int screenWidht = qApp->primaryScreen()->size().width;
|
||||||
|
#else
|
||||||
|
int screenHeight = screen()->size().height();
|
||||||
|
int screenWidth = screen()->size().width();
|
||||||
|
#endif
|
||||||
|
int popWidth = std::min(pSettings->codeCompletion().widthInColumns() * charWidth(),
|
||||||
|
screenWidth / 2) + 4;
|
||||||
|
int popHeight = std::min(pSettings->codeCompletion().heightInLines() * textHeight(),
|
||||||
|
(screenHeight / 2 - textHeight() * 2)) + 4;
|
||||||
|
return QSize{popWidth, popHeight};
|
||||||
|
}
|
||||||
|
|
||||||
quint64 Editor::lastFocusOutTime() const
|
quint64 Editor::lastFocusOutTime() const
|
||||||
{
|
{
|
||||||
return mLastFocusOutTime;
|
return mLastFocusOutTime;
|
||||||
|
|
|
@ -303,6 +303,8 @@ private:
|
||||||
void updateHoverLink(int line);
|
void updateHoverLink(int line);
|
||||||
void cancelHoverLink();
|
void cancelHoverLink();
|
||||||
|
|
||||||
|
QSize calcCompletionPopupSize();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mInited;
|
bool mInited;
|
||||||
QDateTime mBackupTime;
|
QDateTime mBackupTime;
|
||||||
|
|
|
@ -41,7 +41,7 @@ IconsManager::IconsManager(QObject *parent) : QObject(parent)
|
||||||
mMakeDisabledIconDarker = false;
|
mMakeDisabledIconDarker = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconsManager::updateEditorGuttorIcons(const QString& iconSet,int size)
|
void IconsManager::updateEditorGutterIcons(const QString& iconSet,int size)
|
||||||
{
|
{
|
||||||
QString iconFolder = mIconSetTemplate.arg( iconSetsFolder(),iconSet,"editor");
|
QString iconFolder = mIconSetTemplate.arg( iconSetsFolder(),iconSet,"editor");
|
||||||
updateMakeDisabledIconDarker(iconSet);
|
updateMakeDisabledIconDarker(iconSet);
|
||||||
|
@ -54,29 +54,12 @@ void IconsManager::updateEditorGuttorIcons(const QString& iconSet,int size)
|
||||||
|
|
||||||
void IconsManager::updateParserIcons(const QString &iconSet, int size)
|
void IconsManager::updateParserIcons(const QString &iconSet, int size)
|
||||||
{
|
{
|
||||||
QString iconFolder = mIconSetTemplate.arg( iconSetsFolder(),iconSet,"classparser");
|
mParserIconSize = size;
|
||||||
updateMakeDisabledIconDarker(iconSet);
|
mParserIconSet = iconSet;
|
||||||
mIconPixmaps.insert(PARSER_TYPE, createSVGIcon(iconFolder+"type.svg",size,size));
|
mCachedParserIconSet = "";
|
||||||
mIconPixmaps.insert(PARSER_CLASS, createSVGIcon(iconFolder+"class.svg",size,size));
|
mCachedParserIconSize = -1;
|
||||||
mIconPixmaps.insert(PARSER_NAMESPACE, createSVGIcon(iconFolder+"namespace.svg",size,size));
|
mCachedParserIconPixmaps.clear();
|
||||||
mIconPixmaps.insert(PARSER_DEFINE, createSVGIcon(iconFolder+"define.svg",size,size));
|
updateParserIcons(mIconPixmaps,iconSet,size);
|
||||||
mIconPixmaps.insert(PARSER_ENUM, createSVGIcon(iconFolder+"enum.svg",size,size));;
|
|
||||||
mIconPixmaps.insert(PARSER_GLOBAL_METHOD, createSVGIcon(iconFolder+"global_method.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_INHERITED_PROTECTED_METHOD, createSVGIcon(iconFolder+"method_inherited_protected.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_INHERITED_METHOD, createSVGIcon(iconFolder+"method_inherited.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_PROTECTED_METHOD, createSVGIcon(iconFolder+"method_protected.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_PUBLIC_METHOD, createSVGIcon(iconFolder+"method_public.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_PRIVATE_METHOD, createSVGIcon(iconFolder+"method_private.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_GLOBAL_VAR, createSVGIcon(iconFolder+"global.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_INHERITED_PROTECTD_VAR, createSVGIcon(iconFolder+"var_inherited_protected.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_INHERITED_VAR, createSVGIcon(iconFolder+"var_inherited.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_PROTECTED_VAR, createSVGIcon(iconFolder+"var_protected.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_PUBLIC_VAR, createSVGIcon(iconFolder+"var_public.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_PRIVATE_VAR, createSVGIcon(iconFolder+"var_private.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_KEYWORD, createSVGIcon(iconFolder+"keyword.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_CODE_SNIPPET, createSVGIcon(iconFolder+"code_snippet.svg",size,size));
|
|
||||||
mIconPixmaps.insert(PARSER_LOCAL_VAR, createSVGIcon(iconFolder+"var.svg",size,size));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IconsManager::updateActionIcons(const QString& iconSet, int size)
|
void IconsManager::updateActionIcons(const QString& iconSet, int size)
|
||||||
|
@ -281,79 +264,26 @@ void IconsManager::prepareCustomIconSet(const QString &customIconSet)
|
||||||
|
|
||||||
QPixmap IconsManager::getPixmapForStatement(PStatement statement)
|
QPixmap IconsManager::getPixmapForStatement(PStatement statement)
|
||||||
{
|
{
|
||||||
if (!statement)
|
return getPixmapForStatement(mIconPixmaps, statement);
|
||||||
return QPixmap();
|
}
|
||||||
StatementKind kind = getKindOfStatement(statement);
|
|
||||||
switch (kind) {
|
QPixmap IconsManager::getPixmapForStatement(PStatement statement, int size)
|
||||||
case StatementKind::Typedef:
|
{
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_TYPE));
|
if (size == mParserIconSize)
|
||||||
case StatementKind::Class:
|
return getPixmapForStatement(statement);
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_CLASS));
|
if (mParserIconSet != mCachedParserIconSet
|
||||||
case StatementKind::Namespace:
|
|| size != mCachedParserIconSize) {
|
||||||
case StatementKind::NamespaceAlias:
|
mCachedParserIconSet.clear();
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_NAMESPACE));
|
mCachedParserIconSet = mParserIconSet;
|
||||||
case StatementKind::Preprocessor:
|
mCachedParserIconSize = size;
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_DEFINE));
|
updateParserIcons(mCachedParserIconPixmaps,mParserIconSet,size);
|
||||||
case StatementKind::EnumClassType:
|
|
||||||
case StatementKind::EnumType:
|
|
||||||
case StatementKind::Enum:
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_ENUM));
|
|
||||||
case StatementKind::Function:
|
|
||||||
case StatementKind::Constructor:
|
|
||||||
case StatementKind::Destructor:
|
|
||||||
if (statement->scope == StatementScope::Global)
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_GLOBAL_METHOD));
|
|
||||||
if (statement->isInherited()) {
|
|
||||||
if (statement->accessibility == StatementAccessibility::Protected) {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_PROTECTED_METHOD));
|
|
||||||
} else if (statement->accessibility == StatementAccessibility::Public) {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_METHOD));
|
|
||||||
} else {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PRIVATE_METHOD));
|
|
||||||
}
|
}
|
||||||
} else {
|
return getPixmapForStatement(mCachedParserIconPixmaps, statement);
|
||||||
if (statement->accessibility == StatementAccessibility::Protected) {
|
}
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PROTECTED_METHOD));
|
|
||||||
} else if (statement->accessibility == StatementAccessibility::Public) {
|
IconsManager::PPixmap IconsManager::getPixmap(const QMap<IconName, PPixmap> &iconPixmaps, IconName iconName) const
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PUBLIC_METHOD));
|
{
|
||||||
} else {
|
return iconPixmaps.value(iconName, mDefaultIconPixmap);
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PRIVATE_METHOD));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case StatementKind::GlobalVariable:
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_GLOBAL_VAR));
|
|
||||||
case StatementKind::LocalVariable:
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_LOCAL_VAR));
|
|
||||||
case StatementKind::Variable:
|
|
||||||
if (statement->isInherited()) {
|
|
||||||
if (statement->accessibility == StatementAccessibility::Protected) {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_PROTECTD_VAR));
|
|
||||||
} else if (statement->accessibility == StatementAccessibility::Public) {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_INHERITED_VAR));
|
|
||||||
} else {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PRIVATE_VAR));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (statement->accessibility == StatementAccessibility::Protected) {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PROTECTED_VAR));
|
|
||||||
} else if (statement->accessibility == StatementAccessibility::Public) {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PUBLIC_VAR));
|
|
||||||
} else {
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_PRIVATE_VAR));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case StatementKind::Keyword:
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_KEYWORD));
|
|
||||||
case StatementKind::UserCodeSnippet:
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_CODE_SNIPPET));
|
|
||||||
case StatementKind::Alias:
|
|
||||||
return *(pIconsManager->getPixmap(IconsManager::PARSER_TYPE));
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return QPixmap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString IconsManager::iconSetsFolder() const
|
const QString IconsManager::iconSetsFolder() const
|
||||||
|
@ -404,3 +334,106 @@ void IconsManager::updateMakeDisabledIconDarker(const QString& iconset )
|
||||||
{
|
{
|
||||||
mMakeDisabledIconDarker = (iconset == "contrast");
|
mMakeDisabledIconDarker = (iconset == "contrast");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IconsManager::updateParserIcons(QMap<IconName, PPixmap> &iconPixmaps, const QString &iconSet, int size)
|
||||||
|
{
|
||||||
|
QString iconFolder = mIconSetTemplate.arg( iconSetsFolder(),iconSet,"classparser");
|
||||||
|
updateMakeDisabledIconDarker(iconSet);
|
||||||
|
iconPixmaps.insert(PARSER_TYPE, createSVGIcon(iconFolder+"type.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_CLASS, createSVGIcon(iconFolder+"class.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_NAMESPACE, createSVGIcon(iconFolder+"namespace.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_DEFINE, createSVGIcon(iconFolder+"define.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_ENUM, createSVGIcon(iconFolder+"enum.svg",size,size));;
|
||||||
|
iconPixmaps.insert(PARSER_GLOBAL_METHOD, createSVGIcon(iconFolder+"global_method.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_INHERITED_PROTECTED_METHOD, createSVGIcon(iconFolder+"method_inherited_protected.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_INHERITED_METHOD, createSVGIcon(iconFolder+"method_inherited.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_PROTECTED_METHOD, createSVGIcon(iconFolder+"method_protected.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_PUBLIC_METHOD, createSVGIcon(iconFolder+"method_public.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_PRIVATE_METHOD, createSVGIcon(iconFolder+"method_private.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_GLOBAL_VAR, createSVGIcon(iconFolder+"global.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_INHERITED_PROTECTD_VAR, createSVGIcon(iconFolder+"var_inherited_protected.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_INHERITED_VAR, createSVGIcon(iconFolder+"var_inherited.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_PROTECTED_VAR, createSVGIcon(iconFolder+"var_protected.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_PUBLIC_VAR, createSVGIcon(iconFolder+"var_public.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_PRIVATE_VAR, createSVGIcon(iconFolder+"var_private.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_KEYWORD, createSVGIcon(iconFolder+"keyword.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_CODE_SNIPPET, createSVGIcon(iconFolder+"code_snippet.svg",size,size));
|
||||||
|
iconPixmaps.insert(PARSER_LOCAL_VAR, createSVGIcon(iconFolder+"var.svg",size,size));
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap IconsManager::getPixmapForStatement(const QMap<IconName, PPixmap> &iconPixmaps, PStatement statement)
|
||||||
|
{
|
||||||
|
if (!statement)
|
||||||
|
return QPixmap();
|
||||||
|
StatementKind kind = getKindOfStatement(statement);
|
||||||
|
switch (kind) {
|
||||||
|
case StatementKind::Typedef:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_TYPE));
|
||||||
|
case StatementKind::Class:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_CLASS));
|
||||||
|
case StatementKind::Namespace:
|
||||||
|
case StatementKind::NamespaceAlias:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_NAMESPACE));
|
||||||
|
case StatementKind::Preprocessor:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_DEFINE));
|
||||||
|
case StatementKind::EnumClassType:
|
||||||
|
case StatementKind::EnumType:
|
||||||
|
case StatementKind::Enum:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_ENUM));
|
||||||
|
case StatementKind::Function:
|
||||||
|
case StatementKind::Constructor:
|
||||||
|
case StatementKind::Destructor:
|
||||||
|
if (statement->scope == StatementScope::Global)
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_GLOBAL_METHOD));
|
||||||
|
if (statement->isInherited()) {
|
||||||
|
if (statement->accessibility == StatementAccessibility::Protected) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_INHERITED_PROTECTED_METHOD));
|
||||||
|
} else if (statement->accessibility == StatementAccessibility::Public) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_INHERITED_METHOD));
|
||||||
|
} else {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PRIVATE_METHOD));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (statement->accessibility == StatementAccessibility::Protected) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PROTECTED_METHOD));
|
||||||
|
} else if (statement->accessibility == StatementAccessibility::Public) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PUBLIC_METHOD));
|
||||||
|
} else {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PRIVATE_METHOD));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case StatementKind::GlobalVariable:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_GLOBAL_VAR));
|
||||||
|
case StatementKind::LocalVariable:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_LOCAL_VAR));
|
||||||
|
case StatementKind::Variable:
|
||||||
|
if (statement->isInherited()) {
|
||||||
|
if (statement->accessibility == StatementAccessibility::Protected) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_INHERITED_PROTECTD_VAR));
|
||||||
|
} else if (statement->accessibility == StatementAccessibility::Public) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_INHERITED_VAR));
|
||||||
|
} else {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PRIVATE_VAR));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (statement->accessibility == StatementAccessibility::Protected) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PROTECTED_VAR));
|
||||||
|
} else if (statement->accessibility == StatementAccessibility::Public) {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PUBLIC_VAR));
|
||||||
|
} else {
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_PRIVATE_VAR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case StatementKind::Keyword:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_KEYWORD));
|
||||||
|
case StatementKind::UserCodeSnippet:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_CODE_SNIPPET));
|
||||||
|
case StatementKind::Alias:
|
||||||
|
return *(getPixmap(iconPixmaps, IconsManager::PARSER_TYPE));
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return QPixmap();
|
||||||
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ public:
|
||||||
};
|
};
|
||||||
explicit IconsManager(QObject *parent = nullptr);
|
explicit IconsManager(QObject *parent = nullptr);
|
||||||
|
|
||||||
void updateEditorGuttorIcons(const QString& iconSet, int size);
|
void updateEditorGutterIcons(const QString& iconSet, int size);
|
||||||
void updateParserIcons(const QString& iconSet, int size);
|
void updateParserIcons(const QString& iconSet, int size);
|
||||||
void updateActionIcons(const QString& iconSet, int size);
|
void updateActionIcons(const QString& iconSet, int size);
|
||||||
void updateFileSystemIcons(const QString& iconSet, int size);
|
void updateFileSystemIcons(const QString& iconSet, int size);
|
||||||
|
@ -216,13 +216,20 @@ public:
|
||||||
void prepareCustomIconSet(const QString &customIconSet);
|
void prepareCustomIconSet(const QString &customIconSet);
|
||||||
|
|
||||||
QPixmap getPixmapForStatement(PStatement statement);
|
QPixmap getPixmapForStatement(PStatement statement);
|
||||||
|
QPixmap getPixmapForStatement(PStatement statement, int size);
|
||||||
|
|
||||||
const QString iconSetsFolder() const;
|
const QString iconSetsFolder() const;
|
||||||
void setIconSetsFolder(const QString &newIconSetsFolder);
|
void setIconSetsFolder(const QString &newIconSetsFolder);
|
||||||
|
|
||||||
QList<PIconSet> listIconSets();
|
QList<PIconSet> listIconSets();
|
||||||
|
QString iconSet() const;
|
||||||
|
void setIconSet(const QString &newIconSet);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateMakeDisabledIconDarker(const QString& iconset);
|
void updateMakeDisabledIconDarker(const QString& iconset);
|
||||||
|
void updateParserIcons(QMap<IconName,PPixmap> &iconPixmaps, const QString& iconSet, int size);
|
||||||
|
QPixmap getPixmapForStatement(const QMap<IconName,PPixmap> &iconPixmaps, PStatement statement);
|
||||||
|
PPixmap getPixmap(const QMap<IconName,PPixmap> &iconPixmaps, IconName iconName) const;
|
||||||
signals:
|
signals:
|
||||||
void actionIconsUpdated();
|
void actionIconsUpdated();
|
||||||
private:
|
private:
|
||||||
|
@ -231,6 +238,11 @@ private:
|
||||||
QSize mActionIconSize;
|
QSize mActionIconSize;
|
||||||
QString mIconSetTemplate;
|
QString mIconSetTemplate;
|
||||||
QString mIconSetsFolder;
|
QString mIconSetsFolder;
|
||||||
|
QString mParserIconSet;
|
||||||
|
int mParserIconSize;
|
||||||
|
QString mCachedParserIconSet;
|
||||||
|
int mCachedParserIconSize;
|
||||||
|
QMap<IconName,PPixmap> mCachedParserIconPixmaps;
|
||||||
|
|
||||||
bool mMakeDisabledIconDarker;
|
bool mMakeDisabledIconDarker;
|
||||||
};
|
};
|
||||||
|
|
|
@ -547,7 +547,7 @@ void MainWindow::updateStatusbarForLineCol(bool clear)
|
||||||
|
|
||||||
void MainWindow::updateEditorSettings()
|
void MainWindow::updateEditorSettings()
|
||||||
{
|
{
|
||||||
pIconsManager->updateEditorGuttorIcons(
|
pIconsManager->updateEditorGutterIcons(
|
||||||
pSettings->environment().iconSet(),
|
pSettings->environment().iconSet(),
|
||||||
calIconSize(pSettings->editor().fontName(),pSettings->editor().fontSize())
|
calIconSize(pSettings->editor().fontName(),pSettings->editor().fontSize())
|
||||||
);
|
);
|
||||||
|
|
|
@ -4843,30 +4843,30 @@ void Settings::CodeCompletion::setEnabled(bool newEnabled)
|
||||||
mEnabled = newEnabled;
|
mEnabled = newEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Settings::CodeCompletion::height() const
|
int Settings::CodeCompletion::heightInLines() const
|
||||||
{
|
{
|
||||||
return mHeight;
|
return mHeightInLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::CodeCompletion::setHeight(int newHeight)
|
void Settings::CodeCompletion::setHeightInLines(int newHeight)
|
||||||
{
|
{
|
||||||
mHeight = newHeight;
|
mHeightInLines = newHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Settings::CodeCompletion::width() const
|
int Settings::CodeCompletion::widthInColumns() const
|
||||||
{
|
{
|
||||||
return mWidth;
|
return mWidthInColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::CodeCompletion::setWidth(int newWidth)
|
void Settings::CodeCompletion::setWidthInColumns(int newWidth)
|
||||||
{
|
{
|
||||||
mWidth = newWidth;
|
mWidthInColumns = newWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::CodeCompletion::doSave()
|
void Settings::CodeCompletion::doSave()
|
||||||
{
|
{
|
||||||
saveValue("width",mWidth);
|
saveValue("widthInColumns",mWidthInColumns);
|
||||||
saveValue("height",mHeight);
|
saveValue("heightInLines",mHeightInLines);
|
||||||
saveValue("enabled",mEnabled);
|
saveValue("enabled",mEnabled);
|
||||||
saveValue("parse_local_headers",mParseLocalHeaders);
|
saveValue("parse_local_headers",mParseLocalHeaders);
|
||||||
saveValue("parse_global_headers",mParseGlobalHeaders);
|
saveValue("parse_global_headers",mParseGlobalHeaders);
|
||||||
|
@ -4888,8 +4888,8 @@ void Settings::CodeCompletion::doSave()
|
||||||
void Settings::CodeCompletion::doLoad()
|
void Settings::CodeCompletion::doLoad()
|
||||||
{
|
{
|
||||||
//Appearance
|
//Appearance
|
||||||
mWidth = intValue("width",700);
|
mWidthInColumns = intValue("widthInColumns",30);
|
||||||
mHeight = intValue("height",400);
|
mHeightInLines = intValue("heightInLines",8);
|
||||||
mEnabled = boolValue("enabled",true);
|
mEnabled = boolValue("enabled",true);
|
||||||
mParseLocalHeaders = boolValue("parse_local_headers",true);
|
mParseLocalHeaders = boolValue("parse_local_headers",true);
|
||||||
mParseGlobalHeaders = boolValue("parse_global_headers",true);
|
mParseGlobalHeaders = boolValue("parse_global_headers",true);
|
||||||
|
|
|
@ -643,11 +643,11 @@ public:
|
||||||
class CodeCompletion: public _Base {
|
class CodeCompletion: public _Base {
|
||||||
public:
|
public:
|
||||||
explicit CodeCompletion(Settings *settings);
|
explicit CodeCompletion(Settings *settings);
|
||||||
int width() const;
|
int widthInColumns() const;
|
||||||
void setWidth(int newWidth);
|
void setWidthInColumns(int newWidth);
|
||||||
|
|
||||||
int height() const;
|
int heightInLines() const;
|
||||||
void setHeight(int newHeight);
|
void setHeightInLines(int newHeight);
|
||||||
|
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
void setEnabled(bool newEnabled);
|
void setEnabled(bool newEnabled);
|
||||||
|
@ -695,8 +695,8 @@ public:
|
||||||
void setShareParser(bool newShareParser);
|
void setShareParser(bool newShareParser);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mWidth;
|
int mWidthInColumns;
|
||||||
int mHeight;
|
int mHeightInLines;
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
bool mParseLocalHeaders;
|
bool mParseLocalHeaders;
|
||||||
bool mParseGlobalHeaders;
|
bool mParseGlobalHeaders;
|
||||||
|
|
|
@ -41,8 +41,8 @@ void EditorCodeCompletionWidget::doLoad()
|
||||||
ui->chkParseLocalFiles->setChecked(pSettings->codeCompletion().parseLocalHeaders());
|
ui->chkParseLocalFiles->setChecked(pSettings->codeCompletion().parseLocalHeaders());
|
||||||
ui->chkParseSystemFiles->setChecked(pSettings->codeCompletion().parseGlobalHeaders());
|
ui->chkParseSystemFiles->setChecked(pSettings->codeCompletion().parseGlobalHeaders());
|
||||||
|
|
||||||
ui->spinWidth->setValue(pSettings->codeCompletion().width());
|
ui->spinWidth->setValue(pSettings->codeCompletion().widthInColumns());
|
||||||
ui->spinHeight->setValue(pSettings->codeCompletion().height());
|
ui->spinHeight->setValue(pSettings->codeCompletion().heightInLines());
|
||||||
|
|
||||||
ui->chkShowSuggestionWhileTyping->setChecked(pSettings->codeCompletion().showCompletionWhileInput());
|
ui->chkShowSuggestionWhileTyping->setChecked(pSettings->codeCompletion().showCompletionWhileInput());
|
||||||
ui->chkRecordUsage->setChecked(pSettings->codeCompletion().recordUsage());
|
ui->chkRecordUsage->setChecked(pSettings->codeCompletion().recordUsage());
|
||||||
|
@ -67,8 +67,8 @@ void EditorCodeCompletionWidget::doSave()
|
||||||
pSettings->codeCompletion().setParseLocalHeaders(ui->chkParseLocalFiles->isChecked());
|
pSettings->codeCompletion().setParseLocalHeaders(ui->chkParseLocalFiles->isChecked());
|
||||||
pSettings->codeCompletion().setParseGlobalHeaders(ui->chkParseSystemFiles->isChecked());
|
pSettings->codeCompletion().setParseGlobalHeaders(ui->chkParseSystemFiles->isChecked());
|
||||||
|
|
||||||
pSettings->codeCompletion().setWidth(ui->spinWidth->value());
|
pSettings->codeCompletion().setWidthInColumns(ui->spinWidth->value());
|
||||||
pSettings->codeCompletion().setHeight(ui->spinHeight->value());
|
pSettings->codeCompletion().setHeightInLines(ui->spinHeight->value());
|
||||||
|
|
||||||
pSettings->codeCompletion().setShowCompletionWhileInput(ui->chkShowSuggestionWhileTyping->isChecked());
|
pSettings->codeCompletion().setShowCompletionWhileInput(ui->chkShowSuggestionWhileTyping->isChecked());
|
||||||
pSettings->codeCompletion().setRecordUsage(ui->chkRecordUsage->isChecked());
|
pSettings->codeCompletion().setRecordUsage(ui->chkRecordUsage->isChecked());
|
||||||
|
|
|
@ -250,10 +250,10 @@
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QSpinBox" name="spinWidth">
|
<widget class="QSpinBox" name="spinWidth">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>100</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>10000</number>
|
<number>999</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -267,10 +267,10 @@
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QSpinBox" name="spinHeight">
|
<widget class="QSpinBox" name="spinHeight">
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<number>100</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>10000</number>
|
<number>999</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -1300,10 +1300,6 @@ QVariant CodeCompletionListModel::data(const QModelIndex &index, int role) const
|
||||||
PStatement statement = mStatements->at(index.row());
|
PStatement statement = mStatements->at(index.row());
|
||||||
return statement->command;
|
return statement->command;
|
||||||
}
|
}
|
||||||
case Qt::DecorationRole:{
|
|
||||||
PStatement statement = mStatements->at(index.row());
|
|
||||||
return pIconsManager->getPixmapForStatement(statement);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
@ -1317,14 +1313,14 @@ PStatement CodeCompletionListModel::statement(const QModelIndex &index) const
|
||||||
return mStatements->at(index.row());
|
return mStatements->at(index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap CodeCompletionListModel::statementIcon(const QModelIndex &index) const
|
QPixmap CodeCompletionListModel::statementIcon(const QModelIndex &index, int size) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
if (index.row()>=mStatements->count())
|
if (index.row()>=mStatements->count())
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
PStatement statement = mStatements->at(index.row());
|
PStatement statement = mStatements->at(index.row());
|
||||||
return pIconsManager->getPixmapForStatement(statement);
|
return pIconsManager->getPixmapForStatement(statement, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeCompletionListModel::notifyUpdated()
|
void CodeCompletionListModel::notifyUpdated()
|
||||||
|
@ -1348,7 +1344,7 @@ void CodeCompletionListItemDelegate::paint(QPainter *painter, const QStyleOption
|
||||||
if (option.state & QStyle::State_Selected) {
|
if (option.state & QStyle::State_Selected) {
|
||||||
painter->fillRect(option.rect, mCurrentSelectionColor);
|
painter->fillRect(option.rect, mCurrentSelectionColor);
|
||||||
}
|
}
|
||||||
QPixmap icon = mModel->statementIcon(index);
|
QPixmap icon = mModel->statementIcon(index, QFontMetrics(font()).height());
|
||||||
int x=option.rect.left();
|
int x=option.rect.left();
|
||||||
if (!icon.isNull()) {
|
if (!icon.isNull()) {
|
||||||
qreal dpr=icon.devicePixelRatioF();
|
qreal dpr=icon.devicePixelRatioF();
|
||||||
|
@ -1422,7 +1418,7 @@ void CodeCompletionListItemDelegate::setFont(const QFont &newFont)
|
||||||
QSize CodeCompletionListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QSize CodeCompletionListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
||||||
size.setHeight(size.height()*mLineHeightFactor);
|
size.setHeight(QFontMetrics(mFont).height()*mLineHeightFactor);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
int rowCount(const QModelIndex &parent) const override;
|
int rowCount(const QModelIndex &parent) const override;
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
PStatement statement(const QModelIndex &index) const;
|
PStatement statement(const QModelIndex &index) const;
|
||||||
QPixmap statementIcon(const QModelIndex &index) const;
|
QPixmap statementIcon(const QModelIndex &index, int size) const;
|
||||||
void notifyUpdated();
|
void notifyUpdated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -454,7 +454,7 @@ void HeaderCompletionListItemDelegate::paint(QPainter *painter, const QStyleOpti
|
||||||
QSize HeaderCompletionListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QSize HeaderCompletionListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
||||||
size.setHeight(size.height()*mLineHeightFactor);
|
size.setHeight(QFontMetrics(mFont).height()*mLineHeightFactor);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue