-
Notifications
You must be signed in to change notification settings - Fork 61
Add a quick-call left pane to the main window #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ public slots: | |
| signals: | ||
| void address(const QString &, const QString &); | ||
| void address(const QString &); | ||
| void leavehere(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this signal do? How does the name
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this signal for detect potential changes in buddy list and refresh it in main form. Maybe there are better solution. |
||
| private: | ||
| void *addrBook; | ||
| AddressTableModel* m_model; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -236,7 +236,7 @@ void MphoneForm::init() | |
|
|
||
| // View menu | ||
| menu->addAction(viewCall_HistoryAction); | ||
|
|
||
| menu->addSeparator(); | ||
|
|
||
| #ifdef WITH_DIAMONDCARD | ||
|
|
@@ -256,14 +256,14 @@ void MphoneForm::init() | |
|
|
||
| restoreState(g_gui_state->value("mainwindow/state").toByteArray()); | ||
| restoreGeometry(g_gui_state->value("mainwindow/geometry").toByteArray()); | ||
| splitter2->restoreState(g_gui_state->value("mainwindow/mainsplitter").toByteArray()); | ||
| splitter2->restoreState(g_gui_state->value("mainwindow/mainsplitter").toByteArray()); | ||
| } | ||
|
|
||
| void MphoneForm::destroy() | ||
| { | ||
| g_gui_state->setValue("mainwindow/state", saveState()); | ||
| g_gui_state->setValue("mainwindow/geometry", saveGeometry()); | ||
| g_gui_state->setValue("mainwindow/mainsplitter", splitter2->saveState()); | ||
| g_gui_state->setValue("mainwindow/mainsplitter", splitter2->saveState()); | ||
|
|
||
| if (dtmfForm) { | ||
| MEMMAN_DELETE(dtmfForm); | ||
|
|
@@ -2353,7 +2353,9 @@ void MphoneForm::selectProfile() | |
| connect(selectProfileForm, SIGNAL(profileRenamed()), | ||
| this, SLOT(updateUserComboBox())); | ||
| connect(selectProfileForm, SIGNAL(profileRenamed()), | ||
| this, SLOT(populateBuddyList())); | ||
| this, SLOT(populateBuddyList())); | ||
| connect(selectProfileForm, SIGNAL(profileRenamed()), | ||
| this, SLOT(populateAddressList())); | ||
| } | ||
|
|
||
| selectProfileForm->showForm(this); | ||
|
|
@@ -2493,6 +2495,7 @@ void MphoneForm::newUsers(const list<string> &profiles) | |
| progress.setValue(add_profile_list.size()); | ||
|
|
||
| populateBuddyList(); | ||
| populateAddressList(); | ||
| updateUserComboBox(); | ||
| updateRegStatus(); | ||
| updateMwi(); | ||
|
|
@@ -2675,7 +2678,10 @@ void MphoneForm::showAddressBook() | |
| connect(getAddressForm, | ||
| SIGNAL(address(const QString &)), | ||
| this, SLOT(selectedAddress(const QString &))); | ||
|
|
||
| connect(getAddressForm, | ||
| SIGNAL(leavehere()), | ||
| this, SLOT(populateAddressList())); | ||
|
|
||
| getAddressForm->show(); | ||
| } | ||
|
|
||
|
|
@@ -2963,6 +2969,18 @@ void MphoneForm::showBuddyList(bool on) | |
| viewBuddyListAction->setChecked(on); | ||
| } | ||
|
|
||
| void MphoneForm::showAddressList(bool on) | ||
| { | ||
| if (on) { | ||
| addressListView->show(); | ||
| } else { | ||
| addressListView->hide(); | ||
| } | ||
|
|
||
| viewAddressList = on; | ||
| viewAddressListAction->setChecked(on); | ||
| } | ||
|
|
||
| void MphoneForm::showCompactLineStatus(bool on) | ||
| { | ||
| if (on) { | ||
|
|
@@ -3021,6 +3039,11 @@ bool MphoneForm::getViewBuddyList() | |
| return viewBuddyList; | ||
| } | ||
|
|
||
| bool MphoneForm::getViewAddressList() | ||
| { | ||
| return viewAddressList; | ||
| } | ||
|
|
||
| bool MphoneForm::getViewCompactLineStatus() | ||
| { | ||
| return viewCompactLineStatus; | ||
|
|
@@ -3049,6 +3072,16 @@ void MphoneForm::populateBuddyList() | |
| buddyListView->expandAll(); | ||
| } | ||
|
|
||
| void MphoneForm::populateAddressList() | ||
| { | ||
| m_model = new AddressTableModel(this, ab_local->get_address_list()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to reuse the model from |
||
| addressListView->setModel(m_model); | ||
|
|
||
| addressListView->sortByColumn(COL_ADDR_NAME, Qt::AscendingOrder); | ||
|
|
||
| addressListView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); | ||
| } | ||
|
|
||
| void MphoneForm::showBuddyListPopupMenu(const QPoint &pos) | ||
| { | ||
| QTreeWidgetItem* item = buddyListView->currentItem(); | ||
|
|
@@ -3332,3 +3365,29 @@ void MphoneForm::osdMuteClicked() | |
| ((t_gui *)ui)->action_mute(!phone->is_line_muted(phone->get_active_line())); | ||
| updateState(); | ||
| } | ||
|
|
||
| void MphoneForm::on_viewAddressListAction_triggered(bool on) | ||
| { | ||
| if (on) { | ||
| addressListView->show(); | ||
| } else { | ||
| addressListView->hide(); | ||
| } | ||
|
|
||
| viewAddressList = on; | ||
| viewAddressListAction->setChecked(on); | ||
| } | ||
|
|
||
| void MphoneForm::selectLocalAddress() | ||
| { | ||
| qDebug()<<"Enter!"; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does not belong in a release version. |
||
| QModelIndexList sel = addressListView->selectionModel()->selectedRows(); | ||
| if (!sel.isEmpty()) | ||
| { | ||
| t_address_card card = m_model->getAddress(sel[0].row()); | ||
| QString address = '"' +QString::fromStdString(card.get_display_name()) + '"' + " <" + QString::fromStdString(card.sip_address) + '>'; | ||
| addToCallComboBox(address); | ||
| selectedAddress(address); | ||
| qDebug()<<address; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,12 +23,15 @@ | |
| #include "buddylistview.h" | ||
| #include "diamondcard.h" | ||
|
|
||
| #include "addresstablemodel.h" | ||
|
|
||
| class t_phone; | ||
| extern t_phone *phone; | ||
|
|
||
| class OSD; | ||
| class IncomingCallPopup; | ||
|
|
||
|
|
||
| class MphoneForm : public QMainWindow, public Ui::MphoneForm | ||
| { | ||
| Q_OBJECT | ||
|
|
@@ -41,6 +44,7 @@ Q_OBJECT | |
| QSystemTrayIcon * getSysTray(); | ||
| bool getViewDisplay(); | ||
| bool getViewBuddyList(); | ||
| bool getViewAddressList(); | ||
| bool getViewCompactLineStatus(); | ||
| protected: | ||
| virtual void closeEvent( QCloseEvent * e ) override; | ||
|
|
@@ -150,10 +154,12 @@ public slots: | |
| void processCryptLabelClick( int line ); | ||
| void popupMenuVoiceMail( const QPoint & pos ); | ||
| void popupMenuVoiceMail( void ); | ||
| void showDisplay( bool on ); | ||
| void showDisplay( bool on ); | ||
| void showBuddyList( bool on ); | ||
| void showAddressList( bool on ); | ||
| void showCompactLineStatus( bool on ); | ||
| void populateBuddyList(); | ||
| void populateBuddyList(); | ||
| void populateAddressList(); | ||
| void showBuddyListPopupMenu( const QPoint & pos ); | ||
| void doCallBuddy(); | ||
| void doMessageBuddy( QTreeWidgetItem * qitem ); | ||
|
|
@@ -174,14 +180,18 @@ public slots: | |
| void sysTrayIconClicked(QSystemTrayIcon::ActivationReason); | ||
|
|
||
| void osdMuteClicked(); | ||
| void selectLocalAddress(); | ||
|
|
||
| private slots: | ||
| void on_viewAddressListAction_triggered(bool checked); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I should point out that auto-connect is not currently used anywhere throughout the code. I'm not saying it's a bad idea, but for consistency, maybe you should consider doing what the Buddy list does and adding the connect in Designer instead? (This is just my own personal opinion, though.)
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I undestand you. When I only start to do changes, I didn't know about the connect in Designer. I will fix it. |
||
|
|
||
| private: | ||
| void init(); | ||
| void destroy(); | ||
| bool shouldDisplayOSD(); | ||
| void updateOSD(); | ||
| QString lineSubstate2str( int line ); | ||
|
|
||
| AddressTableModel* m_model; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is too generic a name for this purpose. |
||
| private: | ||
| QTimer tmrFlashMWI; | ||
| GetAddressForm *getAddressForm; | ||
|
|
@@ -210,6 +220,7 @@ public slots: | |
| QMenu *buddyListPopupMenu; | ||
| QMenu *changeAvailabilityPopupMenu; | ||
| bool viewBuddyList; | ||
| bool viewAddressList; | ||
| OSD *osdWindow; | ||
| IncomingCallPopup *incomingCallPopup; | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahem. Seriously?