Commit 4a7e5531 authored by Bart van der Velden's avatar Bart van der Velden

Add comments and fix the copyright notice (#68)

parent de126373
...@@ -13,7 +13,7 @@ Prerequisites: ...@@ -13,7 +13,7 @@ Prerequisites:
- Have taglib installed >= 1.9.1 - Have taglib installed >= 1.9.1
- Have Qt installed >= 5.0 - Have Qt installed >= 5.0
Buildin on Linux: Building on Linux:
================= =================
The following steps were obtained from getting MusicCollection to work on Kubuntu The following steps were obtained from getting MusicCollection to work on Kubuntu
...@@ -129,31 +129,28 @@ Buildin on Linux: ...@@ -129,31 +129,28 @@ Buildin on Linux:
Building on Windows Building on Windows
=================== ===================
These steps were obtained from getting MusicCollection to work on two systems, one a 64 These steps were obtained from getting MusicCollection to work on two systems, one a
bit Windows 7 Enterprise and one 64 bit Windows 7 Home Premium. 64 bit Windows 7 Enterprise and one 64 bit Windows 7 Home Premium.
For Qt: set CMAKE_PREFIX_PATH to the path where Qt is installed, i.e. C:\Qt\5.1.1\msvc2010 on my
Windows machine.
On Linux:
Install TagLib:
- wget http://taglib.github.io/releases/taglib-1.9.1.tar.gz
- tar xvf taglib-1.9.1.tar.gz
- cd taglib-1.9.1/
- cmake .
- make
- sudo make install
- Create a build directory on the same level as MusicCollection: mkdir build
- cd build
- Configure cmake: cmake ../MusicCollection
- Build the software: make
- Run the software: ./musiccollection
- To build a debug version: cmake -DCMAKE_BUILD_TYPE=Debug ../MusicCollection
- After that: gdb musiccollection
Install CMake
-------------
- Download a Windows installer from http://cmake.org/cmake/resources/software.html
- Run the installer
Install Boost
-------------
Install taglib
--------------
Install Qt Creator
------------------
For Qt: set CMAKE_PREFIX_PATH to the path where Qt is installed, i.e.
C:\Qt\5.2.1\msvc2010 on my
Windows machine.
On Windows: On Windows:
......
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
set (MUSICCOLLECTION_VERSION_MAJOR 0) set (MUSICCOLLECTION_VERSION_MAJOR 0)
set (MUSICCOLLECTION_VERSION_MINOR 1) set (MUSICCOLLECTION_VERSION_MINOR 1)
# The copyright string
set (MUSICCOLLECTION_COPYRIGHT "Copyright 2012-2014 Bart van der Velden <bart@muckingabout.eu>")
# Configure a header file to pass some of the CMake settings # Configure a header file to pass some of the CMake settings
# to the source code # to the source code
configure_file ( configure_file (
......
...@@ -136,7 +136,7 @@ bool HandleCommandLine( ...@@ -136,7 +136,7 @@ bool HandleCommandLine(
stringstream ss; stringstream ss;
ss << "MusicCollection, version: " << version.GetMajor() << "." << ss << "MusicCollection, version: " << version.GetMajor() << "." <<
version.GetMinor() << ", git revision: " << version.GetGitSha1() << "\n"; version.GetMinor() << ", git revision: " << version.GetGitSha1() << "\n";
ss << CopyrightNotice << "\n"; ss << version.Copyright() << "\n";
AddErrorMessage(message, ss.str()); AddErrorMessage(message, ss.str());
retVal = false; retVal = false;
} }
......
...@@ -26,11 +26,14 @@ int main(int argc, char *argv[]) ...@@ -26,11 +26,14 @@ int main(int argc, char *argv[])
QApplication a(argc, argv); QApplication a(argc, argv);
qDebug() << "Hello, world!"; qDebug() << "Hello, world!";
// Set the version information for later use
Version version; Version version;
QString ret = QString("%1.%2 Git revision: %3"). QString ret = QString("Version %1.%2, Git revision: %3, Qt version: %4").
arg(version.GetMajor(), version.GetMinor(), version.GetGitSha1()); arg(version.GetMajor(), version.GetMinor(), version.GetGitSha1(),
qVersion());
QCoreApplication::setApplicationVersion(ret); QCoreApplication::setApplicationVersion(ret);
// Create and show the main window
MainWindow w; MainWindow w;
w.show(); w.show();
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "ui/about.h" #include "ui/about.h"
#include <QFileDialog> #include <QFileDialog>
//#include <QMessageBox>
#include "FileTypeResolver.h" #include "FileTypeResolver.h"
#include "taglib.h" #include "taglib.h"
//! Set-up the main window
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
m_ui(new Ui::MainWindow) m_ui(new Ui::MainWindow)
...@@ -41,11 +41,13 @@ MainWindow::MainWindow(QWidget *parent) : ...@@ -41,11 +41,13 @@ MainWindow::MainWindow(QWidget *parent) :
m_ui->action_about_qt->setIcon(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); m_ui->action_about_qt->setIcon(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
} }
//! Clean-up the dialogue
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
delete m_ui; delete m_ui;
} }
//! Start a file open dialogue to select a file
void MainWindow::BrowseForFile() void MainWindow::BrowseForFile()
{ {
QString filename = QFileDialog::getOpenFileName(this, tr("Select File")); QString filename = QFileDialog::getOpenFileName(this, tr("Select File"));
...@@ -62,6 +64,7 @@ void MainWindow::LookupFile() ...@@ -62,6 +64,7 @@ void MainWindow::LookupFile()
ftr.createFile(m_ui->filenameLineEdit->text().toStdString().c_str()); ftr.createFile(m_ui->filenameLineEdit->text().toStdString().c_str());
} }
//! Show the about box
void MainWindow::ShowAboutDialog() void MainWindow::ShowAboutDialog()
{ {
if (!m_aboutDialog) if (!m_aboutDialog)
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#define MAINWINDOW_H #define MAINWINDOW_H
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <QMainWindow> #include <QMainWindow>
namespace Ui namespace Ui
...@@ -28,26 +27,35 @@ namespace Ui ...@@ -28,26 +27,35 @@ namespace Ui
class MainWindow; class MainWindow;
} }
// Forward declaration for the About dialogue
class About; class About;
//! MainWindow is the start dialogue of the application
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
//! Set-up the main window
explicit MainWindow(QWidget *parent = 0); explicit MainWindow(QWidget *parent = 0);
~MainWindow();
//! Clean-up the dialogue
~MainWindow();
private slots: private slots:
//! Start a file open dialogue to select a file
void BrowseForFile(); void BrowseForFile();
void LookupFile(); void LookupFile();
//! Show the about box
void ShowAboutDialog(); void ShowAboutDialog();
private: private:
//! The MainWindow UI class
Ui::MainWindow* m_ui; Ui::MainWindow* m_ui;
boost::scoped_ptr<About> m_aboutDialog;
//! The About dialogue is encapsulated in a scoped_ptr for resource management
boost::scoped_ptr<About> m_aboutDialog;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#define VERSION_MAJOR "@MUSICCOLLECTION_VERSION_MAJOR@" #define VERSION_MAJOR "@MUSICCOLLECTION_VERSION_MAJOR@"
#define VERSION_MINOR "@MUSICCOLLECTION_VERSION_MINOR@" #define VERSION_MINOR "@MUSICCOLLECTION_VERSION_MINOR@"
#define VERSION_GITSHA1 "@MUSICCOLLECTION_VERSION_GITSHA1@" #define VERSION_GITSHA1 "@MUSICCOLLECTION_VERSION_GITSHA1@"
#define VERSION_COPYRIGHT "@MUSICCOLLECTION_COPYRIGHT@"
// Construct a Version object which gives access to current version information // Construct a Version object which gives access to current version information
Version::Version() Version::Version()
...@@ -28,6 +29,7 @@ Version::Version() ...@@ -28,6 +29,7 @@ Version::Version()
m_majorVersion = VERSION_MAJOR; m_majorVersion = VERSION_MAJOR;
m_minorVersion = VERSION_MINOR; m_minorVersion = VERSION_MINOR;
m_gitSha1 = VERSION_GITSHA1; m_gitSha1 = VERSION_GITSHA1;
m_copyright = VERSION_COPYRIGHT;
} }
// Retrieve the major version number // Retrieve the major version number
...@@ -47,3 +49,9 @@ const char* Version::GetGitSha1() const ...@@ -47,3 +49,9 @@ const char* Version::GetGitSha1() const
{ {
return m_gitSha1.c_str(); return m_gitSha1.c_str();
} }
// Retrieve the copyright string
const char* Version::Copyright() const
{
return m_copyright.c_str();
}
...@@ -43,10 +43,14 @@ public: ...@@ -43,10 +43,14 @@ public:
//! Retrieve the git SHA1 hash for the current tree //! Retrieve the git SHA1 hash for the current tree
const char* GetGitSha1() const; const char* GetGitSha1() const;
//! Retrieve the copyright string
const char* Copyright() const;
private: private:
std::string m_majorVersion; std::string m_majorVersion;
std::string m_minorVersion; std::string m_minorVersion;
std::string m_gitSha1; std::string m_gitSha1;
std::string m_copyright;
//! The copy constructor is not implemented //! The copy constructor is not implemented
Version(const Version&); Version(const Version&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment