commit 58a3d260ea464c67191e3387dab8eeb9c8bdd955
Author: d3fault <d3fault@d3fault.net>
Date:   Mon May 29 00:30:18 2017 -0700

    MindDumper: Fixed some completely broken functionality that the previous commit introduced. also added some polish missing from the previous commit

diff --git a/.lastModifiedTimestamps b/.lastModifiedTimestamps
index f449273..04ae922 100644
--- a/.lastModifiedTimestamps
+++ b/.lastModifiedTimestamps
@@ -17,7 +17,7 @@ Documents/Qt/qt.quick.cpp.frontend.to.qt.quick.backend.needs.still.a.clean.front
Documents/Qt/quadruple.is.an.understatement.txt:1344528935
Documents/Qt/trolololol.dont.actually.have.anything.but.i.did.ponder.some.up.while.looking.at.QSG.classes.txt:1340559703
Documents/Qt/why.am.i.in.here.i.feel.hacked.txt:1344456043
Documents/minddump/:1495179528Documents/minddump/:1496039992
Documents/minddump/2016/:1459724150
Documents/minddump/2016/3/:1459367409
Documents/minddump/2016/3/1457041314-MTJ867.txt:1457227057
@@ -1438,6 +1438,7 @@ Documents/minddump/lakjfasldfjasdlfjkasdoffsldkfwaoeurlksjfdsdflaskdfjwoeryklfha
Documents/minddump/laksdjflksjflkjsflkjslkfjsdlkjfsdofuadslfjsdlfkjsldkfjsdljfsldkfjoueljflksd.txt:1407742803
Documents/minddump/laksjdflksdjafousdlfjoisduflkjouiwerlkjouilsjdfousdflkjouwer.txt:1370738200
Documents/minddump/lasdfjsadofiuwerlkjasfoiywrasufdioawerlkjsoafiusdflkj.txt:1337283195
Documents/minddump/lasdjfldksjflksdjfoiuwelrjosuflsdfjsofiudslkfjsdofiulk.txt:1496039992
Documents/minddump/lasdjflkasdjfousdfljsdufiosdiuflkwjeoruouodifsldfkjsdfouil.txt:1384063062
Documents/minddump/lasdjkfdsfjsadfouwerlsjdfiawhrlksdjfoiuwerlk.txt:1344286047
Documents/minddump/lasdjkflkasjdfosudfwerwreqrlkjweorulksdjfosdufljsdfousdflkjsdfousdlfkj.txt:1371780408
@@ -4097,15 +4098,15 @@ Projects/LossyDirectoryCopier/src/main.cpp:1386648220
Projects/MindDumper/:1496033126
Projects/MindDumper/design/:1456001533
Projects/MindDumper/design/initial.idea.txt:1456001533
Projects/MindDumper/src/:1496034000Projects/MindDumper/src/:1496042951
Projects/MindDumper/src/MindDumper.pro:1496029635
Projects/MindDumper/src/main.cpp:1495215671
Projects/MindDumper/src/minddumpdocument.cpp:1456174998
Projects/MindDumper/src/minddumpdocument.h:1456171263
Projects/MindDumper/src/minddumperfirstlaunchdirselector.cpp:1496033461
Projects/MindDumper/src/minddumperfirstlaunchdirselector.h:1496033218
Projects/MindDumper/src/minddumpermainwindow.cpp:1496033186
Projects/MindDumper/src/minddumpermainwindow.h:1496029290Projects/MindDumper/src/minddumperfirstlaunchdirselector.cpp:1496042740
Projects/MindDumper/src/minddumperfirstlaunchdirselector.h:1496042377
Projects/MindDumper/src/minddumpermainwindow.cpp:1496042109
Projects/MindDumper/src/minddumpermainwindow.h:1496040818
Projects/MouseAndOrMotionViewMaker/:1427380548
Projects/MouseAndOrMotionViewMaker/design/:1396053309
Projects/MouseAndOrMotionViewMaker/design/initial.idea.txt:1396053674
diff --git a/Documents/minddump/lasdjfldksjflksdjfoiuwelrjosuflsdfjsofiudslkfjsdofiulk.txt b/Documents/minddump/lasdjfldksjflksdjfoiuwelrjosuflsdfjsofiudslkfjsdofiulk.txt
new file mode 100644
index 0000000..69881c0
--- /dev/null
+++ b/Documents/minddump/lasdjfldksjflksdjfoiuwelrjosuflsdfjsofiudslkfjsdofiulk.txt
@@ -0,0 +1,15 @@
I have higher hopes for humanity.


