Skip to content
Snippets Groups Projects
Commit ecfe7421 authored by Anthony Léonard's avatar Anthony Léonard Committed by Olivier SOLDANO
Browse files

replace text by icons on main tabs + ui fixes


Tabs are now smaller and use icons instead of text for "Conversations"
and "Contact requests" tabs. It gives a better looking UI and room for
 additional pages.

Moreover, tab switching was giving inconsistencies in many situations
between item selected on the left and what is displayed on the right
panel. Showing or hiding a widget on the right panel now depends on
the selection model of the list on the left. Consequently, clicking on
a back button now deselects the item on the left which is what switches
the view back to the welcome page.

Change-Id: Ib67149dba62e15bebcfe3ebce2398b7717e3f85d
Reviewed-by: default avatarOlivier Soldano <olivier.soldano@savoirfairelinux.com>
parent 97c4c2dc
No related branches found
No related tags found
No related merge requests found
...@@ -135,8 +135,11 @@ CallWidget::CallWidget(QWidget* parent) : ...@@ -135,8 +135,11 @@ CallWidget::CallWidget(QWidget* parent) :
auto idx = selected.indexes().first(); auto idx = selected.indexes().first();
auto realIdx = RecentModel::instance().peopleProxy()->mapFromSource(idx); auto realIdx = RecentModel::instance().peopleProxy()->mapFromSource(idx);
ui->smartList->selectionModel()->setCurrentIndex(realIdx, QItemSelectionModel::ClearAndSelect); ui->smartList->selectionModel()->setCurrentIndex(realIdx, QItemSelectionModel::ClearAndSelect);
} else } else {
RecentModel::instance().selectionModel()->clearCurrentIndex();
ui->smartList->clearSelection(); ui->smartList->clearSelection();
ui->smartList->selectionModel()->clearCurrentIndex();
}
}); });
connect(&NameDirectory::instance(), SIGNAL(registeredNameFound(Account*,NameDirectory::LookupStatus,const QString&,const QString&)), connect(&NameDirectory::instance(), SIGNAL(registeredNameFound(Account*,NameDirectory::LookupStatus,const QString&,const QString&)),
...@@ -150,7 +153,10 @@ CallWidget::CallWidget(QWidget* parent) : ...@@ -150,7 +153,10 @@ CallWidget::CallWidget(QWidget* parent) :
connect(ui->sendContactRequestWidget, &SendContactRequestWidget::sendCRclicked, [=]{slidePage(ui->messagingPage);}); connect(ui->sendContactRequestWidget, &SendContactRequestWidget::sendCRclicked, [=]{slidePage(ui->messagingPage);});
connect(ui->contactRequestWidget, &ContactRequestWidget::choiceMade, [this]() { connect(ui->contactRequestWidget, &ContactRequestWidget::choiceMade, [this]() {
slidePage(ui->welcomePage); if (getSelectedAccount()->pendingContactRequestModel()->rowCount() == 0)
ui->mainTabMenu->setCurrentWidget(ui->mainTabMenuPage1);
else
ui->contactRequestList->selectionModel()->clear();
}); });
connect(AvailableAccountModel::instance().selectionModel(), &QItemSelectionModel::currentChanged, connect(AvailableAccountModel::instance().selectionModel(), &QItemSelectionModel::currentChanged,
...@@ -538,8 +544,14 @@ void ...@@ -538,8 +544,14 @@ void
CallWidget::smartListCurrentChanged(const QModelIndex &currentIdx, const QModelIndex &previousIdx) CallWidget::smartListCurrentChanged(const QModelIndex &currentIdx, const QModelIndex &previousIdx)
{ {
Q_UNUSED(previousIdx); Q_UNUSED(previousIdx);
if (not currentIdx.isValid()) if (not currentIdx.isValid()) {
auto widget = ui->stackedWidget->currentWidget();
if (widget == ui->messagingPage || widget == ui->videoPage)
slidePage(ui->welcomePage);
if(actualCall_)
setActualCall(nullptr);
return; return;
}
//catch call of current index //catch call of current index
auto currentIdxCall = RecentModel::instance().getActiveCall(currentIdx); auto currentIdxCall = RecentModel::instance().getActiveCall(currentIdx);
...@@ -587,8 +599,14 @@ CallWidget::contactReqListCurrentChanged(const QModelIndex &currentIdx, const QM ...@@ -587,8 +599,14 @@ CallWidget::contactReqListCurrentChanged(const QModelIndex &currentIdx, const QM
{ {
Q_UNUSED(previousIdx) Q_UNUSED(previousIdx)
if (currentIdx.isValid()) {
ui->contactRequestWidget->setCurrentContactRequest(currentIdx); ui->contactRequestWidget->setCurrentContactRequest(currentIdx);
ui->stackedWidget->setCurrentWidget(ui->contactRequestPage); ui->stackedWidget->setCurrentWidget(ui->contactRequestPage);
} else {
ui->contactRequestWidget->setCurrentContactRequest(QModelIndex());
if (ui->stackedWidget->currentWidget() == ui->contactRequestPage)
slidePage(ui->welcomePage);
}
} }
void void
...@@ -713,11 +731,11 @@ CallWidget::selectedAccountChanged(const QModelIndex &current, const QModelIndex ...@@ -713,11 +731,11 @@ CallWidget::selectedAccountChanged(const QModelIndex &current, const QModelIndex
// Then, we update the pending CR list with those from the newly selected account // Then, we update the pending CR list with those from the newly selected account
if (disconnect(crListSelectionConnection_)) { if (disconnect(crListSelectionConnection_)) {
ui->contactRequestList->selectionModel()->clear();
// The selection model must be deleted by the application (see QT doc). // The selection model must be deleted by the application (see QT doc).
QItemSelectionModel* sMod = ui->contactRequestList->selectionModel(); QItemSelectionModel* sMod = ui->contactRequestList->selectionModel();
delete sMod; delete sMod;
RecentModel::instance().selectionModel()->clear(); RecentModel::instance().selectionModel()->clear();
slidePage(ui->welcomePage);
} }
ui->contactRequestList->setItemModel(ac->pendingContactRequestModel()); ui->contactRequestList->setItemModel(ac->pendingContactRequestModel());
...@@ -839,7 +857,6 @@ void ...@@ -839,7 +857,6 @@ void
CallWidget::backToWelcomePage() CallWidget::backToWelcomePage()
{ {
RecentModel::instance().selectionModel()->clear(); RecentModel::instance().selectionModel()->clear();
slidePage(ui->welcomePage);
disconnect(imConnection_); disconnect(imConnection_);
} }
...@@ -931,14 +948,13 @@ CallWidget::on_sendContactRequestPageButton_clicked() ...@@ -931,14 +948,13 @@ CallWidget::on_sendContactRequestPageButton_clicked()
void void
CallWidget::on_sendCRBackButton_clicked() CallWidget::on_sendCRBackButton_clicked()
{ {
slidePage(ui->messagingPage); ui->stackedWidget->setCurrentWidget(ui->messagingPage);
} }
void void
CallWidget::on_pendingCRBackButton_clicked() CallWidget::on_pendingCRBackButton_clicked()
{ {
ui->contactRequestList->selectionModel()->clear(); ui->contactRequestList->selectionModel()->clear();
slidePage(ui->welcomePage);
} }
Account* Account*
...@@ -951,3 +967,15 @@ CallWidget::getSelectedAccount() ...@@ -951,3 +967,15 @@ CallWidget::getSelectedAccount()
} }
return nullptr; return nullptr;
} }
void CallWidget::on_mainTabMenu_currentChanged(int index)
{
Q_UNUSED(index)
auto current = ui->mainTabMenu->currentWidget();
if(current == ui->mainTabMenuPage1)
ui->contactRequestList->selectionModel()->clear();
else if (current == ui->mainTabMenuPage2)
RecentModel::instance().selectionModel()->clear();
}
...@@ -83,6 +83,7 @@ private slots: ...@@ -83,6 +83,7 @@ private slots:
void on_qrButton_toggled(bool checked); void on_qrButton_toggled(bool checked);
void on_shareButton_clicked(); void on_shareButton_clicked();
void on_pendingCRBackButton_clicked(); void on_pendingCRBackButton_clicked();
void on_mainTabMenu_currentChanged(int index);
private slots: private slots:
void callIncoming(Call* call); void callIncoming(Call* call);
......
...@@ -306,8 +306,21 @@ ...@@ -306,8 +306,21 @@
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="mainTabMenuPage1_2"> <property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<widget class="QWidget" name="mainTabMenuPage1">
<attribute name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/icons/ic_chat_black_24dp_2x.png</normaloff>:/images/icons/ic_chat_black_24dp_2x.png</iconset>
</attribute>
<attribute name="title"> <attribute name="title">
<string/>
</attribute>
<attribute name="toolTip">
<string>Conversations</string> <string>Conversations</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
...@@ -351,8 +364,15 @@ ...@@ -351,8 +364,15 @@
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="mainTabMenuPage2"> <widget class="QWidget" name="mainTabMenuPage2">
<attribute name="icon">
<iconset resource="ressources.qrc">
<normaloff>:/images/icons/ic_person_add_black_24dp_2x.png</normaloff>:/images/icons/ic_person_add_black_24dp_2x.png</iconset>
</attribute>
<attribute name="title"> <attribute name="title">
<string>Contact Requests</string> <string/>
</attribute>
<attribute name="toolTip">
<string>Contact requests</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing"> <property name="spacing">
......
images/icons/ic_chat_black_24dp_2x.png

193 B

images/icons/ic_person_add_black_24dp_2x.png

323 B

...@@ -41,5 +41,7 @@ ...@@ -41,5 +41,7 @@
<file>images/icons/ic_share_black_48dp_2x.png</file> <file>images/icons/ic_share_black_48dp_2x.png</file>
<file>images/loading.gif</file> <file>images/loading.gif</file>
<file>images/FontAwesome.otf</file> <file>images/FontAwesome.otf</file>
<file>images/icons/ic_chat_black_24dp_2x.png</file>
<file>images/icons/ic_person_add_black_24dp_2x.png</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -460,7 +460,6 @@ QPushButton#quickBanCRBtn:hover{ ...@@ -460,7 +460,6 @@ QPushButton#quickBanCRBtn:hover{
} }
QTabBar::tab{ QTabBar::tab{
background: transparent;
color: rgb(77, 77, 77); color: rgb(77, 77, 77);
border-radius: 0px; border-radius: 0px;
border-style: solid; border-style: solid;
...@@ -475,9 +474,22 @@ QTabBar::tab{ ...@@ -475,9 +474,22 @@ QTabBar::tab{
height: 20px; height: 20px;
} }
QTabWidget#mainTabMenu QTabBar::tab {
height: 24px;
width: auto;
padding-left: 14px;
margin-left:auto;
margin-right:auto;
}
QTabWidget#mainTabMenu QTabBar::tab:hover {
background-color: rgb(242, 242, 242);
}
QTabWidget::tab-bar{ QTabWidget::tab-bar{
alignment: center; alignment: center;
} }
QTabBar QToolButton{ QTabBar QToolButton{
height: 9; height: 9;
width : 9; width : 9;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment