Commit bff3ad22 authored by philippe groarke's avatar philippe groarke

Interface design.

parent 6db8e4f3
<RCC>
<qresource prefix="/">
<file>data/background_tile.png</file>
<file>data/dark/ic_action_call.png</file>
<file>data/dark/ic_action_cancel.png</file>
<file>data/dark/ic_action_email.png</file>
<file>data/dark/ic_action_new_email.png</file>
<file>data/dark/ic_action_search.png</file>
<file>data/dark/ic_action_video.png</file>
<file>data/light/ic_action_video.png</file>
<file>data/light/ic_action_new_email.png</file>
<file>data/light/ic_action_email.png</file>
<file>data/light/ic_action_call.png</file>
<file>data/light/ic_action_cancel.png</file>
<file>data/light/ic_action_search.png</file>
<file>data/light/ic_action_accept.png</file>
<file>data/dark/ic_action_accept.png</file>
</qresource>
</RCC>
......@@ -15,12 +15,25 @@ MainWindow::MainWindow(QWidget *parent) :
mainAccount_ = AccountModel::currentAccount();
callModel_ = CallModel::instance();
HistoryModel::instance()->addBackend(new LegacyHistoryBackend(this), LoadOptions::FORCE_ENABLED);
connectSlots();
HistoryModel::instance()->addBackend(new LegacyHistoryBackend(this),
LoadOptions::FORCE_ENABLED);
ContactModel::instance()->addBackend(TransitionalContactBackend::instance(),
LoadOptions::FORCE_ENABLED);
Contact* test = new Contact();
test->setNickName("George");
test->setFirstName("George-Amand");
test->setFamilyName("Tremblay");
//test->setPhoneNumbers(PhoneNumber());
ContactModel::instance()->addContact(test);
connectSlots();
ui->contact_list->setModel(ContactModel::instance());
//ui->contact_list->setModel(CallModel::instance());
ui->contact_list->setModel(HistoryModel::instance());
// ui->contact_list->setModel(ContactModel::instance());
//ui->contact_list->setModel(HistoryModel::instance());
//ui->contact_list->setModel(ContactModel::instance());
}
MainWindow::~MainWindow()
......@@ -89,7 +102,7 @@ void MainWindow::incoming_call(Call *call)
void MainWindow::on_call_button_clicked()
{
mainCall_ = CallModel::instance()->dialingCall();
mainCall_->setDialNumber(ui->call_number->text());
mainCall_->setDialNumber(ui->search_bar->text());
mainCall_->performAction(Call::Action::ACCEPT);
}
......
......@@ -13,9 +13,12 @@
#include <accountmodel.h>
#include <call.h>
#include <callmodel.h>
#include <commonbackendmanagerinterface.h>
#include <contact.h>
#include <contactmodel.h>
#include <historymodel.h>
#include <legacyhistorybackend.h>
#include <transitionalcontactbackend.h>
namespace Ui {
class MainWindow;
......@@ -52,7 +55,6 @@ private:
Call* mainCall_{nullptr};
Account* mainAccount_;
LegacyHistoryBackend* backend_;
QString savedNumber_;
QTimer pollTimer_;
QPoint clickPos_{QPoint(0,0)};
};
......
......@@ -65,11 +65,14 @@
<property name="topMargin">
<number>10</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="MySearchBar" name="lineEdit">
<widget class="MySearchBar" name="search_bar">
<property name="minimumSize">
<size>
<width>0</width>
......@@ -97,23 +100,98 @@ color: rgb(160, 160, 160);
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<widget class="QToolButton" name="call_button">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:transparent;</string>
</property>
<property name="text">
<string>M</string>
<string/>
</property>
<property name="icon">
<iconset resource="data.qrc">
<normaloff>:/data/dark/ic_action_call.png</normaloff>
<normalon>:/data/light/ic_action_call.png</normalon>
<disabledoff>:/data/dark/ic_action_call.png</disabledoff>
<disabledon>:/data/light/ic_action_call.png</disabledon>
<activeoff>:/data/dark/ic_action_call.png</activeoff>
<activeon>:/data/light/ic_action_call.png</activeon>
<selectedoff>:/data/dark/ic_action_call.png</selectedoff>
<selectedon>:/data/light/ic_action_call.png</selectedon>:/data/dark/ic_action_call.png</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="default">
<bool>false</bool>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_2">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:transparent;</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="flat">
<bool>false</bool>
<property name="icon">
<iconset resource="data.qrc">
<normaloff>:/data/dark/ic_action_video.png</normaloff>:/data/dark/ic_action_video.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_3">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:transparent;</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="data.qrc">
<normaloff>:/data/dark/ic_action_email.png</normaloff>:/data/dark/ic_action_email.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
......@@ -145,6 +223,12 @@ color: rgb(160, 160, 160);
<property name="lineWidth">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
......@@ -156,39 +240,12 @@ color: rgb(160, 160, 160);
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="call_number">
<widget class="QPushButton" name="hangup_button">
<property name="text">
<string>192.168.49.103</string>
<string>Hang up</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="QPushButton" name="call_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Call</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="hangup_button">
<property name="text">
<string>Hang up</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="answer_button">
<property name="text">
......@@ -250,23 +307,8 @@ background-position: bottom;</string>
<header>mysearchbar.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>call_number</sender>
<signal>returnPressed()</signal>
<receiver>call_button</receiver>
<slot>animateClick()</slot>
<hints>
<hint type="sourcelabel">
<x>160</x>
<y>70</y>
</hint>
<hint type="destinationlabel">
<x>116</x>
<y>98</y>
</hint>
</hints>
</connection>
</connections>
<resources>
<include location="data.qrc"/>
</resources>
<connections/>
</ui>
......@@ -2,6 +2,13 @@
MySearchBar::MySearchBar(QWidget *parent) : QLineEdit(parent)
{
QStringList wordList;
wordList << "alpha" << "omega" << "omicron" << "zeta";
QCompleter *completer = new QCompleter(wordList, this);
completer->setCaseSensitivity(Qt::CaseInsensitive);
setCompleter(completer);
QObject::connect(this, SIGNAL(editingFinished()), this, SLOT(changePlaceholderColor()));
QObject::connect(this, SIGNAL(textChanged(QString)), this, SLOT(changePlaceholderColor()));
QObject::connect(this, SIGNAL(), this, SLOT(changePlaceholderColor()));
......@@ -15,6 +22,7 @@ MySearchBar::~MySearchBar()
void MySearchBar::focusInEvent(QFocusEvent* e)
{
if (text().count() <= 0) {
setClearButtonEnabled(true);
setAlignment(Qt::AlignLeft);
setStyleSheet("background-color: rgb(225, 225, 225);"
"border: 1px solid;"
......@@ -31,6 +39,7 @@ void MySearchBar::focusInEvent(QFocusEvent* e)
void MySearchBar::changePlaceholderColor()
{
if (text().count() <= 0) { // placeholder
setClearButtonEnabled(false);
setAlignment(Qt::AlignHCenter);
setStyleSheet("background-color: rgb(225, 225, 225);"
"border: 1px solid;"
......@@ -38,6 +47,7 @@ void MySearchBar::changePlaceholderColor()
"border-radius: 4px;"
"color: rgb(160, 160, 160);");
} else { // usertext
setClearButtonEnabled(true);
setAlignment(Qt::AlignLeft);
setStyleSheet("background-color: rgb(225, 225, 225);"
"border: 1px solid;"
......
......@@ -4,6 +4,9 @@
#include <QWidget>
#include <QLineEdit>
#include <QDebug>
#include <QCompleter>
#include <QPropertyAnimation>
#include <QMargins>
class MySearchBar : public QLineEdit
{
......
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