Explorar el Código

New class: FbAuthorDlg

Kandrashin Denis hace 13 años
padre
commit
ee333d0001
Se han modificado 5 ficheros con 161 adiciones y 71 borrados
  1. 68 68
      fb2edit.pro
  2. 43 0
      source/fb2head.cpp
  3. 19 3
      source/fb2head.hpp
  4. BIN
      source/ts/ru.qm
  5. 31 0
      source/ts/ru.ts

+ 68 - 68
fb2edit.pro

@@ -1,68 +1,68 @@
-HEADERS = \
-    source/fb2xml.h \
-    source/fb2xml2.h \
-    source/fb2app.hpp \
-    source/fb2code.hpp \
-    source/fb2head.hpp \
-    source/fb2main.hpp \
-    source/fb2read.hpp \
-    source/fb2temp.hpp \
-    source/fb2tree.hpp \
-    source/fb2save.hpp \
-    source/fb2dlgs.hpp \
-    source/fb2html.h \
-    source/fb2text.hpp \
-    source/fb2utils.h
-
-SOURCES = \
-    source/fb2app.cpp \
-    source/fb2code.cpp \
-    source/fb2head.cpp \
-    source/fb2main.cpp \
-    source/fb2read.cpp \
-    source/fb2save.cpp \
-    source/fb2temp.cpp \
-    source/fb2tree.cpp \
-    source/fb2xml.cpp \
-    source/fb2xml2.cpp \
-    source/fb2utils.cpp \
-    source/fb2dlgs.cpp \
-    source/fb2html.cpp \
-    source/fb2text.cpp
-
-RESOURCES = \
-    3rdparty/gnome/gnome.qrc \
-    source/res/fb2edit.qrc \
-    source/js/javascript.qrc \
-    3rdparty/fb2/fb2.qrc
-
-TARGET = fb2edit
-
-TRANSLATIONS = source/ts/ru.ts
-
-VERSION = 0.01.1
-
-QT += xml
-QT += webkit
-QT += network
-
-OTHER_FILES += \
-    source/res/style.css \
-    source/res/blank.fb2 \
-    source/js/export.js \
-    source/js/set_cursor.js \
-    source/js/get_status.js \
-    source/js/get_location.js \
-    source/js/insert_title.js \
-    CMakeLists.txt
-
-if (unix) {
-
-    DEFINES += FB2_USE_LIBXML2
-    INCLUDEPATH += /usr/include/libxml2
-    LIBS += -lxml2
-
-}
-
-FORMS += \
-    source/fb2find.ui
+HEADERS = \
+    source/fb2xml.h \
+    source/fb2xml2.h \
+    source/fb2app.hpp \
+    source/fb2code.hpp \
+    source/fb2head.hpp \
+    source/fb2main.hpp \
+    source/fb2read.hpp \
+    source/fb2temp.hpp \
+    source/fb2tree.hpp \
+    source/fb2save.hpp \
+    source/fb2dlgs.hpp \
+    source/fb2html.h \
+    source/fb2text.hpp \
+    source/fb2utils.h
+
+SOURCES = \
+    source/fb2app.cpp \
+    source/fb2code.cpp \
+    source/fb2head.cpp \
+    source/fb2main.cpp \
+    source/fb2read.cpp \
+    source/fb2save.cpp \
+    source/fb2temp.cpp \
+    source/fb2tree.cpp \
+    source/fb2xml.cpp \
+    source/fb2xml2.cpp \
+    source/fb2utils.cpp \
+    source/fb2dlgs.cpp \
+    source/fb2html.cpp \
+    source/fb2text.cpp
+
+RESOURCES = \
+    3rdparty/gnome/gnome.qrc \
+    source/res/fb2edit.qrc \
+    source/js/javascript.qrc \
+    3rdparty/fb2/fb2.qrc
+
+TARGET = fb2edit
+
+TRANSLATIONS = source/ts/ru.ts
+
+VERSION = 0.01.1
+
+QT += xml
+QT += webkit
+QT += network
+
+OTHER_FILES += \
+    source/res/style.css \
+    source/res/blank.fb2 \
+    source/js/export.js \
+    source/js/set_cursor.js \
+    source/js/get_status.js \
+    source/js/get_location.js \
+    source/js/insert_title.js \
+    CMakeLists.txt
+
+if (unix) {
+
+    DEFINES += FB2_USE_LIBXML2
+    INCLUDEPATH += /usr/include/libxml2
+    LIBS += -lxml2
+
+}
+
+FORMS += \
+    source/fb2find.ui

