Tue, 03 Jun 2014 20:28:10 +0300
- String -> QString
--- a/src/actions.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/actions.cc Tue Jun 03 20:28:10 2014 +0300 @@ -54,7 +54,7 @@ Ui::NewPartUI ui; ui.setupUi (dlg); - String authortext = cfg::defaultName; + QString authortext = cfg::defaultName; if (not cfg::defaultUser.isEmpty()) authortext.append (format (" [%1]", cfg::defaultUser)); @@ -90,7 +90,7 @@ ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW : ui.rb_bfc_cw->isChecked() ? LDBFC::CertifyCW : LDBFC::NoCertify; - const String license = + const QString license = ui.rb_license_ca->isChecked() ? g_CALicense : ui.rb_license_nonca->isChecked() ? g_nonCALicense : ""; @@ -123,7 +123,7 @@ // DEFINE_ACTION (Open, CTRL (O)) { - String name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)"); + QString name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)"); if (name.isEmpty()) return; @@ -392,7 +392,7 @@ // DEFINE_ACTION (InsertFrom, 0) { - String fname = QFileDialog::getOpenFileName(); + QString fname = QFileDialog::getOpenFileName(); int idx = getInsertionPoint(); if (not fname.length()) @@ -430,7 +430,7 @@ if (selection().isEmpty()) return; - String fname = QFileDialog::getSaveFileName(); + QString fname = QFileDialog::getSaveFileName(); if (fname.length() == 0) return; @@ -445,7 +445,7 @@ for (LDObjectPtr obj : selection()) { - String contents = obj->asText(); + QString contents = obj->asText(); QByteArray data = contents.toUtf8(); file.write (data, data.size()); file.write ("\r\n", 2); @@ -475,7 +475,7 @@ getCurrentDocument()->clearSelection(); - for (String line : String (te_edit->toPlainText()).split ("\n")) + for (QString line : QString (te_edit->toPlainText()).split ("\n")) { LDObjectPtr obj = parseLine (line); @@ -498,13 +498,13 @@ uchar* imgdata = R()->getScreencap (w, h); QImage img = imageFromScreencap (imgdata, w, h); - String root = basename (getCurrentDocument()->name()); + QString root = basename (getCurrentDocument()->name()); if (root.right (4) == ".dat") root.chop (4); - String defaultname = (root.length() > 0) ? format ("%1.png", root) : ""; - String fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, + QString defaultname = (root.length() > 0) ? format ("%1.png", root) : ""; + QString fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)"); if (not fname.isEmpty() && not img.save (fname)) @@ -723,28 +723,28 @@ if (selection().size() == 0) return; - String parentpath = getCurrentDocument()->fullPath(); + QString parentpath = getCurrentDocument()->fullPath(); // BFC type of the new subfile - it shall inherit the BFC type of the parent document LDBFC::Statement bfctype = LDBFC::NoCertify; // Dirname of the new subfile - String subdirname = dirname (parentpath); + QString subdirname = dirname (parentpath); // Title of the new subfile - String subtitle; + QString subtitle; // Comment containing the title of the parent document LDCommentPtr titleobj = getCurrentDocument()->getObject (0).dynamicCast<LDComment>(); // License text for the subfile - String license = getLicenseText (cfg::defaultLicense); + QString license = getLicenseText (cfg::defaultLicense); // LDraw code body of the new subfile (i.e. code of the selection) QStringList code; // Full path of the subfile to be - String fullsubname; + QString fullsubname; // Where to insert the subfile reference? int refidx = selection()[0]->lineNumber(); @@ -761,13 +761,13 @@ // If this the parent document isn't already in s/, we need to stuff it into // a subdirectory named s/. Ensure it exists! - String topdirname = basename (dirname (getCurrentDocument()->fullPath())); + QString topdirname = basename (dirname (getCurrentDocument()->fullPath())); if (topdirname != "s") { - String desiredPath = subdirname + "/s"; - String title = tr ("Create subfile directory?"); - String text = format (tr ("The directory <b>%1</b> is suggested for " + QString desiredPath = subdirname + "/s"; + QString title = tr ("Create subfile directory?"); + QString text = format (tr ("The directory <b>%1</b> is suggested for " "subfiles. This directory does not exist, create it?"), desiredPath); if (QDir (desiredPath).exists() || confirm (title, text)) @@ -793,9 +793,9 @@ parentpath.chop (subfilesuffix.matchedLength()); int subidx = 1; - String digits; + QString digits; QFile f; - String testfname; + QString testfname; // Now find the appropriate filename. Increase the number of the subfile // until we find a name which isn't already taken. @@ -853,7 +853,7 @@ doc->addObjects (objs); // Add the actual subfile code to the new document - for (String line : code) + for (QString line : code) { LDObjectPtr obj = parseLine (line); doc->addObject (obj);
--- a/src/actionsEdit.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/actionsEdit.cc Tue Jun 03 20:28:10 2014 +0300 @@ -50,7 +50,7 @@ qApp->clipboard()->clear(); // Now, copy the contents into the clipboard. - String data; + QString data; for (LDObjectPtr obj : objs) { @@ -86,12 +86,12 @@ // DEFINE_ACTION (Paste, CTRL (V)) { - const String clipboardText = qApp->clipboard()->text(); + const QString clipboardText = qApp->clipboard()->text(); int idx = getInsertionPoint(); getCurrentDocument()->clearSelection(); int num = 0; - for (String line : clipboardText.split ("\n")) + for (QString line : clipboardText.split ("\n")) { LDObjectPtr pasted = parseLine (line); getCurrentDocument()->insertObj (idx++, pasted); @@ -132,7 +132,7 @@ // Merge in the inlined objects for (LDObjectPtr inlineobj : objs) { - String line = inlineobj->asText(); + QString line = inlineobj->asText(); inlineobj->destroy(); LDObjectPtr newobj = parseLine (line); getCurrentDocument()->insertObj (idx++, newobj); @@ -744,7 +744,7 @@ return; // Create the comment object based on input - String commentText = format ("!HISTORY %1 [%2] %3", + QString commentText = format ("!HISTORY %1 [%2] %3", ui->m_date->date().toString ("yyyy-MM-dd"), ui->m_username->text(), ui->m_comment->text());
--- a/src/addObjectDialog.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/addObjectDialog.cc Tue Jun 03 20:28:10 2014 +0300 @@ -59,7 +59,7 @@ setlocale (LC_ALL, "C"); int coordCount = 0; - String typeName = LDObject::typeName (type); + QString typeName = LDObject::typeName (type); switch (type) { @@ -283,7 +283,7 @@ // ============================================================================= // ============================================================================= -String AddObjectDialog::currentSubfileName() +QString AddObjectDialog::currentSubfileName() { SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem()); @@ -305,7 +305,7 @@ // ============================================================================= void AddObjectDialog::slot_subfileTypeChanged() { - String name = currentSubfileName(); + QString name = currentSubfileName(); if (name.length() > 0) le_subfileName->setText (name); @@ -346,14 +346,14 @@ if (type == OBJ_Subfile) { - QStringList matrixstrvals = dlg.le_matrix->text().split (" ", String::SkipEmptyParts); + QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts); if (matrixstrvals.size() == 9) { double matrixvals[9]; int i = 0; - for (String val : matrixstrvals) + for (QString val : matrixstrvals) matrixvals[i++] = val.toFloat(); transform = Matrix (matrixvals); @@ -405,7 +405,7 @@ case OBJ_Subfile: { - String name = dlg.le_subfileName->text(); + QString name = dlg.le_subfileName->text(); if (name.length() == 0) return; // no subfile filename
--- a/src/addObjectDialog.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/addObjectDialog.h Tue Jun 03 20:28:10 2014 +0300 @@ -59,7 +59,7 @@ private: void setButtonBackground (QPushButton* button, int color); - String currentSubfileName(); + QString currentSubfileName(); int colnum;
--- a/src/basics.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/basics.cc Tue Jun 03 20:28:10 2014 +0300 @@ -86,7 +86,7 @@ } } -String Vertex::toString (bool mangled) const +QString Vertex::toString (bool mangled) const { if (mangled) return format ("(%1, %2, %3)", x(), y(), z()); @@ -141,16 +141,16 @@ // ============================================================================= // -String Matrix::toString() const +QString Matrix::toString() const { - String val; + QString val; for (int i = 0; i < 9; ++i) { if (i > 0) val += ' '; - val += String::number (m_vals[i]); + val += QString::number (m_vals[i]); } return val;
--- a/src/basics.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/basics.h Tue Jun 03 20:28:10 2014 +0300 @@ -39,7 +39,6 @@ using uint16 = quint16; using uint32 = quint32; using uint64 = quint64; -using String = QString; using LDObjectPtr = QSharedPointer<LDObject>; using LDObjectList = QList<LDObjectPtr>; using LDObjectWeakPtr = QWeakPointer<LDObject>; @@ -72,7 +71,7 @@ void apply (ApplyFunction func); void apply (ApplyConstFunction func) const; - String toString (bool mangled = false) const; + QString toString (bool mangled = false) const; void transform (const Matrix& matr, const Vertex& pos); void setCoordinate (Axis ax, qreal value); @@ -117,7 +116,7 @@ void dump() const; //! \returns a string representation of the matrix. - String toString() const; + QString toString() const; //! Zeroes the matrix out. void zero();
--- a/src/colors.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/colors.h Tue Jun 03 20:28:10 2014 +0300 @@ -25,7 +25,7 @@ class LDColor { public: - String name, hexcode; + QString name, hexcode; QColor faceColor, edgeColor; int index; };
--- a/src/configDialog.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/configDialog.cc Tue Jun 03 20:28:10 2014 +0300 @@ -217,9 +217,9 @@ // ============================================================================= static struct LDExtProgInfo { - const String name, + const QString name, iconname; - String* const path; + QString* const path; QLineEdit* input; QPushButton* setPathButton; #ifndef _WIN32 @@ -515,7 +515,7 @@ // // Pick a color and set the appropriate configuration option. // -void ConfigDialog::pickColor (String& conf, QPushButton* button) +void ConfigDialog::pickColor (QString& conf, QPushButton* button) { QColor col = QColorDialog::getColor (QColor (conf)); @@ -525,7 +525,7 @@ g = col.green(), b = col.blue(); - String colname; + QString colname; colname.sprintf ("#%.2X%.2X%.2X", r, g, b); conf = colname; setButtonBackground (button, colname); @@ -556,7 +556,7 @@ // ============================================================================= // Sets background color of a given button. // ============================================================================= -void ConfigDialog::setButtonBackground (QPushButton* button, String value) +void ConfigDialog::setButtonBackground (QPushButton* button, QString value) { button->setIcon (getIcon ("colorselect")); button->setAutoFillBackground (true); @@ -666,7 +666,7 @@ } assert (info != null); - String fpath = QFileDialog::getOpenFileName (this, format ("Path to %1", info->name), *info->path, g_extProgPathFilter); + QString fpath = QFileDialog::getOpenFileName (this, format ("Path to %1", info->name), *info->path, g_extProgPathFilter); if (fpath.isEmpty()) return; @@ -680,7 +680,7 @@ // void ConfigDialog::slot_findDownloadFolder() { - String dpath = QFileDialog::getExistingDirectory(); + QString dpath = QFileDialog::getExistingDirectory(); ui->downloadPath->setText (dpath); } @@ -691,17 +691,17 @@ void ConfigDialog::setShortcutText (ShortcutListItem* item) { QAction* act = item->action(); - String label = act->iconText(); - String keybind = item->keyConfig()->getValue().toString(); + QString label = act->iconText(); + QString keybind = item->keyConfig()->getValue().toString(); item->setText (format ("%1 (%2)", label, keybind)); } // ============================================================================= // Gets the configuration string of the quick color toolbar // ============================================================================= -String ConfigDialog::quickColorString() +QString ConfigDialog::quickColorString() { - String val; + QString val; for (const LDQuickColor& entry : quickColors) { @@ -759,12 +759,12 @@ // ============================================================================= void KeySequenceDialog::updateOutput() { - String shortcut = seq.toString(); + QString shortcut = seq.toString(); if (seq == QKeySequence()) shortcut = "<empty>"; - String text = format ("<center><b>%1</b></center>", shortcut); + QString text = format ("<center><b>%1</b></center>", shortcut); lb_output->setText (text); }
--- a/src/configDialog.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/configDialog.h Tue Jun 03 20:28:10 2014 +0300 @@ -64,12 +64,12 @@ void applySettings(); void addShortcut (KeySequenceConfigEntry& cfg, QAction* act, int& i); - void setButtonBackground (QPushButton* button, String value); - void pickColor (String& conf, QPushButton* button); + void setButtonBackground (QPushButton* button, QString value); + void pickColor (QString& conf, QPushButton* button); void updateQuickColorList (LDQuickColor* sel = null); void setShortcutText (ShortcutListItem* item); int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack); - String quickColorString(); + QString quickColorString(); QListWidgetItem* getSelectedQuickColor(); QList<ShortcutListItem*> getShortcutSelection(); void initExtProgs();
--- a/src/configuration.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/configuration.cc Tue Jun 03 20:28:10 2014 +0300 @@ -42,7 +42,7 @@ ConfigEntry* g_configPointers[MAX_CONFIG]; static int g_cfgPointerCursor = 0; -static QMap<String, ConfigEntry*> g_configsByName; +static QMap<QString, ConfigEntry*> g_configsByName; static QList<ConfigEntry*> g_configs; // @@ -50,11 +50,11 @@ // static QSettings* getSettingsObject() { - String path = qApp->applicationDirPath() + "/" UNIXNAME EXTENSION; + QString path = qApp->applicationDirPath() + "/" UNIXNAME EXTENSION; return new QSettings (path, QSettings::IniFormat); } -ConfigEntry::ConfigEntry (String name) : +ConfigEntry::ConfigEntry (QString name) : m_name (name) {} // @@ -113,7 +113,7 @@ // // Where is the configuration file located at? // -String Config::filepath (String file) +QString Config::filepath (QString file) { return Config::dirpath() + DIRSLASH + file; } @@ -121,7 +121,7 @@ // // Directory of the configuration file. // -String Config::dirpath() +QString Config::dirpath() { QSettings* cfg = getSettingsObject(); return dirname (cfg->fileName()); @@ -142,7 +142,7 @@ } template<typename T> -T* getConfigByName (String name, ConfigEntry::Type type) +T* getConfigByName (QString name, ConfigEntry::Type type) { auto it = g_configsByName.find (name); @@ -163,7 +163,7 @@ #undef IMPLEMENT_CONFIG #define IMPLEMENT_CONFIG(NAME) \ - NAME##ConfigEntry* NAME##ConfigEntry::getByName (String name) \ + NAME##ConfigEntry* NAME##ConfigEntry::getByName (QString name) \ { \ return getConfigByName<NAME##ConfigEntry> (name, E##NAME##Type); \ }
--- a/src/configuration.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/configuration.h Tue Jun 03 20:28:10 2014 +0300 @@ -43,14 +43,14 @@ bool load(); bool save(); void reset(); - String dirpath(); - String filepath (String file); + QString dirpath(); + QString filepath (QString file); } // ========================================================= class ConfigEntry { - PROPERTY (private, String, name, setName, STOCK_WRITE) + PROPERTY (private, QString, name, setName, STOCK_WRITE) public: enum Type @@ -65,14 +65,14 @@ }; using IntType = int; - using StringType = String; + using StringType = QString; using FloatType = float; using BoolType = bool; using KeySequenceType = QKeySequence; using ListType = QList<QVariant>; using VertexType = Vertex; - ConfigEntry (String name); + ConfigEntry (QString name); virtual QVariant getDefaultAsVariant() const = 0; virtual Type getType() const = 0; @@ -90,7 +90,7 @@ public: \ using ValueType = ConfigEntry::NAME##Type; \ \ - NAME##ConfigEntry (ValueType* valueptr, String name, ValueType def) : \ + NAME##ConfigEntry (ValueType* valueptr, QString name, ValueType def) : \ ConfigEntry (name), \ m_valueptr (valueptr), \ m_default (def) \ @@ -144,7 +144,7 @@ return QVariant::fromValue<ValueType> (m_default); \ } \ \ - static NAME##ConfigEntry* getByName (String name); \ + static NAME##ConfigEntry* getByName (QString name); \ \ private: \ ValueType* m_valueptr; \
--- a/src/crashCatcher.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/crashCatcher.cc Tue Jun 03 20:28:10 2014 +0300 @@ -32,7 +32,7 @@ static bool g_crashCatcherActive = false; // If an assertion failed, what was it? -static String g_assertionFailure; +static QString g_assertionFailure; // List of signals to catch and crash on static QList<int> g_signalsToCatch ({ @@ -75,9 +75,9 @@ if (commandsFile.open()) { commandsFile.write (format ("attach %1\n", pid).toLocal8Bit()); - commandsFile.write (String ("backtrace full\n").toLocal8Bit()); - commandsFile.write (String ("detach\n").toLocal8Bit()); - commandsFile.write (String ("quit").toLocal8Bit()); + commandsFile.write (QString ("backtrace full\n").toLocal8Bit()); + commandsFile.write (QString ("detach\n").toLocal8Bit()); + commandsFile.write (QString ("quit").toLocal8Bit()); commandsFile.close(); } @@ -91,8 +91,8 @@ #endif proc.waitForFinished (1000); - String output = String (proc.readAllStandardOutput()); - String err = String (proc.readAllStandardError()); + QString output = QString (proc.readAllStandardOutput()); + QString err = QString (proc.readAllStandardError()); QFile f (UNIXNAME "-crash.log"); if (f.open (QIODevice::WriteOnly))
--- a/src/dialogs.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/dialogs.cc Tue Jun 03 20:28:10 2014 +0300 @@ -112,7 +112,7 @@ // ============================================================================= // ============================================================================= -String OverlayDialog::fpath() const +QString OverlayDialog::fpath() const { return ui->filename->text(); } @@ -206,12 +206,12 @@ return ui->buttonBox->button (QDialogButtonBox::Cancel); } -void LDrawPathDialog::setPath (String path) +void LDrawPathDialog::setPath (QString path) { ui->path->setText (path); } -String LDrawPathDialog::filename() const +QString LDrawPathDialog::filename() const { return ui->path->text(); } @@ -220,7 +220,7 @@ // ============================================================================= void LDrawPathDialog::slot_findPath() { - String newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path"); + QString newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path"); if (newpath.length() > 0 && newpath != filename()) { @@ -304,12 +304,12 @@ // ============================================================================= // ============================================================================= -ExtProgPathPrompt::ExtProgPathPrompt (String progName, QWidget* parent, Qt::WindowFlags f) : +ExtProgPathPrompt::ExtProgPathPrompt (QString progName, QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f), ui (new Ui_ExtProgPath) { ui->setupUi (this); - String labelText = ui->m_label->text(); + QString labelText = ui->m_label->text(); labelText.replace ("<PROGRAM>", progName); ui->m_label->setText (labelText); connect (ui->m_findPath, SIGNAL (clicked (bool)), this, SLOT (findPath())); @@ -326,7 +326,7 @@ // ============================================================================= void ExtProgPathPrompt::findPath() { - String path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter); + QString path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter); if (not path.isEmpty()) ui->m_path->setText (path); @@ -334,7 +334,7 @@ // ============================================================================= // ============================================================================= -String ExtProgPathPrompt::getPath() const +QString ExtProgPathPrompt::getPath() const { return ui->m_path->text(); } @@ -346,7 +346,7 @@ { Ui::AboutUI ui; ui.setupUi (this); - ui.versionInfo->setText (APPNAME " " + String (fullVersionString())); + ui.versionInfo->setText (APPNAME " " + QString (fullVersionString())); QPushButton* mailButton = new QPushButton; mailButton->setText (tr ("Contact")); @@ -366,7 +366,7 @@ // ============================================================================= // ============================================================================= -void bombBox (const String& message) +void bombBox (const QString& message) { QDialog dlg (g_win); Ui_BombBox ui;
--- a/src/dialogs.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/dialogs.h Tue Jun 03 20:28:10 2014 +0300 @@ -46,7 +46,7 @@ explicit OverlayDialog (QWidget* parent = null, Qt::WindowFlags f = 0); virtual ~OverlayDialog(); - String fpath() const; + QString fpath() const; int ofsx() const; int ofsy() const; double lwidth() const; @@ -72,8 +72,8 @@ public: explicit LDrawPathDialog (const bool validDefault, QWidget* parent = null, Qt::WindowFlags f = 0); virtual ~LDrawPathDialog(); - String filename() const; - void setPath (String path); + QString filename() const; + void setPath (QString path); private: Q_DISABLE_COPY (LDrawPathDialog) @@ -115,9 +115,9 @@ Q_OBJECT public: - explicit ExtProgPathPrompt (String progName, QWidget* parent = 0, Qt::WindowFlags f = 0); + explicit ExtProgPathPrompt (QString progName, QWidget* parent = 0, Qt::WindowFlags f = 0); virtual ~ExtProgPathPrompt(); - String getPath() const; + QString getPath() const; public slots: void findPath(); @@ -138,4 +138,4 @@ void slot_mail(); }; -void bombBox (const String& message); +void bombBox (const QString& message);
--- a/src/editHistory.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/editHistory.h Tue Jun 03 20:28:10 2014 +0300 @@ -30,7 +30,7 @@ return History::E##N##History; \ } \ \ - virtual String getTypeName() const \ + virtual QString getTypeName() const \ { \ return #N; \ } @@ -96,7 +96,7 @@ virtual void undo() const = 0; virtual void redo() const = 0; virtual History::EHistoryType getType() const = 0; - virtual String getTypeName() const = 0; + virtual QString getTypeName() const = 0; }; // ============================================================================= @@ -104,7 +104,7 @@ class DelHistory : public AbstractHistoryEntry { PROPERTY (private, int, index, setIndex, STOCK_WRITE) - PROPERTY (private, String, code, setCode, STOCK_WRITE) + PROPERTY (private, QString, code, setCode, STOCK_WRITE) public: IMPLEMENT_HISTORY_TYPE (Del) @@ -116,13 +116,13 @@ class EditHistory : public AbstractHistoryEntry { PROPERTY (private, int, index, setIndex, STOCK_WRITE) - PROPERTY (private, String, oldCode, setOldCode, STOCK_WRITE) - PROPERTY (private, String, newCode, setNewCode, STOCK_WRITE) + PROPERTY (private, QString, oldCode, setOldCode, STOCK_WRITE) + PROPERTY (private, QString, newCode, setNewCode, STOCK_WRITE) public: IMPLEMENT_HISTORY_TYPE (Edit) - EditHistory (int idx, String oldCode, String newCode) : + EditHistory (int idx, QString oldCode, QString newCode) : m_index (idx), m_oldCode (oldCode), m_newCode (newCode) {} @@ -134,7 +134,7 @@ class AddHistory : public AbstractHistoryEntry { PROPERTY (private, int, index, setIndex, STOCK_WRITE) - PROPERTY (private, String, code, setCode, STOCK_WRITE) + PROPERTY (private, QString, code, setCode, STOCK_WRITE) public: IMPLEMENT_HISTORY_TYPE (Add)
--- a/src/extPrograms.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/extPrograms.cc Tue Jun 03 20:28:10 2014 +0300 @@ -58,7 +58,7 @@ CFGENTRY (String, rectifierPath, ""); CFGENTRY (String, edger2Path, ""); -String* const g_extProgPaths[] = +QString* const g_extProgPaths[] = { &cfg::isecalcPath, &cfg::intersectorPath, @@ -99,7 +99,7 @@ // ============================================================================= // -static bool mkTempFile (QTemporaryFile& tmp, String& fname) +static bool mkTempFile (QTemporaryFile& tmp, QString& fname) { if (not tmp.open()) return false; @@ -113,7 +113,7 @@ // static bool checkProgPath (const extprog prog) { - String& path = *g_extProgPaths[prog]; + QString& path = *g_extProgPaths[prog]; if (path.length() > 0) return true; @@ -131,13 +131,13 @@ // ============================================================================= // -static String processErrorString (extprog prog, QProcess& proc) +static QString processErrorString (extprog prog, QProcess& proc) { switch (proc.error()) { case QProcess::FailedToStart: { - String wineblurb; + QString wineblurb; #ifndef _WIN32 if (*g_extProgWine[prog]) @@ -187,7 +187,7 @@ // ============================================================================= // -static void writeObjects (const LDObjectList& objects, String fname) +static void writeObjects (const LDObjectList& objects, QString fname) { // Write the input file QFile f (fname); @@ -208,14 +208,14 @@ // ============================================================================= // -void writeSelection (String fname) +void writeSelection (QString fname) { writeObjects (selection(), fname); } // ============================================================================= // -void writeColorGroup (const int colnum, String fname) +void writeColorGroup (const int colnum, QString fname) { LDObjectList objects; @@ -232,10 +232,10 @@ // ============================================================================= // -bool runUtilityProcess (extprog prog, String path, String argvstr) +bool runUtilityProcess (extprog prog, QString path, QString argvstr) { QTemporaryFile input; - QStringList argv = argvstr.split (" ", String::SkipEmptyParts); + QStringList argv = argvstr.split (" ", QString::SkipEmptyParts); #ifndef _WIN32 if (*g_extProgWine[prog]) @@ -268,7 +268,7 @@ // Wait while it runs proc.waitForFinished(); - String err = ""; + QString err = ""; if (proc.exitStatus() != QProcess::NormalExit) err = processErrorString (prog, proc); @@ -288,7 +288,7 @@ // ============================================================================= // -static void insertOutput (String fname, bool replace, QList<int> colorsToReplace) +static void insertOutput (QString fname, bool replace, QList<int> colorsToReplace) { #ifdef DEBUG QFile::copy (fname, "./debug_lastOutput"); @@ -361,14 +361,14 @@ condAngle = ui.condAngle->value(); QTemporaryFile indat, outdat; - String inDATName, outDATName; + QString inDATName, outDATName; // Make temp files for the input and output files if (not mkTempFile (indat, inDATName) || not mkTempFile (outdat, outDATName)) return; // Compose the command-line arguments - String argv = join ( + QString argv = join ( { (axis == X) ? "-x" : (axis == Y) ? "-y" : "-z", (mode == Distance) ? "-d" : (mode == Symmetry) ? "-s" : (mode == Projection) ? "-p" : "-r", @@ -405,14 +405,14 @@ return; QTemporaryFile indat, outdat; - String inDATName, outDATName; + QString inDATName, outDATName; // Make temp files for the input and output files if (not mkTempFile (indat, inDATName) || not mkTempFile (outdat, outDATName)) return; // Compose arguments - String argv = join ( + QString argv = join ( { (not ui.cb_condense->isChecked()) ? "-q" : "", (not ui.cb_subst->isChecked()) ? "-r" : "", @@ -479,7 +479,7 @@ // outdat2 = inverse output // edgesdat = edges output (isecalc) QTemporaryFile indat, cutdat, outdat, outdat2, edgesdat; - String inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; + QString inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; if (not mkTempFile (indat, inDATName) || not mkTempFile (cutdat, cutDATName) || @@ -490,7 +490,7 @@ return; } - String parms = join ( + QString parms = join ( { (ui.cb_colorize->isChecked()) ? "-c" : "", (ui.cb_nocondense->isChecked()) ? "-t" : "", @@ -498,7 +498,7 @@ ui.dsb_prescale->value() }); - String argv_normal = join ( + QString argv_normal = join ( { parms, inDATName, @@ -506,7 +506,7 @@ outDATName }); - String argv_inverse = join ( + QString argv_inverse = join ( { parms, cutDATName, @@ -567,7 +567,7 @@ } QTemporaryFile in1dat, in2dat, outdat; - String in1DATName, in2DATName, outDATName; + QString in1DATName, in2DATName, outDATName; if (not mkTempFile (in1dat, in1DATName) || not mkTempFile (in2dat, in2DATName) || @@ -576,7 +576,7 @@ return; } - String argv = join ( + QString argv = join ( { (ui.cb_oldsweep->isChecked() ? "-s" : ""), (ui.cb_reverse->isChecked() ? "-r" : ""), @@ -633,7 +633,7 @@ } QTemporaryFile in1dat, in2dat, outdat; - String in1DATName, in2DATName, outDATName; + QString in1DATName, in2DATName, outDATName; if (not mkTempFile (in1dat, in1DATName) || not mkTempFile (in2dat, in2DATName) || @@ -642,7 +642,7 @@ return; } - String argv = join ( + QString argv = join ( { in1DATName, in2DATName, @@ -672,14 +672,14 @@ return; QTemporaryFile in, out; - String inName, outName; + QString inName, outName; if (not mkTempFile (in, inName) || not mkTempFile (out, outName)) return; int unmatched = ui.unmatched->currentIndex(); - String argv = join ( + QString argv = join ( { format ("-p %1", ui.precision->value()), format ("-af %1", ui.flatAngle->value()),
--- a/src/format.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/format.h Tue Jun 03 20:28:10 2014 +0300 @@ -29,14 +29,14 @@ class StringFormatArg { public: - StringFormatArg (const String& a) : m_text (a) {} + StringFormatArg (const QString& a) : m_text (a) {} StringFormatArg (const char& a) : m_text (a) {} StringFormatArg (const uchar& a) : m_text (a) {} StringFormatArg (const QChar& a) : m_text (a) {} - StringFormatArg (int a) : m_text (String::number (a)) {} - StringFormatArg (long a) : m_text (String::number (a)) {} - StringFormatArg (const float& a) : m_text (String::number (a)) {} - StringFormatArg (const double& a) : m_text (String::number (a)) {} + StringFormatArg (int a) : m_text (QString::number (a)) {} + StringFormatArg (long a) : m_text (QString::number (a)) {} + StringFormatArg (const float& a) : m_text (QString::number (a)) {} + StringFormatArg (const double& a) : m_text (QString::number (a)) {} StringFormatArg (const Vertex& a) : m_text (a.toString()) {} StringFormatArg (const Matrix& a) : m_text (a.toString()) {} StringFormatArg (const char* a) : m_text (a) {} @@ -75,20 +75,20 @@ m_text += "}"; } - inline String text() const + inline QString text() const { return m_text; } private: - String m_text; + QString m_text; }; //! //! Helper function for \c format //! template<typename Arg1, typename... Rest> -void formatHelper (String& str, Arg1 arg1, Rest... rest) +void formatHelper (QString& str, Arg1 arg1, Rest... rest) { str = str.arg (StringFormatArg (arg1).text()); formatHelper (str, rest...); @@ -97,8 +97,8 @@ //! //! Overload of \c formatHelper() with no template args //! -static void formatHelper (String& str) __attribute__ ((unused)); -static void formatHelper (String& str) +static void formatHelper (QString& str) __attribute__ ((unused)); +static void formatHelper (QString& str) { (void) str; } @@ -115,7 +115,7 @@ //! \return The formatted string //! template<typename... Args> -String format (String fmtstr, Args... args) +QString format (QString fmtstr, Args... args) { formatHelper (fmtstr, args...); return fmtstr; @@ -125,7 +125,7 @@ //! From MessageLog.cc - declared here so that I don't need to include //! messageLog.h here. Prints the given message to log. //! -void printToLog (const String& msg); +void printToLog (const QString& msg); //! //! Format and print the given args to the message log. @@ -133,7 +133,7 @@ //! \param args The args to format with //! template<typename... Args> -void print (String fmtstr, Args... args) +void print (QString fmtstr, Args... args) { formatHelper (fmtstr, args...); printToLog (fmtstr); @@ -146,7 +146,7 @@ //! \param args The args to format with //! template<typename... Args> -void fprint (FILE* fp, String fmtstr, Args... args) +void fprint (FILE* fp, QString fmtstr, Args... args) { formatHelper (fmtstr, args...); fprintf (fp, "%s", qPrintable (fmtstr)); @@ -159,7 +159,7 @@ //! \param args The args to format with //! template<typename... Args> -void fprint (QIODevice& dev, String fmtstr, Args... args) +void fprint (QIODevice& dev, QString fmtstr, Args... args) { formatHelper (fmtstr, args...); dev.write (fmtstr.toUtf8()); @@ -171,7 +171,7 @@ //! \param args The args to format with //! template<typename... Args> -void dprint (String fmtstr, Args... args) +void dprint (QString fmtstr, Args... args) { #ifndef RELEASE formatHelper (fmtstr, args...);
--- a/src/glCompiler.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/glCompiler.cc Tue Jun 03 20:28:10 2014 +0300 @@ -30,7 +30,7 @@ struct GLErrorInfo { GLenum value; - String text; + QString text; }; static const GLErrorInfo g_GLErrors[] = @@ -59,7 +59,7 @@ // void checkGLError_private (const char* file, int line) { - String errmsg; + QString errmsg; GLenum errnum = glGetError(); if (errnum == GL_NO_ERROR) @@ -74,7 +74,7 @@ } } - print ("OpenGL ERROR: at %1:%2: %3", basename (String (file)), line, errmsg); + print ("OpenGL ERROR: at %1:%2: %3", basename (QString (file)), line, errmsg); } // =============================================================================
--- a/src/glRenderer.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/glRenderer.cc Tue Jun 03 20:28:10 2014 +0300 @@ -135,7 +135,7 @@ // Init camera icons for (ECamera cam = EFirstCamera; cam < ENumCameras; ++cam) { - String iconname = format ("camera-%1", tr (g_CameraNames[cam]).toLower()); + QString iconname = format ("camera-%1", tr (g_CameraNames[cam]).toLower()); CameraIcon* info = &m_cameraIcons[cam]; info->img = new QPixmap (getIcon (iconname)); info->cam = cam; @@ -593,7 +593,7 @@ #ifndef RELEASE if (not isPicking()) { - String text = format ("Rotation: (%1, %2, %3)\nPanning: (%4, %5), Zoom: %6", + QString text = format ("Rotation: (%1, %2, %3)\nPanning: (%4, %5), Zoom: %6", rot(X), rot(Y), rot(Z), pan(X), pan(Y), zoom()); QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); paint.setPen (textpen); @@ -618,7 +618,7 @@ } // Paint the coordinates onto the screen. - String text = format (tr ("X: %1, Y: %2, Z: %3"), m_position3D[X], m_position3D[Y], m_position3D[Z]); + QString text = format (tr ("X: %1, Y: %2, Z: %3"), m_position3D[X], m_position3D[Y], m_position3D[Z]); QFontMetrics metrics = QFontMetrics (font()); QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); paint.setPen (textpen); @@ -696,7 +696,7 @@ if (cfg::drawLineLengths) { - const String label = String::number ((poly3d[j] - poly3d[i]).length()); + const QString label = QString::number ((poly3d[j] - poly3d[i]).length()); QPoint origin = QLineF (poly[i], poly[j]).pointAt (0.5).toPoint(); paint.drawText (origin, label); } @@ -711,7 +711,7 @@ if (angle < 0) angle = 180 - l1.angleTo (l0); - String label = String::number (angle) + String::fromUtf8 (QByteArray ("\302\260")); + QString label = QString::number (angle) + QString::fromUtf8 (QByteArray ("\302\260")); QPoint pos = poly[i]; pos.setY (pos.y() + metrics.height()); @@ -798,13 +798,13 @@ { // Draw the current radius in the middle of the circle. QPoint origin = coordconv3_2 (m_drawedVerts[0]); - String label = String::number (dist0); + QString label = QString::number (dist0); paint.setPen (textpen); paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label); if (m_drawedVerts.size() >= 2) { - label = String::number (dist1); + label = QString::number (dist1); paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y() + metrics.height(), label); } } @@ -830,13 +830,13 @@ paint.drawPixmap (info.destRect, *info.img, info.srcRect); } - String formatstr = tr ("%1 Camera"); + QString formatstr = tr ("%1 Camera"); // Draw a label for the current camera in the bottom left corner { const int margin = 4; - String label; + QString label; label = format (formatstr, tr (g_CameraNames[camera()])); paint.setPen (textpen); paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label); @@ -849,7 +849,7 @@ m_drawToolTip = false; else { - String label = format (formatstr, tr (g_CameraNames[m_toolTipCamera])); + QString label = format (formatstr, tr (g_CameraNames[m_toolTipCamera])); QToolTip::showText (m_globalpos, label); } } @@ -1739,7 +1739,7 @@ // ============================================================================= // -bool GLRenderer::setupOverlay (ECamera cam, String file, int x, int y, int w, int h) +bool GLRenderer::setupOverlay (ECamera cam, QString file, int x, int y, int w, int h) { QImage* img = new QImage (QImage (file).convertToFormat (QImage::Format_ARGB32)); LDGLOverlay& info = getOverlay (cam);
--- a/src/glRenderer.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/glRenderer.h Tue Jun 03 20:28:10 2014 +0300 @@ -49,7 +49,7 @@ oy; double lw, lh; - String fname; + QString fname; QImage* img; bool invalid; }; @@ -178,7 +178,7 @@ void setBackground(); void setCamera (const ECamera cam); void setDepthValue (double depth); - bool setupOverlay (ECamera cam, String file, int x, int y, int w, int h); + bool setupOverlay (ECamera cam, QString file, int x, int y, int w, int h); void updateOverlayObjects(); void zoomNotch (bool inward); @@ -296,7 +296,7 @@ } template<typename... Args> - inline String format (String fmtstr, Args... args) + inline QString format (QString fmtstr, Args... args) { return ::format (fmtstr, args...); }
--- a/src/ldConfig.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/ldConfig.cc Tue Jun 03 20:28:10 2014 +0300 @@ -27,7 +27,7 @@ // // Helper function for parseLDConfig // -static bool parseLDConfigTag (LDConfigParser& pars, char const* tag, String& val) +static bool parseLDConfigTag (LDConfigParser& pars, char const* tag, QString& val) { int pos; @@ -54,7 +54,7 @@ // Read in the lines while (not fp->atEnd()) { - String line = String::fromUtf8 (fp->readLine()); + QString line = QString::fromUtf8 (fp->readLine()); if (line.isEmpty() || line[0] != '0') continue; // empty or illogical @@ -66,7 +66,7 @@ LDConfigParser pars (line, ' '); int code = 0, alpha = 255; - String name, facename, edgename, valuestr; + QString name, facename, edgename, valuestr; // Check 0 !COLOUR, parse the name if (not pars.tokenCompare (0, "0") || @@ -124,9 +124,9 @@ // ============================================================================= // -LDConfigParser::LDConfigParser (String inText, char sep) +LDConfigParser::LDConfigParser (QString inText, char sep) { - m_tokens = inText.split (sep, String::SkipEmptyParts); + m_tokens = inText.split (sep, QString::SkipEmptyParts); m_pos = -1; } @@ -146,7 +146,7 @@ // ============================================================================= // -bool LDConfigParser::getToken (String& val, const int pos) +bool LDConfigParser::getToken (QString& val, const int pos) { if (pos >= m_tokens.size()) return false; @@ -157,14 +157,14 @@ // ============================================================================= // -bool LDConfigParser::getNextToken (String& val) +bool LDConfigParser::getNextToken (QString& val) { return getToken (val, ++m_pos); } // ============================================================================= // -bool LDConfigParser::peekNextToken (String& val) +bool LDConfigParser::peekNextToken (QString& val) { return getToken (val, m_pos + 1); } @@ -210,7 +210,7 @@ // bool LDConfigParser::tokenCompare (int inPos, const char* sOther) { - String tok; + QString tok; if (not getToken (tok, inPos)) return false;
--- a/src/ldConfig.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/ldConfig.h Tue Jun 03 20:28:10 2014 +0300 @@ -27,20 +27,20 @@ class LDConfigParser { public: - LDConfigParser (String inText, char sep); + LDConfigParser (QString inText, char sep); bool isAtEnd(); bool isAtBeginning(); - bool getNextToken (String& val); - bool peekNextToken (String& val); - bool getToken (String& val, const int pos); + bool getNextToken (QString& val); + bool peekNextToken (QString& val); + bool getToken (QString& val, const int pos); bool findToken (int& result, char const* needle, int args); int getSize(); void rewind(); void seek (int amount, bool rel); bool tokenCompare (int inPos, const char* sOther); - inline String operator[] (const int idx) + inline QString operator[] (const int idx) { return m_tokens[idx]; }
--- a/src/ldDocument.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/ldDocument.cc Tue Jun 03 20:28:10 2014 +0300 @@ -52,12 +52,12 @@ // namespace LDPaths { - static String pathError; + static QString pathError; struct { - String LDConfigPath; - String partsPath, primsPath; + QString LDConfigPath; + QString partsPath, primsPath; } pathInfo; void initPaths() @@ -73,7 +73,7 @@ } } - bool tryConfigure (String path) + bool tryConfigure (QString path) { QDir dir; @@ -100,22 +100,22 @@ } // Accessors - String getError() + QString getError() { return pathError; } - String ldconfig() + QString ldconfig() { return pathInfo.LDConfigPath; } - String prims() + QString prims() { return pathInfo.primsPath; } - String parts() + QString parts() { return pathInfo.partsPath; } @@ -214,7 +214,7 @@ // ============================================================================= // -LDDocumentPtr findDocument (String name) +LDDocumentPtr findDocument (QString name) { for (LDDocumentPtr file : g_allDocuments) { @@ -227,7 +227,7 @@ // ============================================================================= // -String dirname (String path) +QString dirname (QString path) { long lastpos = path.lastIndexOf (DIRSLASH); @@ -244,7 +244,7 @@ // ============================================================================= // -String basename (String path) +QString basename (QString path) { long lastpos = path.lastIndexOf (DIRSLASH); @@ -256,9 +256,9 @@ // ============================================================================= // -static String findLDrawFilePath (String relpath, bool subdirs) +static QString findLDrawFilePath (QString relpath, bool subdirs) { - String fullPath; + QString fullPath; // LDraw models use Windows-style path separators. If we're not on Windows, // replace the path separator now before opening any files. Qt expects @@ -269,24 +269,24 @@ // Try find it relative to other currently open documents. We want a file // in the immediate vicinity of a current model to override stock LDraw stuff. - String reltop = basename (dirname (relpath)); + QString reltop = basename (dirname (relpath)); for (LDDocumentPtr doc : g_allDocuments) { if (doc->fullPath().isEmpty()) continue; - String partpath = format ("%1/%2", dirname (doc->fullPath()), relpath); + QString partpath = format ("%1/%2", dirname (doc->fullPath()), relpath); QFile f (partpath); if (f.exists()) { // ensure we don't mix subfiles and 48-primitives with non-subfiles and non-48 - String proptop = basename (dirname (partpath)); + QString proptop = basename (dirname (partpath)); bool bogus = false; - for (String s : g_specialSubdirectories) + for (QString s : g_specialSubdirectories) { if ((proptop == s && reltop != s) || (reltop == s && proptop != s)) { @@ -313,9 +313,9 @@ { // Look in sub-directories: parts and p. Also look in net_downloadpath, since that's // where we download parts from the PT to. - for (const String& topdir : QList<String> ({ cfg::ldrawPath, cfg::downloadFilePath })) + for (const QString& topdir : QList<QString> ({ cfg::ldrawPath, cfg::downloadFilePath })) { - for (const String& subdir : QList<String> ({ "parts", "p" })) + for (const QString& subdir : QList<QString> ({ "parts", "p" })) { fullPath = format ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath); @@ -331,10 +331,10 @@ // ============================================================================= // -QFile* openLDrawFile (String relpath, bool subdirs, String* pathpointer) +QFile* openLDrawFile (QString relpath, bool subdirs, QString* pathpointer) { print ("Opening %1...\n", relpath); - String path = findLDrawFilePath (relpath, subdirs); + QString path = findLDrawFilePath (relpath, subdirs); if (pathpointer != null) *pathpointer = path; @@ -403,7 +403,7 @@ for (; i < max && i < (int) lines().size(); ++i) { - String line = lines()[i]; + QString line = lines()[i]; // Trim the trailing newline QChar c; @@ -480,7 +480,7 @@ // Read in the lines while (not fp->atEnd()) - lines << String::fromUtf8 (fp->readLine()); + lines << QString::fromUtf8 (fp->readLine()); LDFileLoader* loader = new LDFileLoader; loader->setWarnings (numWarnings); @@ -506,13 +506,13 @@ // ============================================================================= // -LDDocumentPtr openDocument (String path, bool search, bool implicit, LDDocumentPtr fileToOverride) +LDDocumentPtr openDocument (QString path, bool search, bool implicit, LDDocumentPtr fileToOverride) { // Convert the file name to lowercase since some parts contain uppercase // file names. I'll assume here that the library will always use lowercase // file names for the actual parts.. QFile* fp; - String fullpath; + QString fullpath; if (search) fp = openLDrawFile (path.toLower(), true, &fullpath); @@ -574,7 +574,7 @@ // If we have unsaved changes, warn and give the option of saving. if (hasUnsavedChanges()) { - String message = format (tr ("There are unsaved changes to %1. Should it be saved?"), getDisplayName()); + QString message = format (tr ("There are unsaved changes to %1. Should it be saved?"), getDisplayName()); int button = msgbox::question (g_win, tr ("Unsaved Changes"), message, (msgbox::Yes | msgbox::No | msgbox::Cancel), msgbox::Cancel); @@ -586,7 +586,7 @@ // If we don't have a file path yet, we have to ask the user for one. if (name().length() == 0) { - String newpath = QFileDialog::getSaveFileName (g_win, tr ("Save As"), + QString newpath = QFileDialog::getSaveFileName (g_win, tr ("Save As"), getCurrentDocument()->name(), tr ("LDraw files (*.dat *.ldr)")); if (newpath.length() == 0) @@ -646,7 +646,7 @@ // ============================================================================= // -void addRecentFile (String path) +void addRecentFile (QString path) { auto& rfiles = cfg::recentFiles; int idx = rfiles.indexOf (path); @@ -675,12 +675,12 @@ // ============================================================================= // Open an LDraw file and set it as the main model // ============================================================================= -void openMainFile (String path) +void openMainFile (QString path) { // If there's already a file with the same name, this file must replace it. LDDocumentPtr documentToReplace; LDDocumentPtr file; - String shortName = LDDocument::shortenName (path); + QString shortName = LDDocument::shortenName (path); for (LDDocumentWeakPtr doc : g_allDocuments) { @@ -738,7 +738,7 @@ // ============================================================================= // -bool LDDocument::save (String savepath) +bool LDDocument::save (QString savepath) { if (isImplicit()) return false; @@ -755,7 +755,7 @@ if (nameComment->text().left (6) == "Name: ") { - String newname = shortenName (savepath); + QString newname = shortenName (savepath); nameComment->setText (format ("Name: %1", newname)); g_win->buildObjList(); } @@ -799,7 +799,7 @@ static void checkTokenCount (const QStringList& tokens, int num) { if (tokens.size() != num) - throw String (format ("Bad amount of tokens, expected %1, got %2", num, tokens.size())); + throw QString (format ("Bad amount of tokens, expected %1, got %2", num, tokens.size())); } // ============================================================================= @@ -817,7 +817,7 @@ if (not ok && not scient.exactMatch (tokens[i])) { - throw String (format ("Token #%1 was `%2`, expected a number (matched length: %3)", + throw QString (format ("Token #%1 was `%2`, expected a number (matched length: %3)", (i + 1), tokens[i], scient.matchedLength())); } } @@ -837,11 +837,11 @@ // code and returns the object parsed from it. parseLine never returns null, // the object will be LDError if it could not be parsed properly. // ============================================================================= -LDObjectPtr parseLine (String line) +LDObjectPtr parseLine (QString line) { try { - QStringList tokens = line.split (" ", String::SkipEmptyParts); + QStringList tokens = line.split (" ", QString::SkipEmptyParts); if (tokens.size() <= 0) { @@ -850,7 +850,7 @@ } if (tokens[0].length() != 1 || not tokens[0][0].isDigit()) - throw String ("Illogical line code"); + throw QString ("Illogical line code"); int num = tokens[0][0].digitValue(); @@ -859,8 +859,8 @@ case 0: { // Comment - String commentText (line.mid (line.indexOf ("0") + 2)); - String commentTextSimplified (commentText.simplified()); + QString commentText (line.mid (line.indexOf ("0") + 2)); + QString commentTextSimplified (commentText.simplified()); // Handle BFC statements if (tokens.size() > 2 && tokens[1] == "BFC") @@ -1005,10 +1005,10 @@ } default: - throw String ("Unknown line code number"); + throw QString ("Unknown line code number"); } } - catch (String& e) + catch (QString& e) { // Strange line we couldn't parse return spawn<LDError> (line, e); @@ -1017,7 +1017,7 @@ // ============================================================================= // -LDDocumentPtr getDocument (String filename) +LDDocumentPtr getDocument (QString filename) { // Try find the file in the list of loaded files LDDocumentPtr doc = findDocument (filename); @@ -1226,8 +1226,8 @@ // Mark this change to history if (not m_history->isIgnoring()) { - String oldcode = getObject (idx)->asText(); - String newcode = obj->asText(); + QString oldcode = getObject (idx)->asText(); + QString newcode = obj->asText(); *m_history << new EditHistory (idx, oldcode, newcode); } @@ -1272,7 +1272,7 @@ // ============================================================================= // -String LDDocument::getDisplayName() +QString LDDocument::getDisplayName() { if (not name().isEmpty()) return name(); @@ -1485,10 +1485,10 @@ // ============================================================================= // -String LDDocument::shortenName (String a) // [static] +QString LDDocument::shortenName (QString a) // [static] { - String shortname = basename (a); - String topdirname = basename (dirname (a)); + QString shortname = basename (a); + QString topdirname = basename (dirname (a)); if (g_specialSubdirectories.contains (topdirname)) shortname.prepend (topdirname + "\\");
--- a/src/ldDocument.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/ldDocument.h Tue Jun 03 20:28:10 2014 +0300 @@ -31,12 +31,12 @@ namespace LDPaths { void initPaths(); - bool tryConfigure (String path); + bool tryConfigure (QString path); - String ldconfig(); - String prims(); - String parts(); - String getError(); + QString ldconfig(); + QString prims(); + QString parts(); + QString getError(); } // @@ -65,13 +65,13 @@ public: using KnownVertexMap = QMap<Vertex, int>; - PROPERTY (public, String, name, setName, STOCK_WRITE) + PROPERTY (public, QString, name, setName, STOCK_WRITE) PROPERTY (private, LDObjectList, objects, setObjects, STOCK_WRITE) PROPERTY (private, LDObjectList, cache, setCache, STOCK_WRITE) PROPERTY (private, History*, history, setHistory, STOCK_WRITE) PROPERTY (private, KnownVertexMap, vertices, setVertices, STOCK_WRITE) - PROPERTY (public, String, fullPath, setFullPath, STOCK_WRITE) - PROPERTY (public, String, defaultName, setDefaultName, STOCK_WRITE) + PROPERTY (public, QString, fullPath, setFullPath, STOCK_WRITE) + PROPERTY (public, QString, defaultName, setDefaultName, STOCK_WRITE) PROPERTY (public, bool, isImplicit, setImplicit, CUSTOM_WRITE) PROPERTY (public, long, savePosition, setSavePosition, STOCK_WRITE) PROPERTY (public, int, tabIndex, setTabIndex, STOCK_WRITE) @@ -87,7 +87,7 @@ void addObjects (const LDObjectList objs); void clearSelection(); void forgetObject (LDObjectPtr obj); // Deletes the given object from the object chain. - String getDisplayName(); + QString getDisplayName(); const LDObjectList& getSelection() const; bool hasUnsavedChanges() const; // Does this document have unsaved changes? void initializeCachedData(); @@ -95,7 +95,7 @@ void insertObj (int pos, LDObjectPtr obj); int getObjectCount() const; LDObjectPtr getObject (int pos) const; - bool save (String path = ""); // Saves this file to disk. + bool save (QString path = ""); // Saves this file to disk. void swapObjects (LDObjectPtr one, LDObjectPtr other); bool isSafeToClose(); // Perform safety checks. Do this before closing any files! void setObject (int idx, LDObjectPtr obj); @@ -150,7 +150,7 @@ static LDDocumentPtr createNew(); // Turns a full path into a relative path - static String shortenName (String a); + static QString shortenName (QString a); static QList<LDDocumentPtr> const& explicitDocuments(); protected: @@ -187,27 +187,27 @@ void newFile(); // Opens the given file as the main file. Everything is closed first. -void openMainFile (String path); +void openMainFile (QString path); // Finds an OpenFile by name or null if not open -LDDocumentPtr findDocument (String name); +LDDocumentPtr findDocument (QString name); // Opens the given file and parses the LDraw code within. Returns a pointer // to the opened file or null on error. -LDDocumentPtr openDocument (String path, bool search, bool implicit, LDDocumentPtr fileToOverride = LDDocumentPtr()); +LDDocumentPtr openDocument (QString path, bool search, bool implicit, LDDocumentPtr fileToOverride = LDDocumentPtr()); // Opens the given file and returns a pointer to it, potentially looking in /parts and /p -QFile* openLDrawFile (String relpath, bool subdirs, String* pathpointer = null); +QFile* openLDrawFile (QString relpath, bool subdirs, QString* pathpointer = null); // Close all open files, whether user-opened or subfile caches. void closeAll(); // Parses a string line containing an LDraw object and returns the object parsed. -LDObjectPtr parseLine (String line); +LDObjectPtr parseLine (QString line); // Retrieves the pointer to the given document by file name. Document is loaded // from file if necessary. Can return null if neither succeeds. -LDDocumentPtr getDocument (String filename); +LDDocumentPtr getDocument (QString filename); // Re-caches all subfiles. void reloadAllSubfiles(); @@ -222,10 +222,10 @@ return getCurrentDocument()->getSelection(); } -void addRecentFile (String path); +void addRecentFile (QString path); void loadLogoedStuds(); -String basename (String path); -String dirname (String path); +QString basename (QString path); +QString dirname (QString path); // ============================================================================= //
--- a/src/ldObject.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/ldObject.cc Tue Jun 03 20:28:10 2014 +0300 @@ -106,16 +106,16 @@ // ============================================================================= // -String LDComment::asText() const +QString LDComment::asText() const { return format ("0 %1", text()); } // ============================================================================= // -String LDSubfile::asText() const +QString LDSubfile::asText() const { - String val = format ("1 %1 %2 ", color(), position()); + QString val = format ("1 %1 %2 ", color(), position()); val += transform().toString(); val += ' '; val += fileInfo()->name(); @@ -124,9 +124,9 @@ // ============================================================================= // -String LDLine::asText() const +QString LDLine::asText() const { - String val = format ("2 %1", color()); + QString val = format ("2 %1", color()); for (int i = 0; i < 2; ++i) val += format (" %1", vertex (i)); @@ -136,9 +136,9 @@ // ============================================================================= // -String LDTriangle::asText() const +QString LDTriangle::asText() const { - String val = format ("3 %1", color()); + QString val = format ("3 %1", color()); for (int i = 0; i < 3; ++i) val += format (" %1", vertex (i)); @@ -148,9 +148,9 @@ // ============================================================================= // -String LDQuad::asText() const +QString LDQuad::asText() const { - String val = format ("4 %1", color()); + QString val = format ("4 %1", color()); for (int i = 0; i < 4; ++i) val += format (" %1", vertex (i)); @@ -160,9 +160,9 @@ // ============================================================================= // -String LDCondLine::asText() const +QString LDCondLine::asText() const { - String val = format ("5 %1", color()); + QString val = format ("5 %1", color()); // Add the coordinates for (int i = 0; i < 4; ++i) @@ -173,21 +173,21 @@ // ============================================================================= // -String LDError::asText() const +QString LDError::asText() const { return contents(); } // ============================================================================= // -String LDVertex::asText() const +QString LDVertex::asText() const { return format ("0 !LDFORGE VERTEX %1 %2", color(), pos); } // ============================================================================= // -String LDEmpty::asText() const +QString LDEmpty::asText() const { return ""; } @@ -208,7 +208,7 @@ "NOCLIP", }; -String LDBFC::asText() const +QString LDBFC::asText() const { return format ("0 BFC %1", LDBFC::k_statementStrings[m_statement]); } @@ -476,16 +476,16 @@ // ============================================================================= // -String LDObject::typeName (LDObjectType type) +QString LDObject::typeName (LDObjectType type) { return LDObject::getDefault (type)->typeName(); } // ============================================================================= // -String LDObject::describeObjects (const LDObjectList& objs) +QString LDObject::describeObjects (const LDObjectList& objs) { - String text; + QString text; if (objs.isEmpty()) return "nothing"; // :) @@ -504,7 +504,7 @@ if (not text.isEmpty()) text += ", "; - String noun = format ("%1%2", typeName (objType), plural (count)); + QString noun = format ("%1%2", typeName (objType), plural (count)); // Plural of "vertex" is "vertices", correct that if (objType == OBJ_Vertex && count != 1) @@ -769,7 +769,7 @@ // ============================================================================= // -String LDOverlay::asText() const +QString LDOverlay::asText() const { return format ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6", fileName(), camera(), x(), y(), width(), height()); @@ -793,9 +793,9 @@ if (obj->document() != null && (idx = obj->lineNumber()) != -1) { - String before = obj->asText(); + QString before = obj->asText(); *ptr = val; - String after = obj->asText(); + QString after = obj->asText(); if (before != after) { @@ -929,7 +929,7 @@ // ============================================================================= // -String getLicenseText (int id) +QString getLicenseText (int id) { switch (id) {
--- a/src/ldObject.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/ldObject.h Tue Jun 03 20:28:10 2014 +0300 @@ -28,7 +28,7 @@ { \ return OBJ_##T; \ } \ - virtual String asText() const override; \ + virtual QString asText() const override; \ virtual void invert() override; \ \ LD##T (LDObjectPtr* selfptr); \ @@ -36,7 +36,7 @@ protected: \ friend class QSharedPointer<LD##T>::ExternalRefCount; \ -#define LDOBJ_NAME(N) public: virtual String typeName() const override { return #N; } +#define LDOBJ_NAME(N) public: virtual QString typeName() const override { return #N; } #define LDOBJ_VERTICES(V) public: virtual int numVertices() const override { return V; } #define LDOBJ_SETCOLORED(V) public: virtual bool isColored() const override { return V; } #define LDOBJ_COLORED LDOBJ_SETCOLORED (true) @@ -101,7 +101,7 @@ LDObject (LDObjectPtr* selfptr); // This object as LDraw code - virtual String asText() const = 0; + virtual QString asText() const = 0; // Makes a copy of this object LDObjectPtr createCopy() const; @@ -164,13 +164,13 @@ virtual LDObjectType type() const = 0; // Type name of this object - virtual String typeName() const = 0; + virtual QString typeName() const = 0; // Get a vertex by index const Vertex& vertex (int i) const; // Get type name by enumerator - static String typeName (LDObjectType type); + static QString typeName (LDObjectType type); // Returns a default-constructed LDObject by the given type static LDObjectPtr getDefault (const LDObjectType type); @@ -179,7 +179,7 @@ static void moveObjects (LDObjectList objs, const bool up); // Get a description of a list of LDObjects - static String describeObjects (const LDObjectList& objs); + static QString describeObjects (const LDObjectList& objs); static LDObjectPtr fromID (int id); LDPolygon* getPolygon(); @@ -335,12 +335,12 @@ LDOBJ_UNCOLORED LDOBJ_SCEMANTIC LDOBJ_NO_MATRIX - PROPERTY (public, String, fileReferenced, setFileReferenced, STOCK_WRITE) - PROPERTY (private, String, contents, setContents, STOCK_WRITE) - PROPERTY (private, String, reason, setReason, STOCK_WRITE) + PROPERTY (public, QString, fileReferenced, setFileReferenced, STOCK_WRITE) + PROPERTY (private, QString, contents, setContents, STOCK_WRITE) + PROPERTY (private, QString, reason, setReason, STOCK_WRITE) public: - LDError (LDObjectPtr* selfptr, String contents, String reason) : + LDError (LDObjectPtr* selfptr, QString contents, QString reason) : LDObject (selfptr), m_contents (contents), m_reason (reason) {} @@ -372,7 +372,7 @@ // class LDComment : public LDObject { - PROPERTY (public, String, text, setText, STOCK_WRITE) + PROPERTY (public, QString, text, setText, STOCK_WRITE) LDOBJ (Comment) LDOBJ_NAME (comment) LDOBJ_VERTICES (0) @@ -381,7 +381,7 @@ LDOBJ_NO_MATRIX public: - LDComment (LDObjectPtr* selfptr, String text) : + LDComment (LDObjectPtr* selfptr, QString text) : LDObject (selfptr), m_text (text) {} }; @@ -612,16 +612,16 @@ PROPERTY (public, int, y, setY, STOCK_WRITE) PROPERTY (public, int, width, setWidth, STOCK_WRITE) PROPERTY (public, int, height, setHeight, STOCK_WRITE) - PROPERTY (public, String, fileName, setFileName, STOCK_WRITE) + PROPERTY (public, QString, fileName, setFileName, STOCK_WRITE) }; using LDOverlayPtr = QSharedPointer<LDOverlay>; using LDOverlayWeakPtr = QWeakPointer<LDOverlay>; // Other common LDraw stuff -static const String g_CALicense ("!LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt"); -static const String g_nonCALicense ("!LICENSE Not redistributable : see NonCAreadme.txt"); +static const QString g_CALicense ("!LICENSE Redistributable under CCAL version 2.0 : see CAreadme.txt"); +static const QString g_nonCALicense ("!LICENSE Not redistributable : see NonCAreadme.txt"); static const int g_lores = 16; static const int g_hires = 48; -String getLicenseText (int id); +QString getLicenseText (int id);
--- a/src/main.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/main.cc Tue Jun 03 20:28:10 2014 +0300 @@ -35,7 +35,7 @@ #include "crashCatcher.h" MainWindow* g_win = null; -static String g_versionString, g_fullVersionString; +static QString g_versionString, g_fullVersionString; const Vertex g_origin (0.0f, 0.0f, 0.0f); const Matrix g_identity ({1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f});
--- a/src/mainWindow.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/mainWindow.cc Tue Jun 03 20:28:10 2014 +0300 @@ -113,7 +113,7 @@ // KeySequenceConfigEntry* MainWindow::shortcutForAction (QAction* action) { - String keycfgname = action->objectName() + "Shortcut"; + QString keycfgname = action->objectName() + "Shortcut"; return KeySequenceConfigEntry::getByName (keycfgname); } @@ -175,7 +175,7 @@ for (const QVariant& it : cfg::recentFiles) { - String file = it.toString(); + QString file = it.toString(); QAction* recent = new QAction (getIcon ("open-recent"), file, this); connect (recent, SIGNAL (triggered()), this, SLOT (slot_recentFile())); @@ -191,7 +191,7 @@ { QList<LDQuickColor> colors; - for (String colorname : cfg::quickColorToolbar.split (":")) + for (QString colorname : cfg::quickColorToolbar.split (":")) { if (colorname == "|") colors << LDQuickColor::getSeparator(); @@ -252,7 +252,7 @@ // void MainWindow::updateTitle() { - String title = format (APPNAME " %1", fullVersionString()); + QString title = format (APPNAME " %1", fullVersionString()); // Append our current file if we have one if (getCurrentDocument()) @@ -320,7 +320,7 @@ for (LDObjectPtr obj : getCurrentDocument()->objects()) { - String descr; + QString descr; switch (obj->type()) { @@ -727,11 +727,11 @@ // bool MainWindow::save (LDDocumentPtr doc, bool saveAs) { - String path = doc->fullPath(); + QString path = doc->fullPath(); if (saveAs || path.isEmpty()) { - String name = doc->defaultName(); + QString name = doc->defaultName(); if (not doc->fullPath().isEmpty()) name = doc->fullPath(); @@ -761,7 +761,7 @@ return true; } - String message = format (tr ("Failed to save to %1: %2"), path, strerror (errno)); + QString message = format (tr ("Failed to save to %1: %2"), path, strerror (errno)); // Tell the user the save failed, and give the option for saving as with it. QMessageBox dlg (QMessageBox::Critical, tr ("Save Failure"), message, QMessageBox::Close, g_win); @@ -779,7 +779,7 @@ return false; } -void MainWindow::addMessage (String msg) +void MainWindow::addMessage (QString msg) { m_msglog->addLine (msg); } @@ -792,21 +792,21 @@ // ============================================================================= // -QPixmap getIcon (String iconName) +QPixmap getIcon (QString iconName) { return (QPixmap (format (":/icons/%1.png", iconName))); } // ============================================================================= // -bool confirm (const String& message) +bool confirm (const QString& message) { return confirm (MainWindow::tr ("Confirm"), message); } // ============================================================================= // -bool confirm (const String& title, const String& message) +bool confirm (const QString& title, const QString& message) { return QMessageBox::question (g_win, title, message, (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes; @@ -814,7 +814,7 @@ // ============================================================================= // -void critical (const String& message) +void critical (const QString& message) { QMessageBox::critical (g_win, MainWindow::tr ("Error"), message, (QMessageBox::Close), QMessageBox::Close);
--- a/src/mainWindow.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/mainWindow.h Tue Jun 03 20:28:10 2014 +0300 @@ -174,7 +174,7 @@ } //! Adds a message to the renderer's message manager. - void addMessage (String msg); + void addMessage (QString msg); //! Updates the object list. Right now this just rebuilds it. void refreshObjectList(); @@ -314,7 +314,7 @@ extern MainWindow* g_win; //! Get an icon by name from the resources directory. -QPixmap getIcon (String iconName); +QPixmap getIcon (QString iconName); //! \returns a list of quick colors based on the configuration entry. QList<LDQuickColor> quickColorsFromConfig(); @@ -322,15 +322,15 @@ //! Asks the user a yes/no question with the given \c message and the given //! window \c title. //! \returns true if the user answered yes, false if no. -bool confirm (const String& title, const String& message); // Generic confirm prompt +bool confirm (const QString& title, const QString& message); // Generic confirm prompt //! An overload of \c confirm(), this asks the user a yes/no question with the //! given \c message. //! \returns true if the user answered yes, false if no. -bool confirm (const String& message); +bool confirm (const QString& message); //! Displays an error prompt with the given \c message -void critical (const String& message); +void critical (const QString& message); //! Makes an icon of \c size x \c size pixels to represent \c colinfo QIcon makeColorIcon (LDColor* colinfo, const int size);
--- a/src/messageLog.cc Mon Jun 02 14:34:23 2014 +0300 +++ b/src/messageLog.cc Tue Jun 03 20:28:10 2014 +0300 @@ -38,7 +38,7 @@ // ============================================================================= // -MessageManager::Line::Line (String text) : +MessageManager::Line::Line (QString text) : text (text), alpha (1.0f), expiry (QDateTime::currentDateTime().addSecs (g_expiry)) {} @@ -71,7 +71,7 @@ // ============================================================================= // Add a line to the message manager. // -void MessageManager::addLine (String line) +void MessageManager::addLine (QString line) { // If there's too many entries, pop the excess out while (m_lines.size() >= g_maxMessages) @@ -118,9 +118,9 @@ // ============================================================================= // -void printToLog (const String& msg) +void printToLog (const QString& msg) { - for (String& a : msg.split ("\n", String::SkipEmptyParts)) + for (QString& a : msg.split ("\n", QString::SkipEmptyParts)) { if (g_win != null) g_win->addMessage (a);
--- a/src/messageLog.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/messageLog.h Tue Jun 03 20:28:10 2014 +0300 @@ -50,7 +50,7 @@ { public: //! Constructs a line with the given \c text - Line (String text); + Line (QString text); //! Check this line's expiry and update alpha accordingly. //! \c changed is updated to whether the line has somehow @@ -59,7 +59,7 @@ //! \returns if it expired. bool update (bool& changed); - String text; + QString text; float alpha; QDateTime expiry; }; @@ -68,7 +68,7 @@ explicit MessageManager (QObject* parent = null); //! Adds a line with the given \c text to the message manager. - void addLine (String line); + void addLine (QString line); //! \returns all active lines in the message manager. const QList<Line>& getLines() const;
--- a/src/miscallenous.h Mon Jun 02 14:34:23 2014 +0300 +++ b/src/miscallenous.h Tue Jun 03 20:28:10 2014 +0300 @@ -143,10 +143,10 @@ a.erase (std::unique (a.begin(), a.end()), a.end()); } -inline String utf16 (const char16_t* a) +inline QString utf16 (const char16_t* a) { if (Q_LIKELY (sizeof(char16_t) == sizeof(unsigned short))) - return String::fromUtf16 (reinterpret_cast<const unsigned short*> (a)); + return QString::fromUtf16 (reinterpret_cast<const unsigned short*> (a)); QVector<unsigned short> data; @@ -154,5 +154,5 @@ data << *ap; data << '\u0000'; - return String::fromUtf16 (data.constData()); + return QString::fromUtf16 (data.constData()); }