- fix: New non-saved filenames is wrongly saved in the last openfiles list.
- fix: File is parsed before editor is fully created. - enhancement: New GAS File in the File Menu - change: rename "New File" to "New C/C++ File"
This commit is contained in:
parent
9976ee248a
commit
57cbf3a49a
4
NEWS.md
4
NEWS.md
|
@ -11,6 +11,10 @@ Red Panda C++ Version 2.12
|
||||||
- enhancement: Compile/Debug GAS source files in project.
|
- enhancement: Compile/Debug GAS source files in project.
|
||||||
- enhancement: Keyword completion for asm/GAS files.
|
- enhancement: Keyword completion for asm/GAS files.
|
||||||
- enhancement: If GAS source file has "_start" label, compile it with "-nostartfiles".
|
- enhancement: If GAS source file has "_start" label, compile it with "-nostartfiles".
|
||||||
|
- fix: New non-saved filenames is wrongly saved in the last openfiles list.
|
||||||
|
- fix: File is parsed before editor is fully created.
|
||||||
|
- enhancement: New GAS File in the File Menu
|
||||||
|
- change: rename "New File" to "New C/C++ File"
|
||||||
|
|
||||||
Red Panda C++ Version 2.11
|
Red Panda C++ Version 2.11
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,9 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
Project* pProject, bool isNew,
|
Project* pProject, bool isNew,
|
||||||
QTabWidget* parentPageControl):
|
QTabWidget* parentPageControl):
|
||||||
QSynEdit(parent),
|
QSynEdit(parent),
|
||||||
|
mInited(false),
|
||||||
mEncodingOption(encoding),
|
mEncodingOption(encoding),
|
||||||
mFilename(QFileInfo(filename).absoluteFilePath()),
|
mFilename(filename),
|
||||||
mParentPageControl(parentPageControl),
|
mParentPageControl(parentPageControl),
|
||||||
mProject(pProject),
|
mProject(pProject),
|
||||||
mIsNew(isNew),
|
mIsNew(isNew),
|
||||||
|
@ -85,6 +86,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
mSaving(false),
|
mSaving(false),
|
||||||
mHoverModifiedLine(-1)
|
mHoverModifiedLine(-1)
|
||||||
{
|
{
|
||||||
|
mInited=false;
|
||||||
mBackupFile=nullptr;
|
mBackupFile=nullptr;
|
||||||
mHighlightCharPos1 = QSynedit::BufferCoord{0,0};
|
mHighlightCharPos1 = QSynedit::BufferCoord{0,0};
|
||||||
mHighlightCharPos2 = QSynedit::BufferCoord{0,0};
|
mHighlightCharPos2 = QSynedit::BufferCoord{0,0};
|
||||||
|
@ -107,10 +109,8 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
tr("Error Load File"),
|
tr("Error Load File"),
|
||||||
e.reason());
|
e.reason());
|
||||||
}
|
}
|
||||||
syntaxer = syntaxerManager.getSyntaxer(mFilename);
|
|
||||||
} else {
|
|
||||||
syntaxer=syntaxerManager.getSyntaxer(QSynedit::ProgrammingLanguage::CPP);
|
|
||||||
}
|
}
|
||||||
|
syntaxer = syntaxerManager.getSyntaxer(mFilename);
|
||||||
resolveAutoDetectEncodingOption();
|
resolveAutoDetectEncodingOption();
|
||||||
if (syntaxer) {
|
if (syntaxer) {
|
||||||
setSyntaxer(syntaxer);
|
setSyntaxer(syntaxer);
|
||||||
|
@ -166,7 +166,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
pMainWindow, &MainWindow::onEditorContextMenu);
|
pMainWindow, &MainWindow::onEditorContextMenu);
|
||||||
|
|
||||||
mCanAutoSave = false;
|
mCanAutoSave = false;
|
||||||
if (isNew && parentPageControl!=nullptr) {
|
if (isNew && parentPageControl!=nullptr ) {
|
||||||
QString fileTemplate = pMainWindow->codeSnippetManager()->newFileTemplate();
|
QString fileTemplate = pMainWindow->codeSnippetManager()->newFileTemplate();
|
||||||
if (!fileTemplate.isEmpty()) {
|
if (!fileTemplate.isEmpty()) {
|
||||||
insertCodeSnippet(fileTemplate);
|
insertCodeSnippet(fileTemplate);
|
||||||
|
@ -201,6 +201,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
this, &Editor::onScrollBarValueChanged);
|
this, &Editor::onScrollBarValueChanged);
|
||||||
connect(verticalScrollBar(), &QScrollBar::valueChanged,
|
connect(verticalScrollBar(), &QScrollBar::valueChanged,
|
||||||
this, &Editor::onScrollBarValueChanged);
|
this, &Editor::onScrollBarValueChanged);
|
||||||
|
mInited=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::~Editor() {
|
Editor::~Editor() {
|
||||||
|
@ -365,12 +366,18 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
QString selectedFileFilter;
|
QString selectedFileFilter;
|
||||||
QString defaultExt;
|
QString defaultExt;
|
||||||
if (pSettings->editor().defaultFileCpp()) {
|
defaultExt=QFileInfo(oldName).suffix();
|
||||||
selectedFileFilter = pSystemConsts->defaultCPPFileFilter();
|
qDebug()<<defaultExt;
|
||||||
defaultExt = "cpp";
|
if (defaultExt.isEmpty()) {
|
||||||
|
if (pSettings->editor().defaultFileCpp()) {
|
||||||
|
selectedFileFilter = pSystemConsts->defaultCPPFileFilter();
|
||||||
|
defaultExt = "cpp";
|
||||||
|
} else {
|
||||||
|
selectedFileFilter = pSystemConsts->defaultCFileFilter();
|
||||||
|
defaultExt = "c";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectedFileFilter = pSystemConsts->defaultCFileFilter();
|
selectedFileFilter = pSystemConsts->fileFilterFor(defaultExt);
|
||||||
defaultExt = "c";
|
|
||||||
}
|
}
|
||||||
QFileDialog dialog(this,tr("Save As"),extractFilePath(mFilename),
|
QFileDialog dialog(this,tr("Save As"),extractFilePath(mFilename),
|
||||||
pSystemConsts->defaultFileFilters().join(";;"));
|
pSystemConsts->defaultFileFilters().join(";;"));
|
||||||
|
@ -379,28 +386,6 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
||||||
dialog.selectFile(mFilename);
|
dialog.selectFile(mFilename);
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
dialog.setAcceptMode(QFileDialog::AcceptSave);
|
||||||
// connect(&dialog, &QFileDialog::filterSelected,
|
|
||||||
// [&dialog](const QString &filter){
|
|
||||||
// if (filter.indexOf("*.*")) {
|
|
||||||
// dialog.setDefaultSuffix("");
|
|
||||||
// qDebug()<<"lllll";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// int pos = filter.indexOf("*.");
|
|
||||||
// if (pos>=0) {
|
|
||||||
// QString suffix;
|
|
||||||
// pos+=2;
|
|
||||||
// while (pos<filter.length()) {
|
|
||||||
// if (filter[pos] == ';' || filter[pos] ==' ' || filter[pos] == ')')
|
|
||||||
// break;
|
|
||||||
// suffix+=filter[pos];
|
|
||||||
// pos++;
|
|
||||||
// }
|
|
||||||
// //dialog.setDefaultSuffix(suffix);
|
|
||||||
// } else {
|
|
||||||
// dialog.setDefaultSuffix("");
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
if (dialog.exec()!=QFileDialog::Accepted) {
|
if (dialog.exec()!=QFileDialog::Accepted) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2957,6 +2942,8 @@ Editor::QuoteStatus Editor::getQuoteStatus()
|
||||||
|
|
||||||
void Editor::reparse(bool resetParser)
|
void Editor::reparse(bool resetParser)
|
||||||
{
|
{
|
||||||
|
if (!mInited)
|
||||||
|
return;
|
||||||
if (!mParentPageControl)
|
if (!mParentPageControl)
|
||||||
return;
|
return;
|
||||||
if (!pSettings->codeCompletion().enabled())
|
if (!pSettings->codeCompletion().enabled())
|
||||||
|
|
|
@ -292,6 +292,7 @@ private:
|
||||||
QSynedit::PTokenAttribute &attr);
|
QSynedit::PTokenAttribute &attr);
|
||||||
void onScrollBarValueChanged();
|
void onScrollBarValueChanged();
|
||||||
private:
|
private:
|
||||||
|
bool mInited;
|
||||||
QDateTime mBackupTime;
|
QDateTime mBackupTime;
|
||||||
QFile* mBackupFile;
|
QFile* mBackupFile;
|
||||||
QByteArray mEncodingOption; // the encoding type set by the user
|
QByteArray mEncodingOption; // the encoding type set by the user
|
||||||
|
|
|
@ -395,14 +395,11 @@ Editor* EditorList::getOpenedEditorByFilename(QString filename)
|
||||||
{
|
{
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
QFileInfo fileInfo(filename);
|
|
||||||
QString fullname = fileInfo.absoluteFilePath();
|
|
||||||
for (int i=0;i<mLeftPageWidget->count();i++) {
|
for (int i=0;i<mLeftPageWidget->count();i++) {
|
||||||
Editor* e = static_cast<Editor*>(mLeftPageWidget->widget(i));
|
Editor* e = static_cast<Editor*>(mLeftPageWidget->widget(i));
|
||||||
if (!e)
|
if (!e)
|
||||||
continue;
|
continue;
|
||||||
if (e->filename().compare(filename, PATH_SENSITIVITY)==0 ||
|
if (e->filename().compare(filename, PATH_SENSITIVITY)==0) {
|
||||||
e->filename().compare(fullname, PATH_SENSITIVITY)==0) {
|
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,7 +407,7 @@ Editor* EditorList::getOpenedEditorByFilename(QString filename)
|
||||||
Editor* e = static_cast<Editor*>(mRightPageWidget->widget(i));
|
Editor* e = static_cast<Editor*>(mRightPageWidget->widget(i));
|
||||||
if (!e)
|
if (!e)
|
||||||
continue;
|
continue;
|
||||||
if (e->filename().compare(filename)==0 || e->filename().compare(fullname)==0) {
|
if (e->filename().compare(filename)==0) {
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -216,6 +216,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
mMenuNew = new QMenu();
|
mMenuNew = new QMenu();
|
||||||
mMenuNew->setTitle(tr("New"));
|
mMenuNew->setTitle(tr("New"));
|
||||||
mMenuNew->addAction(ui->actionNew);
|
mMenuNew->addAction(ui->actionNew);
|
||||||
|
mMenuNew->addAction(ui->actionNew_GAS_File);
|
||||||
mMenuNew->addAction(ui->actionNew_Project);
|
mMenuNew->addAction(ui->actionNew_Project);
|
||||||
mMenuNew->addSeparator();
|
mMenuNew->addSeparator();
|
||||||
mMenuNew->addAction(ui->actionNew_Template);
|
mMenuNew->addAction(ui->actionNew_Template);
|
||||||
|
@ -3031,7 +3032,7 @@ void MainWindow::onBookmarkContextMenu(const QPoint &pos)
|
||||||
menu.exec(ui->tableBookmark->mapToGlobal(pos));
|
menu.exec(ui->tableBookmark->mapToGlobal(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::saveLastOpens()
|
bool MainWindow::saveLastOpens()
|
||||||
{
|
{
|
||||||
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_LASTOPENS_FILE;
|
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_LASTOPENS_FILE;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
|
@ -3042,7 +3043,7 @@ void MainWindow::saveLastOpens()
|
||||||
tr("Can't open last open information file '%1' for write!")
|
tr("Can't open last open information file '%1' for write!")
|
||||||
.arg(filename),
|
.arg(filename),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
QJsonObject rootObj;
|
QJsonObject rootObj;
|
||||||
if (mProject) {
|
if (mProject) {
|
||||||
|
@ -3052,6 +3053,25 @@ void MainWindow::saveLastOpens()
|
||||||
for (int i=0;i<mEditorList->pageCount();i++) {
|
for (int i=0;i<mEditorList->pageCount();i++) {
|
||||||
Editor * editor = (*mEditorList)[i];
|
Editor * editor = (*mEditorList)[i];
|
||||||
QJsonObject fileObj;
|
QJsonObject fileObj;
|
||||||
|
if (editor->isNew()) {
|
||||||
|
if (!editor->modified())
|
||||||
|
continue;
|
||||||
|
QMessageBox::StandardButton reply;
|
||||||
|
reply = QMessageBox::question(editor,QObject::tr("Save"),
|
||||||
|
QString(QObject::tr("Save changes to %1?")).arg(editor->filename()),
|
||||||
|
QMessageBox::Yes|QMessageBox::No|QMessageBox::Yes|QMessageBox::Cancel);
|
||||||
|
if (reply == QMessageBox::No) {
|
||||||
|
editor->setModified(false);
|
||||||
|
continue;
|
||||||
|
} else if (reply == QMessageBox::Yes) {
|
||||||
|
if (!editor->save(false,false)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fileObj["filename"] = editor->filename();
|
fileObj["filename"] = editor->filename();
|
||||||
fileObj["onLeft"] = (editor->pageControl() != mEditorList->rightPageWidget());
|
fileObj["onLeft"] = (editor->pageControl() != mEditorList->rightPageWidget());
|
||||||
fileObj["focused"] = editor->hasFocus();
|
fileObj["focused"] = editor->hasFocus();
|
||||||
|
@ -3071,9 +3091,10 @@ void MainWindow::saveLastOpens()
|
||||||
tr("Can't save last open info file '%1'")
|
tr("Can't save last open info file '%1'")
|
||||||
.arg(filename),
|
.arg(filename),
|
||||||
QMessageBox::Ok);
|
QMessageBox::Ok);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadLastOpens()
|
void MainWindow::loadLastOpens()
|
||||||
|
@ -3223,10 +3244,18 @@ void MainWindow::updateTools()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::newEditor()
|
void MainWindow::newEditor(const QString& suffix)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Editor * editor=mEditorList->newEditor("",
|
QString filename=QString("untitled%1").arg(getNewFileNumber());
|
||||||
|
if (suffix.isEmpty()) {
|
||||||
|
if (pSettings->editor().defaultFileCpp())
|
||||||
|
filename+=".cpp";
|
||||||
|
else
|
||||||
|
filename+=".c";
|
||||||
|
} else
|
||||||
|
filename+= "." + suffix;
|
||||||
|
Editor * editor=mEditorList->newEditor(filename,
|
||||||
pSettings->editor().defaultEncoding(),
|
pSettings->editor().defaultEncoding(),
|
||||||
nullptr,true);
|
nullptr,true);
|
||||||
editor->activate();
|
editor->activate();
|
||||||
|
@ -5198,7 +5227,10 @@ void MainWindow::on_actionNew_triggered()
|
||||||
tr("New Project File?"),
|
tr("New Project File?"),
|
||||||
tr("Do you want to add the new file to the project?"),
|
tr("Do you want to add the new file to the project?"),
|
||||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||||
newProjectUnitFile();
|
if (mProject->options().isCpp)
|
||||||
|
newProjectUnitFile("cpp");
|
||||||
|
else
|
||||||
|
newProjectUnitFile("c");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5313,7 +5345,12 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mShouldRemoveAllSettings && pSettings->editor().autoLoadLastFiles()) {
|
if (!mShouldRemoveAllSettings && pSettings->editor().autoLoadLastFiles()) {
|
||||||
saveLastOpens();
|
if (!saveLastOpens()) { //canceled
|
||||||
|
mClosingAll=false;
|
||||||
|
mQuitting = false;
|
||||||
|
event->ignore();
|
||||||
|
return ;
|
||||||
|
}
|
||||||
} /*else {
|
} /*else {
|
||||||
//if don't save last open files, close project before editors, to save project openned editors;
|
//if don't save last open files, close project before editors, to save project openned editors;
|
||||||
|
|
||||||
|
@ -7062,7 +7099,7 @@ void MainWindow::prepareTabMessagesData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::newProjectUnitFile()
|
void MainWindow::newProjectUnitFile(const QString& suffix)
|
||||||
{
|
{
|
||||||
if (!mProject)
|
if (!mProject)
|
||||||
return;
|
return;
|
||||||
|
@ -7092,24 +7129,28 @@ void MainWindow::newProjectUnitFile()
|
||||||
modelTypeNode = mProject->rootNode();
|
modelTypeNode = mProject->rootNode();
|
||||||
}
|
}
|
||||||
NewProjectUnitDialog newProjectUnitDialog;
|
NewProjectUnitDialog newProjectUnitDialog;
|
||||||
if (modelTypeNode == mProject->rootNode()) {
|
if (!suffix.isEmpty()) {
|
||||||
if (mProject->options().isCpp)
|
newProjectUnitDialog.setSuffix(suffix);
|
||||||
newProjectUnitDialog.setSuffix("cpp");
|
|
||||||
else
|
|
||||||
newProjectUnitDialog.setSuffix("c");
|
|
||||||
} else {
|
} else {
|
||||||
switch (modelTypeNode->folderNodeType) {
|
if (modelTypeNode == mProject->rootNode()) {
|
||||||
case ProjectModelNodeType::DUMMY_HEADERS_FOLDER:
|
|
||||||
newProjectUnitDialog.setSuffix("h");
|
|
||||||
break;
|
|
||||||
case ProjectModelNodeType::DUMMY_SOURCES_FOLDER:
|
|
||||||
if (mProject->options().isCpp)
|
if (mProject->options().isCpp)
|
||||||
newProjectUnitDialog.setSuffix("cpp");
|
newProjectUnitDialog.setSuffix("cpp");
|
||||||
else
|
else
|
||||||
newProjectUnitDialog.setSuffix("c");
|
newProjectUnitDialog.setSuffix("c");
|
||||||
break;
|
} else {
|
||||||
default:
|
switch (modelTypeNode->folderNodeType) {
|
||||||
newProjectUnitDialog.setSuffix("txt");
|
case ProjectModelNodeType::DUMMY_HEADERS_FOLDER:
|
||||||
|
newProjectUnitDialog.setSuffix("h");
|
||||||
|
break;
|
||||||
|
case ProjectModelNodeType::DUMMY_SOURCES_FOLDER:
|
||||||
|
if (mProject->options().isCpp)
|
||||||
|
newProjectUnitDialog.setSuffix("cpp");
|
||||||
|
else
|
||||||
|
newProjectUnitDialog.setSuffix("c");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
newProjectUnitDialog.setSuffix("txt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString folder = mProject->fileSystemNodeFolderPath(pNode);
|
QString folder = mProject->fileSystemNodeFolderPath(pNode);
|
||||||
|
@ -7124,10 +7165,14 @@ void MainWindow::newProjectUnitFile()
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
newFileName = QString("untitled")+QString("%1").arg(getNewFileNumber());
|
newFileName = QString("untitled")+QString("%1").arg(getNewFileNumber());
|
||||||
if (mProject->options().isCpp)
|
if (!suffix.isEmpty()) {
|
||||||
newFileName += ".cpp";
|
newFileName += "." + suffix;
|
||||||
else
|
} else {
|
||||||
newFileName += ".c";
|
if (mProject->options().isCpp)
|
||||||
|
newFileName += ".cpp";
|
||||||
|
else
|
||||||
|
newFileName += ".c";
|
||||||
|
}
|
||||||
} while (QDir(mProject->directory()).exists(newFileName));
|
} while (QDir(mProject->directory()).exists(newFileName));
|
||||||
newFileName = QInputDialog::getText(
|
newFileName = QInputDialog::getText(
|
||||||
this,
|
this,
|
||||||
|
@ -9436,3 +9481,18 @@ void MainWindow::on_actionDocument_triggered()
|
||||||
QDesktopServices::openUrl(QUrl("https://royqh1979.gitee.io/redpandacpp/docsy/docs/"));
|
QDesktopServices::openUrl(QUrl("https://royqh1979.gitee.io/redpandacpp/docsy/docs/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_actionNew_GAS_File_triggered()
|
||||||
|
{
|
||||||
|
if (mProject) {
|
||||||
|
if (QMessageBox::question(this,
|
||||||
|
tr("New Project File?"),
|
||||||
|
tr("Do you want to add the new file to the project?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||||
|
newProjectUnitFile("s");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newEditor("s");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,13 +160,13 @@ public:
|
||||||
void updateClassBrowserForEditor(Editor* editor);
|
void updateClassBrowserForEditor(Editor* editor);
|
||||||
void resetAutoSaveTimer();
|
void resetAutoSaveTimer();
|
||||||
void updateShortcuts();
|
void updateShortcuts();
|
||||||
void saveLastOpens();
|
bool saveLastOpens();
|
||||||
void loadLastOpens();
|
void loadLastOpens();
|
||||||
void updateTools();
|
void updateTools();
|
||||||
|
|
||||||
void openFiles(const QStringList& files);
|
void openFiles(const QStringList& files);
|
||||||
|
|
||||||
void newEditor();
|
void newEditor(const QString& suffix="");
|
||||||
|
|
||||||
QPlainTextEdit* txtLocals();
|
QPlainTextEdit* txtLocals();
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ private:
|
||||||
void showHideMessagesTab(QWidget *widget, bool show);
|
void showHideMessagesTab(QWidget *widget, bool show);
|
||||||
void prepareTabInfosData();
|
void prepareTabInfosData();
|
||||||
void prepareTabMessagesData();
|
void prepareTabMessagesData();
|
||||||
void newProjectUnitFile();
|
void newProjectUnitFile(const QString& suffix="");
|
||||||
void fillProblemCaseInputAndExpected(const POJProblemCase &problemCase);
|
void fillProblemCaseInputAndExpected(const POJProblemCase &problemCase);
|
||||||
|
|
||||||
void doFilesViewRemoveFile(const QModelIndex& index);
|
void doFilesViewRemoveFile(const QModelIndex& index);
|
||||||
|
@ -775,6 +775,8 @@ private slots:
|
||||||
|
|
||||||
void on_actionDocument_triggered();
|
void on_actionDocument_triggered();
|
||||||
|
|
||||||
|
void on_actionNew_GAS_File_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
bool mFullInitialized;
|
bool mFullInitialized;
|
||||||
|
|
|
@ -2063,7 +2063,7 @@
|
||||||
</iconset>
|
</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>New File</string>
|
<string>New C/C++ File</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>New Source File</string>
|
<string>New Source File</string>
|
||||||
|
@ -3327,6 +3327,11 @@
|
||||||
<string>F1</string>
|
<string>F1</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionNew_GAS_File">
|
||||||
|
<property name="text">
|
||||||
|
<string>New GAS File</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tabSnippet">
|
<widget class="QWidget" name="tabSnippet">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
|
|
@ -107,6 +107,27 @@ const QString &SystemConsts::defaultAllFileFilter() const noexcept
|
||||||
return mDefaultFileFilters[0];
|
return mDefaultFileFilters[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString SystemConsts::fileFilterFor(const QString &suffix)
|
||||||
|
{
|
||||||
|
QString t="*."+suffix;
|
||||||
|
qDebug()<<" * "<<t;
|
||||||
|
foreach(const QString filter,mDefaultFileFilters) {
|
||||||
|
qDebug()<<filter;
|
||||||
|
int pos = filter.lastIndexOf("(");
|
||||||
|
int pos2 = filter.lastIndexOf(")");
|
||||||
|
if (pos<0 || pos2<=pos)
|
||||||
|
continue;
|
||||||
|
QString suffixes=filter.mid(pos+1,pos2-pos-1);
|
||||||
|
QStringList suffixList = suffixes.split(" ");
|
||||||
|
foreach( const QString& s, suffixList) {
|
||||||
|
qDebug()<<" - "<<s;
|
||||||
|
if (s.trimmed()==t)
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
void SystemConsts::addDefaultFileFilter(const QString &name, const QString &fileExtensions)
|
void SystemConsts::addDefaultFileFilter(const QString &name, const QString &fileExtensions)
|
||||||
{
|
{
|
||||||
addFileFilter(mDefaultFileFilters,name,fileExtensions);
|
addFileFilter(mDefaultFileFilters,name,fileExtensions);
|
||||||
|
|
|
@ -142,6 +142,7 @@ public:
|
||||||
const QString& defaultCFileFilter() const noexcept;
|
const QString& defaultCFileFilter() const noexcept;
|
||||||
const QString& defaultCPPFileFilter() const noexcept;
|
const QString& defaultCPPFileFilter() const noexcept;
|
||||||
const QString& defaultAllFileFilter() const noexcept;
|
const QString& defaultAllFileFilter() const noexcept;
|
||||||
|
QString fileFilterFor(const QString& suffix);
|
||||||
void addDefaultFileFilter(const QString& name, const QString& fileExtensions);
|
void addDefaultFileFilter(const QString& name, const QString& fileExtensions);
|
||||||
const QStringList &iconFileFilters() const;
|
const QStringList &iconFileFilters() const;
|
||||||
const QString& iconFileFilter() const;
|
const QString& iconFileFilter() const;
|
||||||
|
|
|
@ -4976,6 +4976,14 @@
|
||||||
<source>Document</source>
|
<source>Document</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>New C/C++ File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>New GAS File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NewClassDialog</name>
|
<name>NewClassDialog</name>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -4789,6 +4789,14 @@
|
||||||
<source>Document</source>
|
<source>Document</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>New C/C++ File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>New GAS File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>NewClassDialog</name>
|
<name>NewClassDialog</name>
|
||||||
|
|
|
@ -3910,6 +3910,15 @@ void QSynEdit::setBackgroundColor(const QColor &newBackgroundColor)
|
||||||
mBackgroundColor = newBackgroundColor;
|
mBackgroundColor = newBackgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QSynEdit::isEmpty()
|
||||||
|
{
|
||||||
|
if (mDocument->count()>1)
|
||||||
|
return false;
|
||||||
|
if (mDocument->count()==1)
|
||||||
|
return mDocument->getLine(0).isEmpty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const QColor &QSynEdit::foregroundColor() const
|
const QColor &QSynEdit::foregroundColor() const
|
||||||
{
|
{
|
||||||
return mForegroundColor;
|
return mForegroundColor;
|
||||||
|
|
|
@ -425,6 +425,8 @@ public:
|
||||||
const QColor &backgroundColor() const;
|
const QColor &backgroundColor() const;
|
||||||
void setBackgroundColor(const QColor &newBackgroundColor);
|
void setBackgroundColor(const QColor &newBackgroundColor);
|
||||||
|
|
||||||
|
bool isEmpty();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void linesDeleted(int FirstLine, int Count);
|
void linesDeleted(int FirstLine, int Count);
|
||||||
void linesInserted(int FirstLine, int Count);
|
void linesInserted(int FirstLine, int Count);
|
||||||
|
|
Loading…
Reference in New Issue