+ 43 - 0
source/fb2head.cpp

@@ -2,9 +2,13 @@
 
 #include <QtDebug>
 #include <QAction>
+#include <QComboBox>
 #include <QDialogButtonBox>
+#include <QFormLayout>
 #include <QGridLayout>
 #include <QHeaderView>
+#include <QLabel>
+#include <QLineEdit>
 #include <QToolBar>
 #include <QWebFrame>
 #include <QWebPage>
@@ -658,3 +662,42 @@ QString FbNodeDlg::value() const
 {
     return m_combo->currentText();
 }
+
+//---------------------------------------------------------------------------
+//  FbAuthorDlg
+//---------------------------------------------------------------------------
+
+FbAuthorDlg::FbAuthorDlg(QWidget *parent)
+    : QDialog(parent)
+{
+    setWindowTitle(tr("Author"));
+
+    QFormLayout * layout = new QFormLayout(this);
+
+    add(layout, "last-name", tr("Last name"));
+    add(layout, "first-name", tr("First name"));
+    add(layout, "moddle-name", tr("Middle name"));
+    add(layout, "nickname", tr("Nic name"));
+    add(layout, "home-page", tr("Home page"));
+    add(layout, "email", tr("E-mail"));
+
+    QDialogButtonBox * buttonBox = new QDialogButtonBox(this);
+    buttonBox->setOrientation(Qt::Horizontal);
+    buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
+    layout->addRow(buttonBox);
+
+    QObject::connect(buttonBox, SIGNAL(accepted()), SLOT(accept()));
+    QObject::connect(buttonBox, SIGNAL(rejected()), SLOT(reject()));
+}
+
+void FbAuthorDlg::add(QFormLayout *layout, const QString &key, const QString &text)
+{
+    QLabel * label = new QLabel(this);
+    label->setText(text);
+
+    QLineEdit * field = new QLineEdit(this);
+    field->setMinimumWidth(200);
+    m_fields[key] = field;
+
+    layout->addRow(label, field);
+}

+ 19 - 3
source/fb2head.hpp

@@ -3,18 +3,20 @@
 
 #include <QAbstractItemModel>
 #include <QDialog>
-#include <QComboBox>
-#include <QLabel>
 #include <QDomDocument>
 #include <QDomElement>
-#include <QStringList>
+#include <QMap>
 #include <QTreeView>
 #include <QWebElement>
 #include <QWebView>
 
 QT_BEGIN_NAMESPACE
 class QAction;
+class QComboBox;
+class QFormLayout;
+class QLabel;
 class QToolBar;
+class QLineEdit;
 QT_END_NAMESPACE
 
 #include "fb2xml.h"
@@ -200,4 +202,18 @@ private:
     QLabel * m_text;
 };
 
+class FbAuthorDlg : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit FbAuthorDlg(QWidget *parent);
+
+private:
+    void add(QFormLayout *layout, const QString &key, const QString &text);
+
+private:
+    QMap<QString, QLineEdit*> m_fields;
+};
+
 #endif // FB2HEAD_H

BIN
source/ts/ru.qm


+ 31 - 0
source/ts/ru.ts

@@ -1,6 +1,37 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="ru_RU">
+<context>
+    <name>FbAuthorDlg</name>
+    <message>
+        <source>Author</source>
+        <translation>Автор</translation>
+    </message>
+    <message>
+        <source>Last name</source>
+        <translation>Фамилия</translation>
+    </message>
+    <message>
+        <source>First name</source>
+        <translation>Имя</translation>
+    </message>
+    <message>
+        <source>Middle name</source>
+        <translation>Отчество</translation>
+    </message>
+    <message>
+        <source>Nic name</source>
+        <translation>Псевдоним</translation>
+    </message>
+    <message>
+        <source>Home page</source>
+        <translation>Сайт</translation>
+    </message>
+    <message>
+        <source>E-mail</source>
+        <translation>Эл. почта</translation>
+    </message>
+</context>
 <context>
     <name>FbCodeFindDlg</name>
     <message>