Пример #1
0
//Checks with local task if a task is due today
bool Storage::isToday(Task* task) {

	if(task->getDeadLine().year == getCurrentYear() && task->getDeadLine().month == getCurrentMonth() && task->getDeadLine().day == getCurrentDay()) {
		return true;
	} else {
		return false;
	}
}
Пример #2
0
// returns true when current day is a DST start or end day in some of the major locations in the
// world currently returns true for start/end dates for the US and EU
int isDSTchangeToday() {
  int y = getCurrentYear();
  int m = getCurrentMonth();
  int d = getCurrentDay();
  return (  (d == 14 - (1+y*5/4) % 7 && m == 3)   // US start
         || (d == 7 - (1+5*y/4) % 7 && m == 11)   // US end
         || (d == 31 - (4+5*y/4) % 7 && m == 3)   // EU start
         || (d == 31 - (1+5*y/4) % 7 && m == 10)); // EU end
}
Пример #3
0
void printVersion( char *executableName )
{
	printf( "LMMS %s\n(%s %s, Qt %s, %s)\n\n"
		"Copyright (c) 2004-%s LMMS developers.\n\n"
		"This program is free software; you can redistribute it and/or\n"
		"modify it under the terms of the GNU General Public\n"
		"License as published by the Free Software Foundation; either\n"
		"version 2 of the License, or (at your option) any later version.\n\n"
		"Try \"%s --help\" for more information.\n\n", LMMS_VERSION,
		PLATFORM, MACHINE, QT_VERSION_STR, GCC_VERSION,
		getCurrentYear().c_str(), executableName );
}
Пример #4
0
//Return true if a task has expired
bool Storage::isExpired(Task* task) {

	int hour = task->getEndTime().hour;
	if(hour == 24 || hour == 12) {
		hour-=12;
	}

	if(task->getDeadLine().year < getCurrentYear()) {
		return true;
	} else if(task->getDeadLine().year == getCurrentYear() && task->getDeadLine().month < getCurrentMonth()) {
		return true;
	} else if(task->getDeadLine().year == getCurrentYear() && task->getDeadLine().month == getCurrentMonth() && task->getDeadLine().day < getCurrentDay()) {
		return true;
	} else if(task->getDeadLine().year == getCurrentYear() && task->getDeadLine().month == getCurrentMonth() && task->getDeadLine().day == getCurrentDay() 
		&& hour < getCurrentTime().hour) {
		return true;
	} else if(task->getDeadLine().year == getCurrentYear() && task->getDeadLine().month == getCurrentMonth() && task->getDeadLine().day == getCurrentDay() 
		&& hour == getCurrentTime().hour && task->getEndTime().min < getCurrentTime().min) {
		return true;
	} else {
		return false;
	}
}
Пример #5
0
void printHelp()
{
	printf( "LMMS %s\n"
		"Copyright (c) 2004-%s LMMS developers.\n\n"
		"Usage: lmms [ -r <project file> ] [ options ]\n"
		"            [ -u <in> <out> ]\n"
		"            [ -d <in> ]\n"
		"            [ -h ]\n"
		"            [ <file to load> ]\n\n"
		"-r, --render <project file>	Render given project file\n"
		"    --rendertracks <project>	Render each track to a different file\n"
		"-o, --output <path>		Render into <path>\n"
		"				For --render, provide a file path\n"
		"				For --rendertracks, provide a directory path\n"
		"-f, --format <format>		Specify format of render-output where\n"
		"				Format is either 'wav' or 'ogg'.\n"
		"-s, --samplerate <samplerate>	Specify output samplerate in Hz\n"
		"				Range: 44100 (default) to 192000\n"
		"-b, --bitrate <bitrate>		Specify output bitrate in KBit/s\n"
		"				Default: 160.\n"
		"-i, --interpolation <method>	Specify interpolation method\n"
		"				Possible values:\n"
		"				   - linear\n"
		"				   - sincfastest (default)\n"
		"				   - sincmedium\n"
		"				   - sincbest\n"
		"-x, --oversampling <value>	Specify oversampling\n"
		"				Possible values: 1, 2, 4, 8\n"
		"				Default: 2\n"
		"-a, --float			32bit float bit depth\n"
		"-l, --loop			Render as a loop\n"
		"-u, --upgrade <in> [out]	Upgrade file <in> and save as <out>\n"
		"       Standard out is used if no output file is specifed\n"
		"-d, --dump <in>			Dump XML of compressed file <in>\n"
		"-v, --version			Show version information and exit.\n"
		"    --allowroot			Bypass root user startup check (use with caution).\n"
		"-h, --help			Show this usage information and exit.\n\n",
		LMMS_VERSION, getCurrentYear().c_str() );
}
Пример #6
0
long long int currentUEBT() { // please note, this is milliseconds from epoch and not seconds
  unsigned int fhour=0,fminute=0,fsecond=0,millisecond=0;
  RTC_GetTime(&fhour, &fminute, &fsecond, &millisecond);
  return dateTimeToUEBT(getCurrentYear(), getCurrentMonth(), getCurrentDay(), getCurrentHour(),
                        getCurrentMinute(), getCurrentSecond(), millisecond);
}
Пример #7
0
void currentDateToString(char *buffer, int format) {
  dateToString(buffer, getCurrentYear(), getCurrentMonth(), getCurrentDay(), format);
}
Пример #8
0
int addTransactionWizard(char* wallet) {
  Transaction tx;
  tx.date.year = getCurrentYear();
  tx.date.month = getCurrentMonth();
  tx.date.day = getCurrentDay();
  tx.time.hour = getCurrentHour();
  tx.time.minute = getCurrentMinute();
  tx.time.second = getCurrentSecond();
  strcpy(tx.description, (char*)"");
  int curstep = 0;
  while(1) {
    SetBackGround(0x0A);
    drawScreenTitle("Add transaction");
    // < (first label), SELECT of on date step, and Next or Finish (last label)
    drawFkeyLabels(curstep>0 ? 0x036F : -1, curstep == 2 ? 0x000F : 0, 0, 0, 0,
                   curstep==4 ? 0x04A4 : 0x04A3);
    if(curstep == 0) {
      MenuItem menuitems[5];
      menuitems[0].text = (char*)"Debit";
      menuitems[1].text = (char*)"Credit";

      Menu menu;
      menu.items=menuitems;
      menu.type=MENUTYPE_FKEYS;
      menu.numitems=2;
      menu.height=2;
      menu.startY=3;
      menu.pBaRtR=1;
      int inloop=1;
      while(inloop) {
        // this must be here, inside this loop:
        SetBackGround(0x0A);
        drawScreenTitle("Add transaction", "Select type:");
        drawFkeyLabels(-1, -1, -1, -1, -1, 0x04A3);
        int res = doMenu(&menu);
        if(res == MENU_RETURN_EXIT) return 0;
        else if(res == KEY_CTRL_F6 || res == MENU_RETURN_SELECTION) {
          tx.credit = menu.selection == 2;
          curstep++;
          break;
        }
      }
    } else if(curstep == 1) {
      drawScreenTitle(NULL, "Amount:");
      char samount[20] = "";
      if(tx.amount.val) {
        currencyToString(samount, &tx.amount);
      }
      textInput input;
      input.charlimit=12;
      input.acceptF6=1;
      input.symbols = 0; // allow the decimal separator
      input.forcetext = 1;
      input.buffer = (char*)samount;
      input.type = INPUTTYPE_NUMERIC;
      while(1) {
        input.key=0;
        int res = doTextInput(&input);
        if (res==INPUT_RETURN_EXIT) return 0; // user aborted
        else if (res==INPUT_RETURN_CONFIRM) {
          if(!stringToCurrency(&tx.amount, samount)) {
            if(!tx.amount.val) {
              AUX_DisplayErrorMessage(0x4B);
            } else {
              curstep++;
            }
            break;
          } else AUX_DisplayErrorMessage(0x43);
        } else if (res==INPUT_RETURN_KEYCODE && input.key == KEY_CTRL_F1) {
          curstep--;
          break;
        }
      }
    } else if(curstep == 2) {
      drawScreenTitle(NULL, "Date:");
      mPrintXY(7, 4, getInputDateFormatHint(), TEXT_MODE_TRANSPARENT_BACKGROUND, TEXT_COLOR_BLACK);
      textInput input;
      input.x=7;
      input.width=8;
      input.charlimit=8;
      input.acceptF6=1;
      input.type=INPUTTYPE_DATE;
      char datebuffer[15];
      fillInputDate(&tx.date, datebuffer);
      input.buffer = (char*)datebuffer;
      while(1) {
        input.key=0;
        int res = doTextInput(&input);
        if (res==INPUT_RETURN_EXIT) return 0; // user aborted
        else if (res==INPUT_RETURN_CONFIRM) {
          int len = strlen(datebuffer);
          if(len == input.charlimit) {
            int yr,m,d;
            stringToDate(datebuffer, &yr, &m, &d);
            if(isDateValid(yr, m, d)) {
                tx.date.year = yr;
                tx.date.month = m;
                tx.date.day = d;
                curstep++;
                break; // continue to next step
            } else invalidFieldMsg(0);
          } else invalidFieldMsg(0);
        } else if (res==INPUT_RETURN_KEYCODE) {
          if(input.key==KEY_CTRL_F1) {
            curstep=curstep-1; break;
          } else if(input.key==KEY_CTRL_F2) {
            int ey=0, em=0, ed=0;
            if(!selectDateScreen(&ey, &em, &ed,
                                  (char*)"Select transaction date:", NULL, 1)) {
              tx.date.year = ey;
              tx.date.month = em;
              tx.date.day = ed;
              curstep++; break; // continue to next step
            }
            break; //redraw
          }
        }
      }
    } else if(curstep == 3) {
      drawScreenTitle(NULL, "Time:");
      mPrintXY(8, 4, "HHMMSS", TEXT_MODE_TRANSPARENT_BACKGROUND, TEXT_COLOR_BLACK);
      
      textInput input;
      input.x=8;
      input.width=6;
      input.charlimit=6;
      input.acceptF6=1;
      input.type=INPUTTYPE_TIME;
      char tbuffer[15];
      fillInputTime(&tx.time, tbuffer);
      input.buffer = (char*)tbuffer;
      while(1) {
        input.key=0;
        int res = doTextInput(&input);
        if (res==INPUT_RETURN_EXIT) return 0; // user aborted
        else if (res==INPUT_RETURN_CONFIRM) {
          if((int)strlen(tbuffer) == input.charlimit) {
            int h, m, s;
            stringToTime(tbuffer, &h, &m, &s);
            if(isTimeValid(h, m, s)) {
              tx.time.hour = h;
              tx.time.minute = m;
              tx.time.second = s;
              curstep++;
              break; // continue to next step
            } else invalidFieldMsg(1);
          } else invalidFieldMsg(1);
        } 
        else if (res==INPUT_RETURN_KEYCODE && input.key==KEY_CTRL_F1) { curstep--; break; }
      }
    } else if(curstep == 4) {
      drawScreenTitle(NULL, "Description:");
      textInput input;
      input.charlimit=128;
      input.acceptF6=1;
      input.buffer = (char*)tx.description;
      int inloop = 1;
      while(inloop) {
        input.key=0;
        int res = doTextInput(&input);
        if (res==INPUT_RETURN_EXIT)
          return 0; // user aborted
        else if (res==INPUT_RETURN_CONFIRM)
          inloop = 0; // all fields complete, continue with transaction adding
        else if (res==INPUT_RETURN_KEYCODE && input.key == KEY_CTRL_F1) {
          curstep--;
          break;
        }
      }
      if(!inloop) break;
    }
  }
  addTransaction(&tx, wallet);
  return 1;
}
Пример #9
0
 std::string getDateStampDMY()
 {
     return (getCurrentDay() + '-' + getCurrentMonth() + '-' + getCurrentYear());
 }