Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) UbuntuOneWatcher

 

UbuntuOneWatcher is a tool to view what Ubuntu One is doing.

 

 

 

 

 

Downloads

 

 

 

 

 

 

External links

 

Technical facts

 

Application type(s)

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ToolUbuntuOneWatcher/ToolUbuntuOneWatcherDesktop.pro

 

QT       += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TEMPLATE = app

INCLUDEPATH += \
    ../../Classes/CppAbout \
    ../../Classes/CppFileIo \
    ../../Classes/CppQtAboutDialog \
    ../../Classes/CppQtHideAndShowDialog \
    ../../Classes/CppTrace

SOURCES +=\
    qtmain.cpp \
    ../../Classes/CppQtAboutDialog/qtaboutdialog.cpp \
    ../../Classes/CppAbout/about.cpp \
    ../../Classes/CppQtHideAndShowDialog/qthideandshowdialog.cpp \
    toolubuntuonewatchermenudialog.cpp \
    qttoolubuntuonewatchermenudialog.cpp \
    qttoolubuntuonewatchermaindialog.cpp \
    ../../Classes/CppFileIo/fileio.cpp

HEADERS  += \
    ../../Classes/CppQtAboutDialog/qtaboutdialog.h \
    ../../Classes/CppAbout/about.h \
    ../../Classes/CppQtHideAndShowDialog/qthideandshowdialog.h \
    toolubuntuonewatchermenudialog.h \
    qttoolubuntuonewatchermenudialog.h \
    qttoolubuntuonewatchermaindialog.h \
    ../../Classes/CppTrace/trace.h \
    ../../Classes/CppFileIo/fileio.h

FORMS    += \
    ../../Classes/CppQtAboutDialog/qtaboutdialog.ui \
    qttoolubuntuonewatchermaindialog.ui \
    qttoolubuntuonewatchermenudialog.ui

RESOURCES += \
    ToolUbuntuOneWatcher.qrc

OTHER_FILES += \
    ../../Classes/CppQtAboutDialog/Licence.txt \
    ../../Classes/CppAbout/Licence.txt \
    ../../Classes/CppQtHideAndShowDialog/Licence.txt \
    ../../Classes/CppTrace/Licence.txt \
    ../../Classes/CppFileIo/Licence.txt


#
#
# Type of compile
#
#

CONFIG(release, debug|release) {
  DEFINES += NDEBUG NTRACE_BILDERBIKKEL
}

QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Weffc++

unix {
  QMAKE_CXXFLAGS += -Werror
}

#
#
# Boost
#
#

win32 {
  INCLUDEPATH += \
    ../../Libraries/boost_1_54_0
}

 

 

 

 

 

./ToolUbuntuOneWatcher/qtmain.cpp

 

