Start: Cleanup and minor bugfixes
Start: Remove QML include Start: Eliminate errors on unreadable images Start: Ensure command succeeded Start: Correct startup WB Also re-enable the migrator, which was not the culprit. Gui: Roll back unneeded NoneWorkbench changes
This commit is contained in:
@@ -951,17 +951,44 @@ void NoneWorkbench::setupContextMenu(const char* recipient,MenuItem* item) const
|
||||
{
|
||||
Q_UNUSED(recipient);
|
||||
Q_UNUSED(item);
|
||||
StdWorkbench::setupContextMenu(recipient, item);
|
||||
}
|
||||
|
||||
MenuItem* NoneWorkbench::setupMenuBar() const
|
||||
{
|
||||
return StdWorkbench::setupMenuBar();
|
||||
// Setup the default menu bar
|
||||
auto menuBar = new MenuItem;
|
||||
|
||||
// File
|
||||
auto file = new MenuItem( menuBar );
|
||||
file->setCommand("&File");
|
||||
*file << "Std_Quit";
|
||||
|
||||
// Edit
|
||||
auto edit = new MenuItem( menuBar );
|
||||
edit->setCommand("&Edit");
|
||||
*edit << "Std_DlgPreferences";
|
||||
|
||||
// View
|
||||
auto view = new MenuItem( menuBar );
|
||||
view->setCommand("&View");
|
||||
*view << "Std_Workbench";
|
||||
|
||||
// Separator
|
||||
auto sep = new MenuItem( menuBar );
|
||||
sep->setCommand("Separator");
|
||||
|
||||
// Help
|
||||
auto help = new MenuItem( menuBar );
|
||||
help->setCommand("&Help");
|
||||
*help << "Std_OnlineHelp" << "Std_About";
|
||||
|
||||
return menuBar;
|
||||
}
|
||||
|
||||
ToolBarItem* NoneWorkbench::setupToolBars() const
|
||||
{
|
||||
return StdWorkbench::setupToolBars();
|
||||
auto root = new ToolBarItem;
|
||||
return root;
|
||||
}
|
||||
|
||||
ToolBarItem* NoneWorkbench::setupCommandBars() const
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <Base/Parameter.h>
|
||||
#include <QtQml/QQmlTypeInfo>
|
||||
|
||||
#include "../StartGlobal.h"
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <QAbstractListModel>
|
||||
#include <QDir>
|
||||
#include <Base/Parameter.h>
|
||||
#include <QtQml/QQmlTypeInfo>
|
||||
|
||||
#include "DisplayedFilesModel.h"
|
||||
#include "../StartGlobal.h"
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <Base/Parameter.h>
|
||||
#include <QtQml/QQmlTypeInfo>
|
||||
|
||||
#include "DisplayedFilesModel.h"
|
||||
#include "../StartGlobal.h"
|
||||
|
||||
@@ -32,11 +32,13 @@
|
||||
#include <Base/PyObjectBase.h>
|
||||
#include <Gui/Language/Translator.h>
|
||||
#include <Gui/Command.h>
|
||||
#include <Gui/MainWindow.h>
|
||||
|
||||
|
||||
#include <3rdParty/GSL/include/gsl/pointers>
|
||||
|
||||
#include "Manipulator.h"
|
||||
#include "StartView.h"
|
||||
|
||||
void loadStartResource()
|
||||
{
|
||||
@@ -70,7 +72,7 @@ public:
|
||||
StartLauncher()
|
||||
{
|
||||
// QTimers don't fire until the event loop starts, which is our signal that the GUI is up
|
||||
QTimer::singleShot(1000, [this] {
|
||||
QTimer::singleShot(100, [this] {
|
||||
Launch();
|
||||
});
|
||||
}
|
||||
@@ -82,6 +84,21 @@ public:
|
||||
bool showOnStartup = hGrp->GetBool("ShowOnStartup", true);
|
||||
if (showOnStartup) {
|
||||
Gui::Application::Instance->commandManager().runCommandByName("Start_Start");
|
||||
QTimer::singleShot(100, [this] {
|
||||
EnsureLaunched();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void EnsureLaunched()
|
||||
{
|
||||
// It's possible that "Start_Start" didn't result in the creation of an MDI window, if it
|
||||
// was called to early. This polls the views to make sure the view was created, and if it
|
||||
// was not, re-calls the command.
|
||||
auto mw = Gui::getMainWindow();
|
||||
auto existingView = mw->findChild<StartGui::StartView*>(QLatin1String("StartView"));
|
||||
if (!existingView) {
|
||||
Launch();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,10 +69,12 @@ void FileCardDelegate::paint(QPainter* painter,
|
||||
auto pixmap = gsl::owner<QPixmap*>(new QPixmap());
|
||||
if (!image.isEmpty()) {
|
||||
pixmap->loadFromData(image);
|
||||
auto scaled = pixmap->scaled(QSize(thumbnailSize, thumbnailSize),
|
||||
Qt::AspectRatioMode::KeepAspectRatio,
|
||||
Qt::TransformationMode::SmoothTransformation);
|
||||
thumbnail->setPixmap(scaled);
|
||||
if (!pixmap->isNull()) {
|
||||
auto scaled = pixmap->scaled(QSize(thumbnailSize, thumbnailSize),
|
||||
Qt::AspectRatioMode::KeepAspectRatio,
|
||||
Qt::TransformationMode::SmoothTransformation);
|
||||
thumbnail->setPixmap(scaled);
|
||||
}
|
||||
}
|
||||
else {
|
||||
thumbnail->setPixmap(generateThumbnail(path));
|
||||
@@ -141,7 +143,9 @@ QPixmap FileCardDelegate::generateThumbnail(const QString& path) const
|
||||
// It is an image: it can be its own thumbnail
|
||||
QImageReader reader(path);
|
||||
auto image = reader.read();
|
||||
return pixmapToSizedQImage(image, thumbnailSize);
|
||||
if (!image.isNull()) {
|
||||
return pixmapToSizedQImage(image, thumbnailSize);
|
||||
}
|
||||
}
|
||||
QIcon icon = QFileIconProvider().icon(QFileInfo(path));
|
||||
if (!icon.isNull()) {
|
||||
|
||||
@@ -24,5 +24,5 @@
|
||||
import StartGui # Not unused, import has a side-effect of creating the "Start_Start" command
|
||||
import StartMigrator
|
||||
|
||||
# migrator = StartMigrator.StartMigrator2024()
|
||||
# migrator.run_migration()
|
||||
migrator = StartMigrator.StartMigrator2024()
|
||||
migrator.run_migration()
|
||||
|
||||
@@ -60,12 +60,12 @@ class StartMigrator2024:
|
||||
FreeCAD.Console.PrintMessage("done.\n")
|
||||
|
||||
# If the old Start workbench was set as the Autoload Module, reconfigure it so the Start command is run at startup,
|
||||
# and set the Autoload module to "NoneWorkbench"
|
||||
# and set the Autoload module to "PartDesignWorkbench"
|
||||
def _update_startup_flags(self):
|
||||
autoload_module = self.general_prefs.GetString("AutoloadModule", "")
|
||||
if autoload_module == "StartWorkbench":
|
||||
self.start_prefs.SetBool("ShowOnStartup", True)
|
||||
self.general_prefs.SetString("AutoloadModule", "NoneWorkbench")
|
||||
self.general_prefs.SetString("AutoloadModule", "PartDesignWorkbench")
|
||||
else:
|
||||
self.start_prefs.SetBool("ShowOnStartup", False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user