Esempio n. 1
0
void Date::setMonth(short m)
{
    while (m >= 12)
    {
        setYear(year+1);
        m-=12;
    }
    while (m <0)
    {
        setYear(year-1);
        m+=12;
    }
    month = m;
    if (month >= 2 && month <= 4)
    {
        setSeason(0);
    }
    else
        if (month >= 5 && month <= 7)
        {
            setSeason(1);
        }
        else
            if (month >= 8 && month <= 10)
            {
                setSeason(2);
            }
            else
                if (month == 11 || month <= 1)
                {
                    setSeason(3);
                }
}
Esempio n. 2
0
// other methods --------------------------------
void Date::addYears(int y)
{
	setYear(getYear() + y);
	if (getYear() < 1)
	{
		setYear(1);
		setMonth(1);
		setDay(1);
	}
}
Esempio n. 3
0
	/**
	 * Set the current date of the picker.
	 * @param date A date struct that specifies a valid date.
	 * @return Any of the following result codes:
	 * - #MAW_RES_OK if the property could be set.
	 * - #MAW_RES_INVALID_PROPERTY_VALUE if the property value was invalid.
	 * - #MAW_RES_ERROR otherwise.
	 */
	int DatePicker::setDate(const struct Date date)
	{
		//Saving the date, in case of error this will be restored.
		int year = getYear();
		int month = getMonth();
		int day = getDayOfMonth();

		//Set the day on 1. Used to avoid errors when setting certain dates.
		int errorCode = setDayOfMonth(1);

		if(MAW_RES_OK != errorCode)
		{
			return errorCode;
		}
		else
		{
			errorCode = setYear(date.year);
			if(MAW_RES_OK != errorCode)
			{
				//reset the day.
				setDayOfMonth(day);
				return errorCode;
			}
			else
			{
				errorCode = setMonth(date.month);
				if(MAW_RES_OK != errorCode)
				{
					//reset the year and the day.
					setYear(year);
					setDayOfMonth(day);
					return errorCode;
				}
				else
				{
					errorCode = setDayOfMonth(date.day);
					if(MAW_RES_OK != errorCode)
					{
						//reset year, month and day
						setYear(year);
						setMonth(month);
						setDayOfMonth(day);

						return errorCode;
					}
				}
			}
		}
		return errorCode;
	}
Esempio n. 4
0
Movie::Movie( std::vector< std::vector< std::string > > &db ) {
	setIMDBID( db[0][0] );
	setTitle( db[0][1] );
	setRated( db[0][2] );
	setReleased( db[0][3] );
	setRuntime( db[0][4] );
	setPlot( db[0][5] );
	setPoster( db[0][6] );
	setType( db[0][7] );
	setYear( std::stoi( db[0][8] ) );
	setIMDBRating( std::stod( db[0][9] ) );
	setIMDBVotes( std::stoi( db[0][10] ) );
	setTomatoFresh( std::stoi( db[0][11] ) );
	setTomatoImage( db[0][12] );
	setTomatoMeter( std::stoi( db[0][13] ) );
	setTomatoRating( std::stod( db[0][14] ) );
	setTomatoReviews( std::stoi( db[0][15] ) );
	setTomatoRotten( std::stoi( db[0][16] ) );
	setTomatoUserMeter( std::stoi( db[0][17] ) );
	setTomatoUserRating( std::stod( db[0][18] ) );
	setTomatoUserReviews( std::stoi( db[0][19] ) );
	for( int row = 0; row < db.size(); row++ ) {
		this->addActor( db[row][20] );
		this->addDirector( db[row][21] );
		this->addGenre( db[row][22] );
		this->addWriter( db[row][23] );
	}
}
Esempio n. 5
0
Date::Date(int year, int month, int day, int hour, int minute) {
  setYear(year);
  setMonth(month);
  setDay(day);
  setHour(hour);
  setMinute(minute);
}
Esempio n. 6
0
ossimLocalTm& ossimLocalTm::setDateFromJulian(double jd)
{
   double fractional = jd - (long)jd;
   long l;
   long n;
   long i;
   long j;
   long k;


   l= (long)(jd+68569);
   n= 4*l/146097;
   l= l-(146097*n+3)/4;
   i= 4000*(l+1)/1461001;
   l= l-1461*i/4+31l;
   j= 80*l/2447;
   k= l-2447*j/80;
   l= j/11;
   j= j+2-12*l;
   i= 100*(n-49)+i+l;
   setDay(k);
   setMonth(j);
   setYear(i);

   setFractionalDay(fractional);
   
   return *this;
}
Esempio n. 7
0
void TrackInfoObject::parse() {
    // Log parsing of header information in developer mode. This is useful for
    // tracking down corrupt files.
    const QString& canonicalLocation = m_fileInfo.canonicalFilePath();
    if (CmdlineArgs::Instance().getDeveloper()) {
        qDebug() << "TrackInfoObject::parse()" << canonicalLocation;
    }

    // Parse the information stored in the sound file.
    SoundSourceProxy proxy(canonicalLocation, m_pSecurityToken);
    Mixxx::SoundSource* pProxiedSoundSource = proxy.getProxiedSoundSource();
    if (pProxiedSoundSource != NULL && proxy.parseHeader() == OK) {

        // Dump the metadata extracted from the file into the track.

        // TODO(XXX): This involves locking the mutex for every setXXX
        // method. We should figure out an optimization where there are private
        // setters that don't lock the mutex.

        // If Artist, Title and Type fields are not blank, modify them.
        // Otherwise, keep their current values.
        // TODO(rryan): Should we re-visit this decision?
        if (!(pProxiedSoundSource->getArtist().isEmpty())) {
            setArtist(pProxiedSoundSource->getArtist());
        }

        if (!(pProxiedSoundSource->getTitle().isEmpty())) {
            setTitle(pProxiedSoundSource->getTitle());
        }

        if (!(pProxiedSoundSource->getType().isEmpty())) {
            setType(pProxiedSoundSource->getType());
        }

        setAlbum(pProxiedSoundSource->getAlbum());
        setAlbumArtist(pProxiedSoundSource->getAlbumArtist());
        setYear(pProxiedSoundSource->getYear());
        setGenre(pProxiedSoundSource->getGenre());
        setComposer(pProxiedSoundSource->getComposer());
        setGrouping(pProxiedSoundSource->getGrouping());
        setComment(pProxiedSoundSource->getComment());
        setTrackNumber(pProxiedSoundSource->getTrackNumber());
        setReplayGain(pProxiedSoundSource->getReplayGain());
        setBpm(pProxiedSoundSource->getBPM());
        setDuration(pProxiedSoundSource->getDuration());
        setBitrate(pProxiedSoundSource->getBitrate());
        setSampleRate(pProxiedSoundSource->getSampleRate());
        setChannels(pProxiedSoundSource->getChannels());
        setKeyText(pProxiedSoundSource->getKey(),
                   mixxx::track::io::key::FILE_METADATA);
        setHeaderParsed(true);
    } else {
        qDebug() << "TrackInfoObject::parse() error at file"
                 << canonicalLocation;
        setHeaderParsed(false);

        // Add basic information derived from the filename:
        parseFilename();
    }
}
Esempio n. 8
0
void Date::adjustYear(
		      int aAmount
		      )
  throw( DateException )
{
  setYear( getYear() + aAmount );
} /* end Date::adjustYear() */
Esempio n. 9
0
void EclipsesBrowserDialog::initialize()
{
    m_browserWidget = new Ui::EclipsesBrowserDialog();
    m_browserWidget->setupUi( this );

    m_browserWidget->treeView->setExpandsOnDoubleClick( false );

    m_eclModel = new EclipsesModel( m_marbleModel );
    m_browserWidget->treeView->setModel( m_eclModel );

    connect( m_browserWidget->buttonShow, SIGNAL(clicked()),
             this, SLOT(accept()) );
    connect( m_browserWidget->buttonClose, SIGNAL(clicked()),
             this, SLOT(reject()) );
    connect( m_browserWidget->spinBoxYear, SIGNAL(valueChanged(int)),
             this, SLOT(updateEclipsesForYear(int)) );
    connect( m_browserWidget->treeView->selectionModel(),
             SIGNAL(selectionChanged(const QItemSelection&,
                                     const QItemSelection&)),
             this, SLOT(updateButtonStates()) );
    connect( m_browserWidget->buttonSettings, SIGNAL(clicked()),
             SIGNAL(buttonSettingsClicked()) );

    setYear( m_marbleModel->clock()->dateTime().date().year() );

    update();

    m_browserWidget->treeView->resizeColumnToContents(2);
    m_browserWidget->treeView->resizeColumnToContents(3);
}
Esempio n. 10
0
Date::Date()
{
	setYear( -1 );
	setMonth( -1 );
	setDay( -1 );
	setHour( -1 );
	setMinute( -1 );
}
Esempio n. 11
0
winery::winery(const winery& aWinery) :name(NULL), location(NULL), year(DEFAULT_YEAR), acres(0), rating(0.0)
{
    setName(aWinery.name);
    setLocation(aWinery.location);
    setYear(aWinery.year);
    setAcres(aWinery.acres);
    setRating(aWinery.rating);
}
Esempio n. 12
0
Date::Date( int y, int mo, int d, int h, int mu )
{
	setYear(y);
	setMonth(mo);
	setDay(d);
	setHour(h);
	setMinute(mu);
}
Esempio n. 13
0
//! [0]
MainWindow::MainWindow()
{
    selectedDate = QDate::currentDate();
    fontSize = 10;

    QWidget *centralWidget = new QWidget;
//! [0]

//! [1]
    QLabel *dateLabel = new QLabel(tr("Date:"));
    QComboBox *monthCombo = new QComboBox;

    for (int month = 1; month <= 12; ++month)
        monthCombo->addItem(QDate::longMonthName(month));

    QDateTimeEdit *yearEdit = new QDateTimeEdit;
    yearEdit->setDisplayFormat("yyyy");
    yearEdit->setDateRange(QDate(1753, 1, 1), QDate(8000, 1, 1));
//! [1]

    monthCombo->setCurrentIndex(selectedDate.month() - 1);
    yearEdit->setDate(selectedDate);

//! [2]
    QLabel *fontSizeLabel = new QLabel(tr("Font size:"));
    QSpinBox *fontSizeSpinBox = new QSpinBox;
    fontSizeSpinBox->setRange(1, 64);
    fontSizeSpinBox->setValue(10);

    editor = new QTextBrowser;
    insertCalendar();
//! [2]

//! [3]
    connect(monthCombo, SIGNAL(activated(int)), this, SLOT(setMonth(int)));
    connect(yearEdit, SIGNAL(dateChanged(QDate)), this, SLOT(setYear(QDate)));
    connect(fontSizeSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(setFontSize(int)));
//! [3]

//! [4]
    QHBoxLayout *controlsLayout = new QHBoxLayout;
    controlsLayout->addWidget(dateLabel);
    controlsLayout->addWidget(monthCombo);
    controlsLayout->addWidget(yearEdit);
    controlsLayout->addSpacing(24);
    controlsLayout->addWidget(fontSizeLabel);
    controlsLayout->addWidget(fontSizeSpinBox);
    controlsLayout->addStretch(1);

    QVBoxLayout *centralLayout = new QVBoxLayout;
    centralLayout->addLayout(controlsLayout);
    centralLayout->addWidget(editor, 1);
    centralWidget->setLayout(centralLayout);

    setCentralWidget(centralWidget);
//! [4]
}
Esempio n. 14
0
TimeStamp::TimeStamp(byte seconds, byte minutes, byte hours, byte dayOfWeek, byte day, byte month, byte year) {
  setSeconds(seconds);
  setMinutes(minutes);
  setHours(hours);
  setDayOfWeek(dayOfWeek);
  setDay(day);
  setMonth(month);
  setYear(year);
}
Esempio n. 15
0
bool UniPAX::PublicationXref::merge(PublicationXref& object)
{
	if (!object.getYear() != 0)
	{
		if (!getYear() != 0)
		{
			if (getYear() != object.getYear())
			{
				std::cerr << "Error during merging: UniPAX::PublicationXref::year not equal ..."
						<< getYear() << " != " << object.getYear() << std::endl;
				return false;
			}
		}
		else
			setYear(object.getYear());
	}
	{
		std::set<std::string> tmp(getUrls().begin(), getUrls().end());
		for (std::vector<std::string>::iterator it = object.getUrls().begin(); it != object.getUrls().end(); it++)
		{
			tmp.insert(*it);
		}
		getUrls().assign(tmp.begin(), tmp.end());
	}
	if (!object.getTitle().empty())
	{
		if (!getTitle().empty())
		{
			if (getTitle() != object.getTitle())
			{
				std::cerr << "Error during merging: UniPAX::PublicationXref::title not equal ..."
						<< getTitle() << " != " << object.getTitle() << std::endl;
				return false;
			}
		}
		else
			setTitle(object.getTitle());
	}
	{
		std::set<std::string> tmp(getSources().begin(), getSources().end());
		for (std::vector<std::string>::iterator it = object.getSources().begin(); it != object.getSources().end(); it++)
		{
			tmp.insert(*it);
		}
		getSources().assign(tmp.begin(), tmp.end());
	}
	{
		std::set<std::string> tmp(getAuthors().begin(), getAuthors().end());
		for (std::vector<std::string>::iterator it = object.getAuthors().begin(); it != object.getAuthors().end(); it++)
		{
			tmp.insert(*it);
		}
		getAuthors().assign(tmp.begin(), tmp.end());
	}

	return UniPAX::Xref::merge(object);
}
Esempio n. 16
0
void Date::updateYears(long years)
{
	long g = getDays(getYear()+years,getMonth(),getDay());
	Date d = getDateFromDays(g);
	setDay(d.getDay());
	setMonth(d.getMm());
	setYear(d.getYear());
	setDayw(d.getDayw());
}
Esempio n. 17
0
Date& Date::operator=( const Date& t ){
	setYear( t.getYear() );
	setMonth( t.getMonth() );
	setDay( t.getDay() );
	setHour( t.getHour() );
	setMinute( t.getMinute() );

	return *this;
}
Esempio n. 18
0
Movie::Movie(int id, QString title, QString file, QString thumbnailsFile, QString descr, QString posterFile, int rating, QString year){
    setId(id);
    setTitle(title);
    setFile(file);
    setThumbsFile(thumbnailsFile);
    setDescr(descr);
    setPosterFile(posterFile);
    setRating(rating);
    setYear(year);
    setChanged(false);
}
Esempio n. 19
0
Truck::Truck(string man, int esize, int iyear, int bsz, bool tow):Vehicle(),bedsize(bsz),towPackage(tow)
{
	//towPackage = bsz;
	//bedsize = tow;
	setYear(iyear);
	setEng(esize);
	setManu(man);
	Person p("nonae");
	setOwner(p);
	setCost(BASE);
}	
Esempio n. 20
0
Movie::Movie(){
    setId(0);
    setTitle("");
    setFile("");
    setThumbsFile("");
    setDescr("");
    setPosterFile("posterFile");
    setRating(0);
    setYear("year");
    setChanged(false);
}
Esempio n. 21
0
Date::Date(string date)
{
	istringstream buf(date);
	int mon,day,year;
	char c1,c2;
	if( buf >> mon >> c1 >> day >> c2 >> year && c1=='/' && c2=='/')
	{
		setMonth(mon);
		setDay(day);
		setYear(year);
	}
}
Esempio n. 22
0
void Date::setDate(string arg)
{
	istringstream buf(arg);
	int mon,day,year;
	char c1,c2;
	if( buf >> mon >> c1 >> day >> c2 >> year && c1=='/' && c2=='/')
	{
		setMonth(mon);
		setDay(day);
		setYear(year);
	}
	else return;
void Clock::setMonth()
{
    if (month >= 12) {
        setYear();
        month = 1;
    }
    else {
        month++;
    }

    return;
}
Esempio n. 24
0
GraphicMode::GraphicMode(QWidget *parent)
    : QWidget(parent) , running(false)  , finder(NULL)
{
    setWindowIcon(QIcon(":/icon.ico"));
    setupUi(this);
    QRegExp rx("[a-fA-F0-9]{6}");
    QValidator *validator = new QRegExpValidator(rx, this);
    lineEdit->setValidator(validator);
    connect( calc , SIGNAL( clicked() ), this , SLOT(processEssid()) );
    connect( lineEdit , SIGNAL( returnPressed() ), this , SLOT(processEssid()) );
    connect( singleYear , SIGNAL( clicked() ), this , SLOT( setYear() ) );
}
Esempio n. 25
0
ZExport0 ZDateTime::ZDateTime (int aYear, int aMonth, int aDay, int aHour,
                               int aMinute, int aSecond)
{
  ZFUNCTRACE_DEVELOP
    ("ZDateTime::ZDateTime(int aYear, int aMonth, int aDay, int aHour, int aMinute, int aSecond)");
  setYear (aYear);
  setMonth (aMonth);
  setDay (aDay);
  setHour (aHour);
  setMinute (aMinute);
  setSecond (aSecond);
}                               // ZDateTime
Esempio n. 26
0
void Date::updateMonths(long months)
{
	months = getMonth() + months;
	long year = getYear() + months/12;
	months = months%12;
	long g = getDays(year,months,getDay());
	Date d = getDateFromDays(g);
	setDay(d.getDay());
	setMonth(d.getMm());
	setYear(d.getYear());
	setDayw(d.getDayw());
}
Esempio n. 27
0
    void Date::set
    (
        unsigned int day, 
        unsigned int month, 
        unsigned int year
    )
    {
        // Set the month and the year before the day for checking this last.
        setMonth(month);
        setYear(year);

        setDay(day);
    }
Esempio n. 28
0
void  Date::menuData() {
	int str;
	cout << " -> podaj dzien: ";
	cin >> str;
	setDay(str);
	cout << " -> podaj miesiac: ";
	cin >> str;
	setMonth(str);
	cout << " -> podaj rok: ";
	cin >> str;
	setYear(str);
	cout << "ustawiono date: " << getDateStamp() << endl;
}
Esempio n. 29
0
ossimDate::ossimDate(int month,
                     int day,
                     int year,
                     int dtfmt)
   :ossimLocalTm (0), _fmt(dtfmt)
{
   setMonth(month);
   setDay(day);
   setYear(year);
   setHour(0);
   setMin(0);
   setSec(0);
   setFractionalSecond(0.0);
}
Esempio n. 30
0
bool ossimLocalTm::loadXml(ossimRefPtr<ossimXmlNode> dateNode)
{
   bool result = true;
   ossimRefPtr<ossimXmlNode> month = dateNode->findFirstNode("month");
   ossimRefPtr<ossimXmlNode> day = dateNode->findFirstNode("day");
   ossimRefPtr<ossimXmlNode> year = dateNode->findFirstNode("year");
   ossimRefPtr<ossimXmlNode> hour = dateNode->findFirstNode("hour");
   ossimRefPtr<ossimXmlNode> minutes = dateNode->findFirstNode("minutes");
   ossimRefPtr<ossimXmlNode> seconds = dateNode->findFirstNode("seconds");
   ossimRefPtr<ossimXmlNode> fractionalSecond = dateNode->findFirstNode("fractionalSecond");
   ossimRefPtr<ossimXmlNode> julian = dateNode->findFirstNode("julian");
   ossimRefPtr<ossimXmlNode> modifiedJulian = dateNode->findFirstNode("modifiedJulian");

   if(month.valid()&&
      day.valid()&&
      year.valid()&&
      hour.valid()&&
      minutes.valid()&&
      seconds.valid())
   {
      setMonth(month->getText().toInt32());
      setDay(day->getText().toInt32());
      setYear(year->getText().toInt32());
      setHour(hour->getText().toInt32());
      setMin(minutes->getText().toInt32());
      setSec(seconds->getText().toInt32());
      if(fractionalSecond.valid())
      {
         setFractionalSecond(fractionalSecond->getText().toDouble());
      }
      else
      {
         setFractionalSecond(0.0);
      }
   }
   else if(modifiedJulian.valid())
   {
      setDateFromModifiedJulian(modifiedJulian->getText().toDouble());
   }
   else if(julian.valid())
   {
      setDateFromJulian(julian->getText().toDouble());
   }
   else
   {
      result = false;
   }

   return result;
}