Changeset 10657
- Timestamp:
- 05/11/11 10:27:33 (14 years ago)
- Location:
- trunk/FACT++
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/CheckBoxDelegate.cc
r10394 r10657 1 // ************************************************************************** 2 /** @class CheckBoxDelegate 3 4 @brief A delegate which displays an arrow if there are sub items and raises an event if the checkbox is checked 5 6 */ 7 // ************************************************************************** 1 8 #include "CheckBoxDelegate.h" 2 9 3 #include <Q tGui/QPainter>4 #include <Q tGui/QApplication>10 #include <QPainter> 11 #include <QApplication> 5 12 6 13 void CheckBoxDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const … … 69 76 return rc; 70 77 } 78 79 // ************************************************************************** 80 /** @class CheckBoxEvent 81 82 @brief An event posted by the CheckBoxDelegate if the CheckBox is used 83 84 */ 85 // ************************************************************************** -
trunk/FACT++/gui/CheckBoxDelegate.h
r10394 r10657 2 2 #define FACT_CheckBoxDelegate 3 3 4 #include <Q tCore/QEvent>5 #include <Q tGui/QStandardItem>4 #include <QEvent> 5 #include <QStandardItem> 6 6 7 7 using namespace std; … … 18 18 19 19 20 #include <Q tGui/QStyledItemDelegate>20 #include <QStyledItemDelegate> 21 21 22 22 class CheckBoxDelegate : public QStyledItemDelegate 23 23 { 24 Q_OBJECT;25 26 24 public: 27 25 CheckBoxDelegate(QObject *p=0) : QStyledItemDelegate(p) -
trunk/FACT++/gui/DockWindow.cc
r10466 r10657 1 // ************************************************************************** 2 /** @class DockWindow 3 4 @brief A main window which can be used to display a QDockWidget from a tab 5 6 */ 7 // ************************************************************************** 1 8 #include "DockWindow.h" 2 9 … … 7 14 8 15 using namespace std; 9 10 #include <iostream>11 16 12 17 DockWindow::DockWindow(QDockWidget *d, const QString &name) … … 42 47 QWidget *w = new QWidget; 43 48 44 QGridLayout *l = 49 QGridLayout *l = new QGridLayout(w); 45 50 //layout->setObjectName(QString::fromUtf8("gridLayout_")+windowTitle()); 46 51 l->addWidget(fDockWidget, 0, 0, 1, 1); … … 50 55 51 56 fDockWidget->setParent(w); 52 53 57 } -
trunk/FACT++/gui/HtmlDelegate.cc
r10475 r10657 1 // ************************************************************************** 2 /** @class HtmlDelegate 3 4 @brief A Qt-Delegate to display HTML text (QTextDocument) in a list 5 6 */ 7 // ************************************************************************** 1 8 #include "HtmlDelegate.h" 2 9 3 #include <Q tGui/QPainter>4 #include <Q tGui/QTextDocument>10 #include <QPainter> 11 #include <QTextDocument> 5 12 6 13 void HtmlDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const -
trunk/FACT++/gui/HtmlDelegate.h
r10394 r10657 2 2 #define FACT_HtmlDelegate 3 3 4 #include <QtGui/QStyledItemDelegate> 5 6 using namespace std; 4 #include <QStyledItemDelegate> 7 5 8 6 class HtmlDelegate : public QStyledItemDelegate 9 7 { 10 Q_OBJECT;11 12 8 public: 13 9 HtmlDelegate(QObject *p=0) : QStyledItemDelegate(p) -
trunk/FACT++/gui/MainWindow.cc
r10644 r10657 31 31 fDimSvcDescription->setItemDelegate(new HtmlDelegate); 32 32 33 // Set a default string to be displayed in a the status bar at startup 33 34 fStatusBar->showMessage(PACKAGE_STRING" | "PACKAGE_URL" | report bugs to <"PACKAGE_BUGREPORT">"); 34 35 36 // Initialize the 40 FTU Leds as a copy of the prototype LED 35 37 fFtuLED[0] = fFtuLEDPrototype; 36 38 … … 58 60 } 59 61 62 // Initialize a timer to update the displayed UTC time 60 63 QTimer *timer = new QTimer(this); 61 64 connect(timer, SIGNAL(timeout()), this, SLOT(slot_TimeUpdate())); -
trunk/FACT++/gui/SpinBoxHex.h
r10605 r10657 2 2 #define FACT_SpinBoxHex 3 3 4 #include <Q tGui/QSpinBox>4 #include <QSpinBox> 5 5 6 6 … … 37 37 #endif 38 38 39 // ************************************************************************** 40 /** @class SpinBoxHex 41 42 @brief A QSpinBox which displays the value as hex-value 43 44 */ 45 // ************************************************************************** -
trunk/FACT++/src/Converter.cc
r10467 r10657 895 895 for (int j=0; j<n; j++) 896 896 { 897 //ETIENNE moved the +s-1 to the second argument and removed the -1898 897 reverse_copy(charSrc, charSrc+s, charDest); 899 898 900 899 charSrc += s; 901 900 charDest += s; … … 933 932 return Print(cout); 934 933 } 935 936 937 938 939 940 941 -
trunk/FACT++/src/Converter.h
r10640 r10657 13 13 14 14 #include <iostream> 15 15 16 class Converter 16 17 { … … 114 115 for (size_t i=0; i<size/sizeof(T); i++) 115 116 { 116 if (prefix && i%col==0)117 if (prefix && col!=0 && i%col==0) 117 118 text << std::setfill('0') << std::setw(w) << i << "| "; 118 119 … … 143 144 144 145 // *************************************************************************** 145 /** @fn GetHex(const void *dat, size_t size )146 /** @fn GetHex(const void *dat, size_t size, size_t col, bool prefix) 146 147 147 148 Converts from a binary block into a hex representation. … … 154 155 155 156 @param col 156 Number of columns before new line 157 Number of columns before new line (zero <default> to write a 158 continous stream 159 160 @param prefix 161 Boolean which defines whether each line should be prefixed with a counter, 162 the default is true. It is ignored if col==0 157 163 158 164 @tparam T … … 163 169 The string 164 170 165 166 171 **/ 167 172 // *************************************************************************** -
trunk/FACT++/src/Dim.cc
r10645 r10657 1 // ************************************************************************** 2 /** @namespace Dim 3 4 @brief Namespace to host some global Dim helper functions 5 6 */ 7 // ************************************************************************** 1 8 #include "Dim.h" 2 9 … … 10 17 using namespace std; 11 18 12 string Dim::GetLocalIp() 19 // -------------------------------------------------------------------------- 20 // 21 //! Tries to determine the local IP address with which we will connect 22 //! to the DIM dns. 23 //! 24 //! @param dns 25 //! Address of the Dim-dns 26 //! 27 //! @returns 28 //! The IP Address through which the connection to the DNS will 29 //! take place. 30 //! 31 string Dim::GetLocalIp(const string &dns) 13 32 { 14 const char *kDnsIp = getenv("DIM_DNS_NODE");15 16 33 struct addrinfo hints, *servinfo, *p; 17 34 … … 21 38 22 39 int rv; 23 if ((rv = getaddrinfo( kDnsIp, NULL, &hints, &servinfo)) != 0)40 if ((rv = getaddrinfo(dns.c_str(), NULL, &hints, &servinfo)) != 0) 24 41 { 25 42 cout << "WARNING - getaddrinfo: " << gai_strerror(rv) << endl; 26 return kDnsIp;43 return dns; 27 44 } 28 45 … … 68 85 freeaddrinfo(servinfo); // all done with this structure 69 86 70 return kDnsIp;87 return dns; 71 88 } 72 89 90 // -------------------------------------------------------------------------- 91 // 92 //! Set the environment variable DIM_DNS_NODE to the given string and 93 //! DIM_HOST_NODE to the IP-address through which this machine connects 94 //! to the dns. 95 //! 96 //! @param dns 97 //! Address of the Dim-dns 98 //! 73 99 void Dim::Setup(const std::string &dns) 74 100 { 75 setenv("DIM_DNS_NODE", dns.c_str(), 1);76 setenv("DIM_HOST_NODE", GetLocalIp( ).c_str(), 1);101 setenv("DIM_DNS_NODE", dns.c_str(), 1); 102 setenv("DIM_HOST_NODE", GetLocalIp(dns).c_str(), 1); 77 103 } -
trunk/FACT++/src/Dim.h
r10645 r10657 8 8 namespace Dim 9 9 { 10 std::string GetLocalIp(const std::string &dns); 11 void Setup(const std::string &dns); 12 13 // -------------------------------------------------------------------------- 14 // 15 //! Simplification wrapper to send a command without data 16 //! 17 //! Example: 18 //! - Dim::SendCommand("SERVER/COMMAND"); 19 //! 20 //! @param command 21 //! Dim command identifier 22 //! 23 //! @returns 24 //! the return value of DimClient::sendCommand 25 //! 10 26 inline bool SendCommand(const std::string &command) 11 27 { … … 13 29 } 14 30 31 // -------------------------------------------------------------------------- 32 // 33 //! Simplification wrapper to send a command with the given data 34 //! 35 //! Example: 36 //! - Dim::SendCommand("SERVER/COMMAND", uint16_t(42)); 37 //! - struct tm t; Dim::SendCommand("SERVER/TIME", t); 38 //! 39 //! @param command 40 //! Dim command identifier 41 //! 42 //! @param t 43 //! object to be sent, the pointer to the data to be sent is 44 //! set to &t 45 //! 46 //! @template T 47 //! type of the data to be sent. The size of the data to be sent 48 //! is determined as sizeof(T) 49 //! 50 //! @returns 51 //! the return value of DimClient::sendCommand 52 //! 15 53 template<typename T> 16 54 inline bool SendCommand(const std::string &command, const T &t) … … 18 56 return DimClient::sendCommand(command.c_str(), (void*)&t, sizeof(t)); 19 57 } 20 21 std::string GetLocalIp();22 23 void Setup(const std::string &dns);24 58 } 25 59 -
trunk/FACT++/src/DimDescriptionService.cc
r10477 r10657 25 25 The description should contain as many descriptions as format chunks, e.g. 26 26 27 I:1 should contain one description chunks28 I:1;F:1 should contain two description chunks29 I:2;F:1 should contain two description chunks30 I:2;I:1;F:1 should contain three description chunks27 - I:1 should contain one description chunks 28 - I:1;F:1 should contain two description chunks 29 - I:2;F:1 should contain two description chunks 30 - I:2;I:1;F:1 should contain three description chunks 31 31 32 32 */ -
trunk/FACT++/src/DimErrorRedirecter.cc
r10583 r10657 1 1 // ************************************************************************** 2 2 /** @class DimErrorRedirecter 3 4 @brief A base class taking care of padding, exit handler and error handlers 5 6 This class first switches off padding for the DimServer and the DimClient 7 (dis and dic). Furthermore, it redirects both error handlers to the 8 DimErrorRedirecter. Redirect the exit handler. 9 10 Only one instance of this class is allowed, since all Dim handlers are 11 global. 12 13 In the destructor of the class the handlers are correctly restored. 14 The padding setup is kept. 15 16 For FACT++ all Dim data is transmitted without padding! 17 18 To catch the error messages overwrite the errorHandler. The errorHandler 19 of the DimErrorRedirecter redirects the error messages to the logging 20 stream given in the constructor. 21 22 To catch the exit requests overwrite the exitHandler. 3 23 4 24 */ … … 15 35 int DimErrorRedirecter::cnt = 0; 16 36 37 // -------------------------------------------------------------------------- 38 // 39 //! - disable padding for dim server and dim client 40 //! - redirect DimClient error handler 41 //! - redirect DimServer error handler 42 //! - set exit handler of DimServer 43 // 17 44 DimErrorRedirecter::DimErrorRedirecter(MessageImp &imp) : fMsg(imp) 18 45 { … … 31 58 } 32 59 60 // -------------------------------------------------------------------------- 61 // 62 //! - reset DimClient error handler 63 //! - reset DimServer error handler 64 //! - reset exit handler of DimServer 65 // 33 66 DimErrorRedirecter::~DimErrorRedirecter() 34 67 { -
trunk/FACT++/src/DimServerList.cc
r10570 r10657 122 122 // -------------------------------------------------------------------------- 123 123 // 124 //! @param server 125 //! server-name to check for 126 //! 127 //! @returns 128 //! whether the server with the given name is online or not 129 //! 124 130 bool DimServerList::HasServer(const std::string &server) const 125 131 { -
trunk/FACT++/src/EventImp.cc
r10486 r10657 208 208 //! @param out 209 209 //! An ostream to which the output should be redirected. 210 //! 211 //! @param strip 212 //! defines whether a possible SERVER name in the event name 213 //! should be stripped or not. 210 214 //! 211 215 void EventImp::Print(ostream &out, bool strip) const … … 277 281 // 278 282 //! Calls Print(std::cout) 283 //! 284 //! @param strip 285 //! defines whether a possible SERVER name in the event name 286 //! should be stripped or not. 279 287 // 280 288 void EventImp::Print(bool strip) const -
trunk/FACT++/src/FACT.cc
r10652 r10657 1 // ************************************************************************** 2 /** @namespace FACT 3 4 @brief Namespace to help with some general things in the program initialization 5 6 */ 7 // ************************************************************************** 1 8 #include "FACT.h" 2 9 … … 5 12 #include <boost/filesystem.hpp> 6 13 7 /* 8 The first line of the --version information is assumed to be in one 9 of the following formats: 10 11 <version> 12 <program> <version> 13 {GNU,Free} <program> <version> 14 <program> ({GNU,Free} <package>) <version> 15 <program> - {GNU,Free} <package> <version> 16 17 and separated from any copyright/author details by a blank line. 18 19 Handle multi-line bug reporting sections of the form: 20 21 Report <program> bugs to <addr> 22 GNU <package> home page: <url> 23 ... 24 */ 14 // -------------------------------------------------------------------------- 15 // 16 //! Print version information about FACT++ 17 //! 18 //! From help2man: 19 //! 20 //! The first line of the --version information is assumed to be in one 21 //! of the following formats: 22 //! 23 //! - <version> 24 //! - <program> <version> 25 //! - {GNU,Free} <program> <version> 26 //! - <program> ({GNU,Free} <package>) <version> 27 //! - <program> - {GNU,Free} <package> <version> 28 //! 29 //! and separated from any copyright/author details by a blank line. 30 //! 31 //! Handle multi-line bug reporting sections of the form: 32 //! 33 //! - Report <program> bugs to <addr> 34 //! - GNU <package> home page: <url> 35 //! - ... 36 //! 37 //! 38 //! @param name 39 //! name of the program (usually argv[0]). A possible leading "lt-" 40 //! is removed. 41 //! 25 42 void FACT::PrintVersion(const char *name) 26 43 { -
trunk/FACT++/src/StateMachineImp.cc
r10586 r10657 295 295 //! size of the memory which should be attached to the event 296 296 //! 297 //! @returns 298 //! false if the event is ignored, true otherwise. 299 //! 297 300 //! @todo 298 301 //! - Shell we check for the validity of a command at the current state, too? … … 333 336 //! event should be for. 334 337 //! 338 //! @returns 339 //! false if the event is ignored, true otherwise. 340 //! 335 341 //! @todo 336 342 //! - Shell we check for the validity of a command at the current state, too? … … 357 363 } 358 364 365 // -------------------------------------------------------------------------- 366 // 367 //! Return all event names of the StateMachine 368 //! 369 //! @returns 370 //! A vector of strings with all event names of the state machine. 371 //! The event names all have the SERVER/ pre-fix removed. 372 // 359 373 const vector<string> StateMachineImp::GetEventNames() const 360 374 { … … 1010 1024 //! if functions are assigned directly to any event to simulate 1011 1025 //! a running loop (e.g. block until Stop() was called or fExitRequested 1012 //! was set by an EXIT command. 1026 //! was set by an EXIT command. If dummy==true, fRunning is not set 1027 //! to true to allow handling events directly from the event handler. 1013 1028 //! 1014 1029 //! @returns
Note:
See TracChangeset
for help on using the changeset viewer.