~d-nelson/research-assistant/nextDNK

« back to all changes in this revision

Viewing changes to RAGUI/NewNoteDlg.cpp

  • Committer: Viktor Bursian
  • Date: 2013-06-06 13:42:39 UTC
  • Revision ID: vbursian@gmail.com-20130606134239-bx5ks8sg3y9oqckz
Tags: version_0.2.0
first usable version 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
////////////////////////////////////////////////////////////////////////////////
 
2
/*! @file NewNoteDlg.cpp   Редактирование текстового атрибута.
 
3
- Part of RAGUI - Research Assistant Graphical User Interface.
 
4
- Uses  QtGui v.4.6  -  http://qt.nokia.com/
 
5
- Uses  RANet - Research Assistant Net Library (based on ANSI C++).
 
6
- Copyright(C) 2010, Viktor E. Bursian, St.Petersburg, Russia.
 
7
                     Viktor.Bursian@mail.ioffe.ru
 
8
*///////////////////////////////////////////////////////////////////////////////
 
9
#include "NewNoteDlg.h"
 
10
namespace RA {
 
11
//------------------------------------------------------------------------------
 
12
 
 
13
sNewNoteDlg::~sNewNoteDlg ()
 
14
{
 
15
}
 
16
 
 
17
 
 
18
sNewNoteDlg::sNewNoteDlg (QWidget *  parent)
 
19
  :sAttrDlg(parent)
 
20
  ,PreventCycling(false)
 
21
{
 
22
  lblValue = new QLabel(this);
 
23
  lblValue->setObjectName(QString::fromUtf8("lblValue"));
 
24
  lblValue->setText(tr("Source HTML:"));
 
25
  ValueSpace->addWidget(lblValue,0,0,1,1/*,Qt::Alignment*/);
 
26
 
 
27
  fldValuePlain = new QTextEdit(this);
 
28
  fldValuePlain->setObjectName(QString::fromUtf8("fldValuePlain"));
 
29
  ValueSpace->addWidget(fldValuePlain,1,0,1,2/*,Qt::Alignment*/);
 
30
 
 
31
  lblValueHTML = new QLabel(this);
 
32
  lblValueHTML->setObjectName(QString::fromUtf8("lblValueHTML"));
 
33
  lblValueHTML->setText(tr("Formatted\ntext:"));
 
34
  ValueSpace->addWidget(lblValueHTML,2,0,1,1/*,Qt::Alignment*/);
 
35
 
 
36
  fldValueHTML = new QTextEdit(this);
 
37
  fldValueHTML->setObjectName(QString::fromUtf8("fldValueHTML"));
 
38
  ValueSpace->addWidget(fldValueHTML,2,1,1,1/*,Qt::Alignment*/);
 
39
 
 
40
  fldValueHTML->setEnabled(false);
 
41
 
 
42
  connect(fldValuePlain,SIGNAL(textChanged()),this,SLOT(UpdateHTML()));
 
43
  connect(fldValueHTML,SIGNAL(textChanged()),this,SLOT(UpdatePlain()));
 
44
};
 
45
 
 
46
 
 
47
void  sNewNoteDlg::SetValue (rcsString  value)
 
48
{
 
49
  fldValuePlain->setPlainText(sString2QString(value));
 
50
  PreventCycling=false;
 
51
  fldValuePlain->setFocus();
 
52
};
 
53
 
 
54
 
 
55
bool  sNewNoteDlg::Validate ()
 
56
{
 
57
  TheValue=QString2sString(fldValuePlain->toPlainText());
 
58
  return sAttrDlg::Validate();
 
59
};
 
60
 
 
61
 
 
62
void  sNewNoteDlg::UpdatePlain ()
 
63
{
 
64
  if( ! PreventCycling ){
 
65
    TheValue=QString2sString(fldValueHTML->toHtml());
 
66
    PreventCycling=true;
 
67
    fldValuePlain->setPlainText(sString2QString(TheValue));
 
68
    PreventCycling=false;
 
69
  };
 
70
};
 
71
 
 
72
 
 
73
void  sNewNoteDlg::UpdateHTML ()
 
74
{
 
75
  if( ! PreventCycling ){
 
76
    TheValue=QString2sString(fldValuePlain->toPlainText());
 
77
    PreventCycling=true;
 
78
    fldValueHTML->setHtml(sString2QString(TheValue));
 
79
    PreventCycling=false;
 
80
  };
 
81
};
 
82
 
 
83
//------------------------------------------------------------------------------
 
84
}; //namespace RA
 
85
 
 
86