Mercurial > octave-libgccjit
comparison libgui/src/m-editor/file-editor-tab.cc @ 18946:0be65bd7f369 gui-release
add an user preference for loading changed files without a prompt (bug #42678)
* file-editor-tab.cc (file_has_changed): check user preference before prompting
for reloading the file;
(notice-settings): get flag for prompting before reloading file from settings;
* file-editor-tab.h: new flag _always_reload_changed files
* settings-dialog.ui: new check box for new preference
* settings-dialog.cc (constructor): get state of new check box from settings;
(write_changes_settings): write state of new check box into settings
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 20 Jul 2014 21:23:32 +0200 |
parents | b43157d085ba |
children |
comparison
equal
deleted
inserted
replaced
18945:d2100cb2331a | 18946:0be65bd7f369 |
---|---|
1430 if (!trackedFiles.isEmpty ()) | 1430 if (!trackedFiles.isEmpty ()) |
1431 _file_system_watcher.removePath (_file_name); | 1431 _file_system_watcher.removePath (_file_name); |
1432 | 1432 |
1433 if (QFile::exists (_file_name)) | 1433 if (QFile::exists (_file_name)) |
1434 { | 1434 { |
1435 // Create a WindowModal message that blocks the edit area | 1435 if (_always_reload_changed_files) |
1436 // by making _edit_area parent. | 1436 |
1437 QMessageBox* msgBox | 1437 load_file (_file_name); |
1438 = new QMessageBox (QMessageBox::Warning, | 1438 |
1439 tr ("Octave Editor"), | 1439 else |
1440 tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?"). | 1440 { |
1441 arg (_file_name), | 1441 // Create a WindowModal message that blocks the edit area |
1442 QMessageBox::Yes | QMessageBox::No, this); | 1442 // by making _edit_area parent. |
1443 | 1443 QMessageBox* msgBox |
1444 connect (msgBox, SIGNAL (finished (int)), | 1444 = new QMessageBox (QMessageBox::Warning, |
1445 this, SLOT (handle_file_reload_answer (int))); | 1445 tr ("Octave Editor"), |
1446 | 1446 tr ("It seems that \'%1\' has been modified by another application. Do you want to reload it?"). |
1447 msgBox->setWindowModality (Qt::WindowModal); | 1447 arg (_file_name), |
1448 msgBox->setAttribute (Qt::WA_DeleteOnClose); | 1448 QMessageBox::Yes | QMessageBox::No, this); |
1449 msgBox->show (); | 1449 |
1450 connect (msgBox, SIGNAL (finished (int)), | |
1451 this, SLOT (handle_file_reload_answer (int))); | |
1452 | |
1453 msgBox->setWindowModality (Qt::WindowModal); | |
1454 msgBox->setAttribute (Qt::WA_DeleteOnClose); | |
1455 msgBox->show (); | |
1456 } | |
1450 } | 1457 } |
1451 else | 1458 else |
1452 { | 1459 { |
1453 QString modified = ""; | 1460 QString modified = ""; |
1454 if (_edit_area->isModified ()) | 1461 if (_edit_area->isModified ()) |
1575 if (settings->value ("editor/long_line_marker",true).toBool ()) | 1582 if (settings->value ("editor/long_line_marker",true).toBool ()) |
1576 _edit_area->setEdgeMode (QsciScintilla::EdgeLine); | 1583 _edit_area->setEdgeMode (QsciScintilla::EdgeLine); |
1577 else | 1584 else |
1578 _edit_area->setEdgeMode (QsciScintilla::EdgeNone); | 1585 _edit_area->setEdgeMode (QsciScintilla::EdgeNone); |
1579 | 1586 |
1587 // reload changed files | |
1588 _always_reload_changed_files = | |
1589 settings->value ("editor/always_reload_changed_files",false).toBool (); | |
1580 } | 1590 } |
1581 | 1591 |
1582 void | 1592 void |
1583 file_editor_tab::auto_margin_width () | 1593 file_editor_tab::auto_margin_width () |
1584 { | 1594 { |