mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Added resizable friendList
Not perfect, but a good start. Note that the editable name&status labels disappeared, QDesigner seems to have turned them into regular QLabels (no idea why).
This commit is contained in:
parent
5211f37d6a
commit
a34e28518f
1
friend.h
1
friend.h
@ -22,6 +22,7 @@ public:
|
|||||||
ChatForm* chatForm;
|
ChatForm* chatForm;
|
||||||
int hasNewMessages;
|
int hasNewMessages;
|
||||||
Status friendStatus;
|
Status friendStatus;
|
||||||
|
QPixmap avatar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRIEND_H
|
#endif // FRIEND_H
|
||||||
|
255
widget.ui
255
widget.ui
@ -10,6 +10,12 @@
|
|||||||
<height>320</height>
|
<height>320</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>640</width>
|
||||||
|
<height>320</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>1920</width>
|
<width>1920</width>
|
||||||
@ -23,10 +29,7 @@
|
|||||||
<iconset resource="res.qrc">
|
<iconset resource="res.qrc">
|
||||||
<normaloff>:/img/icon.png</normaloff>:/img/icon.png</iconset>
|
<normaloff>:/img/icon.png</normaloff>:/img/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
@ -39,8 +42,17 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
<widget class="QWidget" name="titleBar" native="true">
|
<widget class="QWidget" name="titleBar" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@ -220,29 +232,30 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QWidget" name="centralWidget" native="true">
|
<widget class="QSplitter" name="centralWidget">
|
||||||
<property name="enabled">
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="mouseTracking">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<property name="orientation">
|
||||||
<property name="leftMargin">
|
<enum>Qt::Horizontal</enum>
|
||||||
<number>0</number>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="childrenCollapsible">
|
||||||
<number>0</number>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QWidget" name="statusPanel" native="true">
|
<widget class="QWidget" name="statusPanel" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>225</width>
|
<width>225</width>
|
||||||
@ -251,7 +264,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>225</width>
|
<width>1920</width>
|
||||||
<height>16777215</height>
|
<height>16777215</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -718,9 +731,18 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="statusHead" native="true">
|
<widget class="QWidget" name="statusHead" native="true">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>225</width>
|
||||||
<height>60</height>
|
<height>60</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -1142,15 +1164,14 @@
|
|||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QLabel" name="profilePicture">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="geometry">
|
<item row="0" column="0">
|
||||||
<rect>
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<x>10</x>
|
<property name="spacing">
|
||||||
<y>10</y>
|
<number>0</number>
|
||||||
<width>40</width>
|
|
||||||
<height>40</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="profilePicture">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
@ -1173,18 +1194,14 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
<widget class="EditableLabelWidget" name="nameLabel">
|
<widget class="EditableLabelWidget" name="nameLabel">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>70</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>101</width>
|
|
||||||
<height>20</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="palette">
|
<property name="palette">
|
||||||
<palette>
|
<palette>
|
||||||
<active>
|
<active>
|
||||||
@ -1611,15 +1628,9 @@
|
|||||||
<string>Your name</string>
|
<string>Your name</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="EditableLabelWidget" name="statusLabel">
|
<widget class="EditableLabelWidget" name="statusLabel">
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>70</x>
|
|
||||||
<y>30</y>
|
|
||||||
<width>101</width>
|
|
||||||
<height>16</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="palette">
|
<property name="palette">
|
||||||
<palette>
|
<palette>
|
||||||
<active>
|
<active>
|
||||||
@ -1693,15 +1704,27 @@
|
|||||||
<string>Your status</string>
|
<string>Your status</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="statImg">
|
</item>
|
||||||
<property name="geometry">
|
</layout>
|
||||||
<rect>
|
</item>
|
||||||
<x>170</x>
|
<item>
|
||||||
<y>10</y>
|
<spacer name="horizontalSpacer_3">
|
||||||
<width>40</width>
|
<property name="orientation">
|
||||||
<height>40</height>
|
<enum>Qt::Horizontal</enum>
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>1920</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="statImg">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
@ -1714,11 +1737,14 @@
|
|||||||
<height>40</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="layoutDirection">
|
||||||
|
<enum>Qt::LeftToRight</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="pixmap">
|
||||||
<pixmap>img/status/dot_away_2x.png</pixmap>
|
<pixmap>../../c/toxgui/img/status/dot_away_2x.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
@ -1727,6 +1753,10 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
<zorder>profilePicture</zorder>
|
<zorder>profilePicture</zorder>
|
||||||
<zorder>statImg</zorder>
|
<zorder>statImg</zorder>
|
||||||
<zorder>nameLabel</zorder>
|
<zorder>nameLabel</zorder>
|
||||||
@ -1735,6 +1765,18 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QScrollArea" name="friendList">
|
<widget class="QScrollArea" name="friendList">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>225</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="layoutDirection">
|
<property name="layoutDirection">
|
||||||
<enum>Qt::RightToLeft</enum>
|
<enum>Qt::RightToLeft</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -1759,11 +1801,20 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="QWidget" name="tooliconsZone" native="true">
|
<widget class="QWidget" name="tooliconsZone" native="true">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>225</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -2215,6 +2266,9 @@
|
|||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -2227,6 +2281,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="groupButton">
|
<widget class="QPushButton" name="groupButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -2235,6 +2305,9 @@
|
|||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -2247,6 +2320,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="transferButton">
|
<widget class="QPushButton" name="transferButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -2261,6 +2350,9 @@
|
|||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -2273,6 +2365,22 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Maximum</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="settingsButton">
|
<widget class="QPushButton" name="settingsButton">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@ -2287,6 +2395,9 @@
|
|||||||
<height>35</height>
|
<height>35</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
@ -2304,9 +2415,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QWidget" name="mainPanel" native="true">
|
<widget class="QWidget" name="mainPanel" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>375</width>
|
<width>375</width>
|
||||||
@ -2749,6 +2864,12 @@
|
|||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="mainHead" native="true">
|
<widget class="QWidget" name="mainHead" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
@ -2827,9 +2948,15 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="mainContent" native="true">
|
<widget class="QWidget" name="mainContent" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>375</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -2837,8 +2964,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -23,6 +23,7 @@ FileTransfertWidget::FileTransfertWidget(ToxFile File)
|
|||||||
setAutoFillBackground(true);
|
setAutoFillBackground(true);
|
||||||
|
|
||||||
setMinimumSize(250,58);
|
setMinimumSize(250,58);
|
||||||
|
setMaximumHeight(58);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
mainLayout->setMargin(0);
|
mainLayout->setMargin(0);
|
||||||
|
|
||||||
|
@ -11,11 +11,16 @@ FriendWidget::FriendWidget(int FriendId, QString id)
|
|||||||
{
|
{
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
this->setAutoFillBackground(true);
|
this->setAutoFillBackground(true);
|
||||||
this->setLayout(&layout);
|
//this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||||
|
//this->setMinimumWidth(225);
|
||||||
this->setFixedWidth(225);
|
this->setFixedWidth(225);
|
||||||
this->setFixedHeight(55);
|
this->setFixedHeight(55);
|
||||||
layout.setSpacing(0);
|
this->setLayout(&layout);
|
||||||
|
//layout.setSpacing(0);
|
||||||
layout.setMargin(0);
|
layout.setMargin(0);
|
||||||
|
layout.setStretchFactor(this, 100);
|
||||||
|
//this->setFixedWidth(225);
|
||||||
|
//this->setMaximumWidth();
|
||||||
textLayout.setSpacing(0);
|
textLayout.setSpacing(0);
|
||||||
textLayout.setMargin(0);
|
textLayout.setMargin(0);
|
||||||
|
|
||||||
@ -53,6 +58,11 @@ FriendWidget::FriendWidget(int FriendId, QString id)
|
|||||||
isActiveWidget = 0;
|
isActiveWidget = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FriendWidget::setNewFixedWidth(int newWidth)
|
||||||
|
{
|
||||||
|
this->setFixedWidth(newWidth);
|
||||||
|
}
|
||||||
|
|
||||||
void FriendWidget::mouseReleaseEvent (QMouseEvent*)
|
void FriendWidget::mouseReleaseEvent (QMouseEvent*)
|
||||||
{
|
{
|
||||||
emit friendWidgetClicked(this);
|
emit friendWidgetClicked(this);
|
||||||
|
@ -18,6 +18,7 @@ public:
|
|||||||
void leaveEvent(QEvent* event);
|
void leaveEvent(QEvent* event);
|
||||||
void setAsActiveChatroom();
|
void setAsActiveChatroom();
|
||||||
void setAsInactiveChatroom();
|
void setAsInactiveChatroom();
|
||||||
|
void setNewFixedWidth(int newWidth);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendWidgetClicked(FriendWidget* widget);
|
void friendWidgetClicked(FriendWidget* widget);
|
||||||
|
@ -56,6 +56,11 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
|
|||||||
isActiveWidget = 0;
|
isActiveWidget = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupWidget::setNewFixedWidth(int newWidth)
|
||||||
|
{
|
||||||
|
this->setFixedWidth(newWidth);
|
||||||
|
}
|
||||||
|
|
||||||
void GroupWidget::mouseReleaseEvent (QMouseEvent*)
|
void GroupWidget::mouseReleaseEvent (QMouseEvent*)
|
||||||
{
|
{
|
||||||
emit groupWidgetClicked(this);
|
emit groupWidgetClicked(this);
|
||||||
@ -144,7 +149,7 @@ void GroupWidget::setAsActiveChatroom()
|
|||||||
QPalette pal3;
|
QPalette pal3;
|
||||||
pal3.setColor(QPalette::Background, Qt::white);
|
pal3.setColor(QPalette::Background, Qt::white);
|
||||||
this->setPalette(pal3);
|
this->setPalette(pal3);
|
||||||
avatar.setPixmap(QPixmap(":img/group_dark.png"));
|
avatar.setPixmap(QPixmap(":img/group.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupWidget::setAsInactiveChatroom()
|
void GroupWidget::setAsInactiveChatroom()
|
||||||
|
@ -30,6 +30,7 @@ public:
|
|||||||
QVBoxLayout textLayout;
|
QVBoxLayout textLayout;
|
||||||
void setAsInactiveChatroom();
|
void setAsInactiveChatroom();
|
||||||
void setAsActiveChatroom();
|
void setAsActiveChatroom();
|
||||||
|
void setNewFixedWidth(int newWidth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor lastColor;
|
QColor lastColor;
|
||||||
|
@ -38,7 +38,6 @@ Widget::Widget(QWidget *parent) :
|
|||||||
if (useNativeTheme)
|
if (useNativeTheme)
|
||||||
{
|
{
|
||||||
ui->titleBar->hide();
|
ui->titleBar->hide();
|
||||||
//setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint);
|
|
||||||
this->layout()->setContentsMargins(0, 0, 0, 0);
|
this->layout()->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
QString friendListStylesheet = "";
|
QString friendListStylesheet = "";
|
||||||
@ -109,7 +108,7 @@ Widget::Widget(QWidget *parent) :
|
|||||||
QRect geo = settings.value("geometry").toRect();
|
QRect geo = settings.value("geometry").toRect();
|
||||||
|
|
||||||
if (geo.height() > 0 and geo.x() < QApplication::desktop()->width() and geo.width() > 0 and geo.y() < QApplication::desktop()->height())
|
if (geo.height() > 0 and geo.x() < QApplication::desktop()->width() and geo.width() > 0 and geo.y() < QApplication::desktop()->height())
|
||||||
setGeometry(geo);
|
this->setGeometry(geo);
|
||||||
|
|
||||||
if (settings.value("maximized").toBool())
|
if (settings.value("maximized").toBool())
|
||||||
{
|
{
|
||||||
@ -127,7 +126,7 @@ Widget::Widget(QWidget *parent) :
|
|||||||
|
|
||||||
isWindowMinimized = 0;
|
isWindowMinimized = 0;
|
||||||
|
|
||||||
centralLayout = new QHBoxLayout(ui->centralWidget);
|
//centralLayout = new QSplitter(ui->centralWidget);
|
||||||
|
|
||||||
|
|
||||||
ui->mainContent->setLayout(new QVBoxLayout());
|
ui->mainContent->setLayout(new QVBoxLayout());
|
||||||
@ -139,6 +138,7 @@ Widget::Widget(QWidget *parent) :
|
|||||||
friendListWidget->layout()->setSpacing(0);
|
friendListWidget->layout()->setSpacing(0);
|
||||||
friendListWidget->layout()->setMargin(0);
|
friendListWidget->layout()->setMargin(0);
|
||||||
friendListWidget->setLayoutDirection(Qt::LeftToRight);
|
friendListWidget->setLayoutDirection(Qt::LeftToRight);
|
||||||
|
//friendListWidget->
|
||||||
ui->friendList->setWidget(friendListWidget);
|
ui->friendList->setWidget(friendListWidget);
|
||||||
|
|
||||||
ui->nameLabel->setText(Settings::getInstance().getUsername());
|
ui->nameLabel->setText(Settings::getInstance().getUsername());
|
||||||
@ -147,14 +147,24 @@ Widget::Widget(QWidget *parent) :
|
|||||||
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
|
ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}");
|
||||||
ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
|
|
||||||
setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
|
|
||||||
|
QList<QWidget*> widgets = this->findChildren<QWidget*>();
|
||||||
|
foreach (QWidget *widget, widgets)
|
||||||
|
widget->setMouseTracking(true);
|
||||||
|
|
||||||
ui->titleBar->setMouseTracking(true);
|
ui->titleBar->setMouseTracking(true);
|
||||||
ui->LTitle->setMouseTracking(true);
|
ui->LTitle->setMouseTracking(true);
|
||||||
ui->tbMenu->setMouseTracking(true);
|
ui->tbMenu->setMouseTracking(true);
|
||||||
ui->pbMin->setMouseTracking(true);
|
ui->pbMin->setMouseTracking(true);
|
||||||
ui->pbMax->setMouseTracking(true);
|
ui->pbMax->setMouseTracking(true);
|
||||||
ui->pbClose->setMouseTracking(true);
|
ui->pbClose->setMouseTracking(true);
|
||||||
//ui->->setMouseTracking(true);
|
ui->statusHead->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
ui->statusHead->setMouseTracking(true);
|
||||||
|
|
||||||
|
QList<int> currentSizes = ui->centralWidget->sizes();
|
||||||
|
currentSizes[0] = 225;
|
||||||
|
ui->centralWidget->setSizes(currentSizes);
|
||||||
|
|
||||||
camera = new Camera;
|
camera = new Camera;
|
||||||
camview = new SelfCamView(camera);
|
camview = new SelfCamView(camera);
|
||||||
@ -196,6 +206,7 @@ Widget::Widget(QWidget *parent) :
|
|||||||
connect(this, &Widget::friendRequested, core, &Core::requestFriendship);
|
connect(this, &Widget::friendRequested, core, &Core::requestFriendship);
|
||||||
connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest);
|
connect(this, &Widget::friendRequestAccepted, core, &Core::acceptFriendRequest);
|
||||||
|
|
||||||
|
connect(ui->centralWidget, SIGNAL(splitterMoved(int,int)),this, SLOT(splitterMoved(int,int)));
|
||||||
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
|
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddClicked()));
|
||||||
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
connect(ui->groupButton, SIGNAL(clicked()), this, SLOT(onGroupClicked()));
|
||||||
connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
|
connect(ui->transferButton, SIGNAL(clicked()), this, SLOT(onTransferClicked()));
|
||||||
@ -234,7 +245,6 @@ Widget::~Widget()
|
|||||||
settings.setValue("maximized", isMaximized());
|
settings.setValue("maximized", isMaximized());
|
||||||
settings.setValue("useNativeTheme", useNativeTheme);
|
settings.setValue("useNativeTheme", useNativeTheme);
|
||||||
delete ui;
|
delete ui;
|
||||||
delete centralLayout;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget* Widget::getInstance()
|
Widget* Widget::getInstance()
|
||||||
@ -244,6 +254,23 @@ Widget* Widget::getInstance()
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Super ugly hack to enable resizable friend widgets
|
||||||
|
//There should be a way to set them to resize automagicly, but I can't seem to find it.
|
||||||
|
void Widget::splitterMoved(int pos, int index)
|
||||||
|
{
|
||||||
|
updateFriendListWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Widget::updateFriendListWidth()
|
||||||
|
{
|
||||||
|
int newWidth = ui->friendList->width();
|
||||||
|
for (Friend* f : FriendList::friendList)
|
||||||
|
if (f->widget != nullptr)
|
||||||
|
f->widget->setNewFixedWidth(newWidth);
|
||||||
|
for (Group* g : GroupList::groupList)
|
||||||
|
if (g->widget != nullptr)
|
||||||
|
g->widget->setNewFixedWidth(newWidth);
|
||||||
|
}
|
||||||
|
|
||||||
QString Widget::getUsername()
|
QString Widget::getUsername()
|
||||||
{
|
{
|
||||||
@ -379,6 +406,7 @@ void Widget::addFriend(int friendId, const QString &userId)
|
|||||||
QWidget* widget = ui->friendList->widget();
|
QWidget* widget = ui->friendList->widget();
|
||||||
QLayout* layout = widget->layout();
|
QLayout* layout = widget->layout();
|
||||||
layout->addWidget(newfriend->widget);
|
layout->addWidget(newfriend->widget);
|
||||||
|
updateFriendListWidth();
|
||||||
connect(newfriend->widget, SIGNAL(friendWidgetClicked(FriendWidget*)), this, SLOT(onFriendWidgetClicked(FriendWidget*)));
|
connect(newfriend->widget, SIGNAL(friendWidgetClicked(FriendWidget*)), this, SLOT(onFriendWidgetClicked(FriendWidget*)));
|
||||||
connect(newfriend->widget, SIGNAL(removeFriend(int)), this, SLOT(removeFriend(int)));
|
connect(newfriend->widget, SIGNAL(removeFriend(int)), this, SLOT(removeFriend(int)));
|
||||||
connect(newfriend->widget, SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int)));
|
connect(newfriend->widget, SIGNAL(copyFriendIdToClipboard(int)), this, SLOT(copyFriendIdToClipboard(int)));
|
||||||
@ -536,6 +564,7 @@ void Widget::onFriendRequestReceived(const QString& userId, const QString& messa
|
|||||||
void Widget::removeFriend(int friendId)
|
void Widget::removeFriend(int friendId)
|
||||||
{
|
{
|
||||||
Friend* f = FriendList::findFriend(friendId);
|
Friend* f = FriendList::findFriend(friendId);
|
||||||
|
f->widget->setAsInactiveChatroom();
|
||||||
if (f->widget == activeFriendWidget)
|
if (f->widget == activeFriendWidget)
|
||||||
activeFriendWidget = nullptr;
|
activeFriendWidget = nullptr;
|
||||||
FriendList::removeFriend(friendId);
|
FriendList::removeFriend(friendId);
|
||||||
@ -637,6 +666,7 @@ void Widget::onGroupWidgetClicked(GroupWidget* widget)
|
|||||||
void Widget::removeGroup(int groupId)
|
void Widget::removeGroup(int groupId)
|
||||||
{
|
{
|
||||||
Group* g = GroupList::findGroup(groupId);
|
Group* g = GroupList::findGroup(groupId);
|
||||||
|
g->widget->setAsInactiveChatroom();
|
||||||
if (g->widget == activeGroupWidget)
|
if (g->widget == activeGroupWidget)
|
||||||
activeGroupWidget = nullptr;
|
activeGroupWidget = nullptr;
|
||||||
GroupList::removeGroup(groupId);
|
GroupList::removeGroup(groupId);
|
||||||
@ -665,6 +695,7 @@ Group *Widget::createGroup(int groupId)
|
|||||||
QWidget* widget = ui->friendList->widget();
|
QWidget* widget = ui->friendList->widget();
|
||||||
QLayout* layout = widget->layout();
|
QLayout* layout = widget->layout();
|
||||||
layout->addWidget(newgroup->widget);
|
layout->addWidget(newgroup->widget);
|
||||||
|
updateFriendListWidth();
|
||||||
connect(newgroup->widget, SIGNAL(groupWidgetClicked(GroupWidget*)), this, SLOT(onGroupWidgetClicked(GroupWidget*)));
|
connect(newgroup->widget, SIGNAL(groupWidgetClicked(GroupWidget*)), this, SLOT(onGroupWidgetClicked(GroupWidget*)));
|
||||||
connect(newgroup->widget, SIGNAL(removeGroup(int)), this, SLOT(removeGroup(int)));
|
connect(newgroup->widget, SIGNAL(removeGroup(int)), this, SLOT(removeGroup(int)));
|
||||||
connect(newgroup->chatForm, SIGNAL(sendMessage(int,QString)), core, SLOT(sendGroupMessage(int,QString)));
|
connect(newgroup->chatForm, SIGNAL(sendMessage(int,QString)), core, SLOT(sendGroupMessage(int,QString)));
|
||||||
@ -696,6 +727,7 @@ bool Widget::isFriendWidgetCurActiveWidget(Friend* f)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Widget::event(QEvent * e)
|
bool Widget::event(QEvent * e)
|
||||||
{
|
{
|
||||||
if (e->type() == QEvent::WindowStateChange)
|
if (e->type() == QEvent::WindowStateChange)
|
||||||
@ -890,6 +922,7 @@ void Widget::moveWindow(QMouseEvent *e)
|
|||||||
|
|
||||||
void Widget::resizeWindow(QMouseEvent *e)
|
void Widget::resizeWindow(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
|
updateFriendListWidth();
|
||||||
if (!useNativeTheme)
|
if (!useNativeTheme)
|
||||||
{
|
{
|
||||||
if (allowToResize)
|
if (allowToResize)
|
||||||
@ -1008,7 +1041,7 @@ void Widget::setCentralWidget(QWidget *widget, const QString &widgetName)
|
|||||||
connect(widget, SIGNAL(cancelled()), this, SLOT(close()));
|
connect(widget, SIGNAL(cancelled()), this, SLOT(close()));
|
||||||
|
|
||||||
centralLayout->addWidget(widget);
|
centralLayout->addWidget(widget);
|
||||||
ui->centralWidget->setLayout(centralLayout);
|
//ui->centralWidget->setLayout(centralLayout);
|
||||||
ui->LTitle->setText(widgetName);
|
ui->LTitle->setText(widgetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
void updateFriendStatusLights(int friendId);
|
void updateFriendStatusLights(int friendId);
|
||||||
int useNativeTheme;
|
int useNativeTheme;
|
||||||
~Widget();
|
~Widget();
|
||||||
|
void updateFriendListWidth();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void friendRequestAccepted(const QString& userId);
|
void friendRequestAccepted(const QString& userId);
|
||||||
@ -88,6 +89,7 @@ private slots:
|
|||||||
void removeFriend(int friendId);
|
void removeFriend(int friendId);
|
||||||
void copyFriendIdToClipboard(int friendId);
|
void copyFriendIdToClipboard(int friendId);
|
||||||
void removeGroup(int groupId);
|
void removeGroup(int groupId);
|
||||||
|
void splitterMoved(int pos, int index);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void moveWindow(QMouseEvent *e);
|
void moveWindow(QMouseEvent *e);
|
||||||
@ -98,7 +100,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Widget *ui;
|
Ui::Widget *ui;
|
||||||
QHBoxLayout *centralLayout;
|
QSplitter *centralLayout;
|
||||||
QPoint dragPosition;
|
QPoint dragPosition;
|
||||||
TitleMode m_titleMode;
|
TitleMode m_titleMode;
|
||||||
bool moveWidget;
|
bool moveWidget;
|
||||||
@ -108,7 +110,6 @@ private:
|
|||||||
bool resizeHorEsq;
|
bool resizeHorEsq;
|
||||||
bool resizeDiagSupEsq;
|
bool resizeDiagSupEsq;
|
||||||
bool resizeDiagSupDer;
|
bool resizeDiagSupDer;
|
||||||
//void mouseMoveEvent(QMouseEvent *e);
|
|
||||||
void mousePressEvent(QMouseEvent *e);
|
void mousePressEvent(QMouseEvent *e);
|
||||||
void mouseReleaseEvent(QMouseEvent *e);
|
void mouseReleaseEvent(QMouseEvent *e);
|
||||||
void mouseDoubleClickEvent(QMouseEvent *e);
|
void mouseDoubleClickEvent(QMouseEvent *e);
|
||||||
@ -126,6 +127,7 @@ private:
|
|||||||
int isFriendWidgetActive, isGroupWidgetActive;
|
int isFriendWidgetActive, isGroupWidgetActive;
|
||||||
SelfCamView* camview;
|
SelfCamView* camview;
|
||||||
Camera* camera;
|
Camera* camera;
|
||||||
|
bool notify(QObject *receiver, QEvent *event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIDGET_H
|
#endif // WIDGET_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user