Commit ecfe7421 authored by Anthony Léonard's avatar Anthony Léonard Committed by Olivier SOLDANO

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
......@@ -135,8 +135,11 @@ CallWidget::CallWidget(QWidget* parent) :
auto idx = selected.indexes().first();
auto realIdx = RecentModel::instance().peopleProxy()->mapFromSource(idx);
ui->smartList->selectionModel()->setCurrentIndex(realIdx, QItemSelectionModel::ClearAndSelect);
} else
} else {
RecentModel::instance().selectionModel()->clearCurrentIndex();
ui->smartList->clearSelection();
ui->smartList->selectionModel()->clearCurrentIndex();
}
});
connect(&NameDirectory::instance(), SIGNAL(registeredNameFound(Account*,NameDirectory::LookupStatus,const QString&,const QString&)),
......@@ -150,7 +153,10 @@ CallWidget::CallWidget(QWidget* parent) :
connect(ui->sendContactRequestWidget, &SendContactRequestWidget::sendCRclicked, [=]{slidePage(ui->messagingPage);});
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,
......@@ -538,8 +544,14 @@ void
CallWidget::smartListCurrentChanged(const QModelIndex &currentIdx, const QModelIndex &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;
}
//catch call of current index
auto currentIdxCall = RecentModel::instance().getActiveCall(currentIdx);
......@@ -587,8 +599,14 @@ CallWidget::contactReqListCurrentChanged(const QModelIndex &currentIdx, const QM
{
Q_UNUSED(previousIdx)
ui->contactRequestWidget->setCurrentContactRequest(currentIdx);
ui->stackedWidget->setCurrentWidget(ui->contactRequestPage);
if (currentIdx.isValid()) {
ui->contactRequestWidget->setCurrentContactRequest(currentIdx);
ui->stackedWidget->setCurrentWidget(ui->contactRequestPage);
} else {
ui->contactRequestWidget->setCurrentContactRequest(QModelIndex());
if (ui->stackedWidget->currentWidget() == ui->contactRequestPage)
slidePage(ui->welcomePage);
}
}
void
......@@ -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
if (disconnect(crListSelectionConnection_)) {
ui->contactRequestList->selectionModel()->clear();
// The selection model must be deleted by the application (see QT doc).
QItemSelectionModel* sMod = ui->contactRequestList->selectionModel();
delete sMod;
RecentModel::instance().selectionModel()->clear();
slidePage(ui->welcomePage);
}
ui->contactRequestList->setItemModel(ac->pendingContactRequestModel());
......@@ -839,7 +857,6 @@ void
CallWidget::backToWelcomePage()
{
RecentModel::instance().selectionModel()->clear();
slidePage(ui->welcomePage);
disconnect(imConnection_);
}
......@@ -931,14 +948,13 @@ CallWidget::on_sendContactRequestPageButton_clicked()
void
CallWidget::on_sendCRBackButton_clicked()
{
slidePage(ui->messagingPage);
ui->stackedWidget->setCurrentWidget(ui->messagingPage);
}
void
CallWidget::on_pendingCRBackButton_clicked()
{
ui->contactRequestList->selectionModel()->clear();
slidePage(ui->welcomePage);
}
Account*
......@@ -951,3 +967,15 @@ CallWidget::getSelectedAccount()
}
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:
void on_qrButton_toggled(bool checked);
void on_shareButton_clicked();
void on_pendingCRBackButton_clicked();
void on_mainTabMenu_currentChanged(int index);
private slots:
void callIncoming(Call* call);
......
......@@ -306,8 +306,21 @@
<property name="currentIndex">
<number>0</number>
</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">
<string/>
</attribute>
<attribute name="toolTip">
<string>Conversations</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
......@@ -351,8 +364,15 @@
</layout>
</widget>
<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">
<string>Contact Requests</string>
<string/>
</attribute>
<attribute name="toolTip">
<string>Contact requests</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing">
......
......@@ -41,5 +41,7 @@
<file>images/icons/ic_share_black_48dp_2x.png</file>
<file>images/loading.gif</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>
</RCC>
......@@ -460,7 +460,6 @@ QPushButton#quickBanCRBtn:hover{
}
QTabBar::tab{
background: transparent;
color: rgb(77, 77, 77);
border-radius: 0px;
border-style: solid;
......@@ -475,9 +474,22 @@ QTabBar::tab{
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{
alignment: center;
}
QTabBar QToolButton{
height: 9;
width : 9;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment