[Spice-commits] 6 commits - generator/generator.cpp generator/generator.h generator/Makefile.am

Peter Hatina phatina at kemper.freedesktop.org
Mon Oct 21 10:55:51 CEST 2013


 generator/Makefile.am   |    2 -
 generator/generator.cpp |   52 ++++++++++++++++++++++++++++++++++++------------
 generator/generator.h   |    1 
 3 files changed, 41 insertions(+), 14 deletions(-)

New commits:
commit 4b9075ecc830ff6716509cbcad3017e831032c14
Author: Peter Hatina <phatina at redhat.com>
Date:   Mon Oct 21 07:45:46 2013 +0200

    generator, fix missing whitespace

diff --git a/generator/generator.cpp b/generator/generator.cpp
index ac58991..4324b21 100644
--- a/generator/generator.cpp
+++ b/generator/generator.cpp
@@ -50,10 +50,10 @@ void Generator::init()
     s_default_methods.insert("setlanguagestringssection");
     s_default_methods.insert("setlanguagestringslang");
     s_default_methods.insert("setusbfilterfilter");
-    s_default_attribute_values["adminconsole"] = " checked";
-    s_default_attribute_values["hotkey"] = " value=\"toggle-fullscreen=shift+f11," \
-        "release-cursor=shift+f12,smartcard-insert=shift+f8,smartcard-remove=shift+f9\"";
-    s_default_attribute_values["usblistenport"] = " value=\"32023\"";
+    s_default_attribute_values["adminconsole"] = "checked ";
+    s_default_attribute_values["hotkey"] = "value=\"toggle-fullscreen=shift+f11," \
+        "release-cursor=shift+f12,smartcard-insert=shift+f8,smartcard-remove=shift+f9\" ";
+    s_default_attribute_values["usblistenport"] = "value=\"32023\" ";
 }
 
 void Generator::generate()
@@ -199,7 +199,7 @@ void Generator::generateContent()
                       << itm->getIdentifier() << itp->getIdentifier()
                       << "Toggled', '" << itm->getIdentifier()
                       << itp->getIdentifier() << "')\""
-                      << (methodEnabled(*itm, *itp) ? "checked" : "")
+                      << (methodEnabled(*itm, *itp) ? " checked" : "")
                       << "/></td>\n<td>" << splitIdentifier(itm->getIdentifier())
                       << " - " << splitIdentifier(itp->getIdentifier()) << "</td>\n"
                       << "<td><input id=\"" << itm->getIdentifier() << itp->getIdentifier()
commit 1f482bc1ab9df24b945e9116379e7c0499bfadca
Author: Peter Hatina <phatina at redhat.com>
Date:   Wed Oct 2 10:26:39 2013 +0200

    generator, fix uppercase for SetUsbFilter()

diff --git a/generator/generator.cpp b/generator/generator.cpp
index 40ba5f5..ac58991 100644
--- a/generator/generator.cpp
+++ b/generator/generator.cpp
@@ -92,7 +92,7 @@ void Generator::generateHeader()
               << "function bodyUnload()\n{\n    log(\"Body Unload\");\n}\n\n"
               << "function connect()\n{\n"
               << "    setConnectVars();\n"
-              << "    setUsbFilter();\n"
+              << "    SetUsbFilter();\n"
               << "    embed.connect();\n"
               << "    log(\"Connect: host '\" + embed.hostIP + \"', port '\" + "
               << "embed.port\n        + \"', secure port '\" + embed.SecurePort + "
@@ -119,7 +119,7 @@ void Generator::generateHeader()
               << "        document.getElementById(\"SetLanguageStringslang\").value : \"\";\n"
               << "    embed.SetLanguageStrings(section, lang);\n"
               << "    log(\"Language Strings set to '\" + section + \"' '\" + lang + \"'\");\n}\n\n"
-              << "function setUsbFilter()\n{\n"
+              << "function SetUsbFilter()\n{\n"
               << "    UsbFilterToggled = document.getElementById(\"SetUsbFilterfilterToggled\");\n"
               << "    if (!UsbFilterToggled)\n        return;\n"
               << "    filter = UsbFilterToggled.checked ?\n"
commit 1232dc09fe04f51d229dd9486b45eea69e1d0cd8
Author: Peter Hatina <phatina at redhat.com>
Date:   Wed Oct 2 09:03:32 2013 +0200

    generator, do not install generator, if compiled

diff --git a/generator/Makefile.am b/generator/Makefile.am
index c066d55..a82d26b 100644
--- a/generator/Makefile.am
+++ b/generator/Makefile.am
@@ -1,5 +1,5 @@
 if BUILD_GENERATOR
-bin_PROGRAMS                = spice-xpi-generator
+noinst_PROGRAMS             = spice-xpi-generator
 spice_xpi_generator_SOURCES = \
 	attribute.h           \
 	generator.cpp         \
