Commit 621f2af7 authored by Rocky's avatar Rocky
Browse files

Слияние с default

--HG--
branch : MockCompsTest
unix { unix {
QMAKE_CXXFLAGS += -Wno-misleading-indentation QMAKE_CXXFLAGS += -Wno-misleading-indentation -Wno-deprecated-copy
} }
DEFINES += LIBRDK_LIBRARY_EXPORT DEFINES += LIBRDK_LIBRARY_EXPORT
......
...@@ -1710,9 +1710,12 @@ bool UApplication::RenameProject(const std::string &filename) ...@@ -1710,9 +1710,12 @@ bool UApplication::RenameProject(const std::string &filename)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(false); GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(false);
std::string resfilename=filename; std::string resfilename=filename;
int res=RdkMoveFile(ProjectPath, resfilename);
if(filename.find_last_of("\\/") != filename.size()-1) if(filename.find_last_of("\\/") != filename.size()-1)
resfilename+="/"; resfilename+="/";
int res=RdkMoveFile(ProjectPath, resfilename);
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(events_log_mode); GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(events_log_mode);
if(res == 0) if(res == 0)
{ {
......
...@@ -274,10 +274,30 @@ void UDrawEngineImageWidget::dropEvent(QDropEvent *event) ...@@ -274,10 +274,30 @@ void UDrawEngineImageWidget::dropEvent(QDropEvent *event)
} }
} }
QString result_path=QFileDialog::getExistingDirectory(this, tr("Create project directory"), default_path, QFileDialog::ShowDirsOnly); std::string path_dialog=default_path.toUtf8().data();
result_path+="/Project.ini"; //
file_name=result_path.toLocal8Bit().constData(); if(QMessageBox::question(this, "Info", "Autocreate configuration folder?", QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes)
{
time_t curr_time;
time(&curr_time);
// YYYY.MM.DD HH:MM:SS
std::string folder=RDK::get_text_time(curr_time, '.', '_');
path_dialog+=std::string("/Autocreate")+folder.c_str();
if(RDK::CreateNewDirectory(std::string(path_dialog).c_str()) != 0)
return;
}
else
{
path_dialog = QFileDialog::getExistingDirectory(this, tr("Select project directory"), default_path, QFileDialog::ShowDirsOnly).toUtf8().data();
}
if(path_dialog.empty())
return;
file_name=path_dialog + "/Project.ini";
Application->CreateProject(file_name, classname.toLocal8Bit().constData()); Application->CreateProject(file_name, classname.toLocal8Bit().constData());
...@@ -286,7 +306,6 @@ void UDrawEngineImageWidget::dropEvent(QDropEvent *event) ...@@ -286,7 +306,6 @@ void UDrawEngineImageWidget::dropEvent(QDropEvent *event)
DrawEngine.SelectSingleComponent(selectedComponent); DrawEngine.SelectSingleComponent(selectedComponent);
emit componentSelected(QString::fromStdString(selectedComponent)); emit componentSelected(QString::fromStdString(selectedComponent));
reDrawScheme(true); reDrawScheme(true);
} }
return; return;
} }
......
...@@ -110,8 +110,19 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio ...@@ -110,8 +110,19 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio
channels->setGeometry(rect); channels->setGeometry(rect);
ui->dockWidgetChannels->setWidget(channels); ui->dockWidgetChannels->setWidget(channels);
ui->dockWidgetChannels->hide(); ui->dockWidgetChannels->hide();
//channels menu actions:
connect(ui->actionAddCh, SIGNAL(triggered(bool)), channels, SLOT(actionAddChannel()));
connect(ui->actionInsertCh, SIGNAL(triggered(bool)), channels, SLOT(actionInsertChannel()));
connect(ui->actionDeleteSelectedCh, SIGNAL(triggered(bool)), channels, SLOT(actionDeleteSelectedChannel()));
connect(ui->actionCloneCh, SIGNAL(triggered(bool)), channels, SLOT(actionCloneChannel()));
connect(ui->actionStartCh, SIGNAL(triggered(bool)), channels, SLOT(actionStartChannel()));
connect(ui->actionPauseCh, SIGNAL(triggered(bool)), channels, SLOT(actionPauseChannel()));
connect(ui->actionResetCh, SIGNAL(triggered(bool)), channels, SLOT(actionResetChannel()));
connect(channels, SIGNAL(updateVisibility()), this, SLOT(updateChannelsVisibility())); connect(channels, SIGNAL(updateVisibility()), this, SLOT(updateChannelsVisibility()));
logger = new ULoggerWidget(this, application); logger = new ULoggerWidget(this, application);
ui->dockWidgetLoger->setWidget(logger); ui->dockWidgetLoger->setWidget(logger);
...@@ -161,6 +172,7 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio ...@@ -161,6 +172,7 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio
connect(ui->actionCloseConfig, SIGNAL(triggered(bool)), this, SLOT(actionCloseConfig())); connect(ui->actionCloseConfig, SIGNAL(triggered(bool)), this, SLOT(actionCloseConfig()));
connect(ui->actionCopyConfig, SIGNAL(triggered(bool)), this, SLOT(actionCopyConfig())); connect(ui->actionCopyConfig, SIGNAL(triggered(bool)), this, SLOT(actionCopyConfig()));
connect(ui->actionAutocopyConfig, SIGNAL(triggered(bool)), this, SLOT(actionAutoCopyConfig())); connect(ui->actionAutocopyConfig, SIGNAL(triggered(bool)), this, SLOT(actionAutoCopyConfig()));
connect(ui->actionRenameConfig, SIGNAL(triggered(bool)), this, SLOT(actionRenameConfig()));
connect(ui->actionConfigOptions, SIGNAL(triggered(bool)), this, SLOT(actionConfigOptions())); connect(ui->actionConfigOptions, SIGNAL(triggered(bool)), this, SLOT(actionConfigOptions()));
...@@ -173,13 +185,6 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio ...@@ -173,13 +185,6 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio
connect(ui->actionExit, SIGNAL(triggered(bool)), this, SLOT(actionExit())); connect(ui->actionExit, SIGNAL(triggered(bool)), this, SLOT(actionExit()));
//chanels menu actions:
connect(ui->actionAddNew, SIGNAL(triggered(bool)), this, SLOT(actionAddNew()));
connect(ui->actionInsert, SIGNAL(triggered(bool)), this, SLOT(actionInsert()));
connect(ui->actionDeleteLast, SIGNAL(triggered(bool)), this, SLOT(actionDeleteLast()));
connect(ui->actionDeleteAll, SIGNAL(triggered(bool)), this, SLOT(actionDeleteAll()));
connect(ui->actionClone, SIGNAL(triggered(bool)), this, SLOT(actionClone()));
// calculate menu actions: // calculate menu actions:
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(actionStart())); connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(actionStart()));
connect(ui->actionPause, SIGNAL(triggered(bool)), this, SLOT(actionPause())); connect(ui->actionPause, SIGNAL(triggered(bool)), this, SLOT(actionPause()));
...@@ -511,6 +516,51 @@ void UGEngineControllWidget::actionAutoCopyConfig() ...@@ -511,6 +516,51 @@ void UGEngineControllWidget::actionAutoCopyConfig()
} }
} }
void UGEngineControllWidget::actionRenameConfig()
{
try
{
if(!application->GetProjectOpenFlag())
{
QMessageBox::question(this, "Error", "Please open configuration for copy first!", QMessageBox::Ok);
return;
}
std::string config_path=application->GetProjectPath();
if(config_path.empty())
return;
size_t n=config_path.find_last_not_of("\\/");
if(config_path.find_last_of("\\/") == config_path.size()-1)
config_path.resize(n+1);
std::string project_name=RDK::extract_file_name(config_path.c_str());
std::string project_path = RDK::extract_file_path(config_path);
bool ok;
std::string new_name = QInputDialog::getText(this, tr("Select new configuration name"),
tr("Please enter new name: "), QLineEdit::Normal,
QString::fromStdString(project_name), &ok).toStdString();
if (ok && !new_name.empty())
{
if(!application->RenameProject(project_path+new_name))
QMessageBox::question(this, "Error", "Falied to rename configuration!", QMessageBox::Ok);
}
}
catch(RDK::UException& e)
{
QMessageBox::critical(this,"Error at renaming project", QString(e.what()), QMessageBox::Ok);
}
catch(std::exception& e)
{
QMessageBox::critical(this,"Error at renaming project", QString(e.what()), QMessageBox::Ok);
}
}
void UGEngineControllWidget::actionExit() void UGEngineControllWidget::actionExit()
{ {
QApplication::quit(); QApplication::quit();
...@@ -563,62 +613,6 @@ void UGEngineControllWidget:: actionBuildMode3() ...@@ -563,62 +613,6 @@ void UGEngineControllWidget:: actionBuildMode3()
} }
//chanels menu actions:
void UGEngineControllWidget::actionAddNew()
{
if(!application->GetProjectOpenFlag())
return;
pauseChannel(-1);
application->SetNumChannels(application->GetNumChannels()+1);
RDK::UIVisualControllerStorage::UpdateInterface(true);
updateChannelsVisibility();
}
void UGEngineControllWidget::actionInsert()
{
if(!application->GetProjectOpenFlag())
return;
pauseChannel(-1);
int i=Core_GetSelectedChannelIndex();
application->InsertChannel(i);
//application->AddChannel(ChannelsStringGrid->Row);
//RDK::UIVisualControllerStorage::UpdateInterface(true);
RDK::UIVisualControllerStorage::UpdateInterface(true);
updateChannelsVisibility();
}
void UGEngineControllWidget::actionDeleteLast()
{
/*if(!application->GetProjectOpenFlag())
return;
application->SetNumChannels(Core_GetNumChannels()-1);
RDK::UIVisualControllerStorage::UpdateInterface(true);*/
pauseChannel(-1);
application->DeleteChannel(application->GetNumChannels()-1);
RDK::UIVisualControllerStorage::UpdateInterface(true);
updateChannelsVisibility();
}
void UGEngineControllWidget::actionDeleteAll()
{
if(!application->GetProjectOpenFlag())
return;
pauseChannel(-1);
application->SetNumChannels(1);
//RDK::UIVisualControllerStorage::UpdateInterface(true);
updateChannelsVisibility();
}
void UGEngineControllWidget::actionClone()
{
pauseChannel(-1);
int cloned_id=application->GetNumChannels();
application->CloneChannel(Core_GetSelectedChannelIndex(), cloned_id);
RDK::UIVisualControllerStorage::UpdateInterface(true);
updateChannelsVisibility();
}
// calculate menu actions // calculate menu actions
void UGEngineControllWidget::actionReloadParameters() void UGEngineControllWidget::actionReloadParameters()
......
...@@ -111,6 +111,7 @@ public slots: ...@@ -111,6 +111,7 @@ public slots:
void actionCloseConfig(); void actionCloseConfig();
void actionCopyConfig(); void actionCopyConfig();
void actionAutoCopyConfig(); void actionAutoCopyConfig();
void actionRenameConfig();
void actionExit(); void actionExit();
void actionConfigOptions(); void actionConfigOptions();
void actionCreateSaveMockLibs(); void actionCreateSaveMockLibs();
...@@ -118,13 +119,6 @@ public slots: ...@@ -118,13 +119,6 @@ public slots:
void actionBuildMode2(); void actionBuildMode2();
void actionBuildMode3(); void actionBuildMode3();
//chanels menu
void actionAddNew();
void actionInsert();
void actionDeleteLast();
void actionDeleteAll();
void actionClone();
// calculate menu // calculate menu
void actionReloadParameters(); void actionReloadParameters();
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
<addaction name="actionAutocopyConfig"/> <addaction name="actionAutocopyConfig"/>
<addaction name="actionCopyConfig"/> <addaction name="actionCopyConfig"/>
<addaction name="actionCloseConfig"/> <addaction name="actionCloseConfig"/>
<addaction name="actionRenameConfig"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionConfigOptions"/> <addaction name="actionConfigOptions"/>
<addaction name="actionApplicationOptions"/> <addaction name="actionApplicationOptions"/>
...@@ -116,11 +117,14 @@ ...@@ -116,11 +117,14 @@
<property name="title"> <property name="title">
<string>Channels</string> <string>Channels</string>
</property> </property>
<addaction name="actionAddNew"/> <addaction name="actionAddCh"/>
<addaction name="actionInsert"/> <addaction name="actionInsertCh"/>
<addaction name="actionDeleteLast"/> <addaction name="actionCloneCh"/>
<addaction name="actionDeleteAll"/> <addaction name="actionDeleteSelectedCh"/>
<addaction name="actionClone"/> <addaction name="separator"/>
<addaction name="actionStartCh"/>
<addaction name="actionPauseCh"/>
<addaction name="actionResetCh"/>
</widget> </widget>
<widget class="QMenu" name="menuCalculate"> <widget class="QMenu" name="menuCalculate">
<property name="title"> <property name="title">
...@@ -389,7 +393,7 @@ ...@@ -389,7 +393,7 @@
<string>Save Classes Descriptions</string> <string>Save Classes Descriptions</string>
</property> </property>
</action> </action>
<action name="actionAddNew"> <action name="actionAddCh">
<property name="checkable"> <property name="checkable">
<bool>false</bool> <bool>false</bool>
</property> </property>
...@@ -397,10 +401,10 @@ ...@@ -397,10 +401,10 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Add New</string> <string>Add</string>
</property> </property>
</action> </action>
<action name="actionInsert"> <action name="actionInsertCh">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
...@@ -651,7 +655,7 @@ ...@@ -651,7 +655,7 @@
<string>Run N Steps</string> <string>Run N Steps</string>
</property> </property>
</action> </action>
<action name="actionClone"> <action name="actionCloneCh">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
...@@ -715,6 +719,31 @@ ...@@ -715,6 +719,31 @@
<string>Autocopy Config</string> <string>Autocopy Config</string>
</property> </property>
</action> </action>
<action name="actionDeleteSelectedCh">
<property name="text">
<string>Delete Selected</string>
</property>
</action>
<action name="actionStartCh">
<property name="text">
<string>Start</string>
</property>
</action>
<action name="actionPauseCh">
<property name="text">
<string>Pause</string>
</property>
</action>
<action name="actionResetCh">
<property name="text">
<string>Reset</string>
</property>
</action>
<action name="actionRenameConfig">
<property name="text">
<string>Rename Config</string>
</property>
</action>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment