Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CONTRIBUTIONS.tavispa
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
My contributions to this project involved developing the layout for the timer GUI and locating resources for us to use to develop in QT.
I also attempted to manage the repo but we had some problems with it where we couldn't it to sync correctly so we often did things through
dropbox instead.
I wrote prototype code in C and Qt's C++ to demonstrate the single timer application.
I wrote the code for the single timer application and made the decisions on the GUI architecture, and decided on its limitations for the scope of this project.

I also tried to update the README as feedback was received.
9 changes: 9 additions & 0 deletions CONTRIBUTIONS.thomasw4
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

I worked on some of the qt code and ui files. Made changes and updates to some of the source code. Usig github posed some problems for us, we often times
couldn't push or pull. We reverted to dropbox and email, to collaborate on the project. Most of my contribution is for the text based timer (console input and output)
and trying to link the gui to the console. As it is right now, the gui is working great, the console is working great, but still working on the interfacing between the two.
We have not pushed the console version to the repo yet. What we have now is working and in order to meet the deadline of a "working" submission, I chose to not push the
console version until later today.


I have added the new files for the text timer. The gui timer is now executed via the commandline using various options
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

CXX_FLAGS := -O2 -DNDEBUG -Wall -g -march=core2 -std=c++11
CXX := g++
INSTALL_DIR := ./
export CXX
export CXX_FLAGS

all: finalTimer timer

finalTimer:
qmake timerGUI/finalTimer.pro -o timerGUI/Makefile
$(MAKE) -C timerGUI
#mv timerGUI/finalTimer $(INSTALL_DIR)

timer:
$(MAKE) -C dispatcher
mv dispatcher/timer $(INSTALL_DIR)

clean:
rm timerGUI/*.o
rm timerGUI/Makefile
rm timerGUI/moc*
74 changes: 74 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
A Timer application with three options.


In order to properly compile this program in a linux environment you must install the qt4 libraries if
they are not already on your system. To do this run this command from the terminal:

sudo apt-get install libxtst-dev build-essential libqt4-dev qt4-qmake


To create the executable for the main directory run:

make

The executable for the TIMER will be called timer.


To clean the *.o, moc*, and Makefile from the timerGUI directory run:

make clean


To Execute from command line:

./timer [version option] [# of timers]

version options:
1 - stand alone console timer (No GUI)
2 - stand alone GUI timer
3 - Timer that takes console input and outputs via GUI timer

# of timers:
Number of timers needed (must be between 1 and 10)


Version 1 instructions:
NOTE:If you do not enter the time in the correct format, you will get a basic_string error.


User will be prompted to enter events and time for each event, the time must
be entered in the following format:

HH:MM:SS

User will be notified how long before the next event needs to be started and
notified again when to start that event

If you use multiple timers, enter the events beginning at the LAST event:
For example, You want to cook 3 items, meat, potatoes, and corn.
Corn takes 10 seconds, potatoes takes 20 seconds, and meat takes 1 minute.
Run this command:
./timer 1 3

You will be prompted to 'enter timed event' and 'enter time needed.' Do this as follows:
Enter timed event: corn
Enter time needed for corn: 00:00:10
Enter timed event: potatoes
Enter time needed for potatoes: 00:00:20
Enter timed event: meat
Enter time needed for meat: 00:01:00




Version 2 instructions:

There are two buttons in the main window. The single timer button lauches a window that has a single count up or
count down timer. There are two options to choose what will occur when the timer finishes. The dependent timer button launches
a new timer that has dependencies. There is a About button for user instructions.


Version 3:

Still under construction.
-------------------------------------------------------------------------------------
9 changes: 9 additions & 0 deletions dispatcher/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

all: timer

timer: dispatcher.cpp
g++ -std=c++0x -g -o timer timer.cpp dispatcher.cpp




97 changes: 97 additions & 0 deletions dispatcher/dispatcher.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#include <iostream>
#include <sstream>
#include <vector>
#include <stdio.h>
#include <array>
#include <string>
#include <unistd.h>
#include <stdlib.h>
#include "timer.h"

using namespace std;

int main(int argc, char *argv[])
{
if(argc == 1 || argc ==2)
{
cout << "You must include the type of timer and the number of timers" << endl;
cout << "eg. ./timer 2 1" << endl;
cout << "See README for further documentation." << endl;
return EXIT_FAILURE;
}

int switchCase = atoi(argv[1]);
int numberOfTimers = atoi(argv[2]);

checkCommandLine(numberOfTimers, switchCase);

string event;
string time; // string representation of user inputted time
int timeNumber; // variable to store timer as an integer

vector<int> timeDifference; //Vector of user inputted times

int times[numberOfTimers]; // array to hold times
string events[numberOfTimers]; // array to hold events






if(switchCase==2)
{
execv("timerGUI/finalTimer",NULL);
}
else if(switchCase == 1)
{
//Populate vectors with user input
for(int index = 0; index < numberOfTimers; index++)
{
cout << "Enter timed event: ";
getline (cin, event);
events[index] = event;
cout << "Enter time needed for " << events[index] << " : ";
getline(cin, time);
timeNumber = convertTime(time);
times[index] = timeNumber;
}

descendSort(times, events, numberOfTimers); // put longest times at beginning of array

timeDifference = getTimeDifference(times, numberOfTimers); // Load time difference into vector
timeDifference.push_back(times[numberOfTimers-1]); // push the least time to the back of the timerDifference vector

cout << "------------------------------------------------------------------------" << endl;
cout << "The timer for " << events[0] << " has started" << endl;
cout << "In " << timeDifference.at(0) << " seconds, you need to start the " << events[1] << endl;
cout << endl;



for(int x = 0; x < numberOfTimers -1; x++)
{
if(newTimer(timeDifference.at(x)))
{
execute(x, numberOfTimers, timeDifference, events);
}
}

return EXIT_SUCCESS;
}
else
{
cout << "***********************************************" << endl;
cout << "This version is still under construction" << endl;
cout << "When completed it will take input from the user" <<
" and excute the gui timer interface for the provided input" << endl;
cout << "***********************************************" << endl;
pid_t pId = fork();
exit(0);
}
return 0;


}


Loading