Browse Source

change some gui elements

pull/130/head
DenioD 4 years ago
parent
commit
747580151a
  1. 10
      src/Chat/Chat.cpp
  2. 2
      src/Chat/Helper/ChatDelegator.h
  3. 1
      src/DataStore/ChatDataStore.cpp
  4. 4
      src/chatmodel.cpp
  5. 2
      src/controller.cpp
  6. 4
      src/mainwindow.cpp
  7. 76
      src/mainwindow.ui

10
src/Chat/Chat.cpp

@ -50,9 +50,6 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
{ {
QStandardItemModel *chat = new QStandardItemModel(); QStandardItemModel *chat = new QStandardItemModel();
// ui->lcdNumber->setStyleSheet("background-color: red");
// ui->lcdNumber->setPalette(Qt::red);
// ui->lcdNumber->display("1");
DataStore::getChatDataStore()->dump(); // test to see if the chat items in datastore are correctly dumped to json DataStore::getChatDataStore()->dump(); // test to see if the chat items in datastore are correctly dumped to json
for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
{ {
@ -63,7 +60,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
if ( if (
(p.getName() == ui->contactNameMemo->text().trimmed()) && (p.getName() == ui->contactNameMemo->text().trimmed()) &&
(p.getPartnerAddress() == c.second.getAddress()) && (p.getPartnerAddress() == c.second.getAddress()) &&
(c.second.isOutgoing() == true)) (c.second.isOutgoing() == true))
{ {
QStandardItem *Items = new QStandardItem(c.second.toChatLine()); QStandardItem *Items = new QStandardItem(c.second.toChatLine());
@ -81,8 +78,9 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
if ( if (
(p.getName() == ui->contactNameMemo->text().trimmed()) && (p.getName() == ui->contactNameMemo->text().trimmed()) &&
(p.getMyAddress() == c.second.getAddress()) && (p.getMyAddress() == c.second.getAddress()) &&
(c.second.isOutgoing() == false)) (c.second.isOutgoing() == false) &&
(c.second.getCid() == p.getCid())
)
{ {
QStandardItem *Items1 = new QStandardItem(c.second.toChatLine()); QStandardItem *Items1 = new QStandardItem(c.second.toChatLine());
Items1->setData(INCOMING, Qt::UserRole + 1); Items1->setData(INCOMING, Qt::UserRole + 1);

2
src/Chat/Helper/ChatDelegator.h

@ -37,7 +37,7 @@ class ListViewDelegate : public QAbstractItemDelegate
inline QSize sizeHint(QStyleOptionViewItem const &option, QModelIndex const &index) const; inline QSize sizeHint(QStyleOptionViewItem const &option, QModelIndex const &index) const;
}; };
inline ListViewDelegate::ListViewDelegate(QObject *parent): QAbstractItemDelegate(parent), d_radius(5), d_toppadding(5), d_bottompadding(3), d_leftpadding(5), d_rightpadding(5), d_verticalmargin(5), d_horizontalmargin(10), d_pointerwidth(10), d_pointerheight(17), d_widthfraction(.6) inline ListViewDelegate::ListViewDelegate(QObject *parent): QAbstractItemDelegate(parent), d_radius(5), d_toppadding(5), d_bottompadding(3), d_leftpadding(5), d_rightpadding(7), d_verticalmargin(5), d_horizontalmargin(10), d_pointerwidth(10), d_pointerheight(17), d_widthfraction(.7)
{ {
} }

1
src/DataStore/ChatDataStore.cpp

@ -96,6 +96,7 @@ std::map<QString, ChatItem> ChatDataStore::getAllMemos()
(c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().startsWith("{") == false) &&
(c.second.getMemo().isEmpty() == false) (c.second.getMemo().isEmpty() == false)
) )
{ {

4
src/chatmodel.cpp

@ -125,7 +125,7 @@ void MainWindow::renderContactRequest(){
requestContact.requestMemo->setModel(contactMemo); requestContact.requestMemo->setModel(contactMemo);
requestContact.requestMemo->show(); requestContact.requestMemo->show();
requestContact.requestCID->setText(c.second.getCid());
requestContact.requestZaddr->setText(c.second.getRequestZaddr()); requestContact.requestZaddr->setText(c.second.getRequestZaddr());
requestContact.requestMyAddr->setText(c.second.getAddress()); requestContact.requestMyAddr->setText(c.second.getAddress());
}else{} }else{}
@ -617,7 +617,7 @@ Tx MainWindow::createTxForSafeContactRequest()
QString hmemo= createHeaderMemo(type,cid,myAddr); QString hmemo= createHeaderMemo(type,cid,myAddr);
QString memo = contactRequest.getMemo(); QString memo = contactRequest.getMemo();
// ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat
tx.toAddrs.push_back(ToFields{addr, amt, hmemo}); tx.toAddrs.push_back(ToFields{addr, amt, hmemo});
tx.toAddrs.push_back(ToFields{addr, amt, memo}); tx.toAddrs.push_back(ToFields{addr, amt, memo});

2
src/controller.cpp

@ -1009,7 +1009,7 @@ void Controller::refreshTransactions() {
// Update model data, which updates the table view // Update model data, which updates the table view
transactionsTableModel->replaceData(txdata); transactionsTableModel->replaceData(txdata);
chat->renderChatBox(ui, ui->listChat,ui->memoSize); chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
// refreshContacts( // refreshContacts(
// ui->listContactWidget // ui->listContactWidget

4
src/mainwindow.cpp

@ -1080,14 +1080,14 @@ void MainWindow::setupchatTab() {
}); });
ui->memoTxtChat->setLenDisplayLabel(ui->memoSize);// Todo -> activate lendisplay for chat ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat);
} }
void MainWindow::updateChat() void MainWindow::updateChat()
{ {
rpc->refreshChat(ui->listChat,ui->memoSize); rpc->refreshChat(ui->listChat,ui->memoSizeChat);
rpc->refresh(true); rpc->refresh(true);

76
src/mainwindow.ui

@ -1506,16 +1506,16 @@
</rect> </rect>
</property> </property>
<property name="verticalScrollBarPolicy"> <property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum> <enum>Qt::ScrollBarAsNeeded</enum>
</property> </property>
<property name="horizontalScrollBarPolicy"> <property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum> <enum>Qt::ScrollBarAsNeeded</enum>
</property> </property>
<property name="sizeAdjustPolicy"> <property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum> <enum>QAbstractScrollArea::AdjustToContents</enum>
</property> </property>
<property name="editTriggers"> <property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set> <set>QAbstractItemView::AllEditTriggers</set>
</property> </property>
<property name="resizeMode"> <property name="resizeMode">
<enum>QListView::Adjust</enum> <enum>QListView::Adjust</enum>
@ -1533,12 +1533,24 @@
<widget class="QPushButton" name="safeContactRequest"> <widget class="QPushButton" name="safeContactRequest">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>270</x> <x>10</x>
<y>580</y> <y>20</y>
<width>51</width> <width>51</width>
<height>51</height> <height>51</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize"> <property name="baseSize">
<size> <size>
<width>100</width> <width>100</width>
@ -1569,12 +1581,24 @@
<widget class="QPushButton" name="pushContact"> <widget class="QPushButton" name="pushContact">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>80</x>
<y>20</y> <y>20</y>
<width>61</width> <width>51</width>
<height>51</height> <height>51</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize"> <property name="baseSize">
<size> <size>
<width>100</width> <width>100</width>
@ -1607,12 +1631,24 @@
<widget class="QPushButton" name="givemeZaddr"> <widget class="QPushButton" name="givemeZaddr">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>150</x>
<y>20</y> <y>20</y>
<width>61</width> <width>51</width>
<height>51</height> <height>51</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Get a new Address</string> <string>Get a new Address</string>
</property> </property>
@ -1633,15 +1669,18 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="memoSize"> <widget class="QLabel" name="memoSizeChat">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>1160</x> <x>1140</x>
<y>540</y> <y>640</y>
<width>91</width> <width>91</width>
<height>17</height> <height>17</height>
</rect> </rect>
</property> </property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="text"> <property name="text">
<string notr="true">0 / 512</string> <string notr="true">0 / 512</string>
</property> </property>
@ -1649,6 +1688,17 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
<zorder>listContactWidget</zorder>
<zorder>label_39</zorder>
<zorder>contactNameMemo</zorder>
<zorder>contactNameMemo_3</zorder>
<zorder>safeContactRequest</zorder>
<zorder>pushContact</zorder>
<zorder>givemeZaddr</zorder>
<zorder>memoSizeChat</zorder>
<zorder>listChat</zorder>
<zorder>memoTxtChat</zorder>
<zorder>sendChatButton</zorder>
</widget> </widget>
</widget> </widget>
</item> </item>
@ -1838,7 +1888,7 @@
<customwidget> <customwidget>
<class>ChatMemoEdit</class> <class>ChatMemoEdit</class>
<extends>QTextEdit</extends> <extends>QTextEdit</extends>
<header location="global">mainwindow.h</header> <header>mainwindow.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>

Loading…
Cancel
Save