This instance will be upgraded to Heptapod 0.26.0rc1 on 2021-10-26 at 14:30 UTC+2 (a few minutes of down time)

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

Слияние с default

--HG--
branch : MockCompsTest
unix {
QMAKE_CXXFLAGS += -Wno-misleading-indentation
QMAKE_CXXFLAGS += -Wno-misleading-indentation -Wno-deprecated-copy
}
DEFINES += LIBRDK_LIBRARY_EXPORT
......
......@@ -1710,9 +1710,12 @@ bool UApplication::RenameProject(const std::string &filename)
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(false);
std::string resfilename=filename;
int res=RdkMoveFile(ProjectPath, resfilename);
if(filename.find_last_of("\\/") != filename.size()-1)
resfilename+="/";
int res=RdkMoveFile(ProjectPath, resfilename);
GetCore()->GetLogger(RDK_GLOB_MESSAGE)->SetEventsLogMode(events_log_mode);
if(res == 0)
{
......
......@@ -257,38 +257,57 @@ void UDrawEngineImageWidget::dropEvent(QDropEvent *event)
// ,
if(!Application->GetProjectOpenFlag())
{
QMessageBox::StandardButton reply = QMessageBox::question(this, "Warning", "Config not created. Auto-create one-channel configuration and model from this component?", QMessageBox::Yes|QMessageBox::Cancel);
if (reply == QMessageBox::Yes)
{
std::string file_name;
QMessageBox::StandardButton reply = QMessageBox::question(this, "Warning", "Config not created. Auto-create one-channel configuration and model from this component?", QMessageBox::Yes|QMessageBox::Cancel);
if (reply == QMessageBox::Yes)
{
std::string file_name;
QString default_path=QString::fromLocal8Bit((Application->GetWorkDirectory()+"/../../Configs/").c_str());
QDir path1(default_path);
if(!path1.exists(default_path))
{
default_path=QString::fromLocal8Bit((Application->GetWorkDirectory()+"/../../../Configs/").c_str());
QDir path2(default_path);
if(!path2.exists(default_path))
{
default_path=QString::fromLocal8Bit(Application->GetWorkDirectory().c_str());
}
}
QString default_path=QString::fromLocal8Bit((Application->GetWorkDirectory()+"/../../Configs/").c_str());
QDir path1(default_path);
if(!path1.exists(default_path))
{
default_path=QString::fromLocal8Bit((Application->GetWorkDirectory()+"/../../../Configs/").c_str());
QDir path2(default_path);
if(!path2.exists(default_path))
{
default_path=QString::fromLocal8Bit(Application->GetWorkDirectory().c_str());
}
}
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();
Application->CreateProject(file_name, classname.toLocal8Bit().constData());
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();
}
selectedComponent = "";
DrawEngine.SelectSingleComponent(selectedComponent);
emit componentSelected(QString::fromStdString(selectedComponent));
reDrawScheme(true);
if(path_dialog.empty())
return;
}
return;
file_name=path_dialog + "/Project.ini";
Application->CreateProject(file_name, classname.toLocal8Bit().constData());
selectedComponent = "";
DrawEngine.SelectSingleComponent(selectedComponent);
emit componentSelected(QString::fromStdString(selectedComponent));
reDrawScheme(true);
}
return;
}
// ,
......
......@@ -110,8 +110,19 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio
channels->setGeometry(rect);
ui->dockWidgetChannels->setWidget(channels);
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()));
logger = new ULoggerWidget(this, application);
ui->dockWidgetLoger->setWidget(logger);
......@@ -161,6 +172,7 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio
connect(ui->actionCloseConfig, SIGNAL(triggered(bool)), this, SLOT(actionCloseConfig()));
connect(ui->actionCopyConfig, SIGNAL(triggered(bool)), this, SLOT(actionCopyConfig()));
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()));
......@@ -173,13 +185,6 @@ UGEngineControllWidget::UGEngineControllWidget(QWidget *parent, RDK::UApplicatio
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:
connect(ui->actionStart, SIGNAL(triggered(bool)), this, SLOT(actionStart()));
connect(ui->actionPause, SIGNAL(triggered(bool)), this, SLOT(actionPause()));
......@@ -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()
{
QApplication::quit();
......@@ -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
void UGEngineControllWidget::actionReloadParameters()
......
......@@ -111,6 +111,7 @@ public slots:
void actionCloseConfig();
void actionCopyConfig();
void actionAutoCopyConfig();
void actionRenameConfig();
void actionExit();
void actionConfigOptions();
void actionCreateSaveMockLibs();
......@@ -118,13 +119,6 @@ public slots:
void actionBuildMode2();
void actionBuildMode3();
//chanels menu
void actionAddNew();
void actionInsert();
void actionDeleteLast();
void actionDeleteAll();
void actionClone();
// calculate menu
void actionReloadParameters();
......
......@@ -88,6 +88,7 @@
<addaction name="actionAutocopyConfig"/>
<addaction name="actionCopyConfig"/>
<addaction name="actionCloseConfig"/>
<addaction name="actionRenameConfig"/>
<addaction name="separator"/>
<addaction name="actionConfigOptions"/>
<addaction name="actionApplicationOptions"/>
......@@ -116,11 +117,14 @@
<property name="title">
<string>Channels</string>
</property>
<addaction name="actionAddNew"/>
<addaction name="actionInsert"/>
<addaction name="actionDeleteLast"/>
<addaction name="actionDeleteAll"/>
<addaction name="actionClone"/>
<addaction name="actionAddCh"/>
<addaction name="actionInsertCh"/>
<addaction name="actionCloneCh"/>
<addaction name="actionDeleteSelectedCh"/>
<addaction name="separator"/>
<addaction name="actionStartCh"/>
<addaction name="actionPauseCh"/>
<addaction name="actionResetCh"/>
</widget>
<widget class="QMenu" name="menuCalculate">
<property name="title">
......@@ -389,7 +393,7 @@
<string>Save Classes Descriptions</string>
</property>
</action>
<action name="actionAddNew">
<action name="actionAddCh">
<property name="checkable">
<bool>false</bool>
</property>
......@@ -397,10 +401,10 @@
<bool>true</bool>
</property>
<property name="text">
<string>Add New</string>
<string>Add</string>
</property>
</action>
<action name="actionInsert">
<action name="actionInsertCh">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -651,7 +655,7 @@
<string>Run N Steps</string>
</property>
</action>
<action name="actionClone">
<action name="actionCloneCh">
<property name="enabled">
<bool>true</bool>
</property>
......@@ -715,6 +719,31 @@
<string>Autocopy Config</string>
</property>
</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>
<layoutdefault spacing="6" margin="11"/>
<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