- fix: Encoding info in the status bar not correctly updated when save a new file
This commit is contained in:
parent
6bf443d3d8
commit
da2a7549f1
2
NEWS.md
2
NEWS.md
|
@ -31,7 +31,7 @@ Red Panda C++ Version 2.0
|
|||
- enhancement: when add file in the project view, auto select basename in the filename dialog
|
||||
- change: Don't generate localized filename when new header/add file in the project view
|
||||
- fix: Restore project's original compiler set if user choose 'No' in the confirm project compiler set change dialog.
|
||||
|
||||
- fix: Encoding info in the status bar not correctly updated when save a new file
|
||||
|
||||
Red Panda C++ Version 1.5
|
||||
|
||||
|
|
|
@ -205,7 +205,7 @@ void Editor::loadFile(QString filename) {
|
|||
}
|
||||
//this->setModified(false);
|
||||
updateCaption();
|
||||
pMainWindow->updateForEncodingInfo();
|
||||
pMainWindow->updateForEncodingInfo(this);
|
||||
switch(getFileType(mFilename)) {
|
||||
case FileType::CppSource:
|
||||
mUseCppSyntax = true;
|
||||
|
@ -389,8 +389,9 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
|||
|
||||
if (!shouldOpenInReadonly()) {
|
||||
setReadOnly(false);
|
||||
updateCaption();
|
||||
}
|
||||
pMainWindow->updateForEncodingInfo(this);
|
||||
updateCaption();
|
||||
|
||||
emit renamed(oldName, newName , firstSave);
|
||||
return true;
|
||||
|
@ -413,7 +414,7 @@ void Editor::setEncodingOption(const QByteArray& encoding) noexcept{
|
|||
if (!isNew())
|
||||
loadFile();
|
||||
else
|
||||
pMainWindow->updateForEncodingInfo();
|
||||
pMainWindow->updateForEncodingInfo(this);
|
||||
if (mProject) {
|
||||
PProjectUnit unit = mProject->findUnit(this);
|
||||
if (unit) {
|
||||
|
@ -1320,9 +1321,9 @@ void Editor::hideEvent(QHideEvent */*event*/)
|
|||
this,
|
||||
&QSynedit::SynEdit::invalidate);
|
||||
}
|
||||
pMainWindow->updateForEncodingInfo();
|
||||
pMainWindow->updateStatusbarForLineCol();
|
||||
pMainWindow->updateForStatusbarModeInfo();
|
||||
pMainWindow->updateForEncodingInfo(nullptr);
|
||||
pMainWindow->updateStatusbarForLineCol(nullptr);
|
||||
pMainWindow->updateForStatusbarModeInfo(nullptr);
|
||||
|
||||
setHideTime(QDateTime::currentDateTime());
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ Editor* EditorList::getEditor(int index, QTabWidget* tabsWidget) const {
|
|||
}
|
||||
|
||||
bool EditorList::closeEditor(Editor* editor, bool transferFocus, bool force) {
|
||||
if (editor == NULL)
|
||||
if (editor == nullptr)
|
||||
return false;
|
||||
if (force) {
|
||||
editor->save(true,false);
|
||||
|
|
|
@ -429,7 +429,7 @@ void MainWindow::updateForEncodingInfo(bool clear)
|
|||
}
|
||||
|
||||
void MainWindow::updateForEncodingInfo(const Editor* editor, bool clear) {
|
||||
if (!clear && editor!=NULL) {
|
||||
if (!clear && editor!=nullptr) {
|
||||
if (editor->encodingOption() != editor->fileEncoding()) {
|
||||
mFileEncodingStatus->setText(
|
||||
QString("%1(%2)")
|
||||
|
@ -1778,7 +1778,7 @@ bool MainWindow::compile(bool rebuild)
|
|||
updateAppTitle();
|
||||
} else {
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
clearIssues();
|
||||
if (editor->modified() || editor->isNew()) {
|
||||
if (!editor->save(false,false))
|
||||
|
@ -1902,7 +1902,7 @@ void MainWindow::runExecutable(RunType runType)
|
|||
binDirs);
|
||||
} else {
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
if (editor->modified() || editor->isNew()) {
|
||||
if (!editor->save(false,false))
|
||||
return;
|
||||
|
@ -4997,7 +4997,7 @@ bool MainWindow::event(QEvent *event)
|
|||
void MainWindow::on_actionSave_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL) {
|
||||
if (editor) {
|
||||
try {
|
||||
editor->save();
|
||||
// if (editor->inProject() && (mProject))
|
||||
|
@ -5011,7 +5011,7 @@ void MainWindow::on_actionSave_triggered()
|
|||
void MainWindow::on_actionSaveAs_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL) {
|
||||
if (editor) {
|
||||
try {
|
||||
editor->saveAs();
|
||||
} catch(FileError e) {
|
||||
|
@ -5334,7 +5334,7 @@ void MainWindow::on_actionRun_triggered()
|
|||
void MainWindow::on_actionUndo_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->undo();
|
||||
}
|
||||
}
|
||||
|
@ -5342,7 +5342,7 @@ void MainWindow::on_actionUndo_triggered()
|
|||
void MainWindow::on_actionRedo_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->redo();
|
||||
}
|
||||
}
|
||||
|
@ -5350,7 +5350,7 @@ void MainWindow::on_actionRedo_triggered()
|
|||
void MainWindow::on_actionCut_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->cutToClipboard();
|
||||
}
|
||||
}
|
||||
|
@ -5358,7 +5358,7 @@ void MainWindow::on_actionCut_triggered()
|
|||
void MainWindow::on_actionSelectAll_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->selectAll();
|
||||
}
|
||||
}
|
||||
|
@ -5366,7 +5366,7 @@ void MainWindow::on_actionSelectAll_triggered()
|
|||
void MainWindow::on_actionCopy_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->copyToClipboard();
|
||||
}
|
||||
}
|
||||
|
@ -5379,7 +5379,7 @@ void MainWindow::on_actionPaste_triggered()
|
|||
return;
|
||||
if (data->hasText()) {
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->pasteFromClipboard();
|
||||
editor->activate();
|
||||
}
|
||||
|
@ -5399,7 +5399,7 @@ void MainWindow::on_actionPaste_triggered()
|
|||
void MainWindow::on_actionIndent_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->tab();
|
||||
}
|
||||
}
|
||||
|
@ -5407,7 +5407,7 @@ void MainWindow::on_actionIndent_triggered()
|
|||
void MainWindow::on_actionUnIndent_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->shifttab();
|
||||
}
|
||||
}
|
||||
|
@ -5415,7 +5415,7 @@ void MainWindow::on_actionUnIndent_triggered()
|
|||
void MainWindow::on_actionToggleComment_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->toggleComment();
|
||||
}
|
||||
}
|
||||
|
@ -5423,7 +5423,7 @@ void MainWindow::on_actionToggleComment_triggered()
|
|||
void MainWindow::on_actionUnfoldAll_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->unCollpaseAll();
|
||||
}
|
||||
}
|
||||
|
@ -5431,7 +5431,7 @@ void MainWindow::on_actionUnfoldAll_triggered()
|
|||
void MainWindow::on_actionFoldAll_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->collapseAll();
|
||||
}
|
||||
}
|
||||
|
@ -8352,7 +8352,7 @@ void MainWindow::on_actionFilesView_Hide_Non_Support_Files_toggled(bool /* arg1
|
|||
void MainWindow::on_actionToggle_Block_Comment_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->toggleBlockComment();
|
||||
}
|
||||
}
|
||||
|
@ -8361,7 +8361,7 @@ void MainWindow::on_actionToggle_Block_Comment_triggered()
|
|||
void MainWindow::on_actionMatch_Bracket_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->matchBracket();
|
||||
}
|
||||
}
|
||||
|
@ -8475,7 +8475,7 @@ void MainWindow::on_txtProblemCaseInput_cursorPositionChanged()
|
|||
void MainWindow::on_actionMove_Selection_Up_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->moveSelUp();
|
||||
}
|
||||
}
|
||||
|
@ -8484,7 +8484,7 @@ void MainWindow::on_actionMove_Selection_Up_triggered()
|
|||
void MainWindow::on_actionMove_Selection_Down_triggered()
|
||||
{
|
||||
Editor * editor = mEditorList->getEditor();
|
||||
if (editor != NULL ) {
|
||||
if (editor) {
|
||||
editor->moveSelDown();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ void FileAssociationModel::saveAssociations()
|
|||
);
|
||||
}
|
||||
if (!ok) {
|
||||
QMessageBox::critical(NULL,
|
||||
QMessageBox::critical(nullptr,
|
||||
tr("Register File Association Error"),
|
||||
tr("Don't have privilege to register file types!"));
|
||||
return;
|
||||
|
@ -142,7 +142,7 @@ void FileAssociationModel::saveAssociations()
|
|||
ok = unregisterFileType(fileType);
|
||||
}
|
||||
if (!ok) {
|
||||
QMessageBox::critical(NULL,
|
||||
QMessageBox::critical(nullptr,
|
||||
tr("Register File Type Error"),
|
||||
tr("Don't have privilege to register file types!"));
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue