/*
    wmimagedock

  Copyright (c) 2018 Michael Heras

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307,
  USA.
*/

#include <iostream>
#include <cstdlib>

#include "selection.hpp"
#include "wmimagedock.hpp"
#include "imagefiles.hpp"

using std::cerr;
using std::endl;

int main(int argc, char **argv)
{
    WMWindowDock doc;
    doc.parseCmLine(argc, argv);
    doc.filesGetter(argv);

    if ( opts.dfile.empty() )
    {
        cerr<<"ERROR:"<<endl
        <<"Returned Empty. No Files Discovered. "
        <<"Check your directory/list."<<endl;
        exit(EXIT_FAILURE);
    }
    if ( doc.getOrder() ) {  sortList(); }
    if ( doc.getRandom()) { randomizeFiles(); }
    doc.openXup(argc, argv);
    switch (doc.getMode())
    {
    case 0:
        Selection_a(doc);
        break;
    case 1:
        Selection_b(doc);
        break;
    case 2:
        Selection_c(doc);
        break;
    }
return 0;
}
