+ split file extension from descriptive text of file format to avoid that invalid translation breaks file dialog
+ add method to make image view unclosable for user + fix possible crash in MeshAlgorithm::GetMeshBorder + fix possible crash in MeshAlgorithm::ConnectLines
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <QDir>
|
||||
# include <QFileInfo>
|
||||
# include <QLibraryInfo>
|
||||
# include <QMessageBox>
|
||||
# include <QProcess>
|
||||
@@ -33,7 +34,6 @@
|
||||
|
||||
#include "Assistant.h"
|
||||
#include <Base/Console.h>
|
||||
#include <Base/FileInfo.h>
|
||||
#include <App/Application.h>
|
||||
|
||||
using namespace Gui;
|
||||
@@ -100,7 +100,7 @@ bool Assistant::startAssistant()
|
||||
QString doc = QString::fromUtf8(App::Application::getHelpDir().c_str());
|
||||
QString qhc = doc + exe.toLower() + QLatin1String(".qhc");
|
||||
|
||||
Base::FileInfo fi ( (const char*)qhc.toUtf8() );
|
||||
QFileInfo fi(qhc);
|
||||
if (!fi.isReadable()) {
|
||||
QMessageBox::critical(0, tr("%1 Help").arg(exe),
|
||||
tr("%1 help files not found (%2). You might need to install the %1 documentation package.").arg(exe).arg(qhc));
|
||||
|
||||
@@ -14,7 +14,7 @@ if (FREECAD_USE_3DCONNEXION)
|
||||
set(3DCONNEXION_LINKFLAGS "-F/Library/Frameworks -weak_framework 3DconnexionClient")
|
||||
set(3DCONNEXION_INCLUDE_DIR ${3DCONNEXIONCLIENT_FRAMEWORK}/Headers )
|
||||
endif(APPLE)
|
||||
endif(FREECAD_USE_3DCONNEXION)
|
||||
endif(FREECAD_USE_3DCONNEXION)
|
||||
|
||||
if (BUILD_VR)
|
||||
add_definitions(-DBUILD_VR )
|
||||
|
||||
@@ -295,7 +295,7 @@ void StdCmdFreezeViews::onSaveViews()
|
||||
{
|
||||
// Save the views to an XML file
|
||||
QString fn = FileDialog::getSaveFileName(getMainWindow(), QObject::tr("Save frozen views"),
|
||||
QString(), QObject::tr("Frozen views (*.cam)"));
|
||||
QString(), QString::fromLatin1("%1 (*.cam)").arg(QObject::tr("Frozen views")));
|
||||
if (fn.isEmpty())
|
||||
return;
|
||||
QFile file(fn);
|
||||
@@ -345,7 +345,7 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
|
||||
// Restore the views from an XML file
|
||||
QString fn = FileDialog::getOpenFileName(getMainWindow(), QObject::tr("Restore frozen views"),
|
||||
QString(), QObject::tr("Frozen views (*.cam)"));
|
||||
QString(), QString::fromLatin1("%1 (*.cam)").arg(QObject::tr("Frozen views")));
|
||||
if (fn.isEmpty())
|
||||
return;
|
||||
QFile file(fn);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <QMessageBox>
|
||||
# include <QMessageBox>
|
||||
# include <QDir>
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@ DlgOnlineHelpImp::DlgOnlineHelpImp( QWidget* parent )
|
||||
{
|
||||
this->setupUi(this);
|
||||
|
||||
prefStartPage->setFilter( tr("HTML files (*.html *.htm)") );
|
||||
prefStartPage->setFilter(QString::fromLatin1("%1 (*.html *.htm)").arg(tr("HTML files")));
|
||||
if (prefStartPage->fileName().isEmpty()) {
|
||||
prefStartPage->setFileName(getStartpage());
|
||||
}
|
||||
@@ -70,7 +70,7 @@ DlgOnlineHelpImp::~DlgOnlineHelpImp()
|
||||
*/
|
||||
QString DlgOnlineHelpImp::getStartpage()
|
||||
{
|
||||
QDir docdir = QDir(QString::fromUtf8(App::Application::getHelpDir().c_str()));
|
||||
QDir docdir = QDir(QString::fromUtf8(App::Application::getHelpDir().c_str()));
|
||||
return docdir.absoluteFilePath(QString::fromUtf8("Start_Page.html"));
|
||||
}
|
||||
|
||||
|
||||
@@ -442,7 +442,7 @@ void ParameterGroup::onCreateSubgroup()
|
||||
void ParameterGroup::onExportToFile()
|
||||
{
|
||||
QString file = FileDialog::getSaveFileName( this, tr("Export parameter to file"),
|
||||
QString::null, tr("XML (*.FCParam)"));
|
||||
QString::null, QString::fromLatin1("XML (*.FCParam)"));
|
||||
if ( !file.isEmpty() )
|
||||
{
|
||||
QTreeWidgetItem* item = currentItem();
|
||||
@@ -458,7 +458,7 @@ void ParameterGroup::onExportToFile()
|
||||
void ParameterGroup::onImportFromFile()
|
||||
{
|
||||
QString file = FileDialog::getOpenFileName( this, tr("Import parameter from file"),
|
||||
QString::null, tr("XML (*.FCParam)"));
|
||||
QString::null, QString::fromLatin1("XML (*.FCParam)"));
|
||||
if ( !file.isEmpty() )
|
||||
{
|
||||
QFileInfo fi(file);
|
||||
|
||||
@@ -112,6 +112,7 @@ DlgProjectUtility::DlgProjectUtility(QWidget* parent, Qt::WFlags fl)
|
||||
: QDialog(parent, fl), ui(new Ui_DlgProjectUtility)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->extractSource->setFilter(QString::fromLatin1("%1 (*.fcstd)").arg(tr("Project file")));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::FileChooser" name="extractSource">
|
||||
<property name="filter">
|
||||
<string>Project file (*.fcstd)</string>
|
||||
<string notr="true">Project file (*.fcstd)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -82,7 +82,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="Gui::FileChooser" name="createSource">
|
||||
<property name="filter">
|
||||
<string>Document.xml</string>
|
||||
<string notr="true">Document.xml</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -629,7 +629,7 @@ bool Document::saveAs(void)
|
||||
|
||||
QString exe = qApp->applicationName();
|
||||
QString fn = FileDialog::getSaveFileName(getMainWindow(), QObject::tr("Save %1 Document").arg(exe),
|
||||
QString(), QObject::tr("%1 document (*.FCStd)").arg(exe));
|
||||
QString(), QString::fromLatin1("%1 %2 (*.FCStd)").arg(exe).arg(QObject::tr("Document")));
|
||||
if (!fn.isEmpty()) {
|
||||
QFileInfo fi;
|
||||
fi.setFile(fn);
|
||||
|
||||
@@ -269,7 +269,7 @@ void EditorView::setDisplayName(EditorView::DisplayName type)
|
||||
bool EditorView::saveAs(void)
|
||||
{
|
||||
QString fn = FileDialog::getSaveFileName(this, QObject::tr("Save Macro"),
|
||||
QString::null, tr("FreeCAD macro (*.FCMacro);;Python (*.py)"));
|
||||
QString::null, QString::fromLatin1("%1 (*.FCMacro);;Python (*.py)").arg(tr("FreeCAD macro")));
|
||||
if (fn.isEmpty())
|
||||
return false;
|
||||
setCurrentFileName(fn);
|
||||
|
||||
@@ -288,12 +288,12 @@ bool GraphvizView::onMsg(const char* pMsg,const char** ppReturn)
|
||||
{
|
||||
if (strcmp("Save",pMsg) == 0 || strcmp("SaveAs",pMsg) == 0) {
|
||||
QList< QPair<QString, QString> > formatMap;
|
||||
formatMap << qMakePair(tr("PNG format (*.png)"), QString::fromLatin1("png"));
|
||||
formatMap << qMakePair(tr("Bitmap format (*.bmp)"), QString::fromLatin1("bmp"));
|
||||
formatMap << qMakePair(tr("GIF format (*.gif)"), QString::fromLatin1("gif"));
|
||||
formatMap << qMakePair(tr("JPG format (*.jpg)"), QString::fromLatin1("jpg"));
|
||||
formatMap << qMakePair(tr("SVG format (*.svg)"), QString::fromLatin1("svg"));
|
||||
formatMap << qMakePair(tr("PDF format (*.pdf)"), QString::fromLatin1("pdf"));
|
||||
formatMap << qMakePair(QString::fromLatin1("%1 (*.png)").arg(tr("PNG format")), QString::fromLatin1("png"));
|
||||
formatMap << qMakePair(QString::fromLatin1("%1 (*.bmp)").arg(tr("Bitmap format")), QString::fromLatin1("bmp"));
|
||||
formatMap << qMakePair(QString::fromLatin1("%1 (*.gif)").arg(tr("GIF format")), QString::fromLatin1("gif"));
|
||||
formatMap << qMakePair(QString::fromLatin1("%1 (*.jpg)").arg(tr("JPG format")), QString::fromLatin1("jpg"));
|
||||
formatMap << qMakePair(QString::fromLatin1("%1 (*.svg)").arg(tr("SVG format")), QString::fromLatin1("svg"));
|
||||
formatMap << qMakePair(QString::fromLatin1("%1 (*.pdf)").arg(tr("PDF format")), QString::fromLatin1("pdf"));
|
||||
//formatMap << qMakePair(tr("VRML format (*.vrml)"), QString::fromLatin1("vrml"));
|
||||
|
||||
QStringList filter;
|
||||
@@ -377,7 +377,7 @@ void GraphvizView::print()
|
||||
void GraphvizView::printPdf()
|
||||
{
|
||||
QStringList filter;
|
||||
filter << tr("PDF format (*.pdf)");
|
||||
filter << QString::fromLatin1("%1 (*.pdf)").arg(tr("PDF format"));
|
||||
|
||||
QString selectedFilter;
|
||||
QString fn = Gui::FileDialog::getSaveFileName(this, tr("Export graph"), QString(), filter.join(QLatin1String(";;")), &selectedFilter);
|
||||
|
||||
@@ -1197,7 +1197,7 @@ void PythonConsole::onSaveHistoryAs()
|
||||
QString cMacroPath = QString::fromUtf8(getDefaultParameter()->GetGroup( "Macro" )->
|
||||
GetASCII("MacroPath",App::Application::getUserAppDataDir().c_str()).c_str());
|
||||
QString fn = FileDialog::getSaveFileName(this, tr("Save History"), cMacroPath,
|
||||
tr("Macro Files (*.FCMacro *.py)"));
|
||||
QString::fromLatin1("%1 (*.FCMacro *.py)").arg(tr("Macro Files")));
|
||||
if (!fn.isEmpty()) {
|
||||
int dot = fn.indexOf(QLatin1Char('.'));
|
||||
if (dot != -1) {
|
||||
@@ -1215,7 +1215,8 @@ void PythonConsole::onSaveHistoryAs()
|
||||
|
||||
void PythonConsole::onInsertFileName()
|
||||
{
|
||||
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), tr("Insert file name"), QString::null, tr("All Files (*.*)") );
|
||||
QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), tr("Insert file name"), QString::null,
|
||||
QString::fromLatin1("%1 (*.*)").arg(tr("All Files")));
|
||||
if ( fn.isEmpty() )
|
||||
return;
|
||||
insertPlainText(fn);
|
||||
|
||||
@@ -433,7 +433,8 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
|
||||
|
||||
void ReportOutput::onSaveAs()
|
||||
{
|
||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save Report Output"), QString(), tr("Plain Text Files (*.txt *.log)"));
|
||||
QString fn = QFileDialog::getSaveFileName(this, tr("Save Report Output"), QString(),
|
||||
QString::fromLatin1("%1 (*.txt *.log)").arg(tr("Plain Text Files")));
|
||||
if (!fn.isEmpty()) {
|
||||
QFileInfo fi(fn);
|
||||
if (fi.completeSuffix().isEmpty())
|
||||
|
||||
@@ -196,7 +196,7 @@ SoAxisCrossKit::createAxes()
|
||||
setPart("yAxis.shape", shape);
|
||||
setPart("zAxis.shape", shape);
|
||||
|
||||
// Place the axes ând heads
|
||||
// Place the axes and heads
|
||||
set("yAxis.transform", "rotation 0 0 1 1.5707999");
|
||||
set("zAxis.transform", "rotation 0 1 0 -1.5707999");
|
||||
|
||||
|
||||
@@ -450,7 +450,8 @@ void View3DInventor::print()
|
||||
|
||||
void View3DInventor::printPdf()
|
||||
{
|
||||
QString filename = FileDialog::getSaveFileName(this, tr("Export PDF"), QString(), tr("PDF file (*.pdf)"));
|
||||
QString filename = FileDialog::getSaveFileName(this, tr("Export PDF"), QString(),
|
||||
QString::fromLatin1("%1 (*.pdf)").arg(tr("PDF file")));
|
||||
if (!filename.isEmpty()) {
|
||||
Gui::WaitCursor wc;
|
||||
QPrinter printer(QPrinter::ScreenResolution);
|
||||
|
||||
Reference in New Issue
Block a user