diff options
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
| -rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 21 | 
1 files changed, 14 insertions, 7 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index d3a5676..a119043 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -22,8 +22,8 @@  #include <qdebug.h>  namespace Swift { -QtChatTabs::QtChatTabs() : QWidget() { -#ifndef Q_WS_MAC +QtChatTabs::QtChatTabs(bool singleWindow) : QWidget(), singleWindow_(singleWindow) { +#ifndef Q_OS_MAC  	setWindowIcon(QIcon(":/logo-chat-16.png"));  #else  	setAttribute(Qt::WA_ShowWithoutActivating); @@ -46,7 +46,6 @@ QtChatTabs::QtChatTabs() : QWidget() {  	layout->setContentsMargins(0, 3, 0, 0);  	layout->addWidget(tabs_);  	setLayout(layout); -	//resize(400, 300);  }  void QtChatTabs::closeEvent(QCloseEvent* event) { @@ -114,7 +113,13 @@ void QtChatTabs::handleTabClosing() {  	if (widget && ((index = tabs_->indexOf(widget)) >= 0)) {  		tabs_->removeTab(index);  		if (tabs_->count() == 0) { -			hide(); +			if (!singleWindow_) { +				hide(); +			} +			else { +				setWindowTitle(""); +				onTitleChanged(""); +			}  		}  		else {  			handleTabTitleUpdated(tabs_->currentWidget()); @@ -237,7 +242,7 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) {  	switch (tabbable->getWidgetAlertState()) {  	case QtTabbable::WaitingActivity : tabTextColor = QColor(217, 20, 43); break;  	case QtTabbable::ImpendingActivity : tabTextColor = QColor(27, 171, 32); break; -	default : tabTextColor = QColor(); +	case QtTabbable::NoActivity : tabTextColor = QColor(); break;  	}  	tabs_->tabBar()->setTabTextColor(index, tabTextColor); @@ -251,7 +256,9 @@ void QtChatTabs::handleTabTitleUpdated(QWidget* widget) {  	std::string current(Q2PSTRING(qobject_cast<QtTabbable*>(tabs_->currentWidget())->windowTitle()));  	ChatMessageSummarizer summary; -	setWindowTitle(summary.getSummary(current, unreads).c_str()); +	QString title = summary.getSummary(current, unreads).c_str(); +	setWindowTitle(title); +	emit onTitleChanged(title);  }  void QtChatTabs::flash() { @@ -270,7 +277,7 @@ void QtChatTabs::moveEvent(QMoveEvent*) {  void QtChatTabs::checkForFirstShow() {  	if (!isVisible()) { -#ifndef Q_WS_MAC +#ifndef Q_OS_MAC  		showMinimized();  #else  		/* https://bugreports.qt-project.org/browse/QTBUG-19194   | 
 Swift