As long as our well being depends on the economy, we will always be vulnerable to the economic "depressions" in which people (had-here:literally) starve to death.

The economy is a weakness;
our dependency on the economy is a weakness we must get rid of.

A worldwide government (by the humans for the humans) would be much better. It could guarantee, using solar powered robot farms, that humans don't have to work to not die (had:"survive" instead of "not die").


Whether or not the "economy" exists on the side is irrelevant.
^I'd be a dollar that the economy would go out of it's way to make that robot-provided existence miserable. It would do this so you would pay it for an existence [of any kind (could even be the same kind of existence, but with slightly less for you and slightly more for them)].
^^The economy does right at this very moment work against a worldwide government. Lots of people would lose a lot of power. They are willing to kill for it. Without a fucking doubt.
^^^idk wat do about that problem tbh. It seems the only way to beat them is for infinite multiverse theory to be true ("because in at lease one universe, you have to survive a given event (had:experience)"). re: infinite universe theory -- you can live knowing it is true or die trying to find out if it is true, or live not trying to find out if it's true (the default)
diff --git a/Projects/MindDumper/src/minddumperfirstlaunchdirselector.cpp b/Projects/MindDumper/src/minddumperfirstlaunchdirselector.cpp
index ca7b8b4..7ad76cf 100644
--- a/Projects/MindDumper/src/minddumperfirstlaunchdirselector.cpp
+++ b/Projects/MindDumper/src/minddumperfirstlaunchdirselector.cpp
@@ -2,6 +2,7 @@

