Commit Graph

120 Commits

Author SHA1 Message Date
Ajinkya Dahale
820e88f95b [Core] (Partially?) Fix data loss on dir rename (#4996)
* Fix lost filename in err msg

In some circumstances, FileExceptions are constructed empty, then have a
filename assigned to them, but the error message in these scenarios is
left as the default "unknown" one, which is sometimes shown to users.
This change fixes that case to be consistent with instances that are
constructed with the filename.

The exception can happen when trying to save the file in a location that does
not exist, or when the user does not have permission to write there. If it
comes when saving after closing the document, all previous changes can be lost.

Partially fixes issue #4098.

Co-authored-by: Heewa Barfchin <heewa.b@gmail.com>
2021-09-16 12:06:29 -05:00
0penBrain
db1a342853 [Gui] Send 'mainWindowClosed' signal before window settings are saved
So macros/add-ons can eventually restore things
2021-07-20 20:55:04 +02:00
wmayer
8ac8492167 Gui: [skip ci] support user-defined about image 2021-04-04 00:12:53 +02:00
Chris Hennes
c039217af1 Allow different splash and about image 2021-04-03 22:36:28 +02:00
wmayer
e7c91d68af Gui: [skip ci] remove MainWindow::showMainWindow() & timer 2021-04-02 11:15:04 +02:00
Chris Hennes
50c7ee36bf [GUI] Remove code for Qt < 5.9 2021-04-02 10:10:37 +02:00
wmayer
df0f979f3b App/Gui: fix memory leaks:
+ add function to cleanup units and quantities in debug build
+ fix reference leak in PropertyVector::getPyPathValue()
+ fix reference leak in PropertyPlacement::getPyPathValue()
+ in InterpreterSingleton::init() use a static std::vector<wchar_t*> instead of a C array
  to free memory at program end
+ in MainWindow::closeEvent() explicitly delete all task watchers
+ in ReportOutputObserver constructor pass parent to QObject
+ in PropertyEditor destructor explicitly delete QItemEditorFactory
2021-02-27 10:56:19 +01:00
Chris Hennes
ea3ecf4054 Silence Qt/Windows setGeometry Warning
Add the optional Qt::MSWindowsFixedSizeDialogHint parameter to all uses of the QInputDialog::getX static functions to silence a Qt/Windows debug mode warning about QWindowsWindow::setGeometry: Unable to set geometry. Increase the size of the unit calculator to eliminate the same warning. Finally, call adjustSize() on the "Unsaved Changes" dialog to silence the warning.
2020-12-11 09:58:09 +01:00
luz paz
298c677873 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
mwganson
4a0d127dae [Macro Menu] add Recent macros to Macro menu + list size preference. Executes selected macro or if Shift+click opens macro in editor. 2020-09-03 11:29:37 +02:00
wmayer
44f42a8e2c LGTM: [skip ci] fix: Declaration hides parameter
A local variable hides a parameter. This may be confusing. Consider renaming one of them.
2020-07-27 10:57:34 +02:00
Zheng, Lei
536051179b App/Gui: introduce temporary document
Add new argument to Application::newDocument() to create a temporary
    document. Also exposed to Python API App.newDocument() with a named
    argument 'temp'.

    The temporary document is marked with status bit 'TempDoc'. The user
    will not be prompt for saving when closing. The undo/redo is disabled.
    The AutoSaver skips it. And the tree view will not show it.
    PropertyXLink allows linking to/from object within a temporary document
    without saving.
2020-07-14 19:36:05 +02:00
Torsten Sadowski
645cbd6b43 Fix for Bug #4372 2020-07-11 11:34:40 +02:00
wmayer
eced0cb568 Qt5: QDesktopWidget is deprecated use QScreen [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
1ee3d79d7c Qt5: 'int QFontMetrics::width' is deprecated since Qt 5.11: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
4ec45b545e boost 1.73.0: The practice of declaring the Bind placeholders (_1, _2, ...) in the global namespace is deprecated 2020-06-12 17:51:33 +02:00
wmayer
6c80d8df0d Qt5: 'QString QFileInfo::readLink() const' is deprecated: Use QFileInfo::symLinkTarget() instead [-Wdeprecated-declarations] 2020-06-12 17:51:33 +02:00
wmayer
eaedcfea4c Gui: [skip ci] fix some thread issues:
avoid to crash the application when trying to create thumbnail from worker thread
avoid that application behaves weirdly when triggering an action update from worker thread
2020-06-12 12:20:20 +02:00
triplus
ff5a903250 Support for grouped dragging of dockwidgets
Forum discussion:
https://forum.freecadweb.org/viewtopic.php?f=9&t=45697
2020-04-27 11:42:01 +02:00
wmayer
063ca70afe Gui: [skip ci] add slot to update editor related commands 2020-03-17 10:03:32 +01:00
0penBrain
62406e0ce4 Add ability to remember which workbench is active for each tab of the viewport
Can be enabled/disabled through preferences => Connected to 'SaveWBbyTab' parameter
Workbench is saved when it is changed or when a new subwindow is created
It is restored when subwindow is activated if one was previously saved
2020-03-02 11:59:30 -03:00
wmayer
85aeef9384 Gui: ComboView always must be created because it includes the task view. 2020-02-08 14:52:28 +01:00
wmayer
832d175377 Gui: fix naming inconsistency and rename 'combi' to 'combo' 2020-02-08 13:43:44 +01:00
Zheng, Lei
a8e048ec1f Gui: fix tree view mode option in general preference 2020-02-08 13:12:30 +01:00
wmayer
5c17f71a21 Gui: [skip-ci] rename Sequencer to SequencerBar 2020-01-25 16:06:29 +01:00
wmayer
625d252cb1 Gui: implementation classes don't inherit from UI classes any more 2020-01-09 14:30:45 +01:00
Zheng, Lei
004d6061e0 Fix copy/paste objects through temp file 2019-12-06 14:43:02 -03:00
Zheng, Lei
63edea3ea4 Do not reserve memory when copy/paste objects through file 2019-12-06 14:43:02 -03:00
wmayer
2251f53eb5 trigger update of action when activating MDI view 2019-10-29 22:19:43 +01:00
ezzieyguywuf
f27e4590a6 Refactor and rename ConsoleObserver...
...Renamed to "ILogger", to designate that this is an Interface for a
Logger. This "Interface" is pure virtual, so that it cannot be
instantiated directly. This makes it clear that it is intended to be
derived.

Finally, got rid of all the individual log-style methods and replaced
with SendLog. The idea here is that day-to-day users will only interact
with ILogger through ConsoleSingleton (or, likely, LoggerSingleton in
the future). This singleton will manage an arbirtary collection of
ILogger, and call SendLog with the appropriate parameters based on what
the user requests.

Therefore, the singleton itself will have the individual Log, Message,
Error, etc... methods, while stil allowing us to simplify the code base
of ILogger and its derived classes.
2019-10-20 11:46:15 +02:00
wmayer
b50b21576e core system
force strict ISO C++ (-Wpedantic)
TODO: still a lot of variadic macros are not valid ISO C++
2019-09-18 01:01:14 +02:00
Zheng, Lei
4141242e9d Gui: minor adjustment on command status update 2019-09-10 14:17:07 +02:00
wmayer
cb19453921 re-activate DAG view 2019-09-08 16:00:08 +02:00
Zheng, Lei
c2254a64aa Gui: expose MainWindow:showStatus()
Tree view now uses this to show error on hovering over object in error.
2019-08-30 14:33:31 +02:00
wmayer
c4e34ed9be Fix bug in MainWindow::setActiveWindow
The method MainWindow::setActiveWindow() must not automatically add a view to the mdi area if it's not part of it because this causes a crash when trying to make a fullscreen window or undock a view.
Instead the calling instance must explicitly call MainWindow::addWindow where needed.
2019-08-23 23:44:19 +02:00
wmayer
5172c3bc08 Fix clang compiler warnings:
+ fix -Winconsistent-missing-override
+ fix -Wunused-variable
+ fix -Wbraced-scalar-init
+ fix -Wparentheses (View3DInventorViewer::checkGroupOnTop: operator '?:' has lower precedence than '+'; '+' will be evaluated first)
+ fix -Wundefined-bool-conversion (MainWindow::updateActions)
+ suppress -Woverloaded-virtual but fix later
2019-08-17 19:52:12 +02:00
Zheng, Lei
bd2f5191c9 Gui: Application/Document/MainWindow changes following App namespace
Application:

* signalNewDocument, check the extra argument, isMainDoc, the decide
  whether to create view of the new document. This is so that external
  linked document can be opened in background without crowding the tab
  list.

* slotDeleteDocument, calls Document::beforeDelete()

* slotActiveDocument, creates view if none, because external document
  is now opened without view.

* onLastWindowClosed(), switch to next active document, and creates view
  if none.

* send(Has)MsgToFocusView(), new API to send message to the active view
  in focus. This is to solve the ambiguity of things like pressing
  delete key, copy, paste handling when the active new is not in focus.
  For example, when spread sheet view is active, delete/copy/paste
  handling should be different when the focus on the spread sheet view
  or focus on tree view.

* tryClose(), delegate to MainWindow for close confirmation

* reopen(), new API to reload a partial document in full

Document/DocumentP:

* _CoinMap, new internal map for quick access view provider from its
  root node.

* slotNewObject, modified to support view provider override from
  App::FeaturePython, through new API
  DocumentObject::getViewProviderNameOverride().

* slotDeletedObject/slotTransactionRemove, improve handling of geo group
  children rebuild

* slotSkipRecompute, add special handling of document with skip
  recompute. Some command cannot work when skip recompute is active.
  For example, sketcher command will check if recompute is successful
  on many commands, and will undo if not. New 'PartialCompute' flag is
  added to allow recompute only the editing object and all its
  dependencies if 'SkipRecompute' is active.

* slotTouchedObject, new signal handling of manually touched object.

* setModified(), do nothing if already modified. This is a critical
  performance improvement, because marking tab window as modified turns
  out to be a relatively expensive operation, and will cause massive
  slow down if calling it on every property change.

* getViewProviderByPathFromHead/getViewProvidersByPath(), new APIs to
  obtain view provider(s) from coin SoPath.

* save/saveAll/saveCopy, modified to support external document saving.

* Save/RestoreDocFile(), save and restore tree item recursive expansion
  status.

* slotFinishRestoreObject(), handle new signal
  signalFinishRestoreObject(), unifies postprocessing in restore and
  import operation.

* createView/setActiveView(), add support of delayed view creations

* canClose(), delegate to MainWindows to ask for confirmation

* undo/redo(), support grouped transaction undo/redo. Transactions may
  be grouped by the same transaction ID if they are triggered by a
  single operation but involves objects from multiple documents.

* toggleInSceneGraph(), new API to add or remove root node from or to
  scenegraph without deleting the view object.

MainWindow:

* Update command status using a single shot timer instead of periodical
  one.

* Improve message display is status bar. Give error and warning message
  higher priority (using QStatusBar::showMessage()) than normal status
  message (using actionLabel), reversed from original implementation.

* confirmSave(), new API to check for modification, and ask user to save
  the document before closing. The confirmation dialog allows user to
  apply the answer to all document for convenience.

* saveAll(), new API to save all document with correct ordering in case
  of external linking.

* createMimeDataFromSelection/insertFromMimeData(), support copy paste
  object with external linking. A new dialog DlgObjectSelection is used
  to let user select exactly which object to export.

CommandDoc/CommandWindow:

* Related changes to object delete, document import, export, and save.
2019-08-17 15:08:33 +02:00
wmayer
53f51db8ae eliminate some bad old-style casts which hide an obscure error 2019-07-21 17:51:29 +02:00
mwganson
3cc93d1961 [enable report view on warnings/erros] add reportoutputobserver class, manage report view visibility via QDocketWidget toggleViewAction() rather than directly with show(), remove unnecessary variables 2019-07-21 15:58:12 +02:00
triplus
54c6537a21 Set QMdiArea tabs movable 2019-06-20 17:30:47 +02:00
wmayer
c3fb5edc41 allow to define custom background images 2019-03-06 11:09:14 +01:00
wmayer
2e8412f684 fix position of version number in splash screen 2019-02-20 14:05:13 +01:00
wmayer
b29209d523 enhance capabilities to render text in splashscreen 2019-02-12 13:09:51 +01:00
Mateusz Skowroński
317bcd59c9 Use QString's multi-arg overload to save memory allocations. [-Wclazy-qstring-arg] Thanks Clazy! 2019-02-11 15:39:14 +01:00
wmayer
af36a78f7f harmonize settings for DAGView with other dockable windows 2018-11-15 10:58:14 +01:00
wmayer
d86c83d6c5 Enable again the standalone tree and property view by default 2018-11-15 10:24:53 +01:00
wmayer
3d8b815834 by default disable old tree view & property view 2018-11-09 17:44:51 +01:00
wmayer
f898eafd64 move from deprecated boost.signals to boost.signals2 library 2018-10-30 19:09:03 +01:00
mwganson
876c65157d issue 3443, suppress generation of new document when documents are loaded via command line 2018-10-07 23:27:44 +02:00
wmayer
c8cfc15e3c fix build failure on Linux 2018-09-15 21:38:15 +02:00