Commit db7f1ae1 authored by jpbl's avatar jpbl
Browse files

added the clear button

parent 5d25a522
......@@ -53,7 +53,6 @@ JPushButton::release()
void
JPushButton::press()
{
_debug("Pressed.\n");
mIsPressed = true;
resize(mImages[1].size());
setPixmap(mImages[1]);
......
......@@ -62,12 +62,18 @@ PhoneLine::unselect()
emit backgrounded();
}
else {
mBuffer.clear();
clear();
emit unselected();
}
}
}
void
PhoneLine::clear()
{
mBuffer.clear();
}
void
PhoneLine::sendKey(Qt::Key c)
{
......
......@@ -52,6 +52,11 @@ public:
void sendKey(Qt::Key c);
public slots:
/**
* Clears the buffer of the line.
*/
void clear();
/**
* The user selected this line.
*/
......
......@@ -183,3 +183,17 @@ PhoneLineManagerImpl::hangup()
}
}
void
PhoneLineManagerImpl::clear()
{
mCurrentLineMutex.lock();
PhoneLine *selectedLine = mCurrentLine;
PhoneLineLocker guard(selectedLine);
mCurrentLine = NULL;
mCurrentLineMutex.unlock();
if(selectedLine) {
selectedLine->clear();
}
}
......@@ -71,6 +71,12 @@ public slots:
* is invalid, it just do nothing.
*/
void selectLine(unsigned int line);
/**
* This function will clear the buffer of the active
* line. If there's no active line, it will do nothing.
*/
void clear();
PhoneLine *selectNextAvailableLine();
......
......@@ -50,6 +50,8 @@ SFLPhoneApp::initConnections(SFLPhoneWindow *w)
&PhoneLineManager::instance(), SLOT(hangup()));
QObject::connect(w->mHold, SIGNAL(clicked()),
&PhoneLineManager::instance(), SLOT(hold()));
QObject::connect(w->mClear, SIGNAL(clicked()),
&PhoneLineManager::instance(), SLOT(clear()));
QObject::connect(w, SIGNAL(keyPressed(Qt::Key)),
&PhoneLineManager::instance(), SLOT(sendKey(Qt::Key)));
}
......@@ -34,6 +34,11 @@ SFLPhoneWindow::SFLPhoneWindow()
QPixmap(":/sflphone/images/ok_on"),
this);
mOk->move(225,182);
mClear = new JPushButton(QPixmap(":/sflphone/images/clear_off"),
QPixmap(":/sflphone/images/clear_on"),
this);
mClear->move(225,130);
// QLabel *os = new QLabel(this);
// QPixmap overscreen(":/images/overscreen.png");
......
......@@ -34,4 +34,5 @@ private:
JPushButton *mHangup;
JPushButton *mHold;
JPushButton *mOk;
JPushButton *mClear;
};
<RCC>
<qresource prefix="/sflphone" >
<file>images/audio.png</file>
<file>images/clear_off.png</file>
<file>images/clear_on.png</file>
<file>images/close_off.png</file>
<file>images/close_on.png</file>
<file>images/directory_on.png</file>
......
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