#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QDateTime>
#include <QLabel>
#include <QStandardPaths>
#include <QPushButton>
@@ -39,7 +40,11 @@ MindDumperFirstLaunchDirSelector::MindDumperFirstLaunchDirSelector(const QString
    removeTrailingSlashIfPresentButNotIfItsTheOnlyChar(&mindDumpDirectoryPrepopulatedGuess);

    QVBoxLayout *myLayout = new QVBoxLayout();
    QDateTime currentdateTime = QDateTime::currentDateTime();
    QString currentYearNumberAsString = QString::number(currentdateTime.date().year());
    QString currentMonthNumberAsString = QString::number(currentdateTime.date().month());
    QLabel *welcomeText = new QLabel("Welcome. Please choose a MindDumper directory to save your files in. In that directory, your files will be stored in a folder named after the year, and then a subfolder named after the month.\n\nSo for example if you choose: " + mindDumpDirectoryPrepopulatedGuess + "\nThen we will save files like this: " + appendSlashIfNeeded(mindDumpDirectoryPrepopulatedGuess) + "2017/May/example-file.txt"); //TODOoptional: give a 'dynamic' example that uses OS-specific paths. also could factor in mindDumpDirectoryPrepopulatedGuesscurrentYearNumberAsString + "/" + currentMonthNumberAsString + "/example.txt\n\n");
    welcomeText->setWordWrap(true);
    myLayout->addWidget(welcomeText);
    m_MindDumpDirectoryRow = new LabelLineEditBrowseButton("Save files in folder:");
    myLayout->addLayout(m_MindDumpDirectoryRow);
diff --git a/Projects/MindDumper/src/minddumperfirstlaunchdirselector.h b/Projects/MindDumper/src/minddumperfirstlaunchdirselector.h
index bb01c68..a91ea07 100644
--- a/Projects/MindDumper/src/minddumperfirstlaunchdirselector.h
+++ b/Projects/MindDumper/src/minddumperfirstlaunchdirselector.h
@@ -12,7 +12,7 @@ public:
    explicit MindDumperFirstLaunchDirSelector(const QString &optionalSeededDirectoryProbablyPassedInAsAppArg = QString(), QWidget *parent = 0);
    QString selectedDir() const;
private:
    static inline void removeTrailingSlashIfPresentButNotIfItsTheOnlyChar(QString *inputString) { int inputStringLength = inputString->length(); if(inputString->endsWith("/")if((!inputString->endsWith("/")) || inputStringLength < 2) return; *inputString = inputString->left(inputStringLength-1); }
    static inline QString appendSlashIfNeeded(const QString &inputString) { if(inputString.endsWith("/")) return inputString; return inputString + "/"; }

    LabelLineEditBrowseButton *m_MindDumpDirectoryRow;
diff --git a/Projects/MindDumper/src/minddumpermainwindow.cpp b/Projects/MindDumper/src/minddumpermainwindow.cpp
index dd7e83e..23d10fc 100644
--- a/Projects/MindDumper/src/minddumpermainwindow.cpp
+++ b/Projects/MindDumper/src/minddumpermainwindow.cpp
@@ -38,10 +38,6 @@ MindDumperMainWindow::MindDumperMainWindow(QWidget *parent)
        doQueuedClose();
        return;
    }
    else if(argz.size() == 1)
    {
        m_MindDumpDirectoryWithSlashAppended = appendSlashIfNeeded(argz.takeFirst());
    }

    QCoreApplication::setOrganizationName("MindDumperOrganization");
    QCoreApplication::setOrganizationDomain("MindDumperDomain");
@@ -51,43 +47,61 @@ MindDumperMainWindow::MindDumperMainWindow(QWidget *parent)
    QString minddumpDirectoryInSettings = settings.value(MINDDUMP_DIRECTORY_SETTINGS_KEY).toString();
    bool firstLaunch = settings.value(FIRST_LAUNCH_SETTINGS_KEY, true).toBool();
    bool minddumpDirIsInSettings = !(minddumpDirectoryInSettings.trimmed().isEmpty());

    if(firstLaunch || (!minddumpDirIsInSettings))bool askUserForExistingWritableDir = true;
    if(argz.size() == 1)
    {
        //TODOreq: show welcome/browse-for-directory widget
        //TODOreq: they might have supplied a dir as an app arg, so prepopulate the line edit with that to save them time
        settings.setValue(FIRST_LAUNCH_SETTINGS_KEY, false);
        MindDumperFirstLaunchDirSelector dirSelector(m_MindDumpDirectoryWithSlashAppended);
        dirSelector.setModal(true);
        dirSelector.setWindowModality(Qt::ApplicationModal);
        int dialogResultCodeQString dirPassedInViaArg = dirSelector.exec();
        if(dialogResultCode != QDialog::Accepted)argz.first();
        m_MindDumpDirectoryWithSlashAppended = appendSlashIfNeeded(dirPassedInViaArg);
        if(isSane(dirPassedInViaArg))
        {
            doQueuedClose();
            return;askUserForExistingWritableDir = false;
        }
        m_MindDumpDirectoryWithSlashAppended = appendSlashIfNeeded(dirSelector.selectedDir());
    }
    else if(minddumpDirIsInSettings)
    {
        if(m_MindDumpDirectoryWithSlashAppended.isEmpty()) //it might have been already set via app arg abovem_MindDumpDirectoryWithSlashAppended = appendSlashIfNeeded(minddumpDirectoryInSettings);
        if(isSane(minddumpDirectoryInSettings))
        {
            m_MindDumpDirectoryWithSlashAppendedaskUserForExistingWritableDir = appendSlashIfNeeded(minddumpDirectoryInSettings);false;
        }
    }

    QFileInfo fileInfo(m_MindDumpDirectoryWithSlashAppended);
    if(!fileInfo.isDir())if(firstLaunch)
    {
        QMessageBox::critical(this, tr("Critical Error!"), tr("Path either does not exist orsettings.setValue(FIRST_LAUNCH_SETTINGS_KEY, false);
        askUserForExistingWritableDir = true; //even if an existing dir is not a directory: ") + m_MindDumpDirectoryWithSlashAppended);
        doQueuedClose();
        return;passed in via arg (or somehow settings), our first launch always shows the dialog
    }

    if(!fileInfo.isWritable())if(askUserForExistingWritableDir)
    {
        QMessageBox::critical(this, tr("Critical Error!"), tr("Path is not writable: ") + m_MindDumpDirectoryWithSlashAppended);QString chosenExistingWritableDir;
        bool firstLoop = true;
        do
        {
            if(!firstLoop)
            {
                QMessageBox::warning(this, tr("Invalid Directory"), tr("The directory you selected was either non-existent or you don't have permission to write files there"));
            }
            firstLoop = false;
            MindDumperFirstLaunchDirSelector dirSelector(m_MindDumpDirectoryWithSlashAppended /*argz.size() == 1 ? argz.first() : QString()*/);
            dirSelector.setModal(true);
            dirSelector.setWindowModality(Qt::ApplicationModal);
            int dialogResultCode = dirSelector.exec();
            if(dialogResultCode != QDialog::Accepted)
            {
                doQueuedClose();
                return;
            }
            chosenExistingWritableDir = appendSlashIfNeeded(dirSelector.selectedDir());

        } while(!isSane(chosenExistingWritableDir));
        m_MindDumpDirectoryWithSlashAppended = appendSlashIfNeeded(chosenExistingWritableDir);
    }

    if(!isSane(m_MindDumpDirectoryWithSlashAppended, true))
        return;

    settings.setValue(MINDDUMP_DIRECTORY_SETTINGS_KEY, m_MindDumpDirectoryWithSlashAppended);

    restoreGeometry(settings.value("geometry").toByteArray());
@@ -217,6 +231,29 @@ void MindDumperMainWindow::closeEvent(QCloseEvent *theCloseEvent)

    QMainWindow::closeEvent(theCloseEvent);
}
bool MindDumperMainWindow::isSane(const QString &dirToSanitize, bool errorOut)
{
    QFileInfo fileInfo(dirToSanitize);
    if(!fileInfo.isDir())
    {
        if(errorOut)
        {
            QMessageBox::critical(this, tr("Critical Error!"), tr("Path either does not exist or is not a directory: ") + dirToSanitize);
            doQueuedClose();
        }
        return false;
    }
    if(!fileInfo.isWritable())
    {
        if(errorOut)
        {
            QMessageBox::critical(this, tr("Critical Error!"), tr("Path is not writable: ") + dirToSanitize);
            doQueuedClose();
        }
        return false;
    }
    return true;
}
MindDumpDocument *MindDumperMainWindow::createAndAddMindDumpDocument()
{
    QString tabTitle = getTabTitleAutoNumber();
diff --git a/Projects/MindDumper/src/minddumpermainwindow.h b/Projects/MindDumper/src/minddumpermainwindow.h
index 07ab861..cf4c3e0 100644
--- a/Projects/MindDumper/src/minddumpermainwindow.h
+++ b/Projects/MindDumper/src/minddumpermainwindow.h
@@ -18,6 +18,8 @@ protected:
    bool handleSignal(int sig);
    virtual void closeEvent(QCloseEvent *theCloseEvent);
private:
    bool isSane(const QString &dirToSanitize, bool errorOut = false);

    QString m_MindDumpDirectoryWithSlashAppended;
    QTabWidget *m_TabWidget;