ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/DashInterface.cpp
(Generate patch)

Comparing DashInterface/DashInterface.cpp (file contents):
Revision 44 by douglas, 2008-03-06T15:21:03-08:00 vs.
Revision 47 by douglas, 2008-03-07T03:08:31-08:00

# Line 11 | Line 11
11  
12   #include <foreach.hpp>
13   #include <hash.hpp>
14 #include <iconv.hpp>
14   #include <regex.hpp>
15   #include <scopes.hpp>
16   #include <timing.hpp>
17  
19 #include <Audacious.hpp>
18   #include <GPS.hpp>
19  
20   #include <sys/types.h>
# Line 34 | Line 32 | class DashInterface
32          enum { Running, Audio };
33          enum { Stopped, Paused, Playing } audio;
34          Timing::Time now;
37        IConv::IConv ascii;
38        Display display;
39        Pthreads::ThreadMutex displayLock;
35          Audacious::Audacious audacious;
36          //GPS::GPS gps;
37 +        MusicLibrary::Library library;
38          MenuList *list;
39          bool append;
40 +        Display display;
41 +        Pthreads::ThreadMutex displayLock;
42  
43 <        inline std::string Filter(const std::string input)
43 >        void Mode_(bool change = false)
44          {
45 <                std::string output(ascii.Convert(input));
45 >                if (mode != Menu)
46 >                {
47 >                        char when[16];
48  
49 <                std::replace(output.begin(), output.end(), '~', '\xce');
49 >                        std::strftime(when, sizeof (when), "%l:%M:%S %p %Z", std::localtime(now));
50  
51 <                return output;
52 <        }
51 >                        display.Set(2, 0, when);
52 >                }
53  
54        void Mode_(bool change = false)
55        {
54                  switch (mode)
55                  {
56                  case Uname:
# Line 103 | Line 101 | class DashInterface
101                  case Menu:
102                          if (change)
103                          {
104 +                                display.SetCursorPosition(19, 0);
105                                  display.SetCursorStyle(Display::InvertingBlinkingBlock);
106  
107                                  append = true;
108 <                                list = new TopList(display, audacious, append);
108 >                                list = new TopList(display, audacious, append, library);
109  
110                                  list->Render();
111                          }
# Line 235 | Line 234 | update:                        Mode_(change);
234                                  switch (activity)
235                                  {
236                                  case Display::UpPress:
238                                        return (++*list).Render();
239                                case Display::DownPress:
237                                          return (--*list).Render();
238 +                                case Display::DownPress:
239 +                                        return (++*list).Render();
240                                  case Display::LeftPress:
241                                          list = list->Left();
242  
# Line 269 | Line 268 | exit:                          mode = previous;
268          }
269  
270   public:
271 <        DashInterface(const std::string &device) : mode(Uname), audio(Stopped), ascii(_B("ASCII//TRANSLIT//IGNORE"), _B("UTF-8")), display(device, reinterpret_cast<Display::Callback>(::Buttons), this)
271 >        DashInterface(const std::string &device) : mode(Uname), audio(Stopped), display(device, reinterpret_cast<Display::Callback>(::Buttons), this)
272          {
273                  _synchronized (displayLock)
274                  {
275                          display.Clear();
276 +                        display.SetCursorStyle(Display::NoCursor);
277                          display.SetBacklight(100);
278                          display.Set(2, 0, _B("--:--:-- -- ---"));
279  
# Line 302 | Line 302 | public:
302                          {
303                                  now = Timing::GetTimeOfDay();
304  
305                                if (mode != Menu)
306                                {
307                                        char when[16];
308
309                                        std::strftime(when, sizeof (when), "%l:%M:%S %p %Z", std::localtime(now));
310
311                                        display.Set(2, 0, when);
312                                }
313
305                                  if (audacious.IsRunning() && audacious.IsPlaying())
306                                          if (audacious.IsPaused())
307                                          {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines