QTfrontend/game.cpp
branchqmlfrontend
changeset 10886 99273b7afbff
parent 10851 f25dad9c3136
child 11046 47a8c19ecb60
--- a/QTfrontend/game.cpp	Mon Feb 16 22:33:15 2015 +0300
+++ b/QTfrontend/game.cpp	Thu Apr 02 21:09:56 2015 +0300
@@ -16,6 +16,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <QApplication>
+#include <QClipboard>
+
 #include <QString>
 #include <QCheckBox>
 #include <QByteArray>
@@ -258,6 +261,18 @@
                 .arg(QString::fromUtf8(msg.mid(2).left(size - 4))));
             return;
         }
+        case 'y':
+        {
+            // copy string to clipboard
+            QApplication::clipboard()->setText(QString::fromUtf8(msg.mid(2)));
+            break;
+        }
+        case 'Y':
+        {
+            // paste clipboard to game
+            SendIPC(QString("Y").toAscii() + QApplication::clipboard()->text().toUtf8().left(250).replace('\n', ' '));
+            break;
+        }
         case 'i':
         {
             emit GameStats(msg.at(2), QString::fromUtf8(msg.mid(3)));