mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-06-14 00:43:14 +02:00
Compare commits
7 Commits
a73452bf6d
...
11e3f91029
| Author | SHA1 | Date | |
|---|---|---|---|
| 11e3f91029 | |||
| 1ac324242a | |||
| 940ae0c34a | |||
| 7a19756f13 | |||
| 3b24bd25c7 | |||
| 4c7cc9a110 | |||
| 79f894a327 |
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
#include "conductornumexport.h"
|
||||
|
||||
#include "qetapp.h"
|
||||
#include "diagram.h"
|
||||
#include "diagramcontent.h"
|
||||
#include "qetgraphicsitem/conductor.h"
|
||||
@@ -45,7 +46,10 @@ ConductorNumExport::ConductorNumExport(QETProject *project, QWidget *parent) :
|
||||
*/
|
||||
bool ConductorNumExport::toCsv()
|
||||
{
|
||||
QString name = QObject::tr("numero_de_fileries_") + m_project->title() + ".csv";
|
||||
//save in csv file in same directory as project by default
|
||||
QString dir = m_project->currentDir();
|
||||
if (dir.isEmpty()) dir = QETApp::documentDir();
|
||||
QString name = dir + "/" + QObject::tr("numero_de_fileries_") + m_project->title() + ".csv";
|
||||
// if(!name.endsWith(".csv")) {
|
||||
// name += ".csv";
|
||||
// }
|
||||
|
||||
@@ -670,8 +670,7 @@ void projectDataBase::exportDb(projectDataBase *db,
|
||||
if(dir_.isEmpty()) {
|
||||
dir_ = db->project()->filePath();
|
||||
if (dir_.isEmpty()) {
|
||||
dir_ = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first();
|
||||
dir_ += QString("/") += tr("sans_nom") += ".sqlite";
|
||||
dir_ = QETApp::documentDir() + "/" + tr("sans_nom") + ".sqlite";
|
||||
} else {
|
||||
dir_.remove(".qet");
|
||||
dir_.append(".sqlite");
|
||||
|
||||
@@ -105,13 +105,13 @@ void PasteDiagramCommand::redo()
|
||||
}
|
||||
else
|
||||
{
|
||||
const QList <QGraphicsItem *> qgis_list = content.items(filter);
|
||||
const QList<QGraphicsItem *> qgis_list = content.items(filter);
|
||||
for (QGraphicsItem *item : qgis_list) {
|
||||
diagram->addItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
const QList <QGraphicsItem *> qgis_list = content.items();
|
||||
const QList<QGraphicsItem *> qgis_list = content.items();
|
||||
for (QGraphicsItem *qgi : qgis_list)
|
||||
qgi -> setSelected(true);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ DiagramContent::DiagramContent()
|
||||
DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
|
||||
m_selected_items(diagram->selectedItems())
|
||||
{
|
||||
QList <QGraphicsItem *> item_list;
|
||||
QList<QGraphicsItem *> item_list;
|
||||
if (selected) {
|
||||
item_list = m_selected_items;
|
||||
} else {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "diagrameventaddimage.h"
|
||||
|
||||
#include "../qetapp.h"
|
||||
#include "../diagram.h"
|
||||
#include "../undocommand/addgraphicsobjectcommand.h"
|
||||
#include "../qetgraphicsitem/diagramimageitem.h"
|
||||
@@ -155,7 +156,7 @@ void DiagramEventAddImage::openDialog()
|
||||
if (m_diagram -> isReadOnly()) return;
|
||||
|
||||
//Open dialog to select image
|
||||
QString pathPictures = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
QString pathPictures = QETApp::pictureDir();
|
||||
QString fileName = QFileDialog::getOpenFileName(m_diagram->views().isEmpty()? nullptr : m_diagram->views().first(), QObject::tr("Selectionner une image..."), pathPictures, QObject::tr("Image Files (*.png *.jpg *.jpeg *.bmp *.svg)"));
|
||||
|
||||
if (fileName.isEmpty()) return;
|
||||
|
||||
@@ -16,21 +16,18 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "exportproperties.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
#include "qetapp.h"
|
||||
|
||||
/**
|
||||
Constructeur par defaut :
|
||||
* le repertoire de destination est le Bureau de l'utilisateur
|
||||
* le repertoire de destination est l'emplacement des documents de l'utilisateur
|
||||
* le format d'export est PNG
|
||||
* la grille et les bornes ne doivent pas etre dessinees
|
||||
* la bordure et le cartouche doivent etre dessines
|
||||
* la zone exportee est le schema avec son cadre et son cartouche
|
||||
*/
|
||||
ExportProperties::ExportProperties() :
|
||||
destination_directory(
|
||||
QStandardPaths::writableLocation(
|
||||
QStandardPaths::DesktopLocation)),
|
||||
destination_directory(QETApp::documentDir()),
|
||||
format("PNG"),
|
||||
draw_grid(false),
|
||||
draw_border(true),
|
||||
@@ -85,14 +82,13 @@ void ExportProperties::toSettings(QSettings &settings,
|
||||
*/
|
||||
void ExportProperties::fromSettings(QSettings &settings,
|
||||
const QString &prefix) {
|
||||
QString desktop_path = QStandardPaths::writableLocation(
|
||||
QStandardPaths::DesktopLocation);
|
||||
QString export_path = QETApp::documentDir();
|
||||
destination_directory.setPath(
|
||||
settings.value(
|
||||
prefix + "path",
|
||||
desktop_path).toString());
|
||||
export_path).toString());
|
||||
if (!destination_directory.exists())
|
||||
destination_directory.setPath(desktop_path);
|
||||
destination_directory.setPath(export_path);
|
||||
|
||||
format = settings.value(prefix + "format").toString();
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ void MachineInfo::send_info_to_debug()
|
||||
qInfo()<< "";
|
||||
|
||||
|
||||
qInfo()<< " For elmt-files (user-/common-collections, user-/company-collections, user-/custom-collections, etc.):";
|
||||
qInfo()<< " Count the *.elmt files you have in your collections (Official-common-collection, user-/company-collections, user-/custom-collections, etc.):";
|
||||
QStringList nameFilters;
|
||||
nameFilters << "*.elmt";
|
||||
|
||||
@@ -193,7 +193,7 @@ void MachineInfo::send_info_to_debug()
|
||||
commomElementsDir ++;
|
||||
}
|
||||
}
|
||||
qInfo()<< " Common Elements count:"<< commomElementsDir;
|
||||
qInfo()<< " Common Elements count:"<< commomElementsDir << "Elements";
|
||||
|
||||
|
||||
int customElementsDir = 0;
|
||||
@@ -205,7 +205,7 @@ void MachineInfo::send_info_to_debug()
|
||||
customElementsDir ++;
|
||||
}
|
||||
}
|
||||
qInfo()<< " Custom Elements count:"<< customElementsDir;
|
||||
qInfo()<< " Custom Elements count:"<< customElementsDir << "Elements";
|
||||
|
||||
int companyElementsDir = 0;
|
||||
QDirIterator it3(QETApp::companyElementsDir().toLatin1(), nameFilters, QDir::Files, QDirIterator::Subdirectories);
|
||||
@@ -216,7 +216,8 @@ void MachineInfo::send_info_to_debug()
|
||||
companyElementsDir ++;
|
||||
}
|
||||
}
|
||||
qInfo()<< " Company Elements count:"<< companyElementsDir;
|
||||
qInfo()<< " Company Elements count:"<< companyElementsDir << "Elements";
|
||||
|
||||
qInfo()<< "";
|
||||
|
||||
qInfo()<< "*** Qt screens ***";
|
||||
@@ -251,7 +252,7 @@ void MachineInfo::send_info_to_debug()
|
||||
qInfo() << "FileSystemType:" << storage.fileSystemType();
|
||||
qInfo() << "SizeTotal:" << storage.bytesTotal()/1000000000 << "GB";
|
||||
qInfo() << "AvailableSize:" << storage.bytesAvailable()/1000000000 << "GB";
|
||||
|
||||
qInfo()<< "Count All Elements in collections ="<< commomElementsDir + customElementsDir + customElementsDir << "Elements";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -869,6 +869,44 @@ QString QETApp::dataDir()
|
||||
return datadir;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::documentDir
|
||||
Return the standard-folder where to save users documents
|
||||
This directory is generally
|
||||
C:/Users/<USER>/Documents
|
||||
on Windows and
|
||||
~/Documents
|
||||
under UNIX-like systems.
|
||||
\~ @return The path of users document-folder
|
||||
*/
|
||||
QString QETApp::documentDir()
|
||||
{
|
||||
QString docdir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
if (docdir.endsWith('/')) {
|
||||
docdir.remove(docdir.length()-1, 1);
|
||||
}
|
||||
return docdir;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::pictureDir
|
||||
Returns the standard-folder of users pictures
|
||||
This directory is generally
|
||||
C:/Users/<USER>/Pictures
|
||||
on Windows and
|
||||
~/Pictures
|
||||
under UNIX-like systems.
|
||||
\~ @return The path of users picture-folder
|
||||
*/
|
||||
QString QETApp::pictureDir()
|
||||
{
|
||||
QString picturedir = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
if (picturedir.endsWith('/')) {
|
||||
picturedir.remove(picturedir.length()-1, 1);
|
||||
}
|
||||
return picturedir;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief QETApp::realPath
|
||||
Allows you to know the absolute path of the * .elmt file
|
||||
|
||||
@@ -98,6 +98,8 @@ class QETApp : public QObject
|
||||
static int projectId(const QETProject *);
|
||||
static QString configDir();
|
||||
static QString dataDir();
|
||||
static QString documentDir();
|
||||
static QString pictureDir();
|
||||
static QString languagesPath();
|
||||
static QString realPath(const QString &);
|
||||
static QString symbolicPath(const QString &);
|
||||
|
||||
@@ -65,7 +65,7 @@ QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||
m_zoom_actions_group (this),
|
||||
m_select_actions_group (this),
|
||||
m_file_actions_group (this),
|
||||
open_dialog_dir (QStandardPaths::writableLocation(QStandardPaths::DesktopLocation))
|
||||
open_dialog_dir (QETApp::documentDir())
|
||||
{
|
||||
//Trivial property use to set the graphics handler size
|
||||
setProperty("graphics_handler_size", 10);
|
||||
|
||||
@@ -1166,7 +1166,7 @@ void Element::removeTextGroup(ElementTextItemGroup *group)
|
||||
if(!m_texts_group.contains(group))
|
||||
return;
|
||||
|
||||
const QList <QGraphicsItem *> items_list = group->childItems();
|
||||
const QList<QGraphicsItem *> items_list = group->childItems();
|
||||
|
||||
for(QGraphicsItem *qgi : items_list)
|
||||
{
|
||||
|
||||
@@ -359,7 +359,7 @@ Terminal* Terminal::alignedWithTerminal() const
|
||||
path.lineTo(line.p2());
|
||||
|
||||
//Get all QGraphicsItem in the alignement of this terminal
|
||||
QList <QGraphicsItem *> qgi_list = diagram() -> items(path);
|
||||
QList<QGraphicsItem *> qgi_list = diagram() -> items(path);
|
||||
|
||||
//Remove all terminals of the parent element
|
||||
foreach (Terminal *t, parent_element_ -> terminals())
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "qetversion.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QStandardPaths>
|
||||
#include <QTimer>
|
||||
#include <QtConcurrent>
|
||||
#include <QtDebug>
|
||||
@@ -361,15 +360,17 @@ void QETProject::setFilePath(const QString &filepath)
|
||||
}
|
||||
|
||||
/**
|
||||
@return le dossier contenant le fichier projet si celui-ci a ete
|
||||
enregistre ; dans le cas contraire, cette methode retourne l'emplacement
|
||||
du bureau de l'utilisateur.
|
||||
@return the folder containing the project file if it has been saved;
|
||||
otherwise, this method returns the location of the user's documents.
|
||||
en français:
|
||||
@return le dossier contenant le fichier du projet s'il a été enregistré ;
|
||||
sinon, cette méthode renvoie l'emplacement des documents de l'utilisateur.
|
||||
*/
|
||||
QString QETProject::currentDir() const
|
||||
{
|
||||
QString current_directory;
|
||||
if (m_file_path.isEmpty()) {
|
||||
current_directory = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||
current_directory = QETApp::documentDir();
|
||||
} else {
|
||||
current_directory = QFileInfo(m_file_path).absoluteDir().absolutePath();
|
||||
}
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
*/
|
||||
#include "templatelogomanager.h"
|
||||
|
||||
#include "../qetapp.h"
|
||||
#include "../qeticons.h"
|
||||
#include "../titleblocktemplate.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
|
||||
/**
|
||||
Constructor
|
||||
@param managed_template Title block template this widget manages logos for.
|
||||
@@ -78,7 +77,7 @@ void TitleBlockTemplateLogoManager::emitLogosChangedSignal()
|
||||
*/
|
||||
void TitleBlockTemplateLogoManager::initWidgets()
|
||||
{
|
||||
open_dialog_dir_.setPath(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
||||
open_dialog_dir_.setPath(QETApp::documentDir());
|
||||
|
||||
setWindowTitle(tr("Gestionnaire de logos"));
|
||||
setWindowIcon(QET::Icons::InsertImage);
|
||||
|
||||
@@ -62,8 +62,10 @@ int BOMExportDialog::exec()
|
||||
auto r = QDialog::exec();
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
//save in csv file
|
||||
QString file_name = tr("nomenclature_") + QString(m_project ->title() + ".csv");
|
||||
//save in csv file in same directory as project by default
|
||||
QString dir = m_project->currentDir();
|
||||
if (dir.isEmpty()) dir = QETApp::documentDir();
|
||||
QString file_name = dir + "/" + tr("nomenclature_") + QString(m_project ->title() + ".csv");
|
||||
QString file_path = QFileDialog::getSaveFileName(this, tr("Enregister sous... "), file_name, tr("Fichiers csv (*.csv)"));
|
||||
QFile file(file_path);
|
||||
if (!file_path.isEmpty())
|
||||
|
||||
Reference in New Issue
Block a user