Remove redundant MainWindow::audioEnabled

The audioEnabled flag used by clients to decide whether or not to call
NJClient::AudioProc() does not seem necessary.  We only run an audio
streamer when audio should be enabled anyway, so there is no need for
this flag.  Furthermore, if NJClient is not connected to a server we
should only hear local channel monitoring - no metronome and obviously
no remote users.

This patch drops MainWindow::audioEnabled since we don't really need it.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Move audio cleanup to MainWindow::Disconnect()

This patch is analogous to commit a429950b where the
MainWindow::Connect() function was created.  This time we need to split
out the client disconnect and audio cleanup code.

The point of separating MainWindow lifecycle from Connect()/Disconnect()
is that the application can continue running while we connect and
reconnect to servers multiple times.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Provide a working directory for the client

The client needs a working directory (alsa known as the "session
directory") where it stores .ogg files.  This directory can be preserved
but it's often handy to automatically delete it when disconnecting from
the server.  (Normally users who wish to preserve it will remix the jam
session later.)

This patch is the final piece that allows qtclient to play back remote
audio!

Future patches will add a QSettings variable so that the working
directory path can be customized.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Include math.h from njmisc.h

The DB2VAL() macro uses pow(3) so it's necessary to include math.h from
njmisc.h.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add ChannelTreeWidget

The ChannelTreeWidget displays users logged into the server and their
audio channels.

This patch only shows the metronome.  Local and remote channels are
added in the patches that follow.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add local channels to ChannelTreeWidget

This patch adds local audio channels to the channel tree, making it
possible to toggle mute, broadcast, and boost.

Note that it is not yet possible to add/delete/rename local channels
from the GUI.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add remote channels to ChannelTreeWidget

This patch adds remote audio channels to the channel tree, making
it possible to see users that are connected to the server and to toggle
mute.

The NJClient has a flag that indicates when remote user information has
changed.  This patch adds the userInfoChanged() signal to
ClientRunThread and implements a slot in MainWindow to enumerate remote
channels each time remote user information changes.

Since we don't know exactly what changed we use a transaction mechanism
which prunes unused audio channels and users when commit() is called.
This can happen when a remote user disconnects from the server.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add connect/disconnect actions to MainWindow

This patch makes it possible to connect and reconnect many times while
the application is running.  A menu bar is added to the main window
allowing the user to perform these actions.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add PortAudio support

Add a PortAudio audioStreamer to replace the Linux-only ALSA
streamer in the Qt client.  This patch changes the build to link against
libportaudio and introduces a zero-configuration PortAudio streamer.

Note that we use local 8-bit character encoding for all PortAudio
strings.  In the future PortAudio will switch to UTF-8 but it currently
uses ASCII and the local encoding, see
http://www.assembla.com/spaces/portaudio/tickets/200.

Next we need a audio device configuration so that non-trivial use cases
are possible.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add PortAudio audio configuration dialog

This patch adds a dialog that allows users to select the host audio API
(e.g.  WinMME, ALSA, CoreAudio) and input/output devices.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Use audio configuration settings

This patch extends the PortAudio streamer to take a host API (e.g.
WinMME, ALSA, CoreAudio) and input/output devices.  The streamer will
try to use those settings but fall back to defaults if they cannot be
activated.

Also wire up the QSettings for PortAudio configuration and the
PortAudioConfigDialog.

It is now possible to select sound cards!

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add GPL license headers to qtclient

Like the original NINJAM code, the qtclient is licensed under GPLv2 or
later.  Add explicit headers to all code where I forgot to do this.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add more build instructions to README

This patch expands the README to give more compilation instructions.
This still isn't a step-by-step guide but should help people who are
trying to build the Qt client.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add ServerBrowser

Custom widget class based on QTreeWidge.
That fetches public server list resource via HTTP and
shows server address, tempo, users on the tree widget.

Signed-off-by: Ikkei Shimomura (tea) <Ikkei.Shimomura@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add ServerBrowser to ConnectionDialog

Show public server list on ConnectDialog.
Supports single/double click to select server.

Signed-off-by: Ikkei Shimomura (tea) <Ikkei.Shimomura@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Fix host selection from server browser

The server browser is incorrectly hooked up to place the server into the
username field.  Instead we should set the host field.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Show connect/disconnect status and error messages

This patch shows status notifications and error messages in the chat
textbox.  This makes it possible to tell when authentication has failed
or we have disconnected from the server.

The patch adds the ClientRunThread::statusChanged() signal which fires
when NJClient::GetStatus() changes.  Typically this happens when a state
transition happens from "disconnected" to "connected" or "connecting" to
"connecting failed".  Also ensure that we call Disconnect() when the
client enters an error state - this will re-enable the "Connect..." menu
item so the user can try again.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Show hostname in title bar when connected

Most GUI programs show the filename of the current document or the
hostname of the current server in the title bar.  Follow this convention
by showing the hostname in the title bar when we are connected.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Show BPM/BPI in status bar

This patch adds the current Beats Per Minute and Beats Per Interval
settings to the status bar.  This makes it easy to tell what the current
beat settings are without looking back through the chat log.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add About... dialog

The About... dialog shows the program version number and includes links
to the Wahjam website, NINJAM, the GPLv2 license, as well as the git
commit that the binary was built from.

On systems without git or a missing PATH to git the commit ID will be
empty but the build will succeed.

Note that I have chosen version 0.9.0 as the current version.  The
intent is to release 1.0.0 soon.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>