QPIConfig includes improvements
git-svn-id: svn://db.shs.com.ru/libs@77 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -21,7 +21,7 @@ endif ()
|
|||||||
target_link_libraries(kx_utils ${PIP_LIBRARY})
|
target_link_libraries(kx_utils ${PIP_LIBRARY})
|
||||||
|
|
||||||
if (NOT DEFINED ENV{QNX_HOST})
|
if (NOT DEFINED ENV{QNX_HOST})
|
||||||
if (${KX_PULT})
|
if (KX_PULT)
|
||||||
find_package(Qt4 REQUIRED)
|
find_package(Qt4 REQUIRED)
|
||||||
include_directories(${QT_INCLUDES})
|
include_directories(${QT_INCLUDES})
|
||||||
set(CPPS "kx_pult.cpp" "kx_pult.h" "kx_pult.ui" "main_kx_pult.cpp")
|
set(CPPS "kx_pult.cpp" "kx_pult.h" "kx_pult.ui" "main_kx_pult.cpp")
|
||||||
@@ -56,7 +56,7 @@ else ()
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NOT DEFINED ENV{QNX_HOST})
|
if (NOT DEFINED ENV{QNX_HOST})
|
||||||
if (${KX_PULT})
|
if (KX_PULT)
|
||||||
install(TARGETS kx_pult DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
install(TARGETS kx_pult DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
project(piqt_tools)
|
project(piqt_tools)
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
if (NOT LIBPROJECT)
|
if (NOT ${LIBPROJECT})
|
||||||
find_package(PIP REQUIRED)
|
find_package(PIP REQUIRED)
|
||||||
endif ()
|
endif ()
|
||||||
find_package(Qt4 REQUIRED)
|
find_package(Qt4 REQUIRED)
|
||||||
@@ -39,7 +39,7 @@ if (NOT DEFINED ENV{QNX_HOST})
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (DEFINED LIB)
|
if (DEFINED LIB)
|
||||||
set(LIB 1)
|
set(LIB true)
|
||||||
if (${WIN32})
|
if (${WIN32})
|
||||||
find_package(MinGW REQUIRED)
|
find_package(MinGW REQUIRED)
|
||||||
set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
|
set(CMAKE_INSTALL_PREFIX ${MINGW_DIR})
|
||||||
|
|||||||
@@ -26,6 +26,15 @@ ConfigHighlighter::ConfigHighlighter(QTextDocument * parent): QSyntaxHighlighter
|
|||||||
rule.format = sectionFormat;
|
rule.format = sectionFormat;
|
||||||
highlightingRules.append(rule);
|
highlightingRules.append(rule);
|
||||||
|
|
||||||
|
//substFormat.setFontWeight(QFont::Bold);
|
||||||
|
substFormat.setForeground(QColor(192, 0, 192));
|
||||||
|
rule.pattern = QRegExp("\\$\\{.*\\}+");
|
||||||
|
rule.pattern.setMinimal(true);
|
||||||
|
rule.format = substFormat;
|
||||||
|
highlightingRules.append(rule);
|
||||||
|
rule.pattern = QRegExp("\\$\\{[^\\{]*\\}+");
|
||||||
|
highlightingRules.append(rule);
|
||||||
|
|
||||||
singleLineCommentFormat.setFontItalic(true);
|
singleLineCommentFormat.setFontItalic(true);
|
||||||
singleLineCommentFormat.setForeground(QColor(128, 128, 128));
|
singleLineCommentFormat.setForeground(QColor(128, 128, 128));
|
||||||
rule.pattern = QRegExp("#[^\n]*");
|
rule.pattern = QRegExp("#[^\n]*");
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ private:
|
|||||||
|
|
||||||
QVector<HighlightingRule> highlightingRules;
|
QVector<HighlightingRule> highlightingRules;
|
||||||
QRegExp commentStartExpression, commentEndExpression;
|
QRegExp commentStartExpression, commentEndExpression;
|
||||||
QTextCharFormat singleLineCommentFormat, valueNameFormat, valueFormat, equalFormat, sectionFormat, spaceFormat;
|
QTextCharFormat singleLineCommentFormat, valueNameFormat, valueFormat, equalFormat, sectionFormat, spaceFormat, substFormat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONF_HIGHTLIGHTER_H
|
#endif // CONF_HIGHTLIGHTER_H
|
||||||
|
|||||||
@@ -688,7 +688,7 @@ void QPIConfig::updateIncludes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString QPIConfig::entryValue(QString v) {
|
QString QPIConfig::parseLine(QString v) {
|
||||||
int i = -1, l = 0;
|
int i = -1, l = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
i = v.indexOf("${");
|
i = v.indexOf("${");
|
||||||
@@ -696,11 +696,18 @@ QString QPIConfig::entryValue(QString v) {
|
|||||||
l = v.indexOf("}", i + 1);
|
l = v.indexOf("}", i + 1);
|
||||||
QString w = v.mid(i + 2, l - i - 2), r;
|
QString w = v.mid(i + 2, l - i - 2), r;
|
||||||
l = w.length() + 3;
|
l = w.length() + 3;
|
||||||
|
w = parseLine(w);
|
||||||
w = w.trimmed();
|
w = w.trimmed();
|
||||||
foreach (QPIConfig::Entry * e, all_includes) {
|
bool ex = false;
|
||||||
if (e->_full_name == w) {
|
QPIConfig::Entry & me = getValue(w, "", &ex);
|
||||||
r = e->_value;
|
if (ex) {
|
||||||
break;
|
r = me._value;
|
||||||
|
} else {
|
||||||
|
foreach (QPIConfig::Entry * e, all_includes) {
|
||||||
|
if (e->_full_name == w) {
|
||||||
|
r = e->_value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
v.replace(i, l, r);
|
v.replace(i, l, r);
|
||||||
@@ -735,7 +742,7 @@ void QPIConfig::parse(QString content) {
|
|||||||
lines = centry = 0;
|
lines = centry = 0;
|
||||||
while (!stream.atEnd()) {
|
while (!stream.atEnd()) {
|
||||||
other.push_back(QString());
|
other.push_back(QString());
|
||||||
src = str = stream.readLine();
|
src = str = parseLine(stream.readLine());
|
||||||
tprefix = getPrefixFromLine(src, &isPrefix);
|
tprefix = getPrefixFromLine(src, &isPrefix);
|
||||||
if (isPrefix) {
|
if (isPrefix) {
|
||||||
prefix = tprefix;
|
prefix = tprefix;
|
||||||
@@ -799,7 +806,7 @@ void QPIConfig::parse(QString content) {
|
|||||||
ce->delim = delim;
|
ce->delim = delim;
|
||||||
ce->_tab = tab;
|
ce->_tab = tab;
|
||||||
ce->_name = name;
|
ce->_name = name;
|
||||||
ce->_value = entryValue(str.right(str.length() - ind - 1).trimmed());
|
ce->_value = str.right(str.length() - ind - 1).trimmed();
|
||||||
ce->_type = type;
|
ce->_type = type;
|
||||||
ce->_comment = comm;
|
ce->_comment = comm;
|
||||||
ce->_line = lines;
|
ce->_line = lines;
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ private:
|
|||||||
void deleteEntry(Entry * e) {foreach (Entry * i, e->_children) deleteEntry(i); delete e;}
|
void deleteEntry(Entry * e) {foreach (Entry * i, e->_children) deleteEntry(i); delete e;}
|
||||||
QString getPrefixFromLine(QString line, bool * exists);
|
QString getPrefixFromLine(QString line, bool * exists);
|
||||||
void updateIncludes();
|
void updateIncludes();
|
||||||
QString entryValue(QString v);
|
QString parseLine(QString v);
|
||||||
void parse(QString content = QString());
|
void parse(QString content = QString());
|
||||||
|
|
||||||
int centry;
|
int centry;
|
||||||
|
|||||||
Reference in New Issue
Block a user