Hello

I was missing an autoresizing feature in the qt_qui plugin. So I made
little changes to the code and produced the following patch.
In config file, there is a new option AutoResize, which can be set to
0 ... don't resize the window;
1 ... resize window so the userView contains no extra space;
-1 ... like 1, except it moves the window so the bottom border of the
window stays on its position.

There is no change in the GUI. If you will want to add this to the main
branch, add a proper item to the options dialog. I don't like the visual
thinks :-)

Next: I am not sure if this is the best way of doing this. The window is
resized in the CMainWindow::show_user function. And this function is
called pretty often... I was realy trying to find a way to count the
items in the userList, but I failed in that.

Jaromir Malenko
[EMAIL PROTECTED]
[EMAIL PROTECTED]
homepage: http://www.ms.mff.cuni.cz/~malej9am

Here is the patch:

diff -c licq-1.2.7/plugins/qt-gui/src/mainwin.cpp 
licq-1.2.7-new/plugins/qt-gui/src/mainwin.cpp
*** licq-1.2.7/plugins/qt-gui/src/mainwin.cpp   2003-06-17 17:08:23.000000000 +0200
--- licq-1.2.7-new/plugins/qt-gui/src/mainwin.cpp       2004-04-06 00:59:17.969875688 
+0200
***************
*** 403,408 ****
--- 403,409 ----
    licqConf.ReadBool("AutoClose", m_bAutoClose, true);
    licqConf.ReadBool("AutoPopup", m_bAutoPopup, false);
    licqConf.ReadStr("MsgPopupKey", szTemp, "none");
+   licqConf.ReadNum("AutoResize", m_nAutoResize, 0);
  
    m_MsgAutopopupKey = QString::fromLatin1(szTemp);
    if(!(!szTemp || !strcmp(szTemp, "none"))) {
***************
*** 424,429 ****
--- 425,432 ----
              xPos, yPos, wVal, hVal);
    if (yPos > QApplication::desktop()->height() - 16) yPos = 0;
    if (xPos > QApplication::desktop()->width() - 16) xPos = 0;
+   resize(wVal, hVal);
+   move(xPos, yPos);
  
    // Check for qt-gui directory in current base dir
    if (!QDir(QString("%1/%2").arg(BASE_DIR).arg(QTGUI_DIR)).exists())
***************
*** 613,620 ****
     updateGroups();
     manualAway = 0;
  
-    resize(wVal, hVal);
-    move(xPos, yPos);
     if (!m_bHidden && !bStartHidden) show();
  
     // automatically logon if requested in conf file
--- 616,621 ----
***************
*** 1363,1368 ****
--- 1364,1371 ----
        break;
      }
    }
+ 
+   updateUserWin();
  }
  
  
***************
*** 1539,1544 ****
--- 1542,1561 ----
    FOR_EACH_USER_END
    userView->setUpdatesEnabled(true);
    userView->triggerUpdate();
+   
+   if (m_nAutoResize != 0) {
+     QSize size = gMainWindow->size();
+     QPoint pos = gMainWindow->pos();
+     int orig_height = size.height();
+     int base = size.height() - userView->height();
+     size.setHeight(base + userView->childCount()*18);
+     resize(size);
+     if (m_nAutoResize < 0) {
+       pos.setY(pos.y() + (orig_height - gMainWindow->size().height()));
+       move(pos);
+     }
+     resizeEvent(NULL);
+   }
  }
  
  
***************
*** 3001,3006 ****
--- 3018,3024 ----
    licqConf.WriteBool("AutoClose", m_bAutoClose);
    licqConf.WriteBool("AutoPopup", m_bAutoPopup);
    licqConf.WriteStr("MsgPopupKey", m_MsgAutopopupKey.isEmpty() ? "none" : 
m_MsgAutopopupKey.latin1());
+   licqConf.WriteNum("AutoResize", m_nAutoResize);
  
    licqConf.SetSection("appearance");
    licqConf.WriteStr("Skin", skin->szSkinName);
diff -c licq-1.2.7/plugins/qt-gui/src/mainwin.h 
licq-1.2.7-new/plugins/qt-gui/src/mainwin.h
*** licq-1.2.7/plugins/qt-gui/src/mainwin.h     2003-06-12 00:57:30.000000000 +0200
--- licq-1.2.7-new/plugins/qt-gui/src/mainwin.h 2004-04-05 18:25:17.000000000 +0200
***************
*** 216,221 ****
--- 216,222 ----
            pmBirthday, pmPhone, pmCellular, pmInvisible, pmCustomAR, pmCollapsed, 
pmExpanded;
    unsigned long m_nUserMenuUin;
    unsigned int positionChanges;
+   short m_nAutoResize;
  #ifdef QT_PROTOCOL_PLUGIN
    unsigned long m_nProtoNum;
    char *m_szUserMenuId;


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Licq-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/licq-devel

Reply via email to