From 6bec54f2847afcb42eef982f38cc93c24d801d3f Mon Sep 17 00:00:00 2001 From: Miz Date: Thu, 10 Jan 2019 10:29:58 -0800 Subject: [PATCH] support for quoted OSC strings /osc=abc -> arg[0]=abc /osc=abc,def -> arg[0]=abc arg[1]=def /osc="abc,def" -> arg[0]=abc,def /osc="abc,","def," -> arg[0]=abc, arg[1]=def, /osc="""abc,def""" -> arg[0]="abc,def" /osc="""abc,""","""def,""" -> arg[0]="abc," arg[1]="def," --- OSCWidgets/MainWindow.cpp | 2 +- OSCWidgets/ToyCmd.cpp | 3 ++- OSCWidgets/Utils.cpp | 36 ++++++++++++++++++------------------ 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/OSCWidgets/MainWindow.cpp b/OSCWidgets/MainWindow.cpp index 8c6c6c3..1aa6f4c 100644 --- a/OSCWidgets/MainWindow.cpp +++ b/OSCWidgets/MainWindow.cpp @@ -27,7 +27,7 @@ //////////////////////////////////////////////////////////////////////////////// -#define APP_VERSION "0.9" +#define APP_VERSION "0.10" #define MIN_OPACITY 10 diff --git a/OSCWidgets/ToyCmd.cpp b/OSCWidgets/ToyCmd.cpp index bb10dce..4abeba6 100644 --- a/OSCWidgets/ToyCmd.cpp +++ b/OSCWidgets/ToyCmd.cpp @@ -33,7 +33,8 @@ FadeCmd::FadeCmd(QWidget *parent) void FadeCmd::AutoSizeFont() { - QFont fnt( font() ); + QFont fnt("Monospace"); + fnt.setStyleHint(QFont::TypeWriter); fnt.setPixelSize( qMax(10,qRound(height()*0.6)) ); setFont(fnt); } diff --git a/OSCWidgets/Utils.cpp b/OSCWidgets/Utils.cpp index 4de8ba1..9fe293e 100644 --- a/OSCWidgets/Utils.cpp +++ b/OSCWidgets/Utils.cpp @@ -69,27 +69,25 @@ void Utils::GetItemsFromQuotedString(const QString &str, QStringList &items) if(i>=len || (str[i]==QChar(',') && !quoted)) { int itemLen = (i - index); - if(itemLen > 0) - { - QString item( str.mid(index,itemLen).trimmed() ); - // remove quotes - if(item.startsWith('\"') && item.endsWith('\"')) + QString item; + item.reserve(itemLen); + for(int j=0; j 0) - item = item.mid(1, itemLen); - else - item.clear(); + if((j+1)=len || str[i+1]!=QChar('\"')) + else if((i+1)