//---------------------------------------------------------------------------
/*
UbuntuOneWatcher, tool to see what Ubuntu One is doing
Copyright (C) 2010 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolUbuntuOneWatcher.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include <QApplication>
#include "qttoolubuntuonewatchermenudialog.h"
#pragma GCC diagnostic pop

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  ribi::QtUbuntuOneWatcherMenuDialog w;
  w.show();
  return a.exec();
}

 

 

 

 

 

./ToolUbuntuOneWatcher/qttoolubuntuonewatchermaindialog.h

 

//---------------------------------------------------------------------------
/*
UbuntuOneWatcher, tool to see what Ubuntu One is doing
Copyright (C) 2010 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolUbuntuOneWatcher.htm
//---------------------------------------------------------------------------
#ifndef QTTOOLUBUNTUONEWATCHERMAINDIALOG
#define QTTOOLUBUNTUONEWATCHERMAINDIALOG

#include <string>
#include <vector>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qthideandshowdialog.h"
#pragma GCC diagnostic pop

namespace Ui {
  class QtUbuntuOneWatcherMainDialog;
}

namespace ribi {

class QtUbuntuOneWatcherMainDialog : public QtHideAndShowDialog
{
  Q_OBJECT

public:
  explicit QtUbuntuOneWatcherMainDialog(QWidget *parent = 0);
  QtUbuntuOneWatcherMainDialog(const QtUbuntuOneWatcherMainDialog&) = delete;
  QtUbuntuOneWatcherMainDialog& operator=(const QtUbuntuOneWatcherMainDialog&) = delete;
  ~QtUbuntuOneWatcherMainDialog() noexcept;

private:
  Ui::QtUbuntuOneWatcherMainDialog *ui;

private slots:
  void OnFindOut();
};

} //~namespace ribi

#endif // QTTOOLUBUNTUONEWATCHERMAINDIALOG

 

 

 

 

 

./ToolUbuntuOneWatcher/qttoolubuntuonewatchermaindialog.cpp

 

//---------------------------------------------------------------------------
/*
UbuntuOneWatcher, tool to see what Ubuntu One is doing
Copyright (C) 2010 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
//From http://www.richelbilderbeek.nl/ToolUbuntuOneWatcher.htm
//---------------------------------------------------------------------------
#include <cassert>
#include <cstdlib>
#include <fstream>
#include <string>
#include <vector>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"

#include <boost/foreach.hpp>

#include <QDesktopWidget>
#include <QFile>

#include "fileio.h"
#include "qtaboutdialog.h"
#include "qttoolubuntuonewatchermaindialog.h"
#include "ui_qttoolubuntuonewatchermaindialog.h"

#pragma GCC diagnostic pop

ribi::QtUbuntuOneWatcherMainDialog::QtUbuntuOneWatcherMainDialog(QWidget *parent) :
    QtHideAndShowDialog(parent),
    ui(new Ui::QtUbuntuOneWatcherMainDialog)
{
  ui->setupUi(this);
  QObject::connect(ui->button_find_out,&QPushButton::clicked,
    this,&ribi::QtUbuntuOneWatcherMainDialog::OnFindOut);

  //Put the dialog in the screen center
  const QRect screen = QApplication::desktop()->screenGeometry();
  this->setGeometry(0,0,screen.width() * 3 / 4, screen.height() * 3 / 4);
  this->move( screen.center() - this->rect().center() );
}

ribi::QtUbuntuOneWatcherMainDialog::~QtUbuntuOneWatcherMainDialog() noexcept
{
  delete ui;
}

void ribi::QtUbuntuOneWatcherMainDialog::OnFindOut()
{
  ui->text->clear();
  //List the current state
  {
    std::system("u1sdtool -s > tmp.txt");
    ui->text->appendHtml("Ubuntu One current state:");
    const std::vector<std::string> v = ribi::fileio::FileToVector("tmp.txt");
    BOOST_FOREACH(const std::string& s,v)
    {
      ui->text->appendHtml(s.c_str());
    }
  }
  //List the current transfers
  {
    std::system("u1sdtool --current-transfers > tmp.txt");
    ui->text->appendHtml("List of current transfers:");
    const std::vector<std::string> v = ribi::fileio::FileToVector("tmp.txt");
    BOOST_FOREACH(const std::string& s,v)
    {
      ui->text->appendHtml(s.c_str());
    }
  }
  //List the synched folders
  {
    std::system("u1sdtool --list-folders > tmp.txt");
    ui->text->appendHtml("List of synchronized folders:");
    const std::vector<std::string> v = ribi::fileio::FileToVector("tmp.txt");
    BOOST_FOREACH(const std::string& s,v)
    {
      ui->text->appendHtml(s.c_str());
    }
  }

  //List the synched folders
  {
    std::system("u1sdtool --waiting-content > tmp.txt");
    ui->text->appendHtml("List of content waiting to be synchronized:");
    const std::vector<std::string> v = ribi::fileio::FileToVector("tmp.txt");
    BOOST_FOREACH(const std::string& s,v)
    {
      ui->text->appendHtml(s.c_str());
    }
  }
}

 

 

 

 

 

./ToolUbuntuOneWatcher/qttoolubuntuonewatchermenudialog.h

 

#ifndef QTUBUNTUONEWATCHERMENUDIALOG_H
#define QTUBUNTUONEWATCHERMENUDIALOG_H

#include "qthideandshowdialog.h"

namespace Ui {
  class QtUbuntuOneWatcherMenuDialog;
}

namespace ribi {

class QtUbuntuOneWatcherMenuDialog : public QtHideAndShowDialog
{
  Q_OBJECT

public:
  explicit QtUbuntuOneWatcherMenuDialog(QWidget *parent = 0);
  QtUbuntuOneWatcherMenuDialog(const QtUbuntuOneWatcherMenuDialog&) = delete;
  QtUbuntuOneWatcherMenuDialog& operator=(const QtUbuntuOneWatcherMenuDialog&) = delete;
  ~QtUbuntuOneWatcherMenuDialog() noexcept;

protected:
  
  void keyPressEvent(QKeyEvent *);

private:
  Ui::QtUbuntuOneWatcherMenuDialog *ui;

private slots:
  void on_button_about_clicked();
  void on_button_quit_clicked();
  void on_button_start_clicked();
};

} //~namespace ribi

#endif // QTUBUNTUONEWATCHERMENUDIALOG_H

 

 

 

 

 

./ToolUbuntuOneWatcher/qttoolubuntuonewatchermenudialog.cpp

 

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#include "qttoolubuntuonewatchermenudialog.h"

#include <QDesktopWidget>
#include <QKeyEvent>

#include "toolubuntuonewatchermenudialog.h"
#include "qtaboutdialog.h"
#include "qttoolubuntuonewatchermaindialog.h"
#include "qthideandshowdialog.h"
#include "ui_qttoolubuntuonewatchermenudialog.h"
#pragma GCC diagnostic pop

ribi::QtUbuntuOneWatcherMenuDialog::QtUbuntuOneWatcherMenuDialog(QWidget *parent) :
    QtHideAndShowDialog(parent),
    ui(new Ui::QtUbuntuOneWatcherMenuDialog)
{
  ui->setupUi(this);
}

ribi::QtUbuntuOneWatcherMenuDialog::~QtUbuntuOneWatcherMenuDialog() noexcept
{
  delete ui;
}

void ribi::QtUbuntuOneWatcherMenuDialog::keyPressEvent(QKeyEvent * event)
{
  if (event->key() == Qt::Key_Escape) { close(); return; }
}

void ribi::QtUbuntuOneWatcherMenuDialog::on_button_about_clicked()
{
  About a = UbuntuOneWatcherMenuDialog::GetAbout();
  a.AddLibrary("QtHideAndShowDialog version: " + QtHideAndShowDialog::GetVersion());
  QtAboutDialog d(a);
  d.setWindowIcon(this->windowIcon());
  d.setStyleSheet(this->styleSheet());
  this->ShowChild(&d);
}

void ribi::QtUbuntuOneWatcherMenuDialog::on_button_quit_clicked()
{
  close();
}

void ribi::QtUbuntuOneWatcherMenuDialog::on_button_start_clicked()
{
  QtUbuntuOneWatcherMainDialog d;
  d.setStyleSheet(this->styleSheet());
  ShowChild(&d);
}

 

 

 

 

 

./ToolUbuntuOneWatcher/toolubuntuonewatchermenudialog.h

 

//---------------------------------------------------------------------------
/*
UbuntuOneWatcher, solver of quadratic equations
Copyright (C) 2008-2013 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
// From http://www.richelbilderbeek.nl/ToolUbuntuOneWatcher.htm
//---------------------------------------------------------------------------
#ifndef UBUNTUONEWATCHERMENUDIALOG_H
#define UBUNTUONEWATCHERMENUDIALOG_H

#include <string>
#include <vector>

#include "about.h"

namespace ribi {

///GUI independent UbuntuOneWatcher menu dialog
struct UbuntuOneWatcherMenuDialog
{
  static const About GetAbout();
  static const std::string GetVersion();
  static const std::vector<std::string> GetVersionHistory();
};

} //~namespace ribi

#endif // UBUNTUONEWATCHERMENUDIALOG_H

 

 

 

 

 

./ToolUbuntuOneWatcher/toolubuntuonewatchermenudialog.cpp

 

//---------------------------------------------------------------------------
/*
UbuntuOneWatcher, solver of quadratic equations
Copyright (C) 2008-2013 Richel Bilderbeek

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 3 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, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
// From http://www.richelbilderbeek.nl/ToolUbuntuOneWatcher.htm
//---------------------------------------------------------------------------
#include "toolubuntuonewatchermenudialog.h"

#include "trace.h"

const ribi::About ribi::UbuntuOneWatcherMenuDialog::GetAbout()
{
  About a(
    "Richel Bilderbeek",
    "UbuntuOneWatcher",
    "tool to see what Ubuntu One is doing",
    "the 15th of Oktober 2013",
    "2010-2013",
    "http://www.richelbilderbeek.nl/ToolUbuntuOneWatcher.htm",
    GetVersion(),
    GetVersionHistory());
  a.AddLibrary("Trace version: " + Trace::GetVersion());
  return a;
}

const std::string ribi::UbuntuOneWatcherMenuDialog::GetVersion()
{
  return "1.1";
}

const std::vector<std::string> ribi::UbuntuOneWatcherMenuDialog::GetVersionHistory()
{
  return {
    "2010-09-26: version 1.0: initial version",
    "2013-10-14: version 1.1: conformized to ProjectRichelBilderbeek"
  };
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml