Author: mir3x
Date: Fri Jul 15 07:57:56 2016
New Revision: 33243

URL: http://svn.gna.org/viewcvs/freeciv?rev=33243&view=rev
Log:
Qt client - added locking chat/messages and minimap.

See patch #7467


Modified:
    branches/S2_5/client/gui-qt/mapview.cpp
    branches/S2_5/client/gui-qt/mapview.h
    branches/S2_5/client/gui-qt/messagewin.cpp
    branches/S2_5/client/gui-qt/messagewin.h

Modified: branches/S2_5/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=33243&r1=33242&r2=33243&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/mapview.cpp     (original)
+++ branches/S2_5/client/gui-qt/mapview.cpp     Fri Jul 15 07:57:56 2016
@@ -332,6 +332,10 @@
 {
   QPoint qp, np;
 
+  if (gui()->infotab->locked) {
+    return;
+  }
+
   qp = event->globalPos();
   np.setX(qp.x() - point.x());
   np.setY(qp.y() - point.y());
@@ -411,6 +415,7 @@
   cw->put_to_corner();
   pix = new QPixmap;
   scale_factor = 1.0;
+  locked = false;
 }
 
 /**************************************************************************
@@ -763,6 +768,9 @@
 **************************************************************************/
 void minimap_view::mouseMoveEvent(QMouseEvent* event)
 {
+  if (locked) {
+    return;
+  }
   if (event->buttons() & Qt::LeftButton) {
     move(event->globalPos() - cursor);
     setCursor(Qt::SizeAllCursor);

Modified: branches/S2_5/client/gui-qt/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.h?rev=33243&r1=33242&r2=33243&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/mapview.h       (original)
+++ branches/S2_5/client/gui-qt/mapview.h       Fri Jul 15 07:57:56 2016
@@ -214,6 +214,7 @@
   virtual void update_menu();
   void update_image();
   void reset();
+  bool locked;
 
 protected:
   void paintEvent(QPaintEvent * event);

Modified: branches/S2_5/client/gui-qt/messagewin.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/messagewin.cpp?rev=33243&r1=33242&r2=33243&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/messagewin.cpp  (original)
+++ branches/S2_5/client/gui-qt/messagewin.cpp  Fri Jul 15 07:57:56 2016
@@ -60,16 +60,21 @@
     "QPushButton {border: noborder;}");
 
   layout = new QGridLayout;
+  locked = false;
   msg_button = new right_click_button;
   msg_button->setText(_("Messages"));
   chat_button = new right_click_button;
   chat_button->setText(_("Chat"));
   hide_button = new QPushButton(
                     style()->standardIcon(QStyle::SP_ArrowDown), "");
+  lock_button = new QPushButton(
+                    style()->standardIcon(QStyle::SP_TitleBarShadeButton), "");
+  lock_button->setToolTip(_("Locks/unlocks interface"));
 
   layout->addWidget(hide_button, 1, 0, 1, 1);
   layout->addWidget(msg_button, 1, 1, 1, 4);
-  layout->addWidget(chat_button, 1, 5, 1, 5);
+  layout->addWidget(chat_button, 1, 5, 1, 4);
+  layout->addWidget(lock_button, 1, 9, 1, 1);
   msgwdg = new messagewdg(this);
   layout->addWidget(msgwdg, 0, 0, 1, 5);
   layout->setRowStretch(0, 10);
@@ -91,6 +96,7 @@
   connect(chat_button, SIGNAL(clicked()), SLOT(activate_chat()));
   connect(msg_button, SIGNAL(right_clicked()), SLOT(on_right_clicked()));
   connect(chat_button, SIGNAL(right_clicked()), SLOT(on_right_clicked()));
+  connect(lock_button, SIGNAL(clicked()), SLOT(lock()));
   resx = false;
   resy = false;
   chat_stretch = 5;
@@ -143,6 +149,9 @@
 ***************************************************************************/
 void info_tab::mousePressEvent(QMouseEvent * event)
 {
+  if (locked) {
+    return;
+  }
   if (event->button() == Qt::LeftButton) {
     cursor = event->globalPos() - geometry().topLeft();
     if (event->y() > 0 && event->y() < 5){
@@ -178,6 +187,9 @@
 **************************************************************************/
 void info_tab::mouseMoveEvent(QMouseEvent *event)
 {
+  if (locked) {
+    return;
+  }
   if ((event->buttons() & Qt::LeftButton) && resize_mode && resy) {
     resize(width(), gui()->mapview_wdg->height()
            - event->globalPos().y() + cursor.y());
@@ -204,11 +216,11 @@
 {
   if (layout_changed) {
     layout->addWidget(hide_button, 1, 0, 1, 1);
-    layout->addWidget(chat_button, 1, 5, 1, 5);
+    layout->addWidget(chat_button, 1, 5, 1, 4);
     layout_changed =  false;
   } else {
     layout->addWidget(hide_button, 1, 5, 1, 1);
-    layout->addWidget(chat_button, 1, 6, 1, 4);
+    layout->addWidget(chat_button, 1, 6, 1, 3);
     layout_changed =  true;
   }
 }
@@ -221,6 +233,9 @@
 {
   int i;
 
+  if (locked) {
+    return;
+  }
   if (hidden_state) {
     hidden_mess = true;
     hidden_chat = false;
@@ -248,6 +263,9 @@
 ***************************************************************************/
 void info_tab::hide_chat(bool hyde)
 {
+  if (locked) {
+    return;
+  }
   if (hyde == true) {
     chtwdg->hide();
     chat_button->hide();
@@ -268,6 +286,9 @@
 ***************************************************************************/
 void info_tab::hide_messages(bool hyde)
 {
+  if (locked) {
+    return;
+  }
   if (hyde == true) {
     msgwdg->hide();
     msg_button->hide();
@@ -290,6 +311,24 @@
 }
 
 /***************************************************************************
+  Locks/unlocks interface
+***************************************************************************/
+void info_tab::lock()
+{
+  locked = !locked;
+  if (gui()->minimapview_wdg) {
+    gui()->minimapview_wdg->locked = locked;
+  }
+
+  if (locked) {
+    
lock_button->setIcon(style()->standardIcon(QStyle::SP_TitleBarUnshadeButton));
+  } else  {
+    
lock_button->setIcon(style()->standardIcon(QStyle::SP_TitleBarShadeButton));
+  }
+}
+
+
+/***************************************************************************
   Messages button was pressed.
   Changes stretch value for messages (increases messages width)
 ***************************************************************************/
@@ -297,6 +336,9 @@
 {
   int i;
 
+  if (locked) {
+    return;
+  }
   if (hidden_state) {
     hidden_chat = true;
     hidden_mess = false;

Modified: branches/S2_5/client/gui-qt/messagewin.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/messagewin.h?rev=33243&r1=33242&r2=33243&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/messagewin.h    (original)
+++ branches/S2_5/client/gui-qt/messagewin.h    Fri Jul 15 07:57:56 2016
@@ -83,6 +83,7 @@
   void hide_chat(bool hyde);
   void hide_messages(bool hyde);
   bool hidden_chat;
+  bool locked;
   bool hidden_mess;
   int whats_hidden;
 private:
@@ -91,6 +92,7 @@
   QPoint cursor;
   right_click_button *chat_button;
   QPushButton *hide_button;
+  QPushButton *lock_button;
   right_click_button *msg_button;
   QSize last_size;
   bool hidden_state;
@@ -102,6 +104,7 @@
   int msg_stretch;
 public slots:
   void hide_me();
+  void lock();
 private slots:
   void activate_msg();
   void activate_chat();


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to