File indexing completed on 2024-04-21 05:43:43
0001 /*************************************************************************** 0002 * Copyright (C) 2005 by David Saxton * 0003 * david@bluehaze.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #include "config.h" 0012 #ifndef NO_GPSIM 0013 0014 #ifndef SYMBOLVIEWER_H 0015 #define SYMBOLVIEWER_H 0016 0017 #include <QPointer> 0018 #include <QTableWidget> 0019 0020 #include <gpsimprocessor.h> 0021 0022 class KComboBox; 0023 class KConfig; 0024 class SymbolViewer; 0025 0026 namespace KateMDI 0027 { 0028 class ToolView; 0029 } 0030 0031 /** 0032 @author David Saxton 0033 */ 0034 class SymbolViewer : public QWidget 0035 { 0036 Q_OBJECT 0037 public: 0038 static SymbolViewer *self(KateMDI::ToolView *parent = nullptr); 0039 static QString toolViewIdentifier() 0040 { 0041 return "SymbolViewer"; 0042 } 0043 ~SymbolViewer() override; 0044 0045 enum Radix { Binary = 2, Octal = 8, Decimal = 10, Hexadecimal = 16 }; 0046 0047 Radix valueRadix() const 0048 { 0049 return m_valueRadix; 0050 } 0051 0052 // QTableWidget * symbolList() const { return m_pSymbolList; } // 2016.06.02 - unused 0053 /** 0054 * Write the current properties (such as currently selected radix) to 0055 * the config. 0056 */ 0057 void saveProperties(KConfig *config); 0058 /** 0059 * Reads the properties (such as the last selected radix) from the 0060 * config file. 0061 */ 0062 void readProperties(KConfig *config); 0063 0064 void setContext(GpsimProcessor *gpsim); 0065 /** 0066 * Converts the value to a string for display according to the currently 0067 * selected radix. 0068 */ 0069 QString toDisplayString(unsigned value) const; 0070 0071 signals: 0072 void valueRadixChanged(SymbolViewer::Radix newRadix); 0073 0074 public slots: 0075 void selectRadix(int selectIndex); 0076 0077 protected: 0078 QPointer<GpsimProcessor> m_pGpsim; 0079 RegisterSet *m_pCurrentContext; 0080 QTableWidget *m_pSymbolList; 0081 Radix m_valueRadix; 0082 0083 private: 0084 SymbolViewer(KateMDI::ToolView *parent); 0085 static SymbolViewer *m_pSelf; 0086 KComboBox *m_pRadixCombo; 0087 }; 0088 0089 class SymbolViewerItem : public QObject, public QTableWidgetItem 0090 { 0091 Q_OBJECT 0092 public: 0093 SymbolViewerItem(SymbolViewer *symbolViewer, const RegisterInfo *registerInfo, int intendedColumn); 0094 0095 public slots: 0096 void valueChanged(unsigned newValue); 0097 void radixChanged(); 0098 0099 protected: 0100 const RegisterInfo *m_pRegisterInfo; 0101 SymbolViewer *m_pSymbolViewer; 0102 }; 0103 0104 #endif 0105 0106 #endif