Skip to content
Snippets Groups Projects
Commit 24d0fe0d authored by philippe groarke's avatar philippe groarke
Browse files

Various interface tests.

parent d73bacdf
No related branches found
No related tags found
No related merge requests found
......@@ -14,9 +14,11 @@ TEMPLATE = app
CONFIG += c++11
SOURCES += main.cpp\
mainwindow.cpp
mainwindow.cpp \
mylistview.cpp
HEADERS += mainwindow.h
HEADERS += mainwindow.h \
mylistview.h
FORMS += mainwindow.ui
......
......@@ -8,6 +8,11 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->contact_list->setModel(CallModel::instance());
ui->contact_list->setModel(HistoryModel::instance());
ui->contact_list->setModel(ContactModel::instance());
//setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint);
//setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
mainAccount_ = AccountModel::currentAccount();
callModel_ = CallModel::instance();
......@@ -21,22 +26,51 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow()
{
if (mainCall_ != nullptr)
mainCall_->performAction(Call::Action::REFUSE);
delete mainAccount_;
delete mainCall_;
delete ui;
}
void MainWindow::mousePressEvent(QMouseEvent *e)
{
clickPos_ = e->pos();
}
void MainWindow::mouseMoveEvent(QMouseEvent *e)
{
qDebug() << clickPos_;
move(e->globalPos() - clickPos_);
}
//// SLOTS ////
void MainWindow::on_pushButton_clicked()
void MainWindow::on_call_button_clicked()
{
mainCall_ = CallModel::instance()->dialingCall();
mainCall_->setDialNumber(ui->call_number->text());
mainCall_->performAction(Call::Action::ACCEPT);
}
void MainWindow::on_hangup_button_clicked()
{
if (mainCall_)
mainCall_->performAction(Call::Action::REFUSE);
}
void MainWindow::on_state_changed(Call *call, Call::State previousState)
{
qDebug() << "on state changed!" << endl;
}
void MainWindow::pollEvents()
{
qDebug() << "Poll Events?";
AccountModel::currentAccount()->poll_events();
}
......@@ -5,6 +5,7 @@
#include <QDebug>
#include <QMainWindow>
#include <QTimer>
#include <QMouseEvent>
#include <memory>
......@@ -12,6 +13,8 @@
#include <accountmodel.h>
#include <call.h>
#include <callmodel.h>
#include <contactmodel.h>
#include <historymodel.h>
namespace Ui {
class MainWindow;
......@@ -25,24 +28,27 @@ public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_pushButton_clicked();
void on_state_changed(Call* call, Call::State previousState);
protected:
void mousePressEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
private:
private slots:
void pollEvents() {
qDebug() << "Poll Events?";
AccountModel::currentAccount()->poll_events();
}
void on_call_button_clicked();
void on_state_changed(Call* call, Call::State previousState);
void on_hangup_button_clicked();
void pollEvents();
private:
Ui::MainWindow *ui;
CallModel* callModel_;
Call* mainCall_;
CallModel* callModel_{nullptr};
Call* mainCall_{nullptr};
Account* mainAccount_;
QString savedNumber_;
QTimer pollTimer_;
QPoint clickPos_{QPoint(0,0)};
};
#endif // MAINWINDOW_H
......@@ -6,82 +6,170 @@
<rect>
<x>0</x>
<y>0</y>
<width>326</width>
<height>207</height>
<width>766</width>
<height>597</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer_3">
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="call_number">
<property name="text">
<string>192.168.49.103</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Call</string>
<property name="handleWidth">
<number>0</number>
</property>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>10</number>
</property>
<property name="leftMargin">
<number>20</number>
</property>
<property name="topMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="text">
<string/>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Search</string>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>M</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="MyListView" name="contact_list">
<property name="styleSheet">
<string notr="true">background-color: rgba(255,255,255, 0.0);</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255,255,255);</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="call_number">
<property name="text">
<string>192.168.49.103</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<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">
<string>Answer</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>1</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Answer</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Hang up</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
......@@ -89,19 +177,26 @@
<rect>
<x>0</x>
<y>0</y>
<width>326</width>
<width>766</width>
<height>22</height>
</rect>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>MyListView</class>
<extends>QListView</extends>
<header>mylistview.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>call_number</sender>
<signal>returnPressed()</signal>
<receiver>pushButton</receiver>
<receiver>call_button</receiver>
<slot>animateClick()</slot>
<hints>
<hint type="sourcelabel">
......
#include "mylistview.h"
MyListView::MyListView(QWidget *parent) :
QListView(parent)
{
setAttribute(Qt::WA_MacShowFocusRect, false);
}
#ifndef MYLISTVIEW_H
#define MYLISTVIEW_H
#include <QWidget>
#include <QListView>
class MyListView : public QListView
{
Q_OBJECT
public:
explicit MyListView(QWidget *parent = 0);
signals:
public slots:
};
#endif // MYLISTVIEW_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment