InspectorDeckLinkInputWidget::InspectorDeckLinkInputWidget(QWidget* parent) : QWidget(parent), model(NULL), command(NULL) { setupUi(this); QObject::connect(&EventManager::getInstance(), SIGNAL(rundownItemSelected(const RundownItemSelectedEvent&)), this, SLOT(rundownItemSelected(const RundownItemSelectedEvent&))); loadDirection(); loadFormat(); loadTransition(); loadTween(); }
QFQtScriptHighlighter::QFQtScriptHighlighter(const QString &settingsDir, QTextDocument *parent) : QSyntaxHighlighter(parent) { HighlightingRule rule; QString prefix=""; // open the sdff-editor ini file and load the highlighting formats QString sd=settingsDir; if (sd.isEmpty()) { sd=ProgramOptions::getInstance()->getAssetsDirectory()+"/highlighter/qtscript/"; } QSettings settings(sd+"/highlight.ini", QSettings::IniFormat); loadFormat(settings, prefix+"style/keywords", keywordFormat, "blue", true, false, false); loadFormat(settings, prefix+"style/operators", operatorFormat, "red", false, false, false); loadFormat(settings, prefix+"style/comments", singleLineCommentFormat, "darkgray", false, false, false); loadFormat(settings, prefix+"style/multicomments", multiLineCommentFormat, "darkgray", false, false, false); loadFormat(settings, prefix+"style/strings", quotationFormat, "darkred", false, false, false); loadFormat(settings, prefix+"style/functions", functionFormat, "darkblue", false, false, false); loadFormat(settings, prefix+"style/variables", variableFormat, "black", false, false, false); loadFormat(settings, "highlighting/specialfunctions", specialfunctionFormat, "darkblue", true, false, false); // recognizes variables rule.pattern = QRegExp(settings.value(prefix+"rules/variables", "\\b[A-Za-z0-9_]+(?!\\()").toString()); rule.format = variableFormat; highlightingRules.append(rule); // recognizes functions rule.pattern = QRegExp(settings.value(prefix+"rules/functions", "\\b[A-Za-z0-9_]+(?=\\()").toString()); rule.format = functionFormat; highlightingRules.append(rule); // create a list of all valid keywords of SDFF // here the assertion \b (in C string constants typed as \\b, as we use the \-escape sequence here!) // says "word boundary", so \bname\b will only math 'name', not 'myname', as there is no word boundary // in front of the secont 'name' (see QRegExp documentation for details). QStringList keywordPatterns=settings.value(prefix+"lists/keywords", "null,true,false,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with").toString().split(","); foreach (QString pattern, keywordPatterns) { rule.pattern = QRegExp("\\b"+pattern.trimmed()+"\\b"); //qDebug()<<"keyword: "<<rule.pattern.pattern(); rule.format = keywordFormat; highlightingRules.append(rule); }
LRESULT AdvancedPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) { PropPage::translate(texts); PropPage::read(items); PropPage::readCheckBoxList(listItems, GetDlgItem(IDC_ADVANCED_BOOLEANS)); CurSel = SETTING(MEDIA_PLAYER); WMPlayerStr = Text::toT(SETTING(WMP_FORMAT)); WinampStr = Text::toT(SETTING(WINAMP_FORMAT)); iTunesStr = Text::toT(SETTING(ITUNES_FORMAT)); MPCStr = Text::toT(SETTING(MPLAYERC_FORMAT)); ctrlPlayer.Attach(GetDlgItem(IDC_PLAYER_COMBO)); ctrlPlayer.AddString(_T("Winamp")); ctrlPlayer.AddString(_T("Windows Media Player")); ctrlPlayer.AddString(_T("iTunes")); ctrlPlayer.AddString(_T("Media Player Classic")); ctrlPlayer.SetCurSel(CurSel); loadFormat(); return TRUE; }
// ==================================================== // LOAD // ==================================================== void ConfigFile::load(void) { QFile file("config.xml"); if (file.open(QFile::ReadOnly | QFile::Text)) { QDomDocument doc; if (doc.setContent(&file)) { QDomElement root = doc.documentElement(); // Manual Path QDomElement manPath = root.firstChildElement("OgreManualPath"); if (manPath.isNull() == false) { mManualPath = manPath.text() + "\\"; // Make sure it ends with a / } // Formats (required) QDomElement formatsNode = root.firstChildElement("Formats"); QDomNodeList formats = root.elementsByTagName("Format"); for (int i = 0; i < formats.count(); ++i) { QDomElement child = formats.item(i).toElement(); QString formatName = child.text(); QString highFile = child.attribute("highlights_file"); QString wordFile = child.attribute("words_file"); QString fileExt = child.attribute("file_extensions"); // Load this format loadFormat(formatName, highFile, wordFile); // Associate this format with its file extension mFormatsByExt[fileExt] = formatName; } } } } // load
LRESULT AdvancedPage::onSelChange(WORD /* wNotifyCode */, WORD /*wID*/, HWND /* hWndCtl */, BOOL& /* bHandled */) { saveFormat(); CurSel = ctrlPlayer.GetCurSel(); loadFormat(); return 0; }