Sun, 27 Apr 2014 04:23:09 +0300
- type-aliased QString to String
--- a/src/actions.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/actions.cc Sun Apr 27 04:23:09 2014 +0300 @@ -54,7 +54,7 @@ Ui::NewPartUI ui; ui.setupUi (dlg); - QString authortext = ld_defaultname; + String authortext = ld_defaultname; if (not ld_defaultuser.isEmpty()) authortext.append (format (" [%1]", ld_defaultuser)); @@ -90,7 +90,7 @@ ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW : ui.rb_bfc_cw->isChecked() ? LDBFC::CertifyCW : LDBFC::NoCertify; - const QString license = + const String license = ui.rb_license_ca->isChecked() ? g_CALicense : ui.rb_license_nonca->isChecked() ? g_nonCALicense : ""; @@ -120,7 +120,7 @@ // DEFINE_ACTION (Open, CTRL (O)) { - QString name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)"); + String name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)"); if (name.length() == 0) return; @@ -325,7 +325,7 @@ // If we're selecting subfile references, the reference filename must also // be uniform. - QString refName; + String refName; if (type == LDObject::ESubfile) { @@ -384,7 +384,7 @@ // DEFINE_ACTION (InsertFrom, 0) { - QString fname = QFileDialog::getOpenFileName(); + String fname = QFileDialog::getOpenFileName(); int idx = getInsertionPoint(); if (not fname.length()) @@ -422,7 +422,7 @@ if (selection().isEmpty()) return; - QString fname = QFileDialog::getSaveFileName(); + String fname = QFileDialog::getSaveFileName(); if (fname.length() == 0) return; @@ -437,7 +437,7 @@ for (LDObject* obj : selection()) { - QString contents = obj->asText(); + String contents = obj->asText(); QByteArray data = contents.toUtf8(); file.write (data, data.size()); file.write ("\r\n", 2); @@ -467,7 +467,7 @@ getCurrentDocument()->clearSelection(); - for (QString line : QString (te_edit->toPlainText()).split ("\n")) + for (String line : String (te_edit->toPlainText()).split ("\n")) { LDObject* obj = parseLine (line); @@ -490,13 +490,13 @@ uchar* imgdata = R()->getScreencap (w, h); QImage img = imageFromScreencap (imgdata, w, h); - QString root = basename (getCurrentDocument()->name()); + String root = basename (getCurrentDocument()->name()); if (root.right (4) == ".dat") root.chop (4); - QString defaultname = (root.length() > 0) ? format ("%1.png", root) : ""; - QString fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, + String defaultname = (root.length() > 0) ? format ("%1.png", root) : ""; + String 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)) @@ -711,28 +711,28 @@ if (selection().size() == 0) return; - QString parentpath = getCurrentDocument()->fullPath(); + String 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 - QString subdirname = dirname (parentpath); + String subdirname = dirname (parentpath); // Title of the new subfile - QString subtitle; + String subtitle; // Comment containing the title of the parent document LDComment* titleobj = dynamic_cast<LDComment*> (getCurrentDocument()->getObject (0)); // License text for the subfile - QString license = getLicenseText (ld_defaultlicense); + String license = getLicenseText (ld_defaultlicense); // LDraw code body of the new subfile (i.e. code of the selection) QStringList code; // Full path of the subfile to be - QString fullsubname; + String fullsubname; // Where to insert the subfile reference? int refidx = selection()[0]->lineNumber(); @@ -749,13 +749,13 @@ // If this the parent document isn't already in s/, we need to stuff it into // a subdirectory named s/. Ensure it exists! - QString topdirname = basename (dirname (getCurrentDocument()->fullPath())); + String topdirname = basename (dirname (getCurrentDocument()->fullPath())); if (topdirname != "s") { - QString desiredPath = subdirname + "/s"; - QString title = tr ("Create subfile directory?"); - QString text = format (tr ("The directory <b>%1</b> is suggested for " + String desiredPath = subdirname + "/s"; + String title = tr ("Create subfile directory?"); + String 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)) @@ -778,9 +778,9 @@ parentpath.chop (subfilesuffix.matchedLength()); int subidx = 1; - QString digits; + String digits; QFile f; - QString testfname; + String testfname; do { @@ -834,7 +834,7 @@ }); // Add the actual subfile code to the new document - for (QString line : code) + for (String line : code) { LDObject* obj = parseLine (line); doc->addObject (obj);
--- a/src/actionsEdit.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/actionsEdit.cc Sun Apr 27 04:23:09 2014 +0300 @@ -48,7 +48,7 @@ qApp->clipboard()->clear(); // Now, copy the contents into the clipboard. - QString data; + String data; for (LDObject* obj : objs) { @@ -84,12 +84,12 @@ // DEFINE_ACTION (Paste, CTRL (V)) { - const QString clipboardText = qApp->clipboard()->text(); + const String clipboardText = qApp->clipboard()->text(); int idx = getInsertionPoint(); getCurrentDocument()->clearSelection(); int num = 0; - for (QString line : clipboardText.split ("\n")) + for (String line : clipboardText.split ("\n")) { LDObject* pasted = parseLine (line); getCurrentDocument()->insertObj (idx++, pasted); @@ -130,7 +130,7 @@ // Merge in the inlined objects for (LDObject* inlineobj : objs) { - QString line = inlineobj->asText(); + String line = inlineobj->asText(); inlineobj->destroy(); LDObject* newobj = parseLine (line); getCurrentDocument()->insertObj (idx++, newobj); @@ -752,7 +752,7 @@ return; // Create the comment object based on input - QString commentText = format ("!HISTORY %1 [%2] %3", + String 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 Sun Apr 27 04:15:25 2014 +0300 +++ b/src/addObjectDialog.cc Sun Apr 27 04:23:09 2014 +0300 @@ -59,7 +59,7 @@ setlocale (LC_ALL, "C"); int coordCount = 0; - QString typeName = LDObject::typeName (type); + String typeName = LDObject::typeName (type); switch (type) { @@ -286,7 +286,7 @@ // ============================================================================= // ============================================================================= -QString AddObjectDialog::currentSubfileName() +String AddObjectDialog::currentSubfileName() { SubfileListItem* item = static_cast<SubfileListItem*> (tw_subfileList->currentItem()); @@ -308,7 +308,7 @@ // ============================================================================= void AddObjectDialog::slot_subfileTypeChanged() { - QString name = currentSubfileName(); + String name = currentSubfileName(); if (name.length() > 0) le_subfileName->setText (name); @@ -349,14 +349,14 @@ if (type == LDObject::ESubfile) { - QStringList matrixstrvals = dlg.le_matrix->text().split (" ", QString::SkipEmptyParts); + QStringList matrixstrvals = dlg.le_matrix->text().split (" ", String::SkipEmptyParts); if (matrixstrvals.size() == 9) { double matrixvals[9]; int i = 0; - for (QString val : matrixstrvals) + for (String val : matrixstrvals) matrixvals[i++] = val.toFloat(); transform = Matrix (matrixvals); @@ -408,7 +408,7 @@ case LDObject::ESubfile: { - QString name = dlg.le_subfileName->text(); + String name = dlg.le_subfileName->text(); if (name.length() == 0) return; // no subfile filename
--- a/src/addObjectDialog.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/addObjectDialog.h Sun Apr 27 04:23:09 2014 +0300 @@ -59,7 +59,7 @@ private: void setButtonBackground (QPushButton* button, int color); - QString currentSubfileName(); + String currentSubfileName(); int colnum;
--- a/src/basics.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/basics.cc Sun Apr 27 04:23:09 2014 +0300 @@ -86,7 +86,7 @@ } } -QString Vertex::toString (bool mangled) const +String Vertex::toString (bool mangled) const { if (mangled) return format ("(%1, %2, %3)", x(), y(), z()); @@ -141,16 +141,16 @@ // ============================================================================= // -QString Matrix::toString() const +String Matrix::toString() const { - QString val; + String val; for (int i = 0; i < 9; ++i) { if (i > 0) val += ' '; - val += QString::number (m_vals[i]); + val += String::number (m_vals[i]); } return val;
--- a/src/basics.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/basics.h Sun Apr 27 04:23:09 2014 +0300 @@ -36,6 +36,7 @@ using uint16 = quint16; using uint32 = quint32; using uint64 = quint64; +using String = QString; template<typename T, typename R> using Pair = std::pair<T, R>; @@ -68,7 +69,7 @@ void apply (ApplyFunction func); void apply (ApplyConstFunction func) const; - QString toString (bool mangled = false) const; + String toString (bool mangled = false) const; void transform (const Matrix& matr, const Vertex& pos); void setCoordinate (Axis ax, qreal value); @@ -113,7 +114,7 @@ void dump() const; //! \returns a string representation of the matrix. - QString toString() const; + String toString() const; //! Zeroes the matrix out. void zero();
--- a/src/colors.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/colors.h Sun Apr 27 04:23:09 2014 +0300 @@ -25,7 +25,7 @@ class LDColor { public: - QString name, hexcode; + String name, hexcode; QColor faceColor, edgeColor; int index; };
--- a/src/configDialog.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/configDialog.cc Sun Apr 27 04:23:09 2014 +0300 @@ -218,7 +218,7 @@ { // Icon lb_gridIcons[i] = new QLabel; - lb_gridIcons[i]->setPixmap (getIcon (format ("grid-%1", QString (g_GridInfo[i].name).toLower()))); + lb_gridIcons[i]->setPixmap (getIcon (format ("grid-%1", String (g_GridInfo[i].name).toLower()))); // Text label lb_gridLabels[i] = new QLabel (format ("%1:", g_GridInfo[i].name)); @@ -249,9 +249,9 @@ // ============================================================================= static struct LDExtProgInfo { - const QString name, + const String name, iconname; - QString* const path; + String* const path; QLineEdit* input; QPushButton* setPathButton; #ifndef _WIN32 @@ -541,7 +541,7 @@ // // Pick a color and set the appropriate configuration option. // -void ConfigDialog::pickColor (QString& conf, QPushButton* button) +void ConfigDialog::pickColor (String& conf, QPushButton* button) { QColor col = QColorDialog::getColor (QColor (conf)); @@ -551,7 +551,7 @@ g = col.green(), b = col.blue(); - QString colname; + String colname; colname.sprintf ("#%.2X%.2X%.2X", r, g, b); conf = colname; setButtonBackground (button, colname); @@ -582,7 +582,7 @@ // ============================================================================= // Sets background color of a given button. // ============================================================================= -void ConfigDialog::setButtonBackground (QPushButton* button, QString value) +void ConfigDialog::setButtonBackground (QPushButton* button, String value) { button->setIcon (getIcon ("colorselect")); button->setAutoFillBackground (true); @@ -692,7 +692,7 @@ } assert (info != null); - QString fpath = QFileDialog::getOpenFileName (this, format ("Path to %1", info->name), *info->path, g_extProgPathFilter); + String fpath = QFileDialog::getOpenFileName (this, format ("Path to %1", info->name), *info->path, g_extProgPathFilter); if (fpath.isEmpty()) return; @@ -706,7 +706,7 @@ // void ConfigDialog::slot_findDownloadFolder() { - QString dpath = QFileDialog::getExistingDirectory(); + String dpath = QFileDialog::getExistingDirectory(); ui->downloadPath->setText (dpath); } @@ -717,17 +717,17 @@ void ConfigDialog::setShortcutText (ShortcutListItem* item) { QAction* act = item->action(); - QString label = act->iconText(); - QString keybind = item->keyConfig()->getValue().toString(); + String label = act->iconText(); + String keybind = item->keyConfig()->getValue().toString(); item->setText (format ("%1 (%2)", label, keybind)); } // ============================================================================= // Gets the configuration string of the quick color toolbar // ============================================================================= -QString ConfigDialog::quickColorString() +String ConfigDialog::quickColorString() { - QString val; + String val; for (const LDQuickColor& entry : quickColors) { @@ -785,12 +785,12 @@ // ============================================================================= void KeySequenceDialog::updateOutput() { - QString shortcut = seq.toString(); + String shortcut = seq.toString(); if (seq == QKeySequence()) shortcut = "<empty>"; - QString text = format ("<center><b>%1</b></center>", shortcut); + String text = format ("<center><b>%1</b></center>", shortcut); lb_output->setText (text); }
--- a/src/configDialog.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/configDialog.h Sun Apr 27 04:23:09 2014 +0300 @@ -67,12 +67,12 @@ void applySettings(); void addShortcut (KeySequenceConfig& cfg, QAction* act, int& i); - void setButtonBackground (QPushButton* button, QString value); - void pickColor (QString& conf, QPushButton* button); + void setButtonBackground (QPushButton* button, String value); + void pickColor (String& conf, QPushButton* button); void updateQuickColorList (LDQuickColor* sel = null); void setShortcutText (ShortcutListItem* item); int getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack); - QString quickColorString(); + String quickColorString(); QListWidgetItem* getSelectedQuickColor(); QList<ShortcutListItem*> getShortcutSelection(); void initGrids();
--- a/src/configuration.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/configuration.cc Sun Apr 27 04:23:09 2014 +0300 @@ -40,7 +40,7 @@ Config* g_configPointers[MAX_CONFIG]; static int g_cfgPointerCursor = 0; -static QMap<QString, Config*> g_configsByName; +static QMap<String, Config*> g_configsByName; static QList<Config*> g_configs; // ============================================================================= @@ -48,11 +48,11 @@ // ============================================================================= static QSettings* getSettingsObject() { - QString path = qApp->applicationDirPath() + "/" UNIXNAME EXTENSION; + String path = qApp->applicationDirPath() + "/" UNIXNAME EXTENSION; return new QSettings (path, QSettings::IniFormat); } -Config::Config (QString name) : +Config::Config (String name) : m_name (name) {} // ============================================================================= @@ -112,7 +112,7 @@ // ============================================================================= // Where is the configuration file located at? // ============================================================================= -QString Config::filepath (QString file) +String Config::filepath (String file) { return Config::dirpath() + DIRSLASH + file; } @@ -120,7 +120,7 @@ // ============================================================================= // Directory of the configuration file. // ============================================================================= -QString Config::dirpath() +String Config::dirpath() { QSettings* cfg = getSettingsObject(); return dirname (cfg->fileName()); @@ -142,7 +142,7 @@ // ============================================================================= // ============================================================================= -template<class T> T* getConfigByName (QString name, Config::Type type) +template<class T> T* getConfigByName (String name, Config::Type type) { auto it = g_configsByName.find (name); @@ -165,7 +165,7 @@ #undef IMPLEMENT_CONFIG #define IMPLEMENT_CONFIG(NAME) \ - NAME##Config* NAME##Config::getByName (QString name) \ + NAME##Config* NAME##Config::getByName (String name) \ { \ return getConfigByName<NAME##Config> (name, E##NAME##Type); \ }
--- a/src/configuration.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/configuration.h Sun Apr 27 04:23:09 2014 +0300 @@ -37,7 +37,7 @@ // ========================================================= class Config { - PROPERTY (private, QString, name, setName, STOCK_WRITE) + PROPERTY (private, String, name, setName, STOCK_WRITE) public: enum Type @@ -52,14 +52,14 @@ }; using IntType = int; - using StringType = QString; + using StringType = String; using FloatType = float; using BoolType = bool; using KeySequenceType = QKeySequence; using ListType = QList<QVariant>; using VertexType = Vertex; - Config (QString name); + Config (String name); virtual QVariant getDefaultAsVariant() const = 0; virtual Type getType() const = 0; @@ -72,8 +72,8 @@ static bool load(); static bool save(); static void reset(); - static QString dirpath(); - static QString filepath (QString file); + static String dirpath(); + static String filepath (String file); protected: static void addToArray (Config* ptr); @@ -84,7 +84,7 @@ public: \ using ValueType = Config::NAME##Type; \ \ - NAME##Config (ValueType* valueptr, QString name, ValueType def) : \ + NAME##Config (ValueType* valueptr, String name, ValueType def) : \ Config (name), \ m_valueptr (valueptr), \ m_default (def) \ @@ -138,7 +138,7 @@ return QVariant::fromValue<ValueType> (m_default); \ } \ \ - static NAME##Config* getByName (QString name); \ + static NAME##Config* getByName (String name); \ \ private: \ ValueType* m_valueptr; \
--- a/src/crashCatcher.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/crashCatcher.cc Sun Apr 27 04:23:09 2014 +0300 @@ -37,7 +37,7 @@ static bool g_crashCatcherActive = false; // If an assertion failed, what was it? -static QString g_assertionFailure; +static String g_assertionFailure; // List of signals to catch and crash on static QList<int> g_signalsToCatch ({ @@ -68,9 +68,9 @@ if (commandsFile.open()) { commandsFile.write (format ("attach %1\n", pid).toLocal8Bit()); - commandsFile.write (QString ("backtrace full\n").toLocal8Bit()); - commandsFile.write (QString ("detach\n").toLocal8Bit()); - commandsFile.write (QString ("quit").toLocal8Bit()); + commandsFile.write (String ("backtrace full\n").toLocal8Bit()); + commandsFile.write (String ("detach\n").toLocal8Bit()); + commandsFile.write (String ("quit").toLocal8Bit()); commandsFile.flush(); commandsFile.close(); } @@ -87,8 +87,8 @@ #endif proc.waitForFinished (1000); - QString output = QString (proc.readAllStandardOutput()); - QString err = QString (proc.readAllStandardError()); + String output = String (proc.readAllStandardOutput()); + String err = String (proc.readAllStandardError()); bombBox (format ("<h3>Program crashed with signal %1</h3>\n\n" "%2" @@ -122,7 +122,7 @@ // void assertionFailure (const char* file, int line, const char* funcname, const char* expr) { - QString errmsg = format ( + String errmsg = format ( "<p><b>File</b>: <tt>%1</tt><br />" "<b>Line</b>: <tt>%2</tt><br />" "<b>Function:</b> <tt>%3</tt></p>"
--- a/src/dialogs.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/dialogs.cc Sun Apr 27 04:23:09 2014 +0300 @@ -112,7 +112,7 @@ // ============================================================================= // ============================================================================= -QString OverlayDialog::fpath() const +String OverlayDialog::fpath() const { return ui->filename->text(); } @@ -178,7 +178,7 @@ okButton()->setEnabled (false); - connect (ui->path, SIGNAL (textEdited (QString)), this, SLOT (slot_tryConfigure())); + connect (ui->path, SIGNAL (textEdited (String)), this, SLOT (slot_tryConfigure())); connect (ui->searchButton, SIGNAL (clicked()), this, SLOT (slot_findPath())); connect (ui->buttonBox, SIGNAL (rejected()), this, validDefault ? SLOT (reject()) : SLOT (slot_exit())); connect (ui->buttonBox, SIGNAL (accepted()), this, SLOT (slot_accept())); @@ -206,12 +206,12 @@ return ui->buttonBox->button (QDialogButtonBox::Cancel); } -void LDrawPathDialog::setPath (QString path) +void LDrawPathDialog::setPath (String path) { ui->path->setText (path); } -QString LDrawPathDialog::filename() const +String LDrawPathDialog::filename() const { return ui->path->text(); } @@ -220,7 +220,7 @@ // ============================================================================= void LDrawPathDialog::slot_findPath() { - QString newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path"); + String newpath = QFileDialog::getExistingDirectory (this, "Find LDraw Path"); if (newpath.length() > 0 && newpath != filename()) { @@ -304,12 +304,12 @@ // ============================================================================= // ============================================================================= -ExtProgPathPrompt::ExtProgPathPrompt (QString progName, QWidget* parent, Qt::WindowFlags f) : +ExtProgPathPrompt::ExtProgPathPrompt (String progName, QWidget* parent, Qt::WindowFlags f) : QDialog (parent, f), ui (new Ui_ExtProgPath) { ui->setupUi (this); - QString labelText = ui->m_label->text(); + String 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() { - QString path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter); + String path = QFileDialog::getOpenFileName (null, "", "", g_extProgPathFilter); if (not path.isEmpty()) ui->m_path->setText (path); @@ -334,7 +334,7 @@ // ============================================================================= // ============================================================================= -QString ExtProgPathPrompt::getPath() const +String ExtProgPathPrompt::getPath() const { return ui->m_path->text(); } @@ -346,7 +346,7 @@ { Ui::AboutUI ui; ui.setupUi (this); - ui.versionInfo->setText (APPNAME " " + QString (fullVersionString())); + ui.versionInfo->setText (APPNAME " " + String (fullVersionString())); QPushButton* mailButton = new QPushButton; mailButton->setText (tr ("Contact")); @@ -366,7 +366,7 @@ // ============================================================================= // ============================================================================= -void bombBox (const QString& message) +void bombBox (const String& message) { QDialog dlg (g_win); Ui_BombBox ui;
--- a/src/dialogs.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/dialogs.h Sun Apr 27 04:23:09 2014 +0300 @@ -46,7 +46,7 @@ explicit OverlayDialog (QWidget* parent = null, Qt::WindowFlags f = 0); virtual ~OverlayDialog(); - QString fpath() const; + String 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(); - QString filename() const; - void setPath (QString path); + String filename() const; + void setPath (String path); private: Q_DISABLE_COPY (LDrawPathDialog) @@ -115,9 +115,9 @@ Q_OBJECT public: - explicit ExtProgPathPrompt (QString progName, QWidget* parent = 0, Qt::WindowFlags f = 0); + explicit ExtProgPathPrompt (String progName, QWidget* parent = 0, Qt::WindowFlags f = 0); virtual ~ExtProgPathPrompt(); - QString getPath() const; + String getPath() const; public slots: void findPath(); @@ -138,4 +138,4 @@ void slot_mail(); }; -void bombBox (const QString& message); +void bombBox (const String& message);
--- a/src/editHistory.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/editHistory.h Sun Apr 27 04:23:09 2014 +0300 @@ -30,7 +30,7 @@ return History::E##N##History; \ } \ \ - virtual QString getTypeName() const \ + virtual String 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 QString getTypeName() const = 0; + virtual String getTypeName() const = 0; }; // ============================================================================= @@ -104,7 +104,7 @@ class DelHistory : public AbstractHistoryEntry { PROPERTY (private, int, index, setIndex, STOCK_WRITE) - PROPERTY (private, QString, code, setCode, STOCK_WRITE) + PROPERTY (private, String, 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, QString, oldCode, setOldCode, STOCK_WRITE) - PROPERTY (private, QString, newCode, setNewCode, STOCK_WRITE) + PROPERTY (private, String, oldCode, setOldCode, STOCK_WRITE) + PROPERTY (private, String, newCode, setNewCode, STOCK_WRITE) public: IMPLEMENT_HISTORY_TYPE (Edit) - EditHistory (int idx, QString oldCode, QString newCode) : + EditHistory (int idx, String oldCode, String 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, QString, code, setCode, STOCK_WRITE) + PROPERTY (private, String, code, setCode, STOCK_WRITE) public: IMPLEMENT_HISTORY_TYPE (Add)
--- a/src/extPrograms.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/extPrograms.cc Sun Apr 27 04:23:09 2014 +0300 @@ -58,7 +58,7 @@ cfg (String, prog_rectifier, ""); cfg (String, prog_edger2, ""); -QString* const g_extProgPaths[] = +String* const g_extProgPaths[] = { &prog_isecalc, &prog_intersector, @@ -99,7 +99,7 @@ // ============================================================================= // -static bool mkTempFile (QTemporaryFile& tmp, QString& fname) +static bool mkTempFile (QTemporaryFile& tmp, String& fname) { if (not tmp.open()) return false; @@ -113,7 +113,7 @@ // static bool checkProgPath (const extprog prog) { - QString& path = *g_extProgPaths[prog]; + String& path = *g_extProgPaths[prog]; if (path.length() > 0) return true; @@ -131,13 +131,13 @@ // ============================================================================= // -static QString processErrorString (extprog prog, QProcess& proc) +static String processErrorString (extprog prog, QProcess& proc) { switch (proc.error()) { case QProcess::FailedToStart: { - QString wineblurb; + String wineblurb; #ifndef _WIN32 if (*g_extProgWine[prog]) @@ -187,7 +187,7 @@ // ============================================================================= // -static void writeObjects (const LDObjectList& objects, QString fname) +static void writeObjects (const LDObjectList& objects, String fname) { // Write the input file QFile f (fname); @@ -208,14 +208,14 @@ // ============================================================================= // -void writeSelection (QString fname) +void writeSelection (String fname) { writeObjects (selection(), fname); } // ============================================================================= // -void writeColorGroup (const int colnum, QString fname) +void writeColorGroup (const int colnum, String fname) { LDObjectList objects; @@ -232,10 +232,10 @@ // ============================================================================= // -bool runUtilityProcess (extprog prog, QString path, QString argvstr) +bool runUtilityProcess (extprog prog, String path, String argvstr) { QTemporaryFile input; - QStringList argv = argvstr.split (" ", QString::SkipEmptyParts); + QStringList argv = argvstr.split (" ", String::SkipEmptyParts); #ifndef _WIN32 if (*g_extProgWine[prog]) @@ -268,7 +268,7 @@ // Wait while it runs proc.waitForFinished(); - QString err = ""; + String err = ""; if (proc.exitStatus() != QProcess::NormalExit) err = processErrorString (prog, proc); @@ -288,7 +288,7 @@ // ============================================================================= // -static void insertOutput (QString fname, bool replace, QList<int> colorsToReplace) +static void insertOutput (String fname, bool replace, QList<int> colorsToReplace) { #ifdef DEBUG QFile::copy (fname, "./debug_lastOutput"); @@ -361,14 +361,14 @@ condAngle = ui.condAngle->value(); QTemporaryFile indat, outdat; - QString inDATName, outDATName; + String 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 - QString argv = join ( + String 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; - QString inDATName, outDATName; + String inDATName, outDATName; // Make temp files for the input and output files if (not mkTempFile (indat, inDATName) || not mkTempFile (outdat, outDATName)) return; // Compose arguments - QString argv = join ( + String 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; - QString inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; + String inDATName, cutDATName, outDATName, outDAT2Name, edgesDATName; if (not mkTempFile (indat, inDATName) || not mkTempFile (cutdat, cutDATName) || @@ -490,7 +490,7 @@ return; } - QString parms = join ( + String parms = join ( { (ui.cb_colorize->isChecked()) ? "-c" : "", (ui.cb_nocondense->isChecked()) ? "-t" : "", @@ -498,7 +498,7 @@ ui.dsb_prescale->value() }); - QString argv_normal = join ( + String argv_normal = join ( { parms, inDATName, @@ -506,7 +506,7 @@ outDATName }); - QString argv_inverse = join ( + String argv_inverse = join ( { parms, cutDATName, @@ -568,7 +568,7 @@ } QTemporaryFile in1dat, in2dat, outdat; - QString in1DATName, in2DATName, outDATName; + String in1DATName, in2DATName, outDATName; if (not mkTempFile (in1dat, in1DATName) || not mkTempFile (in2dat, in2DATName) || @@ -577,7 +577,7 @@ return; } - QString argv = join ( + String argv = join ( { (ui.cb_oldsweep->isChecked() ? "-s" : ""), (ui.cb_reverse->isChecked() ? "-r" : ""), @@ -634,7 +634,7 @@ } QTemporaryFile in1dat, in2dat, outdat; - QString in1DATName, in2DATName, outDATName; + String in1DATName, in2DATName, outDATName; if (not mkTempFile (in1dat, in1DATName) || not mkTempFile (in2dat, in2DATName) || @@ -643,7 +643,7 @@ return; } - QString argv = join ( + String argv = join ( { in1DATName, in2DATName, @@ -673,14 +673,14 @@ return; QTemporaryFile in, out; - QString inName, outName; + String inName, outName; if (not mkTempFile (in, inName) || not mkTempFile (out, outName)) return; int unmatched = ui.unmatched->currentIndex(); - QString argv = join ( + String argv = join ( { format ("-p %1", ui.precision->value()), format ("-af %1", ui.flatAngle->value()),
--- a/src/format.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/format.h Sun Apr 27 04:23:09 2014 +0300 @@ -17,7 +17,6 @@ */ #pragma once -#include <QString> #include "basics.h" //! \file Format.h @@ -30,14 +29,14 @@ class StringFormatArg { public: - StringFormatArg (const QString& a) : m_text (a) {} + StringFormatArg (const String& 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 (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 (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 (const Vertex& a) : m_text (a.toString()) {} StringFormatArg (const Matrix& a) : m_text (a.toString()) {} StringFormatArg (const char* a) : m_text (a) {} @@ -64,20 +63,20 @@ m_text += "}"; } - inline QString text() const + inline String text() const { return m_text; } private: - QString m_text; + String m_text; }; //! //! Helper function for \c format //! template<typename Arg1, typename... Rest> -void formatHelper (QString& str, Arg1 arg1, Rest... rest) +void formatHelper (String& str, Arg1 arg1, Rest... rest) { str = str.arg (StringFormatArg (arg1).text()); formatHelper (str, rest...); @@ -86,8 +85,8 @@ //! //! Overload of \c formatHelper() with no template args //! -static void formatHelper (QString& str) __attribute__ ((unused)); -static void formatHelper (QString& str) +static void formatHelper (String& str) __attribute__ ((unused)); +static void formatHelper (String& str) { (void) str; } @@ -95,7 +94,7 @@ //! //! @brief Format the message with the given args. //! -//! The formatting ultimately uses QString's arg() method to actually format +//! The formatting ultimately uses String's arg() method to actually format //! the args so the format string should be prepared accordingly, with %1 //! referring to the first arg, %2 to the second, etc. //! @@ -104,7 +103,7 @@ //! \return The formatted string //! template<typename... Args> -QString format (QString fmtstr, Args... args) +String format (String fmtstr, Args... args) { formatHelper (fmtstr, args...); return fmtstr; @@ -114,7 +113,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 QString& msg); +void printToLog (const String& msg); //! //! Format and print the given args to the message log. @@ -122,7 +121,7 @@ //! \param args The args to format with //! template<typename... Args> -void print (QString fmtstr, Args... args) +void print (String fmtstr, Args... args) { formatHelper (fmtstr, args...); printToLog (fmtstr); @@ -135,7 +134,7 @@ //! \param args The args to format with //! template<typename... Args> -void fprint (FILE* fp, QString fmtstr, Args... args) +void fprint (FILE* fp, String fmtstr, Args... args) { formatHelper (fmtstr, args...); fprintf (fp, "%s", qPrintable (fmtstr)); @@ -148,7 +147,7 @@ //! \param args The args to format with //! template<typename... Args> -void fprint (QIODevice& dev, QString fmtstr, Args... args) +void fprint (QIODevice& dev, String fmtstr, Args... args) { formatHelper (fmtstr, args...); dev.write (fmtstr.toUtf8()); @@ -160,7 +159,7 @@ //! \param args The args to format with //! template<typename... Args> -void dprint (QString fmtstr, Args... args) +void dprint (String fmtstr, Args... args) { #ifndef RELEASE formatHelper (fmtstr, args...);
--- a/src/glCompiler.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/glCompiler.cc Sun Apr 27 04:23:09 2014 +0300 @@ -30,7 +30,7 @@ struct GLErrorInfo { GLenum value; - QString text; + String text; }; static const GLErrorInfo g_GLErrors[] = @@ -53,13 +53,13 @@ static const QColor g_BFCFrontColor (64, 192, 80); static const QColor g_BFCBackColor (208, 64, 64); -// static QMap<LDObject*, QString> g_objectOrigins; +// static QMap<LDObject*, String> g_objectOrigins; // ============================================================================= // void checkGLError_private (const char* file, int line) { - QString errmsg; + String errmsg; GLenum errnum = glGetError(); if (errnum == GL_NO_ERROR) @@ -74,7 +74,7 @@ } } - print ("OpenGL ERROR: at %1:%2: %3", basename (QString (file)), line, errmsg); + print ("OpenGL ERROR: at %1:%2: %3", basename (String (file)), line, errmsg); } // =============================================================================
--- a/src/glRenderer.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/glRenderer.cc Sun Apr 27 04:23:09 2014 +0300 @@ -146,7 +146,7 @@ // Init camera icons for (const GL::EFixedCamera cam : g_Cameras) { - QString iconname = format ("camera-%1", tr (g_CameraNames[cam]).toLower()); + String iconname = format ("camera-%1", tr (g_CameraNames[cam]).toLower()); CameraIcon* info = &m_cameraIcons[cam]; info->img = new QPixmap (getIcon (iconname)); @@ -602,7 +602,7 @@ #ifndef RELEASE if (not isPicking()) { - QString text = format ("Rotation: (%1, %2, %3)\nPanning: (%4, %5), Zoom: %6", + String 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); @@ -627,7 +627,7 @@ } // Paint the coordinates onto the screen. - QString text = format (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]); + String text = format (tr ("X: %1, Y: %2, Z: %3"), m_hoverpos[X], m_hoverpos[Y], m_hoverpos[Z]); QFontMetrics metrics = QFontMetrics (font()); QRect textSize = metrics.boundingRect (0, 0, m_width, m_height, Qt::AlignCenter, text); paint.setPen (textpen); @@ -705,7 +705,7 @@ if (gl_linelengths) { - const QString label = QString::number ((poly3d[j] - poly3d[i]).length()); + const String label = String::number ((poly3d[j] - poly3d[i]).length()); QPoint origin = QLineF (poly[i], poly[j]).pointAt (0.5).toPoint(); paint.drawText (origin, label); } @@ -720,7 +720,7 @@ if (angle < 0) angle = 180 - l1.angleTo (l0); - QString label = QString::number (angle) + QString::fromUtf8 (QByteArray ("\302\260")); + String label = String::number (angle) + String::fromUtf8 (QByteArray ("\302\260")); QPoint pos = poly[i]; pos.setY (pos.y() + metrics.height()); @@ -807,13 +807,13 @@ { // Draw the current radius in the middle of the circle. QPoint origin = coordconv3_2 (m_drawedVerts[0]); - QString label = QString::number (dist0); + String label = String::number (dist0); paint.setPen (textpen); paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y(), label); if (m_drawedVerts.size() >= 2) { - label = QString::number (dist1); + label = String::number (dist1); paint.drawText (origin.x() - (metrics.width (label) / 2), origin.y() + metrics.height(), label); } } @@ -839,13 +839,13 @@ paint.drawPixmap (info.destRect, *info.img, info.srcRect); } - QString formatstr = tr ("%1 Camera"); + String formatstr = tr ("%1 Camera"); // Draw a label for the current camera in the bottom left corner { const int margin = 4; - QString label; + String label; label = format (formatstr, tr (g_CameraNames[camera()])); paint.setPen (textpen); paint.drawText (QPoint (margin, height() - (margin + metrics.descent())), label); @@ -858,7 +858,7 @@ m_drawToolTip = false; else { - QString label = format (formatstr, tr (g_CameraNames[m_toolTipCamera])); + String label = format (formatstr, tr (g_CameraNames[m_toolTipCamera])); QToolTip::showText (m_globalpos, label); } } @@ -1707,7 +1707,7 @@ // ============================================================================= // -bool GLRenderer::setupOverlay (EFixedCamera cam, QString file, int x, int y, int w, int h) +bool GLRenderer::setupOverlay (EFixedCamera cam, String 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 Sun Apr 27 04:15:25 2014 +0300 +++ b/src/glRenderer.h Sun Apr 27 04:23:09 2014 +0300 @@ -49,7 +49,7 @@ oy; double lw, lh; - QString fname; + String fname; QImage* img; bool invalid; }; @@ -178,7 +178,7 @@ void setBackground(); void setCamera (const EFixedCamera cam); void setDepthValue (double depth); - bool setupOverlay (EFixedCamera cam, QString file, int x, int y, int w, int h); + bool setupOverlay (EFixedCamera cam, String file, int x, int y, int w, int h); void updateOverlayObjects(); void zoomNotch (bool inward); @@ -309,7 +309,7 @@ } template<typename... Args> - inline QString format (QString fmtstr, Args... args) + inline String format (String fmtstr, Args... args) { return ::format (fmtstr, args...); }
--- a/src/glShared.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/glShared.h Sun Apr 27 04:23:09 2014 +0300 @@ -18,7 +18,7 @@ #ifndef LDFORGE_GLSHARED_H #define LDFORGE_GLSHARED_H -#include <QString> +#include "basics.h" class LDObject;
--- a/src/ldConfig.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/ldConfig.cc Sun Apr 27 04:23:09 2014 +0300 @@ -27,7 +27,7 @@ // // Helper function for parseLDConfig // -static bool parseLDConfigTag (LDConfigParser& pars, char const* tag, QString& val) +static bool parseLDConfigTag (LDConfigParser& pars, char const* tag, String& val) { int pos; @@ -54,7 +54,7 @@ // Read in the lines while (not fp->atEnd()) { - QString line = QString::fromUtf8 (fp->readLine()); + String line = String::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; - QString name, facename, edgename, valuestr; + String name, facename, edgename, valuestr; // Check 0 !COLOUR, parse the name if (not pars.tokenCompare (0, "0") || @@ -124,9 +124,9 @@ // ============================================================================= // -LDConfigParser::LDConfigParser (QString inText, char sep) +LDConfigParser::LDConfigParser (String inText, char sep) { - m_tokens = inText.split (sep, QString::SkipEmptyParts); + m_tokens = inText.split (sep, String::SkipEmptyParts); m_pos = -1; } @@ -146,7 +146,7 @@ // ============================================================================= // -bool LDConfigParser::getToken (QString& val, const int pos) +bool LDConfigParser::getToken (String& val, const int pos) { if (pos >= m_tokens.size()) return false; @@ -157,14 +157,14 @@ // ============================================================================= // -bool LDConfigParser::getNextToken (QString& val) +bool LDConfigParser::getNextToken (String& val) { return getToken (val, ++m_pos); } // ============================================================================= // -bool LDConfigParser::peekNextToken (QString& val) +bool LDConfigParser::peekNextToken (String& val) { return getToken (val, m_pos + 1); } @@ -210,7 +210,7 @@ // bool LDConfigParser::tokenCompare (int inPos, const char* sOther) { - QString tok; + String tok; if (not getToken (tok, inPos)) return false;
--- a/src/ldConfig.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/ldConfig.h Sun Apr 27 04:23:09 2014 +0300 @@ -27,20 +27,20 @@ class LDConfigParser { public: - LDConfigParser (QString inText, char sep); + LDConfigParser (String inText, char sep); bool isAtEnd(); bool isAtBeginning(); - bool getNextToken (QString& val); - bool peekNextToken (QString& val); - bool getToken (QString& val, const int pos); + bool getNextToken (String& val); + bool peekNextToken (String& val); + bool getToken (String& 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 QString operator[] (const int idx) + inline String operator[] (const int idx) { return m_tokens[idx]; }
--- a/src/ldDocument.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/ldDocument.cc Sun Apr 27 04:23:09 2014 +0300 @@ -52,12 +52,12 @@ // namespace LDPaths { - static QString pathError; + static String pathError; struct { - QString LDConfigPath; - QString partsPath, primsPath; + String LDConfigPath; + String partsPath, primsPath; } pathInfo; void initPaths() @@ -73,7 +73,7 @@ } } - bool tryConfigure (QString path) + bool tryConfigure (String path) { QDir dir; @@ -100,22 +100,22 @@ } // Accessors - QString getError() + String getError() { return pathError; } - QString ldconfig() + String ldconfig() { return pathInfo.LDConfigPath; } - QString prims() + String prims() { return pathInfo.primsPath; } - QString parts() + String parts() { return pathInfo.partsPath; } @@ -185,7 +185,7 @@ // ============================================================================= // -LDDocument* findDocument (QString name) +LDDocument* findDocument (String name) { for (LDDocument * file : g_loadedFiles) if (not file->name().isEmpty() && file->name() == name) @@ -196,7 +196,7 @@ // ============================================================================= // -QString dirname (QString path) +String dirname (String path) { long lastpos = path.lastIndexOf (DIRSLASH); @@ -213,7 +213,7 @@ // ============================================================================= // -QString basename (QString path) +String basename (String path) { long lastpos = path.lastIndexOf (DIRSLASH); @@ -225,9 +225,9 @@ // ============================================================================= // -static QString findLDrawFilePath (QString relpath, bool subdirs) +static String findLDrawFilePath (String relpath, bool subdirs) { - QString fullPath; + String 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 @@ -238,24 +238,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. - QString reltop = basename (dirname (relpath)); + String reltop = basename (dirname (relpath)); for (LDDocument* doc : g_loadedFiles) { if (doc->fullPath().isEmpty()) continue; - QString partpath = format ("%1/%2", dirname (doc->fullPath()), relpath); + String 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 - QString proptop = basename (dirname (partpath)); + String proptop = basename (dirname (partpath)); bool bogus = false; - for (QString s : g_specialSubdirectories) + for (String s : g_specialSubdirectories) { if ((proptop == s && reltop != s) || (reltop == s && proptop != s)) { @@ -282,9 +282,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 QString& topdir : QList<QString> ({ io_ldpath, net_downloadpath })) + for (const String& topdir : QList<String> ({ io_ldpath, net_downloadpath })) { - for (const QString& subdir : QList<QString> ({ "parts", "p" })) + for (const String& subdir : QList<String> ({ "parts", "p" })) { fullPath = format ("%1" DIRSLASH "%2" DIRSLASH "%3", topdir, subdir, relpath); @@ -298,10 +298,10 @@ return ""; } -QFile* openLDrawFile (QString relpath, bool subdirs, QString* pathpointer) +QFile* openLDrawFile (String relpath, bool subdirs, String* pathpointer) { print ("Opening %1...\n", relpath); - QString path = findLDrawFilePath (relpath, subdirs); + String path = findLDrawFilePath (relpath, subdirs); if (pathpointer != null) *pathpointer = path; @@ -370,7 +370,7 @@ for (; i < max && i < (int) lines().size(); ++i) { - QString line = lines()[i]; + String line = lines()[i]; // Trim the trailing newline QChar c; @@ -447,7 +447,7 @@ // Read in the lines while (not fp->atEnd()) - lines << QString::fromUtf8 (fp->readLine()); + lines << String::fromUtf8 (fp->readLine()); LDFileLoader* loader = new LDFileLoader; loader->setWarnings (numWarnings); @@ -472,13 +472,13 @@ // ============================================================================= // -LDDocument* openDocument (QString path, bool search, bool implicit) +LDDocument* openDocument (String path, bool search, bool implicit) { // 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; - QString fullpath; + String fullpath; if (search) fp = openLDrawFile (path.toLower(), true, &fullpath); @@ -543,7 +543,7 @@ // If we have unsaved changes, warn and give the option of saving. if (hasUnsavedChanges()) { - QString message = format (tr ("There are unsaved changes to %1. Should it be saved?"), + String message = format (tr ("There are unsaved changes to %1. Should it be saved?"), (name().length() > 0) ? name() : tr ("<anonymous>")); int button = msgbox::question (g_win, tr ("Unsaved Changes"), message, @@ -556,7 +556,7 @@ // If we don't have a file path yet, we have to ask the user for one. if (name().length() == 0) { - QString newpath = QFileDialog::getSaveFileName (g_win, tr ("Save As"), + String newpath = QFileDialog::getSaveFileName (g_win, tr ("Save As"), getCurrentDocument()->name(), tr ("LDraw files (*.dat *.ldr)")); if (newpath.length() == 0) @@ -619,7 +619,7 @@ // ============================================================================= // -void addRecentFile (QString path) +void addRecentFile (String path) { auto& rfiles = io_recentfiles; int idx = rfiles.indexOf (path); @@ -648,13 +648,13 @@ // ============================================================================= // Open an LDraw file and set it as the main model // ============================================================================= -void openMainFile (QString path) +void openMainFile (String path) { g_loadingMainFile = true; // If there's already a file with the same name, this file must replace it. LDDocument* documentToReplace = null; - QString shortName = LDDocument::shortenName (path); + String shortName = LDDocument::shortenName (path); for (LDDocument* doc : g_loadedFiles) { @@ -723,7 +723,7 @@ // ============================================================================= // -bool LDDocument::save (QString savepath) +bool LDDocument::save (String savepath) { if (not savepath.length()) savepath = fullPath(); @@ -743,7 +743,7 @@ if (nameComment->text().left (6) == "Name: ") { - QString newname = shortenName (savepath); + String newname = shortenName (savepath); nameComment->setText (format ("Name: %1", newname)); g_win->buildObjList(); } @@ -771,11 +771,11 @@ // class LDParseError : public std::exception { - PROPERTY (private, QString, error, setError, STOCK_WRITE) - PROPERTY (private, QString, line, setLine, STOCK_WRITE) + PROPERTY (private, String, error, setError, STOCK_WRITE) + PROPERTY (private, String, line, setLine, STOCK_WRITE) public: - LDParseError (QString line, QString a) : + LDParseError (String line, String a) : m_error (a), m_line (line) {} @@ -787,7 +787,7 @@ // ============================================================================= // -void checkTokenCount (QString line, const QStringList& tokens, int num) +void checkTokenCount (String line, const QStringList& tokens, int num) { if (tokens.size() != num) throw LDParseError (line, format ("Bad amount of tokens, expected %1, got %2", num, tokens.size())); @@ -795,7 +795,7 @@ // ============================================================================= // -void checkTokenNumbers (QString line, const QStringList& tokens, int min, int max) +void checkTokenNumbers (String line, const QStringList& tokens, int min, int max) { bool ok; @@ -828,11 +828,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. // ============================================================================= -LDObject* parseLine (QString line) +LDObject* parseLine (String line) { try { - QStringList tokens = line.split (" ", QString::SkipEmptyParts); + QStringList tokens = line.split (" ", String::SkipEmptyParts); if (tokens.size() <= 0) { @@ -850,7 +850,7 @@ case 0: { // Comment - QString comm = line.mid (line.indexOf ("0") + 1).simplified(); + String comm = line.mid (line.indexOf ("0") + 1).simplified(); // Handle BFC statements if (tokens.size() > 2 && tokens[1] == "BFC") @@ -864,7 +864,7 @@ // need to handle MLCAD-style invertnext, clip and noclip separately. struct { - QString a; + String a; LDBFC::Statement b; } BFCData[] = { @@ -1013,7 +1013,7 @@ // ============================================================================= // -LDDocument* getDocument (QString filename) +LDDocument* getDocument (String filename) { // Try find the file in the list of loaded files LDDocument* doc = findDocument (filename); @@ -1223,8 +1223,8 @@ // Mark this change to history if (not m_history->isIgnoring()) { - QString oldcode = getObject (idx)->asText(); - QString newcode = obj->asText(); + String oldcode = getObject (idx)->asText(); + String newcode = obj->asText(); *m_history << new EditHistory (idx, oldcode, newcode); } @@ -1278,7 +1278,7 @@ // ============================================================================= // -QString LDDocument::getDisplayName() +String LDDocument::getDisplayName() { if (not name().isEmpty()) return name(); @@ -1506,10 +1506,10 @@ // ============================================================================= // -QString LDDocument::shortenName (QString a) // [static] +String LDDocument::shortenName (String a) // [static] { - QString shortname = basename (a); - QString topdirname = basename (dirname (a)); + String shortname = basename (a); + String topdirname = basename (dirname (a)); if (g_specialSubdirectories.contains (topdirname)) shortname.prepend (topdirname + "\\");
--- a/src/ldDocument.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/ldDocument.h Sun Apr 27 04:23:09 2014 +0300 @@ -32,12 +32,12 @@ namespace LDPaths { void initPaths(); - bool tryConfigure (QString path); + bool tryConfigure (String path); - QString ldconfig(); - QString prims(); - QString parts(); - QString getError(); + String ldconfig(); + String prims(); + String parts(); + String getError(); } // @@ -69,14 +69,14 @@ using KnownVertexMap = QMap<Vertex, int>; Q_OBJECT - PROPERTY (public, QString, name, setName, STOCK_WRITE) + PROPERTY (public, String, 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 (private, ReferenceList, references, setReferences, STOCK_WRITE) - PROPERTY (public, QString, fullPath, setFullPath, STOCK_WRITE) - PROPERTY (public, QString, defaultName, setDefaultName, STOCK_WRITE) + PROPERTY (public, String, fullPath, setFullPath, STOCK_WRITE) + PROPERTY (public, String, defaultName, setDefaultName, STOCK_WRITE) PROPERTY (public, bool, isImplicit, setImplicit, STOCK_WRITE) PROPERTY (public, long, savePosition, setSavePosition, STOCK_WRITE) PROPERTY (public, int, tabIndex, setTabIndex, STOCK_WRITE) @@ -91,7 +91,7 @@ void addObjects (const LDObjectList objs); void clearSelection(); void forgetObject (LDObject* obj); // Deletes the given object from the object chain. - QString getDisplayName(); + String getDisplayName(); const LDObjectList& getSelection() const; bool hasUnsavedChanges() const; // Does this document have unsaved changes? void initializeCachedData(); @@ -99,7 +99,7 @@ void insertObj (int pos, LDObject* obj); int getObjectCount() const; LDObject* getObject (int pos) const; - bool save (QString path = ""); // Saves this file to disk. + bool save (String path = ""); // Saves this file to disk. void swapObjects (LDObject* one, LDObject* other); bool isSafeToClose(); // Perform safety checks. Do this before closing any files! void setObject (int idx, LDObject* obj); @@ -149,7 +149,7 @@ static int countExplicitFiles(); // Turns a full path into a relative path - static QString shortenName (QString a); + static String shortenName (String a); protected: void addToSelection (LDObject* obj); @@ -187,27 +187,27 @@ void newFile(); // Opens the given file as the main file. Everything is closed first. -void openMainFile (QString path); +void openMainFile (String path); // Finds an OpenFile by name or null if not open -LDDocument* findDocument (QString name); +LDDocument* findDocument (String name); // Opens the given file and parses the LDraw code within. Returns a pointer // to the opened file or null on error. -LDDocument* openDocument (QString path, bool search, bool implicit); +LDDocument* openDocument (String path, bool search, bool implicit); // Opens the given file and returns a pointer to it, potentially looking in /parts and /p -QFile* openLDrawFile (QString relpath, bool subdirs, QString* pathpointer = null); +QFile* openLDrawFile (String relpath, bool subdirs, String* 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. -LDObject* parseLine (QString line); +LDObject* parseLine (String line); // Retrieves the pointer to the given document by file name. Document is loaded // from file if necessary. Can return null if neither succeeds. -LDDocument* getDocument (QString filename); +LDDocument* getDocument (String filename); // Re-caches all subfiles. void reloadAllSubfiles(); @@ -224,10 +224,10 @@ return getCurrentDocument()->getSelection(); } -void addRecentFile (QString path); +void addRecentFile (String path); void loadLogoedStuds(); -QString basename (QString path); -QString dirname (QString path); +String basename (String path); +String dirname (String path); extern QList<LDDocument*> g_loadedFiles; // Vector of all currently opened files.
--- a/src/ldObject.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/ldObject.cc Sun Apr 27 04:23:09 2014 +0300 @@ -81,16 +81,16 @@ // ============================================================================= // -QString LDComment::asText() const +String LDComment::asText() const { return format ("0 %1", text()); } // ============================================================================= // -QString LDSubfile::asText() const +String LDSubfile::asText() const { - QString val = format ("1 %1 %2 ", color(), position()); + String val = format ("1 %1 %2 ", color(), position()); val += transform().toString(); val += ' '; val += fileInfo()->name(); @@ -99,9 +99,9 @@ // ============================================================================= // -QString LDLine::asText() const +String LDLine::asText() const { - QString val = format ("2 %1", color()); + String val = format ("2 %1", color()); for (int i = 0; i < 2; ++i) val += format (" %1", vertex (i)); @@ -111,9 +111,9 @@ // ============================================================================= // -QString LDTriangle::asText() const +String LDTriangle::asText() const { - QString val = format ("3 %1", color()); + String val = format ("3 %1", color()); for (int i = 0; i < 3; ++i) val += format (" %1", vertex (i)); @@ -123,9 +123,9 @@ // ============================================================================= // -QString LDQuad::asText() const +String LDQuad::asText() const { - QString val = format ("4 %1", color()); + String val = format ("4 %1", color()); for (int i = 0; i < 4; ++i) val += format (" %1", vertex (i)); @@ -135,9 +135,9 @@ // ============================================================================= // -QString LDCondLine::asText() const +String LDCondLine::asText() const { - QString val = format ("5 %1", color()); + String val = format ("5 %1", color()); // Add the coordinates for (int i = 0; i < 4; ++i) @@ -148,21 +148,21 @@ // ============================================================================= // -QString LDError::asText() const +String LDError::asText() const { return contents(); } // ============================================================================= // -QString LDVertex::asText() const +String LDVertex::asText() const { return format ("0 !LDFORGE VERTEX %1 %2", color(), pos); } // ============================================================================= // -QString LDEmpty::asText() const +String LDEmpty::asText() const { return ""; } @@ -183,7 +183,7 @@ "NOCLIP", }; -QString LDBFC::asText() const +String LDBFC::asText() const { return format ("0 BFC %1", LDBFC::k_statementStrings[m_statement]); } @@ -434,20 +434,20 @@ // ============================================================================= // -QString LDObject::typeName (LDObject::Type type) +String LDObject::typeName (LDObject::Type type) { LDObject* obj = LDObject::getDefault (type); - QString name = obj->typeName(); + String name = obj->typeName(); obj->destroy(); return name; } // ============================================================================= // -QString LDObject::describeObjects (const LDObjectList& objs) +String LDObject::describeObjects (const LDObjectList& objs) { bool firstDetails = true; - QString text = ""; + String text = ""; if (objs.isEmpty()) return "nothing"; // :) @@ -467,7 +467,7 @@ if (not firstDetails) text += ", "; - QString noun = format ("%1%2", typeName (objType), plural (count)); + String noun = format ("%1%2", typeName (objType), plural (count)); // Plural of "vertex" is "vertices", correct that if (objType == EVertex && count != 1) @@ -678,7 +678,7 @@ // ============================================================================= // -QString LDOverlay::asText() const +String LDOverlay::asText() const { return format ("0 !LDFORGE OVERLAY %1 %2 %3 %4 %5 %6", fileName(), camera(), x(), y(), width(), height()); @@ -701,9 +701,9 @@ if (obj->document() != null && (idx = obj->lineNumber()) != -1) { - QString before = obj->asText(); + String before = obj->asText(); *ptr = val; - QString after = obj->asText(); + String after = obj->asText(); if (before != after) { @@ -821,7 +821,7 @@ // ============================================================================= // -QString getLicenseText (int id) +String getLicenseText (int id) { switch (id) {
--- a/src/ldObject.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/ldObject.h Sun Apr 27 04:23:09 2014 +0300 @@ -34,10 +34,10 @@ { \ return LDObject::E##T; \ } \ - virtual QString asText() const override; \ + virtual String asText() const override; \ virtual void invert() override; -#define LDOBJ_NAME(N) virtual QString typeName() const override { return #N; } +#define LDOBJ_NAME(N) virtual String typeName() const override { return #N; } #define LDOBJ_VERTICES(V) virtual int vertices() const override { return V; } #define LDOBJ_SETCOLORED(V) virtual bool isColored() const override { return V; } #define LDOBJ_COLORED LDOBJ_SETCOLORED (true) @@ -112,7 +112,7 @@ const Vertex& vertex (int i) const; // Type name of this object - virtual QString typeName() const = 0; + virtual String typeName() const = 0; // Does this object have a matrix and position? (see LDMatrixObject) virtual bool hasMatrix() const = 0; @@ -136,7 +136,7 @@ LDObject* previous() const; // This object as LDraw code - virtual QString asText() const = 0; + virtual String asText() const = 0; // Replace this LDObject with another LDObject. Object is deleted in the process. void replace (LDObject* other); @@ -163,7 +163,7 @@ virtual int vertices() const = 0; // Get type name by enumerator - static QString typeName (LDObject::Type type); + static String typeName (LDObject::Type type); // Returns a default-constructed LDObject by the given type static LDObject* getDefault (const LDObject::Type type); @@ -172,7 +172,7 @@ static void moveObjects (LDObjectList objs, const bool up); // Get a description of a list of LDObjects - static QString describeObjects (const LDObjectList& objs); + static String describeObjects (const LDObjectList& objs); static LDObject* fromID (int id); LDPolygon* getPolygon(); @@ -294,13 +294,13 @@ LDOBJ_UNCOLORED LDOBJ_SCEMANTIC LDOBJ_NO_MATRIX - PROPERTY (public, QString, fileReferenced, setFileReferenced, STOCK_WRITE) - PROPERTY (private, QString, contents, setContents, STOCK_WRITE) - PROPERTY (private, QString, reason, setReason, STOCK_WRITE) + PROPERTY (public, String, fileReferenced, setFileReferenced, STOCK_WRITE) + PROPERTY (private, String, contents, setContents, STOCK_WRITE) + PROPERTY (private, String, reason, setReason, STOCK_WRITE) public: LDError(); - LDError (QString contents, QString reason) : + LDError (String contents, String reason) : m_contents (contents), m_reason (reason) {} }; @@ -325,7 +325,7 @@ // class LDComment : public LDObject { - PROPERTY (public, QString, text, setText, STOCK_WRITE) + PROPERTY (public, String, text, setText, STOCK_WRITE) LDOBJ (Comment) LDOBJ_NAME (comment) LDOBJ_VERTICES (0) @@ -335,7 +335,7 @@ public: LDComment() {} - LDComment (QString text) : m_text (text) {} + LDComment (String text) : m_text (text) {} }; // ============================================================================= @@ -552,13 +552,13 @@ PROPERTY (public, int, y, setY, STOCK_WRITE) PROPERTY (public, int, width, setWidth, STOCK_WRITE) PROPERTY (public, int, height, setHeight, STOCK_WRITE) - PROPERTY (public, QString, fileName, setFileName, STOCK_WRITE) + PROPERTY (public, String, fileName, setFileName, STOCK_WRITE) }; // Other common LDraw stuff -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 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 int g_lores = 16; static const int g_hires = 48; -QString getLicenseText (int id); +String getLicenseText (int id);
--- a/src/main.cc Sun Apr 27 04:15:25 2014 +0300 +++ b/src/main.cc Sun Apr 27 04:23:09 2014 +0300 @@ -36,7 +36,7 @@ QList<LDDocument*> g_loadedFiles; MainWindow* g_win = null; -static QString g_versionString, g_fullVersionString; +static String 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 Sun Apr 27 04:15:25 2014 +0300 +++ b/src/mainWindow.cc Sun Apr 27 04:23:09 2014 +0300 @@ -116,7 +116,7 @@ // KeySequenceConfig* MainWindow::shortcutForAction (QAction* action) { - QString keycfgname = format ("key_%1", action->objectName()); + String keycfgname = format ("key_%1", action->objectName()); return KeySequenceConfig::getByName (keycfgname); } @@ -178,7 +178,7 @@ for (const QVariant& it : io_recentfiles) { - QString file = it.toString(); + String file = it.toString(); QAction* recent = new QAction (getIcon ("open-recent"), file, this); connect (recent, SIGNAL (triggered()), this, SLOT (slot_recentFile())); @@ -194,7 +194,7 @@ { QList<LDQuickColor> colors; - for (QString colorname : gui_colortoolbar.split (":")) + for (String colorname : gui_colortoolbar.split (":")) { if (colorname == "|") colors << LDQuickColor::getSeparator(); @@ -255,7 +255,7 @@ // void MainWindow::updateTitle() { - QString title = format (APPNAME " %1", fullVersionString()); + String title = format (APPNAME " %1", fullVersionString()); // Append our current file if we have one if (getCurrentDocument()) @@ -326,7 +326,7 @@ for (LDObject* obj : getCurrentDocument()->objects()) { - QString descr; + String descr; switch (obj->type()) { @@ -742,11 +742,11 @@ // bool MainWindow::save (LDDocument* doc, bool saveAs) { - QString path = doc->fullPath(); + String path = doc->fullPath(); if (saveAs || path.isEmpty()) { - QString name = doc->defaultName(); + String name = doc->defaultName(); if (not doc->fullPath().isEmpty()) name = doc->fullPath(); @@ -776,7 +776,7 @@ return true; } - QString message = format (tr ("Failed to save to %1: %2"), path, strerror (errno)); + String 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); @@ -794,7 +794,7 @@ return false; } -void MainWindow::addMessage (QString msg) +void MainWindow::addMessage (String msg) { m_msglog->addLine (msg); } @@ -807,21 +807,21 @@ // ============================================================================= // -QPixmap getIcon (QString iconName) +QPixmap getIcon (String iconName) { return (QPixmap (format (":/icons/%1.png", iconName))); } // ============================================================================= // -bool confirm (const QString& message) +bool confirm (const String& message) { return confirm (MainWindow::tr ("Confirm"), message); } // ============================================================================= // -bool confirm (const QString& title, const QString& message) +bool confirm (const String& title, const String& message) { return QMessageBox::question (g_win, title, message, (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes; @@ -829,7 +829,7 @@ // ============================================================================= // -void critical (const QString& message) +void critical (const String& message) { QMessageBox::critical (g_win, MainWindow::tr ("Error"), message, (QMessageBox::Close), QMessageBox::Close);
--- a/src/mainWindow.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/mainWindow.h Sun Apr 27 04:23:09 2014 +0300 @@ -179,7 +179,7 @@ } //! Adds a message to the renderer's message manager. - void addMessage (QString msg); + void addMessage (String msg); //! Updates the object list. Right now this just rebuilds it. void refreshObjectList(); @@ -318,7 +318,7 @@ extern MainWindow* g_win; //! Get an icon by name from the resources directory. -QPixmap getIcon (QString iconName); +QPixmap getIcon (String iconName); //! \returns a list of quick colors based on the configuration entry. QList<LDQuickColor> quickColorsFromConfig(); @@ -326,15 +326,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 QString& title, const QString& message); // Generic confirm prompt +bool confirm (const String& title, const String& 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 QString& message); +bool confirm (const String& message); //! Displays an error prompt with the given \c message -void critical (const QString& message); +void critical (const String& 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 Sun Apr 27 04:15:25 2014 +0300 +++ b/src/messageLog.cc Sun Apr 27 04:23:09 2014 +0300 @@ -38,7 +38,7 @@ // ============================================================================= // -MessageManager::Line::Line (QString text) : +MessageManager::Line::Line (String 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 (QString line) +void MessageManager::addLine (String line) { // If there's too many entries, pop the excess out while (m_lines.size() >= g_maxMessages) @@ -118,9 +118,9 @@ // ============================================================================= // -void printToLog (const QString& msg) +void printToLog (const String& msg) { - for (QString& a : msg.split ("\n", QString::SkipEmptyParts)) + for (String& a : msg.split ("\n", String::SkipEmptyParts)) { if (g_win != null) g_win->addMessage (a);
--- a/src/messageLog.h Sun Apr 27 04:15:25 2014 +0300 +++ b/src/messageLog.h Sun Apr 27 04:23:09 2014 +0300 @@ -50,7 +50,7 @@ { public: //! Constructs a line with the given \c text - Line (QString text); + Line (String 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); - QString text; + String 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 (QString line); + void addLine (String line); //! \returns all active lines in the message manager. const QList<Line>& getLines() const;