Commit 56c77308 authored by jpbl's avatar jpbl

now we have a frameless window

parent 04b3673b
#include "SFLPhoneWindow.hpp"
#include <QIcon>
#include <QLabel>
#include <QMessageBox>
#include <QMouseEvent>
#include <QPixmap>
#include <QKeyEvent>
#include <iostream>
......@@ -11,7 +13,7 @@
#include "JPushButton.hpp"
SFLPhoneWindow::SFLPhoneWindow()
: QMainWindow()
: QMainWindow(NULL, Qt::FramelessWindowHint)
{
// Initialize the background image
QLabel *l = new QLabel(this);
......@@ -20,6 +22,28 @@ SFLPhoneWindow::SFLPhoneWindow()
resize(main.size());
l->resize(main.size());
setWindowIcon(QIcon(QPixmap(":/sflphone/images/logo_ico")));
setMouseTracking(false);
mLastPos = pos();
// QLabel *os = new QLabel(this);
// QPixmap overscreen(":/images/overscreen.png");
// os->setPixmap(overscreen);
// os->resize(overscreen.size());
// os->move(22,44);
initGUIButtons();
initWindowButtons();
initLineButtons();
}
SFLPhoneWindow::~SFLPhoneWindow()
{}
void
SFLPhoneWindow::initGUIButtons()
{
mHangup = new JPushButton(QPixmap(":/sflphone/images/hangup_off"),
QPixmap(":/sflphone/images/hangup_on"),
this);
......@@ -40,21 +64,8 @@ SFLPhoneWindow::SFLPhoneWindow()
QPixmap(":/sflphone/images/clear_on"),
this);
mClear->move(225,130);
// QLabel *os = new QLabel(this);
// QPixmap overscreen(":/images/overscreen.png");
// os->setPixmap(overscreen);
// os->resize(overscreen.size());
// os->move(22,44);
initWindowButtons();
initLineButtons();
}
SFLPhoneWindow::~SFLPhoneWindow()
{}
void
SFLPhoneWindow::initLineButtons()
{
......@@ -133,3 +144,15 @@ SFLPhoneWindow::askResendStatus()
close();
}
}
void
SFLPhoneWindow::mousePressEvent(QMouseEvent *e)
{
mLastPos = e->pos();
}
void
SFLPhoneWindow::mouseMoveEvent(QMouseEvent *e)
{
move(e->globalPos() - mLastPos);
}
#include <QObject>
#include <QMainWindow>
#include <QObject>
#include <QPoint>
#include <list>
class PhoneLineButton;
......@@ -16,6 +17,7 @@ public:
~SFLPhoneWindow();
private:
void initGUIButtons();
void initLineButtons();
void initWindowButtons();
......@@ -25,6 +27,9 @@ signals:
void resendStatusAsked();
public slots:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
/**
* This function will prompt a message box, to ask
* if the user want to reconnect to sflphoned.
......@@ -50,4 +55,6 @@ private:
JPushButton *mHold;
JPushButton *mOk;
JPushButton *mClear;
QPoint mLastPos;
};
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