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