| 1 | /* |
| 2 | * midisnoop - MIDI monitor and prober |
| 3 | * Copyright (C) 2012 Devin Anderson |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License as published by the Free |
| 7 | * Software Foundation; either version 2 of the License, or (at your option) |
| 8 | * any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | * more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License along with |
| 16 | * this program; if not, write to the Free Software Foundation, Inc., 675 Mass |
| 17 | * Ave, Cambridge, MA 02139, USA. |
| 18 | */ |
| 19 | |
| 20 | #include <cassert> |
| 21 | |
| 22 | #include <QtWidgets/QApplication> |
| 23 | |
| 24 | #include "mainview.h"cxx . . $ `<file>/src/mainview.h`/ |
| 25 | #include "util.h"cxx . . $ `<file>/src/util.h`/ |
| 26 | |
| 27 | MainViewcxx . . $ MainView#::MainViewcxx . . $ MainView#MainView(749de1b6ae65bddd).(QObjectcxx . . $ QObject# *parent): |
| 28 | DesignerViewcxx . . $ DesignerView#(":/midisnoop/mainview.ui"cxx . . $ QString#QString(85c52e162fed56f9)., parent) |
| 29 | { |
| 30 | QWidgetcxx . . $ QWidget# *widget = getRootWidgetcxx . . $ View#getRootWidget(9b769eeb00a33a04).(); |
| 31 | |
| 32 | aboutActioncxx . . $ MainView#aboutAction. = getChildcxx . . $ getChild(4f9d5d769841a92).<QActioncxx . . $ QAction#>(widget, "aboutAction"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 33 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(aboutActioncxx . . $ MainView#aboutAction., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()), |
| 34 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(aboutRequest())); |
| 35 | |
| 36 | addActioncxx . . $ MainView#addAction. = getChildcxx . . $ getChild(4f9d5d769841a92).<QActioncxx . . $ QAction#>(widget, "addAction"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 37 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(addActioncxx . . $ MainView#addAction., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()), |
| 38 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(addMessageRequest())); |
| 39 | |
| 40 | clearActioncxx . . $ MainView#clearAction. = getChildcxx . . $ getChild(4f9d5d769841a92).<QActioncxx . . $ QAction#>(widget, "clearAction"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 41 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(clearActioncxx . . $ MainView#clearAction., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()), |
| 42 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(clearMessagesRequest())); |
| 43 | |
| 44 | configureActioncxx . . $ MainView#configureAction. = getChildcxx . . $ getChild(4f9d5d769841a92).<QActioncxx . . $ QAction#>(widget, "configureAction"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 45 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(configureActioncxx . . $ MainView#configureAction., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()), |
| 46 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(configureRequest())); |
| 47 | |
| 48 | quitActioncxx . . $ MainView#quitAction. = getChildcxx . . $ getChild(4f9d5d769841a92).<QActioncxx . . $ QAction#>(widget, "quitAction"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 49 | connectcxx . . $ QObject#connect(f4332061c7e4ca89).(quitActioncxx . . $ MainView#quitAction., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(triggered()), |
| 50 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(closeRequest())); |
| 51 | |
| 52 | tableModelcxx . . $ MainView#tableModel..setColumnCountcxx . . $ QStandardItemModel#setColumnCount(d4f767463ce0a6b3).(MESSAGETABLECOLUMN_TOTALcxx . . $ MainView#MESSAGETABLECOLUMN_TOTAL.); |
| 53 | tableModelcxx . . $ MainView#tableModel..setRowCountcxx . . $ QStandardItemModel#setRowCount(d4f767463ce0a6b3).(0); |
| 54 | tableModelcxx . . $ MainView#tableModel..setHeaderDatacxx . . $ QStandardItemModel#setHeaderData(3110bf0452509494).(MESSAGETABLECOLUMN_DATAcxx . . $ MainView#MESSAGETABLECOLUMN_DATA., Qtcxx . . $ Qt/::Horizontalcxx . . $ Qt/Horizontal., |
| 55 | trcxx . . $ QVariant#QVariant(3520e46b33348bf6).("Data"), Qtcxx . . $ Qt/::DisplayRolecxx . . $ Qt/DisplayRole.); |
| 56 | tableModelcxx . . $ MainView#tableModel..setHeaderDatacxx . . $ QStandardItemModel#setHeaderData(3110bf0452509494).(MESSAGETABLECOLUMN_STATUScxx . . $ MainView#MESSAGETABLECOLUMN_STATUS., Qtcxx . . $ Qt/::Horizontalcxx . . $ Qt/Horizontal., |
| 57 | trcxx . . $ QVariant#QVariant(3520e46b33348bf6).("Status"), Qtcxx . . $ Qt/::DisplayRolecxx . . $ Qt/DisplayRole.); |
| 58 | tableModelcxx . . $ MainView#tableModel..setHeaderDatacxx . . $ QStandardItemModel#setHeaderData(3110bf0452509494).(MESSAGETABLECOLUMN_TIMESTAMPcxx . . $ MainView#MESSAGETABLECOLUMN_TIMESTAMP., Qtcxx . . $ Qt/::Horizontalcxx . . $ Qt/Horizontal., |
| 59 | trcxx . . $ QVariant#QVariant(3520e46b33348bf6).("Timestamp"), Qtcxx . . $ Qt/::DisplayRolecxx . . $ Qt/DisplayRole.); |
| 60 | |
| 61 | tableViewcxx . . $ MainView#tableView. = getChildcxx . . $ getChild(4f9d5d769841a92).<QTableViewcxx . . $ QTableView#>(widget, "centralWidget"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 62 | tableViewcxx . . $ MainView#tableView.->setItemDelegatecxx . . $ QAbstractItemView#setItemDelegate(fa3867fa1f6ca1e7).(&tableDelegatecxx . . $ MainView#tableDelegate.); |
| 63 | tableViewcxx . . $ MainView#tableView.->setModelcxx . . $ QTableView#setModel(c6e1f1e42522b780).(&tableModelcxx . . $ MainView#tableModel.); |
| 64 | } |
| 65 | |
| 66 | MainViewcxx . . $ MainView#::~cxx . . $ MainView#`~MainView`(ced63f7c635d850d).MainViewcxx . . $ MainView#() |
| 67 | { |
| 68 | // Empty |
| 69 | } |
| 70 | |
| 71 | int |
| 72 | MainViewcxx . . $ MainView#::addMessagecxx . . $ MainView#addMessage(5a5f492b7abd2693).(quint64cxx . . $ quint64# timeStamp, const QStringcxx . . $ QString# &statusDescription, |
| 73 | const QStringcxx . . $ QString# &dataDescription, bool valid) |
| 74 | { |
| 75 | int count = tableModelcxx . . $ MainView#tableModel..rowCountcxx . . $ QStandardItemModel#rowCount(e3878d4d6cd9529c).(); |
| 76 | bool inserted = tableModelcxx . . $ MainView#tableModel..insertRowcxx . . $ QStandardItemModel#insertRow(eb30e146838e644d).(count); |
| 77 | assertcxx . . $ `/usr/include/assert.h:102:11`!(inserted); |
| 78 | Qtcxx . . $ Qt/::AlignmentFlagcxx . . $ Qt/AlignmentFlag# alignment = Qtcxx . . $ Qt/::AlignTopcxx . . $ Qt/AlignTop.; |
| 79 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(count, MESSAGETABLECOLUMN_DATAcxx . . $ MainView#MESSAGETABLECOLUMN_DATA., dataDescriptioncxx . . $ QVariant#QVariant(3520e46b33348bf6).); |
| 80 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(count, MESSAGETABLECOLUMN_DATAcxx . . $ MainView#MESSAGETABLECOLUMN_DATA., alignmentcxx . . $ QVariant#QVariant(d4f767463ce0a6b3)., |
| 81 | Qtcxx . . $ Qt/::TextAlignmentRolecxx . . $ Qt/TextAlignmentRole.); |
| 82 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(count, MESSAGETABLECOLUMN_STATUScxx . . $ MainView#MESSAGETABLECOLUMN_STATUS., statusDescriptioncxx . . $ QVariant#QVariant(3520e46b33348bf6).); |
| 83 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(count, MESSAGETABLECOLUMN_STATUScxx . . $ MainView#MESSAGETABLECOLUMN_STATUS., alignmentcxx . . $ QVariant#QVariant(d4f767463ce0a6b3)., |
| 84 | Qtcxx . . $ Qt/::TextAlignmentRolecxx . . $ Qt/TextAlignmentRole.); |
| 85 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(count, MESSAGETABLECOLUMN_TIMESTAMPcxx . . $ MainView#MESSAGETABLECOLUMN_TIMESTAMP., timeStampcxx . . $ QVariant#QVariant(891dc3055356b409).); |
| 86 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(count, MESSAGETABLECOLUMN_TIMESTAMPcxx . . $ MainView#MESSAGETABLECOLUMN_TIMESTAMP., alignmentcxx . . $ QVariant#QVariant(d4f767463ce0a6b3)., |
| 87 | Qtcxx . . $ Qt/::TextAlignmentRolecxx . . $ Qt/TextAlignmentRole.); |
| 88 | if (! valid) { |
| 89 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(count, MESSAGETABLECOLUMN_STATUScxx . . $ MainView#MESSAGETABLECOLUMN_STATUS., |
| 90 | QIconcxx . . $ QIcon#QIcon(3520e46b33348bf6).(":/midisnoop/images/16x16/error.png"cxx . . $ QString#QString(85c52e162fed56f9).), |
| 91 | Qtcxx . . $ Qt/::DecorationRolecxx . . $ Qt/DecorationRole.); |
| 92 | } |
| 93 | tableViewcxx . . $ MainView#tableView.->resizeRowToContentscxx . . $ QTableView#resizeRowToContents(d4f767463ce0a6b3).(count); |
| 94 | tableViewcxx . . $ MainView#tableView.->scrollToBottomcxx . . $ QAbstractItemView#scrollToBottom(49f6e7a06ebc5aa8).(); |
| 95 | return count; |
| 96 | } |
| 97 | |
| 98 | void |
| 99 | MainViewcxx . . $ MainView#::addReceivedMessagecxx . . $ MainView#addReceivedMessage(e22750454831b9e4).(quint64cxx . . $ quint64# timeStamp, |
| 100 | const QStringcxx . . $ QString# &statusDescription, |
| 101 | const QStringcxx . . $ QString# &dataDescription, bool valid) |
| 102 | { |
| 103 | addMessagecxx . . $ MainView#addMessage(5a5f492b7abd2693).(timeStamp, statusDescription, dataDescription, valid); |
| 104 | } |
| 105 | |
| 106 | void |
| 107 | MainViewcxx . . $ MainView#::addSentMessagecxx . . $ MainView#addSentMessage(e22750454831b9e4).(quint64cxx . . $ quint64# timeStamp, const QStringcxx . . $ QString# &statusDescription, |
| 108 | const QStringcxx . . $ QString# &dataDescription, bool valid) |
| 109 | { |
| 110 | int index = addMessagecxx . . $ MainView#addMessage(5a5f492b7abd2693).(timeStamp, statusDescription, dataDescription, |
| 111 | valid); |
| 112 | const QBrushcxx . . $ QBrush# &brush = qAppcxx . . $ `<external>/6022697617041041825/qapplication.h:70:9`!->palettecxx . . $ QGuiApplication#palette(522fbdbbff1b5a68).().alternateBasecxx . . $ QPalette#alternateBase(e14a554c07951b96).(); |
| 113 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(index, MESSAGETABLECOLUMN_DATAcxx . . $ MainView#MESSAGETABLECOLUMN_DATA., brush, Qtcxx . . $ Qt/::BackgroundRolecxx . . $ Qt/BackgroundRole.); |
| 114 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(index, MESSAGETABLECOLUMN_STATUScxx . . $ MainView#MESSAGETABLECOLUMN_STATUS., brush, Qtcxx . . $ Qt/::BackgroundRolecxx . . $ Qt/BackgroundRole.); |
| 115 | setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(index, MESSAGETABLECOLUMN_TIMESTAMPcxx . . $ MainView#MESSAGETABLECOLUMN_TIMESTAMP., brush, |
| 116 | Qtcxx . . $ Qt/::BackgroundRolecxx . . $ Qt/BackgroundRole.); |
| 117 | } |
| 118 | |
| 119 | void |
| 120 | MainViewcxx . . $ MainView#::clearMessagescxx . . $ MainView#clearMessages(49f6e7a06ebc5aa8).() |
| 121 | { |
| 122 | int count = tableModelcxx . . $ MainView#tableModel..rowCountcxx . . $ QStandardItemModel#rowCount(e3878d4d6cd9529c).(); |
| 123 | if (count) { |
| 124 | bool removed = tableModelcxx . . $ MainView#tableModel..removeRowscxx . . $ QStandardItemModel#removeRows(c4e00837c4ba3150).(0, tableModelcxx . . $ MainView#tableModel..rowCountcxx . . $ QStandardItemModel#rowCount(e3878d4d6cd9529c).()); |
| 125 | assertcxx . . $ `/usr/include/assert.h:102:11`!(removed); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | void |
| 130 | MainViewcxx . . $ MainView#::setMessageSendEnabledcxx . . $ MainView#setMessageSendEnabled(b45ddcbc8423892c).(bool enabled) |
| 131 | { |
| 132 | addActioncxx . . $ MainView#addAction.->setEnabledcxx . . $ QAction#setEnabled(b45ddcbc8423892c).(enabled); |
| 133 | } |
| 134 | |
| 135 | void |
| 136 | MainViewcxx . . $ MainView#::setModelDatacxx . . $ MainView#setModelData(6f4589bb1ee65142).(int row, int column, const QVariantcxx . . $ QVariant# &value, int role) |
| 137 | { |
| 138 | bool result = tableModelcxx . . $ MainView#tableModel..setDatacxx . . $ QStandardItemModel#setData(6d1d8401440d0a2c).(tableModelcxx . . $ MainView#tableModel..indexcxx . . $ QStandardItemModel#index(37dbccf64c4e392).(row, column), value, |
| 139 | role); |
| 140 | assertcxx . . $ `/usr/include/assert.h:102:11`!(result); |
| 141 | } |