commit aba58310165301392e8a970c24348cb7f98ab89a
Author: Peter Hatina <phatina at redhat.com>
Date:   Wed Oct 2 08:50:34 2013 +0200

    generator, resize certificate textarea

diff --git a/generator/generator.cpp b/generator/generator.cpp
index f683338..40ba5f5 100644
--- a/generator/generator.cpp
+++ b/generator/generator.cpp
@@ -251,7 +251,7 @@ std::string Generator::attributeToHtmlElement(const Attribute &attr)
     std::string id = lowerString(attr.getIdentifier());
     if (id == "truststore") {
         ss << "<textarea id=\"" << attr.getIdentifier()
-           << "\" cols=\"66\" rows=\"33\" "
+           << "\" cols=\"80\" rows=\"10\" "
            << (attributeEnabled(attr) ? "" : "disabled")
            << "/></textarea>";
     } else {
commit d6e6646ddad8104481676b8851aed6d45837375d
Author: Peter Hatina <phatina at redhat.com>
Date:   Wed Oct 2 08:49:42 2013 +0200

    generator, reverse log order

diff --git a/generator/generator.cpp b/generator/generator.cpp
index 48b34d2..f683338 100644
--- a/generator/generator.cpp
+++ b/generator/generator.cpp
@@ -111,7 +111,7 @@ void Generator::generateHeader()
               << "    msgCell.innerHTML = message;\n\n"
               << "    newRow.appendChild(tsCell);\n"
               << "    newRow.appendChild(msgCell);\n"
-              << "    log.appendChild(newRow);\n}\n\n"
+              << "    log.insertBefore(newRow, log.firstChild);\n}\n\n"
               << "function setLanguageStrings()\n{\n"
               << "    section = document.getElementById(\"SetLanguageStringssectionToggled\").checked ?\n"
               << "        document.getElementById(\"SetLanguageStringssection\").value : \"\";\n"
commit 7f399a3871216b72854aa42765a057ea39d98c93
Author: Peter Hatina <phatina at redhat.com>
Date:   Wed Oct 2 08:45:35 2013 +0200

    generator, add parseInt() and parseFloat() into Generator::generateConnectVars() output

diff --git a/generator/generator.cpp b/generator/generator.cpp
index ee3eedd..48b34d2 100644
--- a/generator/generator.cpp
+++ b/generator/generator.cpp
@@ -157,11 +157,14 @@ void Generator::generateConnectVars()
     for (it = m_attributes.begin(); it != m_attributes.end(); ++it) {
         std::cout << "    embed." << it->getIdentifier() << " = "
                   << "document.getElementById(\""
-                  << it->getIdentifier() << "Toggled\").checked ? "
-                  << "document.getElementById(\""
+                  << it->getIdentifier() << "Toggled\").checked ? ";
+        bool generated_cast = generateConnectVarsParse(*it);
+        std::cout << "document.getElementById(\""
                   << it->getIdentifier() << "\")."
-                  << (it->getType() == Token::T_BOOLEAN ? "checked" : "value")
-                  << " : \"\";\n";
+                  << (it->getType() == Token::T_BOOLEAN ? "checked" : "value");
+        if (generated_cast)
+            std::cout << ")";
+        std::cout << " : \"\";\n";
     }
     std::cout << "}\n\n</script>\n\n";
 }
@@ -280,3 +283,26 @@ bool Generator::methodEnabled(const Method &method, const Method::MethodParam &p
     std::set<std::string>::iterator found = s_default_methods.find(id);
     return found != s_default_methods.end();
 }
+
+bool Generator::generateConnectVarsParse(const Attribute &attr)
+{
+    switch (attr.getType()) {
+    case Token::T_FLOAT:
+    case Token::T_DOUBLE:
+        std::cout << "parseFloat(";
+        return true;
+    case Token::T_UNSIGNED:
+    case Token::T_SHORT:
+    case Token::T_LONG:
+    case Token::T_LONG_LONG:
+    case Token::T_OCTET:
+    case Token::T_NUMBER:
+    case Token::T_UNSIGNED_SHORT:
+    case Token::T_UNSIGNED_LONG:
+    case Token::T_UNSIGNED_LONG_LONG:
+        std::cout << "parseInt(";
+        return true;
+    }
+
+    return false;
+}
diff --git a/generator/generator.h b/generator/generator.h
index 0a9bd3f..3dfde3a 100644
--- a/generator/generator.h
+++ b/generator/generator.h
@@ -47,6 +47,7 @@ private:
     static std::string attributeToHtmlElement(const Attribute &attr);
     static bool attributeEnabled(const Attribute &attr);
     static bool methodEnabled(const Method &method, const Method::MethodParam &param);
+    static bool generateConnectVarsParse(const Attribute &attr);
 
 private:
     std::list<Attribute> m_attributes;


More information about the Spice-commits mailing list