#include "mainwindow.h"#include "ui_mainwindow.h"//-----------------------------------------------------------------------------------------------------------//КонструкторMainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ QDomDocument m_XMLFile("XMLFile"); m_CurrentTab = 0;//Текущий таб 0 ui->setupUi(this); //Привязка экшнов меню к слотам //Меню Файл connect(ui->actionOpen_File,SIGNAL(triggered()), this, SLOT(OpenFile())); connect(ui->actionSave_File,SIGNAL(triggered()),this,SLOT(Save()));ui->actionSave_File->setEnabled(false); connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(Quit())); //Меню Модуль ui->actionStartModule->setEnabled(false); //Меню Справка ui->actionAbout->setEnabled(false); ui->actionAbout_Qt->setEnabled(false); //Привязка экшнов дерева connect(ui->m_XMLTree,SIGNAL(itemSelectionChanged()),this,SLOT(m_XMLTreeChange())); //Привязка экшенов табов //Таб Text connect(ui->m_btnTextTitleBgcolor,SIGNAL(clicked()),this,SLOT(ChooseTextTitleBgcolor())); connect(ui->m_btnTextHintBgcolor,SIGNAL(clicked()),this,SLOT(ChooseTextHintBgcolor())); connect(ui->m_btnTextParamSrc,SIGNAL(clicked()),this,SLOT(ChooseTextParamSrc())); connect(ui->m_btnTextHintSrc,SIGNAL(clicked()),this,SLOT(ChooseTextHintSrc())); connect(ui->m_btnTextAction0,SIGNAL(clicked()),this,SLOT(AddTextAction0())); connect(ui->m_btnTextAction1,SIGNAL(clicked()),this,SLOT(AddTextAction1())); connect(ui->m_btnTextAction2,SIGNAL(clicked()),this,SLOT(AddTextAction2())); connect(ui->m_btnTextAction3,SIGNAL(clicked()),this,SLOT(AddTextAction3())); connect(ui->m_btnTextAction4,SIGNAL(clicked()),this,SLOT(AddTextAction4())); connect(ui->m_btnTextAction5,SIGNAL(clicked()),this,SLOT(AddTextAction5())); connect(ui->m_btnTextAction6,SIGNAL(clicked()),this,SLOT(AddTextAction6())); connect(ui->m_btnTextAction7,SIGNAL(clicked()),this,SLOT(AddTextAction7())); //Таб Image connect(ui->m_btnImageTitleBgcolor,SIGNAL(clicked()),this,SLOT(ChooseImageTitleBgcolor())); connect(ui->m_btnImageHintBgcolor,SIGNAL(clicked()),this,SLOT(ChooseImageHintBgcolor())); connect(ui->m_btnImageParamSrc,SIGNAL(clicked()),this,SLOT(ChooseImageParamSrc())); connect(ui->m_btnImageHintSrc,SIGNAL(clicked()),this,SLOT(ChooseImageHintSrc())); connect(ui->m_btnImageAction0,SIGNAL(clicked()),this,SLOT(AddImageAction0())); connect(ui->m_btnImageAction1,SIGNAL(clicked()),this,SLOT(AddImageAction1())); connect(ui->m_btnImageAction2,SIGNAL(clicked()),this,SLOT(AddImageAction2())); connect(ui->m_btnImageAction3,SIGNAL(clicked()),this,SLOT(AddImageAction3())); connect(ui->m_btnImageAction4,SIGNAL(clicked()),this,SLOT(AddImageAction4())); connect(ui->m_btnImageAction5,SIGNAL(clicked()),this,SLOT(AddImageAction5())); connect(ui->m_btnImageAction6,SIGNAL(clicked()),this,SLOT(AddImageAction6())); connect(ui->m_btnImageAction7,SIGNAL(clicked()),this,SLOT(AddImageAction7())); //Таб Audio connect(ui->m_btnAudioTitleBgcolor,SIGNAL(clicked()),this,SLOT(ChooseAudioTitleBgcolor())); connect(ui->m_btnAudioParamSrc,SIGNAL(clicked()),this,SLOT(ChooseAudioParamSrc())); connect(ui->m_btnAudioAction0,SIGNAL(clicked()),this,SLOT(AddAudioAction0())); connect(ui->m_btnAudioAction1,SIGNAL(clicked()),this,SLOT(AddAudioAction1())); //Настройка доступности табов в начале for (int i = 1; i < ui->m_tabwTags->count();i++) ui->m_tabwTags->setTabEnabled(i,false); ui->m_tabText->setVisible(false);}//-----------------------------------------------------------------------------------------------------------//ДеструкторMainWindow::~MainWindow(){ delete ui;}
#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QtGui/QMainWindow>#include <QTreeWidget>#include <QList>#include <QtXml>#include <QFileDialog>#include <QColorDialog>namespace Ui{ class MainWindow;}class MainWindow : public QMainWindow{ Q_OBJECTpublic: //Основные функции MainWindow(QWidget *parent = 0); ~MainWindow(); void SaveChanges();//mainFuncSaveChanges.cpp //Вспомогательные функции : MainWindowOtherFunc.cpp void createXMLTree(QTreeWidgetItem*, QDomNode); QString GetLastParent(QTreeWidgetItem*); QDomNode GetLastParentXML(QDomNode); int GetNodeCounted(QDomNodeList); QDomNode SelectedNode(QDomNodeList, int); int XMLTreeNodeCounted(QTreeWidgetItem*); int XMLTreeChildSelected(QTreeWidgetItem*); int XMLTreeSelectInd(); void SelectTreeNode(QTreeWidgetItem*, int); void IdLoad(QDomNode);public slots: virtual void m_XMLTreeChange();//mainFuncXMLTreeChanges.cpp //MainMenuSlots.cpp virtual void OpenFile(); virtual void Save(); virtual void Quit(); //Слоты для Text : tabText.cpp virtual void ChooseTextTitleBgcolor(); virtual void ChooseTextHintBgcolor(); virtual void ChooseTextParamSrc(); virtual void ChooseTextHintSrc(); virtual void AddTextAction0(); virtual void AddTextAction1(); virtual void AddTextAction2(); virtual void AddTextAction3(); virtual void AddTextAction4(); virtual void AddTextAction5(); virtual void AddTextAction6(); virtual void AddTextAction7(); //Слоты для Image : tabImage.cpp virtual void ChooseImageTitleBgcolor(); virtual void ChooseImageHintBgcolor(); virtual void ChooseImageParamSrc(); virtual void ChooseImageHintSrc(); virtual void AddImageAction0(); virtual void AddImageAction1(); virtual void AddImageAction2(); virtual void AddImageAction3(); virtual void AddImageAction4(); virtual void AddImageAction5(); virtual void AddImageAction6(); virtual void AddImageAction7(); //Слоты для Audio : tabAudio.cpp virtual void ChooseAudioTitleBgcolor(); virtual void ChooseAudioParamSrc(); virtual void AddAudioAction0(); virtual void AddAudioAction1();private: Ui::MainWindow *ui; QDomDocument m_XMLFile; QDomNodeList m_NodeList;//Список корневых узлов XML документа QDomNode m_NodeSelected;//Выбранный тег QDomNode m_NodeParentSelected;//Основной родитель выбранного тега int m_CurrentTab;//Номер текущего таба QString m_strFileName,//Имя рабочего файла m_strModuleDir,//Папка модуля m_strModuleSrcDir;//Папка ресурсов модуля};#endif // MAINWINDOW_H
C++ (Qt) connect(ui->m_btnImageAction0,SIGNAL(clicked()),this,SLOT(AddImageAction0())); connect(ui->m_btnImageAction1,SIGNAL(clicked()),this,SLOT(AddImageAction1())); connect(ui->m_btnImageAction2,SIGNAL(clicked()),this,SLOT(AddImageAction2())); connect(ui->m_btnImageAction3,SIGNAL(clicked()),this,SLOT(AddImageAction3())); connect(ui->m_btnImageAction4,SIGNAL(clicked()),this,SLOT(AddImageAction4())); connect(ui->m_btnImageAction5,SIGNAL(clicked()),this,SLOT(AddImageAction5())); connect(ui->m_btnImageAction6,SIGNAL(clicked()),this,SLOT(AddImageAction6())); connect(ui->m_btnImageAction7,SIGNAL(clicked()),this,SLOT(AddImageAction7()));