diff --git a/img/group_dark.png b/img/group_dark.png new file mode 100644 index 000000000..55147f6c9 Binary files /dev/null and b/img/group_dark.png differ diff --git a/res.qrc b/res.qrc index 2692b39f2..5f56c9c1f 100644 --- a/res.qrc +++ b/res.qrc @@ -81,5 +81,21 @@ ui/videoButton/videoButtonYellow.png ui/videoButton/videoButtonYellowHover.png ui/videoButton/videoButtonYellowPressed.png + img/group_dark.png + ui/window/applicationIcon.png + ui/window/closeButton.png + ui/window/closeButtonHover.png + ui/window/closeButtonPressed.png + ui/window/maximizeButton.png + ui/window/maximizeButtonHover.png + ui/window/maximizeButtonPressed.png + ui/window/minimizeButton.png + ui/window/minimizeButtonHover.png + ui/window/minimizeButtonPressed.png + ui/window/restoreButton.png + ui/window/restoreButtonHover.png + ui/window/restoreButtonPressed.png + ui/friendList/friendList.css + ui/window/window.css diff --git a/ui/chatArea/chatArea.css b/ui/chatArea/chatArea.css index 5b621b6b2..9589c06aa 100644 --- a/ui/chatArea/chatArea.css +++ b/ui/chatArea/chatArea.css @@ -1,21 +1,24 @@ QScrollArea { - background: transparent; - border: 0 0 0 0; + background: white; + border: 0 0 0 0 ; } QScrollArea > QWidget > QWidget { - background: transparent; + background: white; } QScrollBar:vertical { - background: white; - width: 10px; - margin: 12px 0 12px 0; + background: transparent; + width: 12px; + margin-top: 2px; + margin-bottom: 2px; } QScrollBar::handle:vertical { background: #d1d1d1; min-height: 20px; + border-radius: 3px; + margin-left: 2px; } QScrollBar::handle:vertical:hover { @@ -27,36 +30,19 @@ QScrollBar::handle:vertical:pressed { } QScrollBar::add-line:vertical { - background: url(":/ui/chatArea/scrollBarDownArrow.png") center; - height: 10px; + background: url(":ui/chatArea/scrollBarDownArrow.png") center; + height: 0px; subcontrol-position: bottom; subcontrol-origin: margin; } -QScrollBar::add-line:vertical:hover { - background: url(":/ui/chatArea/scrollBarDownArrowHover.png") center; -} - -QScrollBar::add-line:vertical:pressed { - background: url(":/ui/chatArea/scrollBarDownArrowPressed.png") center; -} - QScrollBar::sub-line:vertical { - background: url(":/ui/chatArea/scrollBarUpArrow.png") center; - height: 10px; + background: url(":ui/chatArea/scrollBarUpArrow.png") center; + height: 0px; subcontrol-position: top; subcontrol-origin: margin; } -QScrollBar::sub-line:vertical:hover { - background: url(":/ui/chatArea/scrollBarUpArrowHover.png") center; -} - -QScrollBar::sub-line:vertical:pressed { - background: url(":/ui/chatArea/scrollBarUpArrowPressed.png") center; - -} - QScrollBar:QScrollBar::down-arrow:vertical { width: 10; height: 10px; @@ -77,12 +63,13 @@ QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { QScrollBar:horizontal { background: white; height: 10px; - margin: 0 12px 0 12px; + margin: 0 2px 0 2px; } QScrollBar::handle:horizontal { background: #d1d1d1; min-width: 20px; + border-radius: 2px; } QScrollBar::handle:horizontal:hover { @@ -94,36 +81,19 @@ QScrollBar::handle:horizontal:pressed { } QScrollBar::add-line:horizontal { - background: url(":/ui/chatArea/scrollBarRightArrow.png") center; - width: 10px; + background: url(":ui/chatArea/scrollBarRightArrow.png") center; + width: 0px; subcontrol-position: right; subcontrol-origin: margin; } -QScrollBar::add-line:horizontal:hover { - background: url(":/ui/chatArea/scrollBarRightArrowHover.png") center; -} - -QScrollBar::add-line:horizontal:pressed { - background: url(":/ui/chatArea/scrollBarRightArrowPressed.png") center; -} - QScrollBar::sub-line:horizontal { - background: url(":/ui/chatArea/scrollBarLeftArrow.png") center; - width: 10px; + background: url(":ui/chatArea/scrollBarLeftArrow.png") center; + width: 0px; subcontrol-position: left; subcontrol-origin: margin; } -QScrollBar::sub-line:horizontal:hover { - background: url(":/ui/chatArea/scrollBarLeftArrowHover.png") center; -} - -QScrollBar::sub-line:horizontal:pressed { - background: url(":/ui/chatArea/scrollBarLeftArrowPressed.png") center; - -} - QScrollBar:QScrollBar::down-arrow:horizontal { width: 10; height: 10px; diff --git a/ui/friendList/friendList.css b/ui/friendList/friendList.css new file mode 100644 index 000000000..42bf69cc1 --- /dev/null +++ b/ui/friendList/friendList.css @@ -0,0 +1,34 @@ +QScrollArea { + background: #414141!important; +} + +QScrollBar:vertical { + background: #414141!important; + width: 14px!important; + margin-top: 2px!important; + margin-bottom: 2px!important; +} + +QScrollBar:handle:vertical { + background: #1c1c1c!important; + min-height: 20px!important; + border-radius: 3px!important; + margin-left: 3px!important; + margin-right: 1px!important; +} + +QScrollBar:handle:vertical:hover { + background: #2d2d2d!important; +} + +QScrollBar:handle:vertical:pressed { + background: #171717!important; +} + +QScrollBar:add-line:vertical {height: 0px!important;subcontrol-position: bottom!important;subcontrol-origin: margin!important;} + +QScrollBar:sub-line:vertical {height: 0px!important;subcontrol-position: top!important;subcontrol-origin: margin!important;} + +QScrollBar:add-page:vertical, QScrollBar::sub-page:vertical { + background: none!important; +} diff --git a/ui/window/applicationIcon.png b/ui/window/applicationIcon.png new file mode 100644 index 000000000..b9cbe71bf Binary files /dev/null and b/ui/window/applicationIcon.png differ diff --git a/ui/window/closeButton.png b/ui/window/closeButton.png new file mode 100644 index 000000000..ce57b0e9e Binary files /dev/null and b/ui/window/closeButton.png differ diff --git a/ui/window/closeButtonHover.png b/ui/window/closeButtonHover.png new file mode 100644 index 000000000..8b756f08b Binary files /dev/null and b/ui/window/closeButtonHover.png differ diff --git a/ui/window/closeButtonPressed.png b/ui/window/closeButtonPressed.png new file mode 100644 index 000000000..caa1e4074 Binary files /dev/null and b/ui/window/closeButtonPressed.png differ diff --git a/ui/window/maximizeButton.png b/ui/window/maximizeButton.png new file mode 100644 index 000000000..d3223796c Binary files /dev/null and b/ui/window/maximizeButton.png differ diff --git a/ui/window/maximizeButtonHover.png b/ui/window/maximizeButtonHover.png new file mode 100644 index 000000000..dae87a3b5 Binary files /dev/null and b/ui/window/maximizeButtonHover.png differ diff --git a/ui/window/maximizeButtonPressed.png b/ui/window/maximizeButtonPressed.png new file mode 100644 index 000000000..719b3f8bc Binary files /dev/null and b/ui/window/maximizeButtonPressed.png differ diff --git a/ui/window/minimizeButton.png b/ui/window/minimizeButton.png new file mode 100644 index 000000000..8773e5359 Binary files /dev/null and b/ui/window/minimizeButton.png differ diff --git a/ui/window/minimizeButtonHover.png b/ui/window/minimizeButtonHover.png new file mode 100644 index 000000000..982c032b0 Binary files /dev/null and b/ui/window/minimizeButtonHover.png differ diff --git a/ui/window/minimizeButtonPressed.png b/ui/window/minimizeButtonPressed.png new file mode 100644 index 000000000..c72c1a5e9 Binary files /dev/null and b/ui/window/minimizeButtonPressed.png differ diff --git a/ui/window/restoreButton.png b/ui/window/restoreButton.png new file mode 100644 index 000000000..d3223796c Binary files /dev/null and b/ui/window/restoreButton.png differ diff --git a/ui/window/restoreButtonHover.png b/ui/window/restoreButtonHover.png new file mode 100644 index 000000000..dae87a3b5 Binary files /dev/null and b/ui/window/restoreButtonHover.png differ diff --git a/ui/window/restoreButtonPressed.png b/ui/window/restoreButtonPressed.png new file mode 100644 index 000000000..719b3f8bc Binary files /dev/null and b/ui/window/restoreButtonPressed.png differ diff --git a/ui/window/window.css b/ui/window/window.css new file mode 100644 index 000000000..84c771a95 --- /dev/null +++ b/ui/window/window.css @@ -0,0 +1,68 @@ +Widget#activeWindow +{ + background-color: #DFDFDF; + border: 2px solid #ABABAB; +} + +Widget#inactiveWindow +{ + background-color: #f4f4f4; + border: 2px solid #ABABAB; +} +/* +Widget#titleBar +{ + border: 10px solid #ABABAB; + border-top: 0px solid transparent; + background-color: #DFDFDF; +} + +Widget#titleBarInactive +{ + border: 5px solid #ABABAB; + border-top: 0px solid transparent; + background-color: #F1F1F1; +}*/ + +QToolButton#tbMenu +{ + border: 0px solid transparent; + background-color: transparent; +} + + +QPushButton#minimizeButton +{ + border: 0px solid transparent; + background-color: transparent; + image: url(":ui/window/minimizeButton.png");} +QPushButton#minimizeButton:hover {image: url(":ui/window/minimizeButtonHover.png");} +QPushButton#minimizeButton:pressed {image: url(":ui/window/minimizeButtonPressed.png");} +QPushButton#minimizeButton:focus {outline: none;} + +QPushButton#maximizeButton +{ + border: 0px solid transparent; + background-color: transparent; + image: url(":ui/window/maximizeButton.png");} +QPushButton#maximizeButton:hover {image: url(":ui/window/maximizeButtonHover.png");} +QPushButton#maximizeButton:pressed {image: url(":ui/window/maximizeButtonPressed.png");} +QPushButton#maximizeButton:focus {outline: none;} + +QPushButton#closeButton +{ + border: 0px solid transparent; + background-color: transparent; + image: url(":ui/window/closeButton.png");} +QPushButton#closeButton:hover {image: url(":ui/window/closeButtonHover.png");} +QPushButton#closeButton:pressed {image: url(":ui/window/closeButtonPressed.png");} +QPushButton#closeButton:focus {outline: none;} + +QPushButton#restoreButton +{ + border: 0px solid transparent; + background-color: transparent; + image: url(":ui/window/restoreButton.png");} +QPushButton#restoreButton:hover {image: url(":ui/window/restoreButtonHover.png");} +QPushButton#restoreButton:pressed {image: url(":ui/window/restoreButtonPressed.png");} +QPushButton#restoreButton:focus {outline: none;} diff --git a/widget.ui b/widget.ui index d3000aebf..3ec467ccc 100644 --- a/widget.ui +++ b/widget.ui @@ -1,2610 +1,2883 @@ - - - Widget - - - - 0 - 0 - 600 - 370 - - - - - 600 - 320 - - - - Tox - - - - :/img/icon.png:/img/icon.png - - - - 0 - - - 0 - - - - - - 225 - 0 - - - - - 225 - 16777215 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 255 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - true - - - - 0 - - - 0 - - - - - - 0 - 60 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 255 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - true - - - - - 10 - 10 - 40 - 40 - - - - - 40 - 40 - - - - - 40 - 40 - - - - - - - :/img/contact.png - - - true - - - - - true - - - - 70 - 10 - 101 - 20 - - - - - 11 - 75 - true - - - - Your name - - - - - - 70 - 30 - 101 - 16 - - - - - - - - - 193 - 193 - 193 - - - - - - - 193 - 193 - 193 - - - - - - - - - 193 - 193 - 193 - - - - - - - 193 - 193 - 193 - - - - - - - - - 14 - 14 - 14 - - - - - - - 14 - 14 - 14 - - - - - - - - - 8 - - - - Your status - - - - - - 170 - 10 - 40 - 40 - - - - - 40 - 40 - - - - - 40 - 40 - - - - - - - :/img/status/dot_away_2x.png - - - Qt::AlignCenter - - - true - - - - - - - - - - - - - 255 - 255 - 255 - - - - - - - 65 - 65 - 65 - - - - - - - 97 - 97 - 97 - - - - - - - 81 - 81 - 81 - - - - - - - 32 - 32 - 32 - - - - - - - 43 - 43 - 43 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 65 - 65 - 65 - - - - - - - 0 - 0 - 0 - - - - - - - 32 - 32 - 32 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 65 - 65 - 65 - - - - - - - 97 - 97 - 97 - - - - - - - 81 - 81 - 81 - - - - - - - 32 - 32 - 32 - - - - - - - 43 - 43 - 43 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 65 - 65 - 65 - - - - - - - 0 - 0 - 0 - - - - - - - 32 - 32 - 32 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 32 - 32 - 32 - - - - - - - 65 - 65 - 65 - - - - - - - 97 - 97 - 97 - - - - - - - 81 - 81 - 81 - - - - - - - 32 - 32 - 32 - - - - - - - 43 - 43 - 43 - - - - - - - 32 - 32 - 32 - - - - - - - 255 - 255 - 255 - - - - - - - 32 - 32 - 32 - - - - - - - 65 - 65 - 65 - - - - - - - 65 - 65 - 65 - - - - - - - 0 - 0 - 0 - - - - - - - 65 - 65 - 65 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - Qt::RightToLeft - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff - - - true - - - - - 0 - 0 - 225 - 275 - - - - - - - - - - 0 - 35 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 255 - 255 - 255 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 42 - 42 - 42 - - - - - - - 35 - 35 - 35 - - - - - - - 14 - 14 - 14 - - - - - - - 18 - 18 - 18 - - - - - - - 14 - 14 - 14 - - - - - - - 255 - 255 - 255 - - - - - - - 14 - 14 - 14 - - - - - - - 28 - 28 - 28 - - - - - - - 28 - 28 - 28 - - - - - - - 0 - 0 - 0 - - - - - - - 28 - 28 - 28 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - true - - - - 0 - - - 0 - - - - - - 55 - 35 - - - - - 55 - 35 - - - - - - - - :/img/add.png:/img/add.png - - - true - - - - - - - - 55 - 35 - - - - - - - - :/img/group.png:/img/group.png - - - true - - - - - - - - 55 - 35 - - - - - 55 - 35 - - - - - - - - :/img/transfer.png:/img/transfer.png - - - true - - - - - - - - 55 - 35 - - - - - 55 - 35 - - - - - - - - :/img/settings.png:/img/settings.png - - - true - - - - - - - - - - - - - - 375 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 170 - 170 - 170 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 170 - 170 - 170 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - - 127 - 127 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 170 - 170 - 170 - - - - - - - 127 - 127 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 127 - 127 - 127 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 255 - - - - - - - 0 - 0 - 0 - - - - - - - 255 - 255 - 255 - - - - - - - 255 - 255 - 220 - - - - - - - 0 - 0 - 0 - - - - - - - - true - - - - 0 - - - 0 - - - - - - 0 - 60 - - - - - 16777215 - 60 - - - - - - - - - 0 - 1 - - - - - 16777215 - 1 - - - - - - - - - 193 - 193 - 193 - - - - - - - - - 193 - 193 - 193 - - - - - - - - - 127 - 127 - 127 - - - - - - - - QFrame::HLine - - - QFrame::Plain - - - - - - - - 0 - 0 - - - - - - - - - - - - - EditableLabelWidget - QLabel -
widget/tool/editablelabelwidget.h
-
-
- - - - -
+ + + Widget + + + + 0 + 0 + 640 + 320 + + + + + 1920 + 1080 + + + + Tox + + + + :/img/icon.png:/img/icon.png + + + + 0 + + + 2 + + + 1 + + + 2 + + + 2 + + + + + + 0 + 23 + + + + + 16777215 + 23 + + + + + 4 + + + 5 + + + 0 + + + 1 + + + 0 + + + + + + 16 + 16 + + + + + 16 + 16 + + + + + 16 + 16 + + + + QToolButton::InstantPopup + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 15 + 1 + + + + + + + + + 100 + 22 + + + + + 16777215 + 22 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 134 + 20 + + + + + + + + + 22 + 22 + + + + + 22 + 22 + + + + + 22 + 22 + + + + true + + + + + + + + 22 + 22 + + + + + 22 + 22 + + + + + 22 + 22 + + + + true + + + + + + + + 22 + 22 + + + + + 22 + 22 + + + + + 22 + 22 + + + + true + + + + + + + + + + true + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 225 + 0 + + + + + 225 + 16777215 + + + + + + + + + 255 + 255 + 255 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 14 + 14 + 14 + + + + + + + 255 + 255 + 255 + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 28 + 28 + 28 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + true + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 60 + + + + + + + + + 255 + 255 + 255 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 14 + 14 + 14 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 14 + 14 + 14 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 14 + 14 + 14 + + + + + + + 255 + 255 + 255 + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + true + + + + + 10 + 10 + 40 + 40 + + + + + 40 + 40 + + + + + 40 + 40 + + + + + + + :/img/contact.png + + + true + + + + + true + + + + 70 + 10 + 101 + 20 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 240 + 240 + 240 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + + + 11 + 75 + true + + + + Your name + + + + + + 70 + 30 + 101 + 16 + + + + + + + + + 193 + 193 + 193 + + + + + + + 193 + 193 + 193 + + + + + + + + + 193 + 193 + 193 + + + + + + + 193 + 193 + 193 + + + + + + + + + 14 + 14 + 14 + + + + + + + 14 + 14 + 14 + + + + + + + + + 8 + + + + Your status + + + + + + 170 + 10 + 40 + 40 + + + + + 40 + 40 + + + + + 40 + 40 + + + + + + + img/status/dot_away_2x.png + + + Qt::AlignCenter + + + true + + + profilePicture + statImg + nameLabel + statusLabel + + + + + + Qt::RightToLeft + + + QFrame::NoFrame + + + Qt::ScrollBarAlwaysOff + + + true + + + + + 0 + 0 + 225 + 199 + + + + + + + + + + 0 + 35 + + + + + + + + + 255 + 255 + 255 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 14 + 14 + 14 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 255 + 255 + 255 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 14 + 14 + 14 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 42 + 42 + 42 + + + + + + + 35 + 35 + 35 + + + + + + + 14 + 14 + 14 + + + + + + + 18 + 18 + 18 + + + + + + + 14 + 14 + 14 + + + + + + + 255 + 255 + 255 + + + + + + + 14 + 14 + 14 + + + + + + + 28 + 28 + 28 + + + + + + + 28 + 28 + 28 + + + + + + + 0 + 0 + 0 + + + + + + + 28 + 28 + 28 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + true + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 55 + 35 + + + + + 55 + 35 + + + + + + + + :/img/add.png:/img/add.png + + + true + + + + + + + + 55 + 35 + + + + + + + + :/img/group.png:/img/group.png + + + true + + + + + + + + 55 + 35 + + + + + 55 + 35 + + + + + + + + :/img/transfer.png:/img/transfer.png + + + true + + + + + + + + 55 + 35 + + + + + 55 + 35 + + + + + + + + :/img/settings.png:/img/settings.png + + + true + + + + + + + + + + + + + + 375 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 170 + 170 + 170 + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 127 + 127 + 127 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 255 + + + + + + + 0 + 0 + 0 + + + + + + + 255 + 255 + 255 + + + + + + + 255 + 255 + 220 + + + + + + + 0 + 0 + 0 + + + + + + + + true + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 60 + + + + + 16777215 + 60 + + + + true + + + + + + + + 0 + 1 + + + + + 16777215 + 1 + + + + + + + + + 193 + 193 + 193 + + + + + + + + + 193 + 193 + 193 + + + + + + + + + 127 + 127 + 127 + + + + + + + + QFrame::HLine + + + QFrame::Plain + + + + + + + + 0 + 0 + + + + + + + + + + + + + + Close + + + Ctrl+Q + + + + + + + EditableLabelWidget + QLabel +
widget/tool/editablelabelwidget.h
+
+
+ + + + + + actionClose + triggered() + Widget + close() + + + -1 + -1 + + + 69 + 61 + + + + +
diff --git a/widget/friendwidget.cpp b/widget/friendwidget.cpp index c01393507..8f66b87fb 100644 --- a/widget/friendwidget.cpp +++ b/widget/friendwidget.cpp @@ -9,6 +9,7 @@ FriendWidget::FriendWidget(int FriendId, QString id) : friendId(FriendId) { + this->setMouseTracking(true); this->setAutoFillBackground(true); this->setLayout(&layout); this->setFixedWidth(225); @@ -18,16 +19,22 @@ FriendWidget::FriendWidget(int FriendId, QString id) textLayout.setSpacing(0); textLayout.setMargin(0); - avatar.setPixmap(QPixmap(":/img/contact.png")); + avatar.setPixmap(QPixmap(":img/contact.png")); name.setText(id); //statusPic.setAlignment(Qt::AlignHCenter); - statusPic.setPixmap(QPixmap(":/img/status/dot_away.png")); + statusPic.setPixmap(QPixmap(":img/status/dot_away.png")); QFont small; small.setPixelSize(10); statusMessage.setFont(small); QPalette pal; pal.setColor(QPalette::WindowText,Qt::gray); statusMessage.setPalette(pal); + QPalette pal2; + pal2.setColor(QPalette::WindowText,Qt::white); + name.setPalette(pal2); + QPalette pal3; + pal3.setColor(QPalette::Background, QColor(65,65,65,255)); + this->setPalette(pal3); textLayout.addStretch(); textLayout.addWidget(&name); @@ -140,7 +147,7 @@ void FriendWidget::setAsActiveChatroom() QPalette pal3; pal3.setColor(QPalette::Background, Qt::white); this->setPalette(pal3); - avatar.setPixmap(QPixmap(":/img/contact_dark.png")); + avatar.setPixmap(QPixmap(":img/contact_dark.png")); } void FriendWidget::setAsInactiveChatroom() @@ -159,5 +166,5 @@ void FriendWidget::setAsInactiveChatroom() QPalette pal3; pal3.setColor(QPalette::Background, QColor(65,65,65,255)); this->setPalette(pal3); - avatar.setPixmap(QPixmap(":/img/contact.png")); + avatar.setPixmap(QPixmap(":img/contact.png")); } diff --git a/widget/groupwidget.cpp b/widget/groupwidget.cpp index 0d44be739..9932f0162 100644 --- a/widget/groupwidget.cpp +++ b/widget/groupwidget.cpp @@ -8,6 +8,7 @@ GroupWidget::GroupWidget(int GroupId, QString Name) : groupId{GroupId} { + this->setMouseTracking(true); this->setAutoFillBackground(true); this->setLayout(&layout); this->setFixedWidth(225); @@ -17,8 +18,8 @@ GroupWidget::GroupWidget(int GroupId, QString Name) textLayout.setSpacing(0); textLayout.setMargin(0); - avatar.setPixmap(QPixmap(":/img/group.png")); - statusPic.setPixmap(QPixmap(":/img/status/dot_groupchat.png")); + avatar.setPixmap(QPixmap(":img/group.png")); + statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png")); name.setText(Name); QFont small; small.setPixelSize(10); @@ -26,6 +27,12 @@ GroupWidget::GroupWidget(int GroupId, QString Name) QPalette pal; pal.setColor(QPalette::WindowText,Qt::gray); nusers.setPalette(pal); + QPalette pal2; + pal2.setColor(QPalette::WindowText,Qt::white); + name.setPalette(pal2); + QPalette pal3; + pal3.setColor(QPalette::Background, QColor(65,65,65,255)); + this->setPalette(pal3); Group* g = GroupList::findGroup(groupId); if (g) nusers.setText(QString("%1 users in chat").arg(g->peers.size())); @@ -137,7 +144,7 @@ void GroupWidget::setAsActiveChatroom() QPalette pal3; pal3.setColor(QPalette::Background, Qt::white); this->setPalette(pal3); - avatar.setPixmap(QPixmap(":/img/group_dark.png")); + avatar.setPixmap(QPixmap(":img/group_dark.png")); } void GroupWidget::setAsInactiveChatroom() @@ -156,5 +163,5 @@ void GroupWidget::setAsInactiveChatroom() QPalette pal3; pal3.setColor(QPalette::Background, QColor(65,65,65,255)); this->setPalette(pal3); - avatar.setPixmap(QPixmap(":/img/group.png")); + avatar.setPixmap(QPixmap("img/group.png")); } diff --git a/widget/widget.cpp b/widget/widget.cpp index 89019655d..99028c242 100644 --- a/widget/widget.cpp +++ b/widget/widget.cpp @@ -12,6 +12,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include Widget *Widget::instance{nullptr}; @@ -19,6 +27,115 @@ Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget), activeFriendWidget{nullptr}, activeGroupWidget{nullptr} { ui->setupUi(this); + + QSettings settings(Settings::getInstance().getSettingsDirPath() + '/' + "windowSettings.ini", QSettings::IniFormat); + if (!settings.contains("useNativeTheme")) + useNativeTheme = 1; + else + useNativeTheme = settings.value("useNativeTheme").toInt(); + + if (useNativeTheme) + { + ui->titleBar->hide(); + //setWindowFlags(windowFlags() & ~Qt::FramelessWindowHint); + this->layout()->setContentsMargins(0, 0, 0, 0); + + QString friendListStylesheet = ""; + try + { + QFile f(":ui/friendList/friendList.css"); + f.open(QFile::ReadOnly | QFile::Text); + QTextStream friendListStylesheetStream(&f); + friendListStylesheet = friendListStylesheetStream.readAll(); + } + catch (int e) {} + ui->friendList->setObjectName("friendList"); + ui->friendList->setStyleSheet(friendListStylesheet); + } + else + { + QString windowStylesheet = ""; + try + { + QFile f(":ui/window/window.css"); + f.open(QFile::ReadOnly | QFile::Text); + QTextStream windowStylesheetStream(&f); + windowStylesheet = windowStylesheetStream.readAll(); + } + catch (int e) {} + this->setObjectName("activeWindow"); + this->setStyleSheet(windowStylesheet); + ui->statusPanel->setStyleSheet(QString("")); + ui->friendList->setStyleSheet(QString("")); + + QString friendListStylesheet = ""; + try + { + QFile f(":ui/friendList/friendList.css"); + f.open(QFile::ReadOnly | QFile::Text); + QTextStream friendListStylesheetStream(&f); + friendListStylesheet = friendListStylesheetStream.readAll(); + } + catch (int e) {} + ui->friendList->setObjectName("friendList"); + ui->friendList->setStyleSheet(friendListStylesheet); + + ui->tbMenu->setIcon(QIcon(":ui/window/applicationIcon.png")); + ui->pbMin->setObjectName("minimizeButton"); + ui->pbMax->setObjectName("maximizeButton"); + ui->pbClose->setObjectName("closeButton"); + + setWindowFlags(Qt::CustomizeWindowHint); + setWindowFlags(Qt::FramelessWindowHint); + setAttribute(Qt::WA_DeleteOnClose); + setMouseTracking(true); + ui->titleBar->setMouseTracking(true); + ui->LTitle->setMouseTracking(true); + ui->tbMenu->setMouseTracking(true); + ui->pbMin->setMouseTracking(true); + ui->pbMax->setMouseTracking(true); + ui->pbClose->setMouseTracking(true); + + addAction(ui->actionClose); + + connect(ui->pbMin, SIGNAL(clicked()), this, SLOT(minimizeBtnClicked())); + connect(ui->pbMax, SIGNAL(clicked()), this, SLOT(maximizeBtnClicked())); + connect(ui->pbClose, SIGNAL(clicked()), this, SLOT(close())); + + m_titleMode = FullTitle; + moveWidget = false; + inResizeZone = false; + allowToResize = false; + resizeVerSup = false; + resizeHorEsq = false; + resizeDiagSupEsq = false; + resizeDiagSupDer = false; + + QSettings settings(Settings::getInstance().getSettingsDirPath() + '/' + "windowSettings.ini", QSettings::IniFormat); + 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()) + setGeometry(geo); + + if (settings.value("maximized").toBool()) + { + showMaximized(); + ui->pbMax->setObjectName("restoreButton"); + } + + QList widgets = this->findChildren(); + + foreach (QWidget *widget, widgets) + { + widget->setMouseTracking(true); + } + } + + isWindowMinimized = 0; + + centralLayout = new QHBoxLayout(ui->centralWidget); + + ui->mainContent->setLayout(new QVBoxLayout()); ui->mainHead->setLayout(new QVBoxLayout()); ui->mainHead->layout()->setMargin(0); @@ -31,7 +148,9 @@ Widget::Widget(QWidget *parent) : ui->friendList->setWidget(friendListWidget); ui->nameLabel->setText(Settings::getInstance().getUsername()); + ui->nameLabel->label->setStyleSheet("QLabel { color : white; font-size: 11pt; font-weight:bold;}"); ui->statusLabel->setText(Settings::getInstance().getStatusMessage()); + ui->statusLabel->label->setStyleSheet("QLabel { color : white; font-size: 8pt;}"); ui->friendList->widget()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); camera = new Camera; @@ -107,8 +226,12 @@ Widget::~Widget() for (Group* g : GroupList::groupList) delete g; GroupList::groupList.clear(); - + QSettings settings(Settings::getInstance().getSettingsDirPath() + '/' + "windowSettings.ini", QSettings::IniFormat); + settings.setValue("geometry", geometry()); + settings.setValue("maximized", isMaximized()); + settings.setValue("useNativeTheme", useNativeTheme); delete ui; + delete centralLayout; } Widget* Widget::getInstance() @@ -118,6 +241,7 @@ Widget* Widget::getInstance() return instance; } + QString Widget::getUsername() { return ui->nameLabel->text(); @@ -150,11 +274,11 @@ void Widget::onFailedToStartCore() void Widget::onStatusSet(Status status) { if (status == Status::Online) - ui->statImg->setPixmap(QPixmap(":/img/status/dot_online_2x.png")); + ui->statImg->setPixmap(QPixmap(":img/status/dot_online_2x.png")); else if (status == Status::Busy || status == Status::Away) - ui->statImg->setPixmap(QPixmap(":/img/status/dot_idle_2x.png")); + ui->statImg->setPixmap(QPixmap(":img/status/dot_idle_2x.png")); else if (status == Status::Offline) - ui->statImg->setPixmap(QPixmap(":/img/status/dot_away_2x.png")); + ui->statImg->setPixmap(QPixmap(":img/status/dot_away_2x.png")); } void Widget::onAddClicked() @@ -358,7 +482,7 @@ void Widget::onFriendMessageReceived(int friendId, const QString& message) if (activeFriendWidget != nullptr) { Friend* f2 = FriendList::findFriend(activeFriendWidget->friendId); - if ((f->friendId != f2->friendId) || isFriendWidgetActive == 0) + if (((f->friendId != f2->friendId) || isFriendWidgetActive == 0) || isWindowMinimized) { f->hasNewMessages = 1; newMessageAlert(); @@ -378,23 +502,23 @@ void Widget::updateFriendStatusLights(int friendId) Friend* f = FriendList::findFriend(friendId); Status status = f->friendStatus; if (status == Status::Online && f->hasNewMessages == 0) - f->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_online.png")); + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online.png")); else if (status == Status::Online && f->hasNewMessages == 1) - f->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_online_notification.png")); + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_online_notification.png")); else if ((status == Status::Busy || status == Status::Away) && f->hasNewMessages == 0) - f->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_idle.png")); + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_idle.png")); else if ((status == Status::Busy || status == Status::Away) && f->hasNewMessages == 1) - f->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_idle_notification.png")); + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_idle_notification.png")); else if (status == Status::Offline && f->hasNewMessages == 0) - f->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_away.png")); + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_away.png")); else if (status == Status::Offline && f->hasNewMessages == 1) - f->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_away_notification.png")); + f->widget->statusPic.setPixmap(QPixmap(":img/status/dot_away_notification.png")); } void Widget::newMessageAlert() { - QApplication::alert(this, 1000); - QSound::play(":/audio/notification.wav"); + QApplication::alert(this); + QSound::play(":audio/notification.wav"); } void Widget::onFriendRequestReceived(const QString& userId, const QString& message) @@ -435,20 +559,20 @@ void Widget::onGroupMessageReceived(int groupnumber, int friendgroupnumber, cons g->chatForm->addGroupMessage(message, friendgroupnumber); - if (isGroupWidgetActive != 1 || (g->groupId != activeGroupWidget->groupId)) + if ((isGroupWidgetActive != 1 || (g->groupId != activeGroupWidget->groupId)) || isWindowMinimized) { if (message.contains(Settings::getInstance().getUsername(), Qt::CaseInsensitive)) { newMessageAlert(); g->hasNewMessages = 1; g->userWasMentioned = 1; - g->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_groupchat_notification.png")); + g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_notification.png")); } else if (g->hasNewMessages == 0) { g->hasNewMessages = 1; - g->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_groupchat_newmessages.png")); + g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat_newmessages.png")); } } } @@ -492,7 +616,7 @@ void Widget::onGroupWidgetClicked(GroupWidget* widget) { g->hasNewMessages = 0; g->userWasMentioned = 0; - g->widget->statusPic.setPixmap(QPixmap(":/img/status/dot_groupchat.png")); + g->widget->statusPic.setPixmap(QPixmap(":img/status/dot_groupchat.png")); } } @@ -557,3 +681,408 @@ bool Widget::isFriendWidgetCurActiveWidget(Friend* f) return false; return true; } + + + +void Widget::mouseMoveEvent(QMouseEvent *e) +{ + if (!useNativeTheme) + { + int xMouse = e->pos().x(); + int yMouse = e->pos().y(); + int wWidth = this->geometry().width(); + int wHeight = this->geometry().height(); + + if (moveWidget) + { + inResizeZone = false; + moveWindow(e); + } + else if (allowToResize) + resizeWindow(e); + //right + else if (xMouse >= wWidth - PIXELS_TO_ACT or allowToResize) + { + inResizeZone = true; + + if (yMouse >= wHeight - PIXELS_TO_ACT) + setCursor(Qt::SizeFDiagCursor); + else if (yMouse <= PIXELS_TO_ACT) + setCursor(Qt::SizeBDiagCursor); + else + setCursor(Qt::SizeHorCursor); + + resizeWindow(e); + } + //left + else if (xMouse <= PIXELS_TO_ACT or allowToResize) + { + inResizeZone = true; + + if (yMouse >= wHeight - PIXELS_TO_ACT) + setCursor(Qt::SizeBDiagCursor); + else if (yMouse <= PIXELS_TO_ACT) + setCursor(Qt::SizeFDiagCursor); + else + setCursor(Qt::SizeHorCursor); + + resizeWindow(e); + } + //bottom edge + else if ((yMouse >= wHeight - PIXELS_TO_ACT) or allowToResize) + { + inResizeZone = true; + setCursor(Qt::SizeVerCursor); + + resizeWindow(e); + } + //Cursor part top + else if (yMouse <= PIXELS_TO_ACT or allowToResize) + { + inResizeZone = true; + setCursor(Qt::SizeVerCursor); + + resizeWindow(e); + } + else + { + inResizeZone = false; + setCursor(Qt::ArrowCursor); + } + + e->accept(); + } +} + +bool Widget::event(QEvent * e) +{ + if (e->type() == QEvent::WindowStateChange) + { + if(windowState().testFlag(Qt::WindowMinimized) == true) + { + isWindowMinimized = 1; + } + } + else if (e->type() == QEvent::WindowActivate) + { + if (!useNativeTheme) + { + this->setObjectName("activeWindow"); + this->style()->polish(this); + } + isWindowMinimized = 0; + if (isFriendWidgetActive && activeFriendWidget != nullptr) + { + Friend* f = FriendList::findFriend(activeFriendWidget->friendId); + f->hasNewMessages = 0; + updateFriendStatusLights(f->friendId); + } + else if (isGroupWidgetActive && activeGroupWidget != nullptr) + { + Group* g = GroupList::findGroup(activeGroupWidget->groupId); + g->hasNewMessages = 0; + g->userWasMentioned = 0; + g->widget->statusPic.setPixmap(QPixmap("img/status/dot_groupchat.png")); + } + } + else if (e->type() == QEvent::WindowDeactivate && !useNativeTheme) + { + this->setObjectName("inactiveWindow"); + this->style()->polish(this); + } + + return QWidget::event(e); +} + +void Widget::mousePressEvent(QMouseEvent *e) +{ + if (!useNativeTheme) + { + if (e->button() == Qt::LeftButton) + { + if (inResizeZone) + { + allowToResize = true; + + if (e->pos().y() <= PIXELS_TO_ACT) + { + if (e->pos().x() <= PIXELS_TO_ACT) + resizeDiagSupEsq = true; + else if (e->pos().x() >= geometry().width() - PIXELS_TO_ACT) + resizeDiagSupDer = true; + else + resizeVerSup = true; + } + else if (e->pos().x() <= PIXELS_TO_ACT) + resizeHorEsq = true; + } + else if (e->pos().x() >= PIXELS_TO_ACT and e->pos().x() < ui->titleBar->geometry().width() + and e->pos().y() >= PIXELS_TO_ACT and e->pos().y() < ui->titleBar->geometry().height()) + { + moveWidget = true; + dragPosition = e->globalPos() - frameGeometry().topLeft(); + } + } + + e->accept(); + } +} + +void Widget::mouseReleaseEvent(QMouseEvent *e) +{ + if (!useNativeTheme) + { + moveWidget = false; + allowToResize = false; + resizeVerSup = false; + resizeHorEsq = false; + resizeDiagSupEsq = false; + resizeDiagSupDer = false; + + e->accept(); + } +} + +void Widget::mouseDoubleClickEvent(QMouseEvent *e) +{ + if (!useNativeTheme) + { + if (e->pos().x() < ui->tbMenu->geometry().right() and e->pos().y() < ui->tbMenu->geometry().bottom() + and e->pos().x() >= ui->tbMenu->geometry().x() and e->pos().y() >= ui->tbMenu->geometry().y() + and ui->tbMenu->isVisible()) + close(); + else if (e->pos().x() < ui->titleBar->geometry().width() + and e->pos().y() < ui->titleBar->geometry().height() + and m_titleMode != FullScreenMode) + maximizeBtnClicked(); + e->accept(); + } +} + +void Widget::paintEvent (QPaintEvent *) +{ + QStyleOption opt; + opt.init (this); + QPainter p(this); + style()->drawPrimitive (QStyle::PE_Widget, &opt, &p, this); +} + +void Widget::moveWindow(QMouseEvent *e) +{ + if (!useNativeTheme) + { + if (e->buttons() & Qt::LeftButton) + { + move(e->globalPos() - dragPosition); + e->accept(); + } + } +} + +void Widget::resizeWindow(QMouseEvent *e) +{ + if (!useNativeTheme) + { + if (allowToResize) + { + int xMouse = e->pos().x(); + int yMouse = e->pos().y(); + int wWidth = geometry().width(); + int wHeight = geometry().height(); + + if (cursor().shape() == Qt::SizeVerCursor) + { + if (resizeVerSup) + { + int newY = geometry().y() + yMouse; + int newHeight = wHeight - yMouse; + + if (newHeight > minimumSizeHint().height()) + { + resize(wWidth, newHeight); + move(geometry().x(), newY); + } + } + else + resize(wWidth, yMouse+1); + } + else if (cursor().shape() == Qt::SizeHorCursor) + { + if (resizeHorEsq) + { + int newX = geometry().x() + xMouse; + int newWidth = wWidth - xMouse; + + if (newWidth > minimumSizeHint().width()) + { + resize(newWidth, wHeight); + move(newX, geometry().y()); + } + } + else + resize(xMouse, wHeight); + } + else if (cursor().shape() == Qt::SizeBDiagCursor) + { + int newX = 0; + int newWidth = 0; + int newY = 0; + int newHeight = 0; + + if (resizeDiagSupDer) + { + newX = geometry().x(); + newWidth = xMouse; + newY = geometry().y() + yMouse; + newHeight = wHeight - yMouse; + } + else + { + newX = geometry().x() + xMouse; + newWidth = wWidth - xMouse; + newY = geometry().y(); + newHeight = yMouse; + } + + if (newWidth >= minimumSizeHint().width() and newHeight >= minimumSizeHint().height()) + { + resize(newWidth, newHeight); + move(newX, newY); + } + else if (newWidth >= minimumSizeHint().width()) + { + resize(newWidth, wHeight); + move(newX, geometry().y()); + } + else if (newHeight >= minimumSizeHint().height()) + { + resize(wWidth, newHeight); + move(geometry().x(), newY); + } + } + else if (cursor().shape() == Qt::SizeFDiagCursor) + { + if (resizeDiagSupEsq) + { + int newX = geometry().x() + xMouse; + int newWidth = wWidth - xMouse; + int newY = geometry().y() + yMouse; + int newHeight = wHeight - yMouse; + + if (newWidth >= minimumSizeHint().width() and newHeight >= minimumSizeHint().height()) + { + resize(newWidth, newHeight); + move(newX, newY); + } + else if (newWidth >= minimumSizeHint().width()) + { + resize(newWidth, wHeight); + move(newX, geometry().y()); + } + else if (newHeight >= minimumSizeHint().height()) + { + resize(wWidth, newHeight); + move(geometry().x(), newY); + } + } + else + resize(xMouse+1, yMouse+1); + } + + e->accept(); + } + } +} + +void Widget::setCentralWidget(QWidget *widget, const QString &widgetName) +{ + connect(widget, SIGNAL(cancelled()), this, SLOT(close())); + + centralLayout->addWidget(widget); + ui->centralWidget->setLayout(centralLayout); + ui->LTitle->setText(widgetName); +} + +void Widget::setTitlebarMode(const TitleMode &flag) +{ + m_titleMode = flag; + + switch (m_titleMode) + { + case CleanTitle: + ui->tbMenu->setHidden(true); + ui->pbMin->setHidden(true); + ui->pbMax->setHidden(true); + ui->pbClose->setHidden(true); + break; + case OnlyCloseButton: + ui->tbMenu->setHidden(true); + ui->pbMin->setHidden(true); + ui->pbMax->setHidden(true); + break; + case MenuOff: + ui->tbMenu->setHidden(true); + break; + case MaxMinOff: + ui->pbMin->setHidden(true); + ui->pbMax->setHidden(true); + break; + case FullScreenMode: + ui->pbMax->setHidden(true); + showMaximized(); + break; + case MaximizeModeOff: + ui->pbMax->setHidden(true); + break; + case MinimizeModeOff: + ui->pbMin->setHidden(true); + break; + case FullTitle: + ui->tbMenu->setVisible(true); + ui->pbMin->setVisible(true); + ui->pbMax->setVisible(true); + ui->pbClose->setVisible(true); + break; + break; + default: + ui->tbMenu->setVisible(true); + ui->pbMin->setVisible(true); + ui->pbMax->setVisible(true); + ui->pbClose->setVisible(true); + break; + } + ui->LTitle->setVisible(true); +} + +void Widget::setTitlebarMenu(QMenu *menu, const QString &icon) +{ + ui->tbMenu->setMenu(menu); + ui->tbMenu->setIcon(QIcon(icon)); +} + +void Widget::maximizeBtnClicked() +{ + if (isFullScreen() or isMaximized()) + { + ui->pbMax->setIcon(QIcon(":/ui/images/app_max.png")); + setWindowState(windowState() & ~Qt::WindowFullScreen & ~Qt::WindowMaximized); + } + else + { + ui->pbMax->setIcon(QIcon(":/ui/images/app_rest.png")); + setWindowState(windowState() | Qt::WindowFullScreen | Qt::WindowMaximized); + } +} + +void Widget::minimizeBtnClicked() +{ + if (isMinimized()) + { + setWindowState(windowState() & ~Qt::WindowMinimized); + } + else + { + setWindowState(windowState() | Qt::WindowMinimized); + } +} + diff --git a/widget/widget.h b/widget/widget.h index 6abdec89a..0d6d03d5d 100644 --- a/widget/widget.h +++ b/widget/widget.h @@ -4,11 +4,15 @@ #include #include #include +#include +#include #include "core.h" #include "widget/form/addfriendform.h" #include "widget/form/settingsform.h" #include "camera.h" +#define PIXELS_TO_ACT 5 + namespace Ui { class Widget; } @@ -26,6 +30,10 @@ class Widget : public QWidget public: explicit Widget(QWidget *parent = 0); + enum TitleMode { CleanTitle = 0, OnlyCloseButton, MenuOff, MaxMinOff, FullScreenMode, MaximizeModeOff, MinimizeModeOff, FullTitle }; + void setTitlebarMode(const TitleMode &flag); + void setTitlebarMenu(QMenu *menu, const QString &icon = ""); + void setCentralWidget(QWidget *widget, const QString &widgetName); QString getUsername(); Core* getCore(); Camera* getCamera(); @@ -34,6 +42,7 @@ public: void newMessageAlert(); bool isFriendWidgetCurActiveWidget(Friend* f); void updateFriendStatusLights(int friendId); + int useNativeTheme; ~Widget(); signals: @@ -45,6 +54,8 @@ signals: void statusMessageChanged(const QString& statusMessage); private slots: + void maximizeBtnClicked(); + void minimizeBtnClicked(); void onConnected(); void onDisconnected(); void onStatusSet(Status status); @@ -77,12 +88,33 @@ private slots: void removeFriend(int friendId); void removeGroup(int groupId); +protected slots: + void moveWindow(QMouseEvent *e); + private: void hideMainForms(); Group* createGroup(int groupId); private: Ui::Widget *ui; + QHBoxLayout *centralLayout; + QPoint dragPosition; + TitleMode m_titleMode; + bool moveWidget; + bool inResizeZone; + bool allowToResize; + bool resizeVerSup; + bool resizeHorEsq; + bool resizeDiagSupEsq; + bool resizeDiagSupDer; + void mouseMoveEvent(QMouseEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); + void paintEvent (QPaintEvent *); + void resizeWindow(QMouseEvent *e); + bool event(QEvent *event); + int isWindowMinimized; Core* core; QThread* coreThread; AddFriendForm friendForm;