mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-30 23:18:08 +02:00
* editor menus
This commit is contained in:
parent
92ffa6eb1d
commit
776eb13663
@ -3,6 +3,7 @@
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../lib/VCMIDirs.h"
|
||||
#include "../lib/Filesystem/CResourceLoader.h"
|
||||
#include "../lib/CGeneralTextHandler.h"
|
||||
|
||||
Editor::Editor(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
@ -13,6 +14,9 @@ Editor::Editor(QWidget *parent)
|
||||
preinitDLL(console,logfile);
|
||||
loadDLLClasses();
|
||||
|
||||
VLC->generaltexth->readToVector("DATA/EDITOR", txtEditor);
|
||||
VLC->generaltexth->readToVector("DATA/EDITRCMD", txtEditorCmd);
|
||||
|
||||
ui.setupUi(this);
|
||||
|
||||
createMenus();
|
||||
@ -25,10 +29,54 @@ Editor::~Editor()
|
||||
|
||||
void Editor::createMenus()
|
||||
{
|
||||
QMenu * fileMenu = menuBar()->addMenu(tr("File"));
|
||||
QMenu * editMenu = menuBar()->addMenu(tr("Edit"));
|
||||
QMenu * viewMenu = menuBar()->addMenu(tr("View"));
|
||||
QMenu * toolsMenu = menuBar()->addMenu(tr("Tools"));
|
||||
QMenu * playerMenu = menuBar()->addMenu(tr("Player"));
|
||||
QMenu * helpMenu = menuBar()->addMenu(tr("Help"));
|
||||
enum MenuName {FILE, EDIT, VIEW, TOOLS, PLAYER, HELP};
|
||||
QMenu * menus[6];
|
||||
for(int i=0; i<6; ++i)
|
||||
menus[i] = menuBar()->addMenu(tr(txtEditor[751+i].c_str()));
|
||||
|
||||
for(int i=0; i<6; ++i)
|
||||
{
|
||||
if(i == 4)
|
||||
menus[FILE]->addSeparator();
|
||||
QAction * qa = new QAction(tr(txtEditor[758+i].c_str()), menus[FILE]);
|
||||
menus[FILE]->addAction(qa);
|
||||
}
|
||||
|
||||
for(int i=0; i<10; ++i)
|
||||
{
|
||||
if(i == 2 || i == 6 || i == 9)
|
||||
menus[EDIT]->addSeparator();
|
||||
QAction * qa = new QAction(tr(txtEditor[860+i].c_str()), menus[EDIT]);
|
||||
menus[EDIT]->addAction(qa);
|
||||
}
|
||||
|
||||
for(int i=0; i<10; ++i)
|
||||
{
|
||||
if(i == 2 || i == 3 || i == 7)
|
||||
menus[VIEW]->addSeparator();
|
||||
QAction * qa = new QAction(tr(txtEditor[778+i].c_str()), menus[VIEW]);
|
||||
menus[VIEW]->addAction(qa);
|
||||
}
|
||||
|
||||
for(int i=0; i<9; ++i)
|
||||
{
|
||||
if(i == 6 || i == 8)
|
||||
menus[TOOLS]->addSeparator();
|
||||
QAction * qa = new QAction(tr(txtEditor[789+i].c_str()), menus[TOOLS]);
|
||||
menus[TOOLS]->addAction(qa);
|
||||
}
|
||||
|
||||
for(int i=0; i<9; ++i)
|
||||
{
|
||||
QAction * qa = new QAction(tr(txtEditor[846+i].c_str()), menus[PLAYER]);
|
||||
menus[PLAYER]->addAction(qa);
|
||||
}
|
||||
|
||||
for(int i=0; i<2; ++i)
|
||||
{
|
||||
if(i == 1)
|
||||
menus[HELP]->addSeparator();
|
||||
QAction * qa = new QAction(tr(txtEditor[856+i].c_str()), menus[HELP]);
|
||||
menus[HELP]->addAction(qa);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ public:
|
||||
void createMenus();
|
||||
private:
|
||||
|
||||
std::vector<std::string> txtEditor, txtEditorCmd;
|
||||
|
||||
std::ofstream * logfile;
|
||||
CConsoleHandler * console;
|
||||
|
||||
|
@ -139,7 +139,7 @@ bool CLegacyConfigParser::endLine()
|
||||
return curr < end;
|
||||
}
|
||||
|
||||
void readToVector(std::string sourceName, std::vector<std::string> & dest)
|
||||
void CGeneralTextHandler::readToVector(std::string sourceName, std::vector<std::string> & dest)
|
||||
{
|
||||
CLegacyConfigParser parser(sourceName);
|
||||
do
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
std::vector <std::string> campaignMapNames;
|
||||
std::vector < std::vector <std::string> > campaignRegionNames;
|
||||
|
||||
void readToVector(std::string sourceName, std::vector<std::string> & dest);
|
||||
void load();
|
||||
CGeneralTextHandler();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user