ChineseCalendar::ChineseCalendar(QWidget *parent)
    : QWidget(parent)
{
    setupUi(this); m_strFileList.clear();
//    bg = new QPixmap(":/img/chinesecalendarBGyellow.png");
    icon = QIcon(":/img/icon.png");
    icon64 = QIcon(":/img/chinesecalendar-64.png");

    mycalendat=new CCBO;
    mycalendat->InitConnection(QDir::currentPath ());
    selectedDate = QDate::currentDate();
	monthCombo->setCurrentIndex(selectedDate.month() - 1);
    YearSelect->setCurrentIndex(selectedDate.year()-1900);

    connect(monthCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setMonth(int)));
    connect(monthCombo, SIGNAL(activated(int)), this, SLOT(setMonth(int)));
    connect(YearSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(setYear(int)));
    connect(this->backtotoday, SIGNAL(clicked()), this, SLOT(backtoday()));

//    this->TbnextMonth->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}");
//    this->TbnextYear->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}");
//    this->TbpreviousMonth->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}");
//    this->TbpreviousYear->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}");
//    this->backtotoday->setStyleSheet("QPushButton{background-color:transparent;color:rgb(200,200,150);}QPushButton:hover{color:rgb(255,255,255);}");
//    this->YearSelect->setStyleSheet("QComboBox{border: 2px solid lightgray;border-radius: 5px;font:12pt;}");
//    this->monthCombo->setStyleSheet("QComboBox{border: 2px solid lightgray;border-radius: 5px;font:12pt;}");
//    this->label->setStyleSheet("QLabel{font:12pt;}");
//    this->label_2->setStyleSheet("QLabel{font:12pt;}");

    QString week;
    QDateTime dateTime = QDateTime::currentDateTime();

    if (dateTime.toString("ddd") == "Mon")
        week = "星期一"; // Monday
    else if (dateTime.toString("ddd") == "Tue")
        week = "星期二"; // Tuesday
    else if (dateTime.toString("ddd") == "Wed")
        week = "星期三"; // Wednesday
    else if (dateTime.toString("ddd") == "Thu")
        week = "星期四"; // Thursday
    else if(dateTime.toString("ddd") == "Fri")
        week = "星期五"; // Friday
    else if (dateTime.toString("ddd") == "Sat")
        week = "星期六"; // Saturday
    else
        week = "星期日"; // Sunday

    QString currentTime = dateTime.toString("yyyy-MM-dd %1").arg(week);
    QDate day = QDate::currentDate();
    struct CCalendar datebase;
    mycalendat->ctcl_solar_to_lunar(day.year(),day.month(),day.day(),&datebase);
    QString chinesemonth = datebase.cmonth;

    if (chinesemonth == "一月")
        chinesemonth = "正月";
    if (chinesemonth == "十一月")
        chinesemonth = "冬月";
    if (chinesemonth == "十二月")
        chinesemonth = "腊月";

    QString chineseday = QString("农历 %1%2").arg(chinesemonth).arg(datebase.cday);
    QString chineseyear = QString("%1年(%2年)").arg(datebase.ganzhi).arg(datebase.shengxiao);

    QString chineseyi = QString("%1").arg(datebase.yi);
    QStringList chineseyilist = chineseyi.split("、");
    QString chineseji = QString("%2").arg(datebase.ji);
    QStringList chinesejilist = chineseji.split("、");

    QFont font;
    QPalette pa;
    font.setPointSize(48);
    font.setBold(true);
    this->label_10->setFont(font);
    this->label_10->setText(QString::number(day.day()));
    font.setBold(false);
    font.setPointSize(9);
    this->label_12->setFont(font);
    this->label_12->setText(currentTime);
    font.setPointSize(10);
    this->label_13->setFont(font);
    this->label_13->setText(chineseday);
    this->label_14->setFont(font);
    this->label_14->setText(chineseyear);
    font.setPointSize(15);
    this->label_15->setFont(font);
    font.setPointSize(10);
    this->label_17->setFont(font);
    this->label_18->setFont(font);

    QString yi=QString("");
    QString ji=QString("");
    if(chineseyilist.count() == 0 )
       yi =QString("");
    if(chineseyilist.count() >= 5)
       yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1)).append("\n").append(chineseyilist.at(2)).append("\n").append(chineseyilist.at(3)).append("\n").append(chineseyilist.at(4));
    if(chineseyilist.count() == 4)
       yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1)).append("\n").append(chineseyilist.at(2)).append("\n").append(chineseyilist.at(3));
    if (chineseyilist.count() == 3)
       yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1)).append("\n").append(chineseyilist.at(2));
    if (chineseyilist.count() == 2)
       yi = QString("").append(chineseyilist.at(0)).append("\n").append(chineseyilist.at(1));
    if (chineseyilist.count() == 1)
       yi = QString("").append(chineseyilist.at(0)).append("\n");
    this->label_17->setText(yi);

    if(chinesejilist.count() == 0 )
       ji =QString("");
    if(chinesejilist.count() >= 5)
       ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1)).append("\n").append(chinesejilist.at(2)).append("\n").append(chinesejilist.at(3)).append("\n").append(chinesejilist.at(4));
    if(chinesejilist.count() == 4)
       ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1)).append("\n").append(chinesejilist.at(2)).append("\n").append(chinesejilist.at(3));
    if (chinesejilist.count() == 3)
       ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1)).append("\n").append(chinesejilist.at(2));
    if (chinesejilist.count() == 2)
       ji = QString("").append(chinesejilist.at(0)).append("\n").append(chinesejilist.at(1));
    if (chinesejilist.count() == 1)
       ji = QString("").append(chinesejilist.at(0)).append("\n");
    this->label_18->setText(ji);

    QString cnote=mycalendat->ctcl_displaydata(day.year(),day.month(),day.day());
    QString haveplan=QString("今日有行程安排");
    QString noplan=QString("今日无行程安排");
    int num = cnote.count();
    while (num > 0 && cnote.at(num-1).isSpace())
    {
        num--;
    }

    if(cnote.isEmpty() || num == 0)
        this->label_19->setText(noplan);
    else
        this->label_19->setText(haveplan);

    pa.setColor(QPalette::WindowText,Qt::white);
    this->label->setPalette(pa);
    this->label_2->setPalette(pa);
    this->label_15->setPalette(pa);
    this->label_4->setPalette(pa);
    this->label_5->setPalette(pa);
    this->label_6->setPalette(pa);
    this->label_7->setPalette(pa);
    this->label_8->setPalette(pa);

    pa.setColor(QPalette::WindowText,QColor(255,255,255));
    this->label_3->setPalette(pa);
    this->label_9->setPalette(pa); 

    pa.setColor(QPalette::WindowText,Qt::black);
    this->label_18->setPalette(pa);

    pa.setColor(QPalette::WindowText,QColor(235,74,20));
    this->label_10->setPalette(pa);
    this->label_12->setPalette(pa);
    this->label_13->setPalette(pa);
    this->label_14->setPalette(pa);

    pa.setColor(QPalette::WindowText,Qt::white);
    this->label_19->setPalette(pa);

    pa.setColor(QPalette::WindowText,Qt::red);
    this->label_11->setPalette(pa);
    this->label_17->setPalette(pa);

    map = new QMap<QString, DateItem *>();

    for (int i = 1; i <= 6; i++)
    {
        for (int j = 1; j <= 7; j++)
        {
            DateItem *dateitem = new DateItem(this);
            if (i <= 5)
            {
                dateitem->show();
            }
            else
            {
                dateitem->hide();
            }

            map->insert(QString("%1-%2").arg(i).arg(j), dateitem);

            if ((i < 6) || (i == 6 && (j == 1 || j == 2)))
            {
                connect(dateitem, SIGNAL(clicked(QString)), this, SLOT(resetcalendardate(QString)));
                connect(dateitem, SIGNAL(day(QString)), this, SLOT(setclickday(QString)));
                connect(dateitem, SIGNAL(resetColor()), this, SLOT(resetDateItemColor()));
            }
        }
    }

    setItemLayout();
    setCalendar();

    QTimer *timer = new QTimer(this);
    timer->setInterval(1000);
    connect(timer,SIGNAL(timeout()),this,SLOT(setTime()));
    timer->start();

    QBitmap objBitmap(size());
    QPainter painter(&objBitmap);
    painter.fillRect(rect(),Qt::white);
    painter.setBrush(QColor(0,0,0));
    painter.drawRoundedRect(this->rect(),10,10);
    setMask(objBitmap);

    aboutDlg = new AboutDialog();
    aboutDlg->hide();

    this->createTray();

    note = new Cnote;
    QDesktopWidget desktop;
    int width = desktop.screenGeometry().width();
    note->setGeometry(QRect(width-400,80,224,280));
    connect(note,SIGNAL(save(QString)),this,SLOT(savedata(QString)));
    note->hide();
}
UBBrushPropertiesFrame::UBBrushPropertiesFrame(QFrame* owner, const QList<QColor>& lightBackgroundColors,
        const QList<QColor>& darkBackgroundColors, const QList<QColor>& lightBackgroundSelectedColors,
        const QList<QColor>& darkBackgroundSelectedColors, UBPreferencesController* controller)
{
    setupUi(owner);

    QPalette lightBackgroundPalette = QApplication::palette();
    lightBackgroundPalette.setColor(QPalette::Window, Qt::white);

    lightBackgroundFrame->setAutoFillBackground(true);
    lightBackgroundFrame->setPalette(lightBackgroundPalette);

    QPalette darkBackgroundPalette = QApplication::palette();
    darkBackgroundPalette.setColor(QPalette::Window, Qt::black);
    darkBackgroundPalette.setColor(QPalette::ButtonText, Qt::white);
    darkBackgroundPalette.setColor(QPalette::WindowText, Qt::white);

    darkBackgroundFrame->setAutoFillBackground(true);
    darkBackgroundFrame->setPalette(darkBackgroundPalette);
    darkBackgroundLabel->setPalette(darkBackgroundPalette);

    QList<QColor> firstLightBackgroundColor;
    firstLightBackgroundColor.append(lightBackgroundColors[0]);

    lightBackgroundColorPicker0->setColors(firstLightBackgroundColor);
    lightBackgroundColorPicker0->setSelectedColorIndex(0);
    lightBackgroundColorPickers.append(lightBackgroundColorPicker0);

    for (int i = 1 ; i < UBSettings::settings()->colorPaletteSize ; i++)
    {
        UBColorPicker *picker = new UBColorPicker(lightBackgroundFrame);
        picker->setObjectName(QString::fromUtf8("penLightBackgroundColor") + i);
        picker->setMinimumSize(QSize(32, 32));
        picker->setFrameShape(QFrame::StyledPanel);
        picker->setFrameShadow(QFrame::Raised);

        lightBackgroundLayout->addWidget(picker);

        picker->setColors(lightBackgroundColors);

        picker->setSelectedColorIndex(lightBackgroundColors.indexOf(lightBackgroundSelectedColors.at(i)));

        lightBackgroundColorPickers.append(picker);

        QObject::connect(picker, SIGNAL(colorSelected(const QColor&)), controller, SLOT(colorSelected(const QColor&)));

    }

    QList<QColor> firstDarkBackgroundColor;
    firstDarkBackgroundColor.append(darkBackgroundColors[0]);

    darkBackgroundColorPicker0->setColors(firstDarkBackgroundColor);
    darkBackgroundColorPicker0->setSelectedColorIndex(0);
    darkBackgroundColorPickers.append(darkBackgroundColorPicker0);

    for (int i = 1 ; i < UBSettings::settings()->colorPaletteSize ; i++)
    {
        UBColorPicker *picker = new UBColorPicker(darkBackgroundFrame);
        picker->setObjectName(QString::fromUtf8("penDarkBackgroundColor") + i);
        picker->setMinimumSize(QSize(32, 32));
        picker->setFrameShape(QFrame::StyledPanel);
        picker->setFrameShadow(QFrame::Raised);

        darkBackgroundLayout->addWidget(picker);

        picker->setColors(darkBackgroundColors);
        picker->setSelectedColorIndex(darkBackgroundColors.indexOf(darkBackgroundSelectedColors.at(i)));

        darkBackgroundColorPickers.append(picker);

        QObject::connect(picker, SIGNAL(colorSelected(const QColor&)), controller, SLOT(colorSelected(const QColor&)));

    }
}
Example #3
0
	void paintContact(QPainter* mp, const QStyleOptionViewItem& option, const QModelIndex& index, GCUserViewItem* item) const
	{
		mp->save();
		QStyleOptionViewItem o = option;
		QPalette palette = o.palette;
		MUCItem::Role r = item->s.mucItem().role();
		QRect rect = o.rect;

		if(nickColoring_) {
			if(r == MUCItem::Moderator)
				palette.setColor(QPalette::Text, colorModerator_);
			else if(r == MUCItem::Participant)
				palette.setColor(QPalette::Text, colorParticipant_);
			else if(r == MUCItem::Visitor)
				palette.setColor(QPalette::Text, colorVisitor_);
			else
				palette.setColor(QPalette::Text, colorNoRole_);
		}

		mp->fillRect(rect, (o.state & QStyle::State_Selected) ? palette.color(QPalette::Highlight) : palette.color(QPalette::Base));

		if(showAvatar_) {
			QPixmap ava = item->avatar();
			if(ava.isNull()) {
				ava = IconsetFactory::iconPixmap("psi/default_avatar");
			}
			ava = AvatarFactory::roundedAvatar(ava, avatarRadius_, avatarSize_);
			QRect avaRect(rect);
			avaRect.setWidth(ava.width());
			avaRect.setHeight(ava.height());
			if(!avatarAtLeft_) {
				avaRect.moveTopRight(rect.topRight());
				avaRect.translate(-1, 1);
				rect.setRight(avaRect.left() - 1);
			}
			else {
				avaRect.translate(1, 1);
				rect.setLeft(avaRect.right() + 1);
			}
			mp->drawPixmap(avaRect, ava);
		}

		QPixmap status = showStatusIcons_ ? item->icon() : QPixmap();
		int h = rect.height();
		int sh = status.isNull() ? 0 : status.height();
		rect.setHeight(qMax(sh, fontHeight_));
		rect.moveTop(rect.top() + (h - rect.height())/2);
		if(!status.isNull()) {
			QRect statusRect(rect);
			statusRect.setWidth(status.width());
			statusRect.setHeight(status.height());
			statusRect.translate(1, 1);
			mp->drawPixmap(statusRect, status);
			rect.setLeft(statusRect.right() + 2);
		}
		else
			rect.setLeft(rect.left() + 2);

		mp->setPen(QPen((o.state & QStyle::State_Selected) ? palette.color(QPalette::HighlightedText) : palette.color(QPalette::Text)));
		mp->setFont(o.font);
		mp->setClipRect(rect);
		QTextOption to;
		to.setWrapMode(QTextOption::NoWrap);
		mp->drawText(rect, index.data(Qt::DisplayRole).toString(), to);

		QList<QPixmap> rightPixs;
		if(showClients_) {
			GCUserView *gcuv = (GCUserView*)item->treeWidget();
			GCMainDlg* dlg = gcuv->mainDlg();
			QPixmap clientPix;
			if(dlg) {
				UserListItem u;
				const QString &nick = item->text(0);
				Jid caps_jid(/*s.mucItem().jid().isEmpty() ? */ dlg->jid().withResource(nick) /* : s.mucItem().jid()*/);
				QString client_name = dlg->account()->capsManager()->clientName(caps_jid);
				QString client_version = (client_name.isEmpty() ? QString() : dlg->account()->capsManager()->clientVersion(caps_jid));
				UserResource ur;
				ur.setClient(client_name,client_version,"");
				u.userResourceList().append(ur);
				QStringList clients = u.clients();
				if(!clients.isEmpty())
					clientPix = IconsetFactory::iconPixmap("clients/" + clients.takeFirst());
			}
			if(!clientPix.isNull())
				rightPixs.push_back(clientPix);
		}

		if(showAffiliations_) {
			MUCItem::Affiliation a = item->s.mucItem().affiliation();
			QPixmap pix;
			if(a == MUCItem::Owner)
				pix = IconsetFactory::iconPixmap("affiliation/owner");
			else if(a == MUCItem::Admin)
				pix = IconsetFactory::iconPixmap("affiliation/admin");
			else if(a == MUCItem::Member)
				pix = IconsetFactory::iconPixmap("affiliation/member");
			else if(a == MUCItem::Outcast)
				pix = IconsetFactory::iconPixmap("affiliation/outcast");
			else
				pix = IconsetFactory::iconPixmap("affiliation/noaffiliation");
			if(!pix.isNull())
				rightPixs.push_back(pix);
		}

		mp->restore();

		if(rightPixs.isEmpty())
			return;

		int sumWidth = 0;
		foreach (const QPixmap& pix, rightPixs) {
				sumWidth += pix.width();
		}
		sumWidth += rightPixs.count();

		QColor bgc = (option.state & QStyle::State_Selected) ? palette.color(QPalette::Highlight) : palette.color(QPalette::Base);
		QColor tbgc = bgc;
		tbgc.setAlpha(0);
		QLinearGradient grad(rect.right() - sumWidth - 20, 0, rect.right() - sumWidth, 0);
		grad.setColorAt(0, tbgc);
		grad.setColorAt(1, bgc);
		QBrush tbakBr(grad);
		QRect gradRect(rect);
		gradRect.setLeft(gradRect.right() - sumWidth - 20);
		mp->fillRect(gradRect, tbakBr);

		QRect iconRect(rect);
		for (int i=0; i<rightPixs.size(); i++) {
			const QPixmap pix = rightPixs[i];
			iconRect.setRight(iconRect.right() - pix.width() -1);
			mp->drawPixmap(iconRect.topRight(), pix);
		}

	}
Example #4
0
SubWindow::SubWindow(QWidget *parent , const QString &firstLabel, const QString &seclabel, const QString &thrdlabel,
                     int w, int h) :
    QFrame(parent)
{

    active=true;
    QPalette PW;
    PW.setColor(backgroundRole(), Qt::white);

    setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    setLineWidth(3);
    resize(w,h);
    setAutoFillBackground(true);
    setPalette(PW);

    first_label = new ExLabel(firstLabel, this);
    first_label->setAlignment(Qt::AlignCenter);

    second_label = new ExLabel(seclabel,this);
    second_label->setAlignment(Qt::AlignCenter);

    third_label = new ExLabel(thrdlabel,this);
    third_label->setAlignment(Qt::AlignCenter);

    QPalette pal;
    pal.setColor(first_label->foregroundRole(), QColor(0, 90, 255));


    QFont unsel;
    unsel.setPixelSize(13);
    unsel.setBold(false);
    unsel.setUnderline(false);

    QFont sel;
    sel.setPixelSize(13);
    sel.setBold(true);
    sel.setUnderline(true);

    QFont act;
    act.setPixelSize(14);
    act.setBold(true);
    act.setUnderline(true);

    first_label->setPalette(pal);
    first_label->SetSelectedFont(sel);
    first_label->SetUnSelectedFont(unsel);
    first_label->SetActiveFont(act);


    second_label->setPalette(pal);
    second_label->SetSelectedFont(sel);
    second_label->SetUnSelectedFont(unsel);
    second_label->SetActiveFont(act);

    third_label->setPalette(pal);
    third_label->SetSelectedFont(sel);
    third_label->SetUnSelectedFont(unsel);
    third_label->SetActiveFont(act);

    QFrame *hor_line = new QFrame(this);
    hor_line->setFrameStyle(QFrame::HLine| QFrame::Raised);
    hor_line->setLineWidth(1);
    hor_line->setMaximumHeight(5);

    connect(first_label, SIGNAL(clicked()),SLOT(firstLabelClick()));
    connect(second_label, SIGNAL(clicked()), SLOT(secondLabelClick()));
    connect(third_label, SIGNAL(clicked()), SLOT(thirdLabelClick()));

    toplay = new QBoxLayout(QBoxLayout::TopToBottom);
    midlay = new QBoxLayout(QBoxLayout::TopToBottom);
    botlay = new QBoxLayout(QBoxLayout::TopToBottom);

    QBoxLayout * headerlay=new QBoxLayout(QBoxLayout::LeftToRight);


    headerlay->setSpacing(10);
    headerlay->setMargin(10);


    headerlay->addWidget(first_label, 1);
    headerlay->addWidget(second_label, 1);
    headerlay->addWidget(third_label,1);

    toplay->addLayout(headerlay, 0);
    toplay->addWidget(hor_line, 0, Qt::AlignTop);

    QBoxLayout *biglay = new QBoxLayout(QBoxLayout::TopToBottom, this);
    biglay->addLayout(toplay, 0);
    biglay->addLayout(midlay, 0);
    biglay->addLayout(botlay, 0);

    grayZone= new QFrame(this);
    QPalette botGrayPal;
    botGrayPal.setColor(grayZone->backgroundRole(), QColor(238, 233, 233));
    grayZone->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    grayZone->setPalette(botGrayPal);
    grayZone->setAutoFillBackground(true);
    grayZone->setVisible(false);

    hide();

}
Example #5
0
void g_setProperty(const char* what, const char* arg) {

    QString argGet = QString::fromUtf8(arg);
    int arg1 = 0;
    int arg2 = 0;
    int arg3 = 0;
    QString argString = "";

    if ( g_checkStringProperty(true,what)) {
        argString = argGet;
        argString.replace("\\","\\\\");
    } else {
        QStringList arrayArg = argGet.split("|",QString::KeepEmptyParts);
        arg1 = arrayArg.at(0).toInt();
        arg2 = arrayArg.at(1).toInt();
        arg3 = arrayArg.at(2).toInt();
    }



    /*------------------------------------------------------------------*/
    if (strcmp(what, "cursor") == 0)
    {
        QStringList acceptedValue;
        acceptedValue << "arrow" << "upArrow" << "cross" << "wait" << "IBeam";
        acceptedValue << "sizeVer" << "sizeHor" << "sizeBDiag" << "sizeFDiag" << "sizeAll";
        acceptedValue << "blank" << "splitV" << "splitH" << "pointingHand" << "forbidden";
        acceptedValue << "whatsThis" << "busy" << "openHand" << "closedHand" << "dragCopy";
        acceptedValue << "dragMove" << "dragLink";
        // value of cursor also taken from index of the text, do not change the list

        if (acceptedValue.contains(argString)) {
            arg1 = acceptedValue.indexOf(argString);
            MainWindow::getInstance()->setCursor((Qt::CursorShape) arg1);
        } else {
            QString info = "Accepted value for ";
            info.append(what);
            info.append(" :");
            MainWindow::getInstance()->printToOutput(info.toStdString().c_str());
            for( int i=0; i<acceptedValue.size(); ++i ) {
                MainWindow::getInstance()->printToOutput( QString("- ").append(acceptedValue.at(i)).toStdString().c_str() );
            }
        }


        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "windowPosition") == 0)
    {
        MainWindow::getInstance()->move(arg1,arg2);

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "windowSize") == 0)
    {
        MainWindow::getInstance()->resizeWindow(arg1,arg2);


        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "minimumSize") == 0)
    {
        MainWindow::getInstance()->setMinimumSize(QSize(arg1,arg2));

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "maximumSize") == 0)
    {
        MainWindow::getInstance()->setMaximumSize(QSize(arg1,arg2));

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "windowColor") == 0)
    {
        if (arg1 > 255) {
            arg1 = 255;
        }
        else if(arg1 < 0) {
            arg1 = 255;
        }
        if (arg2 > 255) {
            arg2 = 255;
        }
        else if(arg2 < 0) {
            arg2 = 255;
        }
        if (arg3 > 255) {
            arg3 = 255;
        }
        else if(arg3 < 0) {
            arg3 = 255;
        }
        QPalette palette;
        QColor backgroundColor = QColor(arg1, arg2, arg3);
        palette.setColor(QPalette::Window, backgroundColor);
        MainWindow::getInstance()->setPalette(palette);

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "windowTitle") == 0)
    {
        MainWindow::getInstance()->setWindowTitle(argString);

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "windowModel") == 0)
    {
        QStringList acceptedValue;
        acceptedValue << "reset" << "stayOnTop" << "stayOnBottom" << "frameless" << "noTitleBar";
        acceptedValue << "noButton" << "onlyMinimize" << "onlyMaximize" << "onlyClose" << "noMinimize";
        acceptedValue << "noMaximize" << "noClose" << "helpButton";

        if (acceptedValue.contains(argString)) {
            Qt::WindowFlags flags = MainWindow::getInstance()->windowFlags();

            if (argString == "reset") {
                flags = Qt::Window;
            } else if (argString == "stayOnTop") {
                flags |= Qt::WindowStaysOnTopHint;
            } else if (argString == "stayOnBottom") {
                flags |= Qt::WindowStaysOnBottomHint;
            } else if (argString == "frameless") {
                flags |= Qt::FramelessWindowHint;
            } else if (argString == "noTitleBar") {
                flags = Qt::Window;
                flags |= Qt::CustomizeWindowHint;
            } else if (argString == "noButton") {
                flags = Qt::Window;
                flags |= Qt::WindowTitleHint;
            } else if (argString == "noClose") {
                flags = Qt::Window;
                flags |= Qt::WindowMinimizeButtonHint;
            } else if (argString == "onlyMaximize") {
                flags = Qt::Window;
                flags |= Qt::WindowMaximizeButtonHint;
            } else if (argString == "onlyClose") {
                flags = Qt::Window;
                flags |= Qt::WindowCloseButtonHint;
            } else if (argString == "noMinimize") {
                flags = Qt::Window;
                flags |= Qt::WindowMaximizeButtonHint;
                flags |= Qt::WindowCloseButtonHint;
            } else if (argString == "noMaximize") {
                flags = Qt::Window;
                flags |= Qt::WindowMinimizeButtonHint;
                flags |= Qt::WindowCloseButtonHint;
            } else if (argString == "noClose") {
                flags = Qt::Window;
                flags |= Qt::WindowMinimizeButtonHint;
                flags |= Qt::WindowMaximizeButtonHint;
            } else if (argString == "helpButton") {
                flags = Qt::Window;
                flags |= Qt::WindowContextHelpButtonHint;
                flags |= Qt::WindowCloseButtonHint;
            }

            MainWindow::getInstance()->setWindowFlags(flags);
            if (MainWindow::getInstance()->fullScreen()) {
                MainWindow::getInstance()->showFullScreen();
            } else {
                MainWindow::getInstance()->showNormal();
            }

        } else {

            QString info = "Accepted value for ";
            info.append(what);
            info.append(" :");
            MainWindow::getInstance()->printToOutput(info.toStdString().c_str());
            for( int i=0; i<acceptedValue.size(); ++i ) {
                MainWindow::getInstance()->printToOutput( QString("- ").append(acceptedValue.at(i)).toStdString().c_str() );
            }
        }

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "cursorPosition") == 0)
    {
        QCursor::setPos(arg1,arg2);


        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "clipboard") == 0)
    {
        QClipboard *clipboard = QApplication::clipboard();
        clipboard->setText(argString);

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "mkDir") == 0)
    {
        QStringList argSplit = argString.split("|",QString::KeepEmptyParts);
        if(argSplit.size() == 1) {

            MainWindow::getInstance()->printToOutput("[[Usage Example]]");
            MainWindow::getInstance()->printToOutput("application:set(\"mkDir\",application:get(\"directory\",\"executable\")..\"|dirName\")");
        } else {
            QDir dirPath = QDir::temp();
            dirPath.setPath(argSplit.at(0));
            dirPath.mkdir(argSplit.at(1));
        }

        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "documentDirectory") == 0)
    {
        setDocumentsDirectory(argString.toStdString().c_str());
        /*------------------------------------------------------------------*/
    } else if (strcmp(what, "temporaryDirectory") == 0)
    {
        setTemporaryDirectory(argString.toStdString().c_str());

    } else {

        // feel free to change this list
        QStringList acceptedWhat;
        acceptedWhat << "windowPosition(x,y)";
        acceptedWhat << "windowSize(w,h)";
        acceptedWhat << "minimumSize(w,h)";
        acceptedWhat << "maximumSize(w,h)";
        acceptedWhat << "windowColor(r,g,b)";
        acceptedWhat << "windowTitle(text)";
        acceptedWhat << "windowModel(type//help)";
        acceptedWhat << "cursor(type//help)";
        acceptedWhat << "cursorPosition(x,y)";
        acceptedWhat << "clipboard(text)";
        acceptedWhat << "mkdir(path|dirName//help)";
        acceptedWhat << "documentDirectory(path)";
        acceptedWhat << "temporaryDirectory(path)";

        MainWindow::getInstance()->printToOutput("Accepted value for Desktop's application:set()");
        for( int i=0; i<acceptedWhat.size(); ++i ) {
            MainWindow::getInstance()->printToOutput( QString("- ").append(acceptedWhat.at(i)).toStdString().c_str() );
        }
    }
}
controlForm::controlForm(QString fileName,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::controlForm)
{
    ui->setupUi(this);
    this->setToolTip ("select target");
    QString sceneName = fileName.split ("/").last ().split (".")[0];
    scene_ID = sceneName;
    sceneName.remove (0,1);
    qDebug () << sceneName;
    QStringList temp = fileName.split ("/");
    temp.removeLast ();
    QString path = temp.join ("/")+ "/Single";
    qDebug () << path;
    QDir currentDir = QDir(path);
    QStringList singleFileList = currentDir.entryList ();

    int count = 0;
    int showCount = 0 ;

    foreach (QString temp, singleFileList)
    {
        if (temp.contains (sceneName.split ("-")[0]))
            count++;
    }

//    QHBoxLayout *layout = new QHBoxLayout;
//    QHBoxLayout *layout2 = new QHBoxLayout;
//    QHBoxLayout *layout3 = new QHBoxLayout;
//    QHBoxLayout *layout4 = new QHBoxLayout;


    foreach(QString singleFile, singleFileList)
    {
        qDebug () <<count;

        if (singleFile.contains (sceneName.split ("-")[0]))
        {
            showCount++;
            qDebug () << singleFile << "file name";

            QPixmap pixmapItem;
            QString imageForButton = path + "/" + singleFile;
            MyButton *myButtonWithImage;
            QPalette palette;
            QIcon icon = QIcon(imageForButton);
            myButtonWithImage = new MyButton(icon);
            myButtonWithImage->setText (singleFile.split (".")[0]);
            myButtonWithImage->setAutoFillBackground(true);
            palette = myButtonWithImage->palette();
            palette.setColor(QPalette::Button,QColor(82,110,166));
            myButtonWithImage->setPalette(palette);
            myButtonWithImage->setIcon(icon);
            myButtonWithImage->setIconSize(QSize(80, 120));
            myButtonWithImage->setToolTip("Select target");


            QLabel *IDLabel = new QLabel();
            IDLabel->setText (singleFile.split (".")[0]);
            myButtonWithImage->setFixedSize (80,130);

//            layout->addWidget (myButtonWithImage);
//            layout->addWidget (IDLabel);
            ui->horizontalLayout->addWidget (myButtonWithImage);
            ui->horizontalLayout->addWidget (IDLabel);
            ui->horizontalLayout->setDirection (QBoxLayout::RightToLeft);
            //ui->horizontalLayout->addLayout (layout);

            globalMyButtons.append (myButtonWithImage);

        }
        ui->horizontalLayout->addStretch (0);
    }
QBalloonTip::QBalloonTip(QSystemTrayIcon::MessageIcon icon, const QString& title,
                         const QString& message, QSystemTrayIcon *ti)
    : QWidget(0, Qt::ToolTip), trayIcon(ti), timerId(-1)
{
    setAttribute(Qt::WA_DeleteOnClose);
    QObject::connect(ti, SIGNAL(destroyed()), this, SLOT(close()));

    QLabel *titleLabel = new QLabel;
    titleLabel->installEventFilter(this);
    titleLabel->setText(title);
    QFont f = titleLabel->font();
    f.setBold(true);
#ifdef Q_OS_WINCE
    f.setPointSize(f.pointSize() - 2);
#endif
    titleLabel->setFont(f);
    titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows

#ifdef Q_OS_WINCE
    const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
    const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2;
#else
    const int iconSize = 18;
    const int closeButtonSize = 15;
#endif

    QPushButton *closeButton = new QPushButton;
    closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
    closeButton->setIconSize(QSize(closeButtonSize, closeButtonSize));
    closeButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    closeButton->setFixedSize(closeButtonSize, closeButtonSize);
    QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

    QLabel *msgLabel = new QLabel;
#ifdef Q_OS_WINCE
    f.setBold(false);
    msgLabel->setFont(f);
#endif
    msgLabel->installEventFilter(this);
    msgLabel->setText(message);
    msgLabel->setTextFormat(Qt::PlainText);
    msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);

    // smart size for the message label
#ifdef Q_OS_WINCE
    int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2;
#else
    int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3;
#endif
    if (msgLabel->sizeHint().width() > limit) {
        msgLabel->setWordWrap(true);
        if (msgLabel->sizeHint().width() > limit) {
            msgLabel->d_func()->ensureTextControl();
            if (QWidgetTextControl *control = msgLabel->d_func()->control) {
                QTextOption opt = control->document()->defaultTextOption();
                opt.setWrapMode(QTextOption::WrapAnywhere);
                control->document()->setDefaultTextOption(opt);
            }
        }
#ifdef Q_OS_WINCE
        // Make sure that the text isn't wrapped "somewhere" in the balloon widget
        // in the case that we have a long title label.
        setMaximumWidth(limit);
#else
        // Here we allow the text being much smaller than the balloon widget
        // to emulate the weird standard windows behavior.
        msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
#endif
    }

    QIcon si;
    switch (icon) {
    case QSystemTrayIcon::Warning:
        si = style()->standardIcon(QStyle::SP_MessageBoxWarning);
        break;
    case QSystemTrayIcon::Critical:
	si = style()->standardIcon(QStyle::SP_MessageBoxCritical);
        break;
    case QSystemTrayIcon::Information:
	si = style()->standardIcon(QStyle::SP_MessageBoxInformation);
        break;
    case QSystemTrayIcon::NoIcon:
    default:
        break;
    }

    QGridLayout *layout = new QGridLayout;
    if (!si.isNull()) {
        QLabel *iconLabel = new QLabel;
        iconLabel->setPixmap(si.pixmap(iconSize, iconSize));
        iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
        iconLabel->setMargin(2);
        layout->addWidget(iconLabel, 0, 0);
        layout->addWidget(titleLabel, 0, 1);
    } else {
        layout->addWidget(titleLabel, 0, 0, 1, 2);
    }

    layout->addWidget(closeButton, 0, 2);
    layout->addWidget(msgLabel, 1, 0, 1, 3);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    layout->setMargin(3);
    setLayout(layout);

    QPalette pal = palette();
    pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1));
    pal.setColor(QPalette::WindowText, Qt::black);
    setPalette(pal);
}
RealtimePlot::RealtimePlot() : 
    pwrCurve(NULL),
    showPowerState(Qt::Checked),
    showPow30sState(Qt::Checked),
    showHrState(Qt::Checked),
    showSpeedState(Qt::Checked),
    showCadState(Qt::Checked),
    showAltState(Qt::Checked),
    smooth(0)
{
    setInstanceName("Realtime Plot");

    //insertLegend(new QwtLegend(), QwtPlot::BottomLegend);
    pwr30Data = new Realtime30PwrData;
    pwrData = new RealtimePwrData;
    altPwrData = new RealtimePwrData;
    spdData = new RealtimeSpdData;
    hrData = new RealtimeHrData;
    cadData = new RealtimeCadData;

    // Setup the axis (of evil :-)
    setAxisTitle(yLeft, "Watts");
    setAxisTitle(yRight, "Cadence / HR");
    setAxisTitle(yRight2, "Speed");
    setAxisTitle(xBottom, "Seconds Ago");
    setAxisMaxMinor(xBottom, 0);
    setAxisMaxMinor(yLeft, 0);
    setAxisMaxMinor(yLeft2, 0);
    setAxisMaxMinor(yRight, 0);
    setAxisMaxMinor(yRight2, 0);

    QPalette pal;
    setAxisScale(yLeft, 0, 500); // watts
    pal.setColor(QPalette::WindowText, GColor(CPOWER));
    pal.setColor(QPalette::Text, GColor(CPOWER));
    axisWidget(QwtPlot::yLeft)->setPalette(pal);
    axisWidget(QwtPlot::yLeft)->scaleDraw()->setTickLength(QwtScaleDiv::MajorTick, 3);

    setAxisScale(yRight, 0, 230); // cadence / hr
    pal.setColor(QPalette::WindowText, GColor(CHEARTRATE));
    pal.setColor(QPalette::Text, GColor(CHEARTRATE));
    axisWidget(QwtPlot::yRight)->setPalette(pal);
    axisWidget(QwtPlot::yRight)->scaleDraw()->setTickLength(QwtScaleDiv::MajorTick, 3);

    setAxisScale(xBottom, MAXSAMPLES, 0, 15); // time ago
    pal.setColor(QPalette::WindowText, GColor(CPLOTMARKER));
    pal.setColor(QPalette::Text, GColor(CPLOTMARKER));
    axisWidget(QwtPlot::xBottom)->setPalette(pal);
    axisWidget(QwtPlot::xBottom)->scaleDraw()->setTickLength(QwtScaleDiv::MajorTick, 3);

    setAxisScale(yRight2, 0, 60); // speed km/h - 60kmh on a turbo is good going!
    pal.setColor(QPalette::WindowText, GColor(CSPEED));
    pal.setColor(QPalette::Text, GColor(CSPEED));
    axisWidget(QwtPlot::yRight2)->setPalette(pal);
    axisWidget(QwtPlot::yRight2)->scaleDraw()->setTickLength(QwtScaleDiv::MajorTick, 3);

	setAxisLabelRotation(yRight2,90);
	setAxisLabelAlignment(yRight2,Qt::AlignVCenter);

    enableAxis(xBottom, false); // very little value and some cpu overhead
    enableAxis(yLeft, true);
    enableAxis(yRight, true);
    enableAxis(yRight2, true);

    // 30s Power curve
    pwr30Curve = new QwtPlotCurve("30s Power");
    pwr30Curve->setRenderHint(QwtPlotItem::RenderAntialiased); // too cpu intensive
    pwr30Curve->attach(this);
    pwr30Curve->setYAxis(QwtPlot::yLeft);

    // Power curve
    pwrCurve = new QwtPlotCurve("Power");
    //pwrCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    pwrCurve->setData(pwrData);
    pwrCurve->attach(this);
    pwrCurve->setYAxis(QwtPlot::yLeft);

    altPwrCurve = new QwtPlotCurve("Alt Power");
    //pwrCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    altPwrCurve->setData(altPwrData);
    altPwrCurve->attach(this);
    altPwrCurve->setYAxis(QwtPlot::yLeft);

    // HR
    hrCurve = new QwtPlotCurve("HeartRate");
    //hrCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    hrCurve->setData(hrData);
    hrCurve->attach(this);
    hrCurve->setYAxis(QwtPlot::yRight);

    // Cadence
    cadCurve = new QwtPlotCurve("Cadence");
    //cadCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    cadCurve->setData(cadData);
    cadCurve->attach(this);
    cadCurve->setYAxis(QwtPlot::yRight);

    // Speed
    spdCurve = new QwtPlotCurve("Speed");
    //spdCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
    spdCurve->setData(spdData);
    spdCurve->attach(this);
    spdCurve->setYAxis(QwtPlot::yRight2);

    // Load
//    lodCurve = new QwtPlotCurve("Load");
//    //lodCurve->setRenderHint(QwtPlotItem::RenderAntialiased);
//    QPen lodpen = QPen(QColor(128,128,128));
//    lodpen.setWidth(2.0);
//    lodCurve->setPen(lodpen);
//    QColor brush_color = QColor(124, 91, 31);
//    brush_color.setAlpha(64);
//    lodCurve->setBrush(brush_color);   // fill below the line
//    lodCurve->setData(lodData);
//    lodCurve->attach(this);
//    lodCurve->setYAxis(QwtPlot::yLeft);
    canvas()->setFrameStyle(QFrame::NoFrame);
    configChanged(); // set colors
}
Example #9
0
TodoList::TodoList(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::TodoList),
    pa("WKCN"){
    ui->setupUi(this);

    state = WINSTATE::LIST;

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(timerUpDate()));
    timer->start(10);//FPS 100

    //设置白色背景
    QPalette palette;
    palette.setBrush(this->backgroundRole(), Qt::white);
    this->setPalette(palette);

    //设置字体
    //QPainter painter;
    font  = this->font;//painter.font();
    font.setPointSize(20);
    sFont  = this->font;//painter.font();
    sFont.setPointSize(15);
    //painter.setFont(font);
    dateFont  = this->font;//painter.font();
    dateFont.setPointSize(9);

    //针对linux字体显示过大问题
    #if !defined(Q_OS_WIN)
        ui->comboBox->setFont(dateFont);
        ui->radioButton_1->setFont(dateFont);
        ui->radioButton_2->setFont(dateFont);
        ui->radioButton_3->setFont(dateFont);
        ui->radioButton_4->setFont(dateFont);
        ui->warningBox->setFont(dateFont);
    #endif

    //"+",标题蓝色
    QPalette   pal;
    pal.setColor(QPalette::ButtonText, QColor(0,205,255));
    ui->addTodo->setPalette(pal);
    ui->confirmButton->setPalette(pal);
    ui->titleBox->setFont(font);
    pal.setColor(QPalette::WindowText, QColor(0,205,255));
    ui->titleBox->setPalette(pal);

    //读取图片资源
    boxes[0] = QPixmap(GetFileDir("pic//green.png"));
    boxes[1] = QPixmap(GetFileDir("pic//blue.png"));
    boxes[2] = QPixmap(GetFileDir("pic//orange.png"));
    boxes[3] = QPixmap(GetFileDir("pic//red.png"));

    checkPic = QPixmap(GetFileDir("pic//check.png"));
    line = QPixmap(GetFileDir("pic//line.png"));
    circle = QPixmap(GetFileDir("pic//circle.png"));
    selectBox = QPixmap(GetFileDir("pic//box.png"));

    //设置数据
    char temp[128];
    sprintf(temp,"我的一天 - %s",pa.GetName().c_str());
    this->setWindowTitle(QString::fromStdString(temp));
    QDateTime dateTime= QDateTime::currentDateTime();
    QDate qdate = dateTime.date();
    viewDate = Date(qdate.year(),qdate.month(),qdate.day(),0,0);

    viewState = VIEWSTATE::ALL;
    ChangeState(WINSTATE::LIST);

    moveAniFrame = maxMoveAniFrame + 1;
    HideWindows(true);
}
Example #10
0
void CDlgOptions::showEvent(QShowEvent *)
{
    ui->cbAutoLogin->setChecked(CGlobal::Instance()->GetAutoLogin());
    ui->sbDelayTime->setValue(CGlobal::Instance()->GetAutoLoginDelayTime());
    ui->cbNotificationFlash->setChecked(CGlobal::Instance()->IsNotifiationFlashs());
    ui->cbNotificationShowMessage->setChecked(CGlobal::Instance()->IsNotifiationBarShowMessage());
    ui->sbFlashInterval->setValue(CGlobal::Instance()->GetNotifiationFlashInterval());
    ui->sbShowMessageDelay->setValue(CGlobal::Instance()->GetNotifiationBarShowMessageDelay());
    ui->cbMessageSound->setChecked(CGlobal::Instance()->GetMessageSound());
    ui->sbWindowDelayTime->setValue(CGlobal::Instance()->GetAnimationHideMainWindow());
    ui->sbAnimationDuration->setValue(CGlobal::Instance()->GetAnimationDuration());
    ui->cbAutoHideMainWindow->setChecked(CGlobal::Instance()->IsAnimationHideMainWindow());

    CGlobal::E_ROSTER_SHOW_TYPE type = CGlobal::Instance()->GetRosterShowType();
    switch (type) {
    case CGlobal::E_ROSTER_SHOW_JID:
        ui->rbJID->setChecked(true);
        break;
    case CGlobal::E_ROSTER_SHOW_NAME:
        ui->rbName->setChecked(true);
        break;
    case CGlobal::E_ROSTER_SHOW_NICK:
    default:
        ui->rbNick->setChecked(true);
        break;
    }

    CGlobal::E_CLOSE_TYPE closeType = CGlobal::Instance()->GetCloseType();
    switch(closeType)
    {
    case CGlobal::E_CLOSE_TYPE_NO:
        ui->tBtnPrompt->setChecked(true);
        break;
    case CGlobal::E_CLOSE_TYPE_CLOSE_PROGRAME:
        ui->rBtnClosePrograme->setChecked(true);
        break;
    case CGlobal::E_CLOSE_TYPE_LOGOUT:
        ui->rBtnLogout->setChecked(true);
        break;
    }

    CGlobal::E_MESSAGE_SEND_TYPE messageType = CGlobal::Instance()->GetMessageSendType();
    switch(messageType){
    case CGlobal::E_MESSAGE_SEND_TYPE_ENTER:
        ui->rbtnENTER->setChecked(true);
        break;
    case CGlobal::E_MESSAGE_SEND_TYPE_CTRL_ENTER:
    default:
        ui->rBtnCTRLENTER->setChecked(true);
        break;
    }

    QPalette pa;
    pa.setColor(QPalette::WindowText, CGlobal::Instance()->GetUserColor());
    ui->lbLocalUserColor->setPalette(pa);
    pa.setColor(QPalette::WindowText, CGlobal::Instance()->GetRosterColor());
    ui->lbRosterColor->setPalette(pa);
    pa.setColor(QPalette::WindowText, CGlobal::Instance()->GetRosterMessageColor());
    ui->lbRosterMessageColor->setPalette(pa);
    pa.setColor(QPalette::WindowText, CGlobal::Instance()->GetUserMessageColor());
    ui->lbLocalUserMessageColor->setPalette(pa);
    pa.setColor(QPalette::WindowText, CGlobal::Instance()->GetUnreadMessageCountColor());
    ui->lbUnreadMessageCountColor->setPalette(pa);

    CGlobal::E_SCREEN_SHOT_TO_TYPE screenShotType = CGlobal::Instance()->GetScreenShotToType();
    switch (screenShotType) {
    case CGlobal::E_TO_CLIPBOARD:
        ui->rBtn_clipboard->setChecked(true);
        break;
    case CGlobal::E_TO_SAVE:
        ui->rBtn_save->setChecked(true);
        break;
    case CGlobal::E_TO_SEND:
    default:
        ui->rBtn_send->setChecked(true);
        break;
    }

    CGlobal::E_UPDATE updateType = CGlobal::Instance()->GetUpdate();
    switch(updateType)
    {
    case CGlobal::E_UPDATE_EVERY_TIME:
        ui->rbEveryTime->setChecked(true);
        break;
    case CGlobal::E_UPDATE_DAY:
        ui->rbDay->setChecked(true);
        break;
    case CGlobal::E_UPDATE_WEEK:
        ui->rbWeek->setChecked(true);
        break;
    case CGlobal::E_UPDATE_MONTH:
        ui->rbMonth->setChecked(true);
        break;
    case CGlobal::E_UPDATE_DONOT:
        ui->rbDont->setChecked(true);
        break;
    default:
        ui->rbDay->setChecked(true);
        break;
    }

    std::vector<CCameraInfo::CamerInfo> info;
    CCameraFactory::Instance()->EnumDevice(info);
    std::vector<CCameraInfo::CamerInfo>::iterator it;
    for(it = info.begin(); it != info.end(); it++)
    {
        CCameraInfo::CamerInfo ci = *it;
        ui->cbVideo->addItem(ci.szName.c_str());
    }
    ui->cbVideo->addItem(tr("no device"));
    ui->cbVideo->setCurrentIndex(CGlobal::Instance()->GetVideoCaptureDevice());

    QList<QAudioDeviceInfo> infos = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
    foreach (QAudioDeviceInfo info, infos) {
        ui->cbAudioInput->addItem(info.deviceName());
    }
Example #11
0
void QCntEditForm::rowToggle(int row){
    this->row = row;
    lineEdit_row->setText(QString::number(row));
    /*********花板行*****************************/
    lineEdit_hbhl->setText(QString::number(pattern->cnt_huabanhang(row,Md::POSLEFT,Md::POSREAR)));
    lineEdit_hbhr->setText(QString::number(pattern->cnt_huabanhang(row,Md::POSRIGHT,Md::POSREAR)));
    lineEdit_hbhl_q->setText(QString::number(pattern->cnt_huabanhang(row,Md::POSLEFT,Md::POSFRONT)));
    lineEdit_hbhr_q->setText(QString::number(pattern->cnt_huabanhang(row,Md::POSRIGHT,Md::POSFRONT)));

    /**********左口后床指令*********************/
    int indextmp =pattern->cnt_ZhilingIndex(row,Md::POSLEFT,Md::POSREAR);
    comboBox_zllh->setCurrentIndex(indextmp);
    /**********左口前床指令*********************/
    indextmp =  pattern->cnt_ZhilingIndex(row,Md::POSLEFT,Md::POSFRONT);
    comboBox_zllq->setCurrentIndex(indextmp);
    /**********右口后床指令*********************/
    indextmp =  pattern->cnt_ZhilingIndex(row,Md::POSRIGHT,Md::POSREAR);
    comboBox_zlrh->setCurrentIndex(indextmp);
    /**********右口前床指令*********************/
    indextmp = pattern->cnt_ZhilingIndex(row,Md::POSRIGHT,Md::POSFRONT);
    comboBox_zlrq->setCurrentIndex(indextmp);

    /**********左口后床色代号A*********************/
    lineEdit_sdhal->setText(pattern->cnt_seDaiHaoA(row,Md::POSLEFT,Md::POSREAR));
    /**********左口后床色代号H*********************/
    lineEdit_sdhhl->setText(pattern->cnt_seDaiHaoH(row,Md::POSLEFT,Md::POSREAR));
    /**********左口前床色代号A*********************/
    lineEdit_sdhal_q->setText(pattern->cnt_seDaiHaoA(row,Md::POSLEFT,Md::POSFRONT));
    /**********左口前床色代号H*********************/
    lineEdit_sdhhl_q->setText(pattern->cnt_seDaiHaoH(row,Md::POSLEFT,Md::POSFRONT));


    /**********右口后床色代号A*********************/
    lineEdit_sdhar->setText( pattern->cnt_seDaiHaoA(row,Md::POSRIGHT,Md::POSREAR));
    /**********右口后床色代号H*********************/
    lineEdit_sdhhr->setText(pattern->cnt_seDaiHaoH(row,Md::POSRIGHT,Md::POSREAR));
    /**********右口前床色代号A*********************/
    lineEdit_sdhar_q->setText(pattern->cnt_seDaiHaoA(row,Md::POSRIGHT,Md::POSFRONT));
    /**********右口前床色代号H*********************/
    lineEdit_sdhhr_q->setText(pattern->cnt_seDaiHaoH(row,Md::POSRIGHT,Md::POSFRONT));

    /**********左口纱嘴*********************/
    unsigned char sz1 =pattern->cnt_shaZui(row,Md::POSLEFT);
    for(int i=0;i<8;i++)
        pcheckBoxArray1[i]->setChecked(sz1&1<<i);
    /**********右口纱嘴*********************/
    unsigned char sz2 = pattern->cnt_shaZui(row,Md::POSRIGHT);
    for(int i=0;i<8;i++)
        pcheckBoxArray2[i]->setChecked(sz2&1<<i);
    /**********度目,类型*********************/
    //bool doubleorsigle;
    //unsigned char dumu1 = pattern->cnt_duMu(row,doubleorsigle);
    //lineEdit_dm1->setText(QString::number(dumu1));
    //lineEdit_lx->setText(doubleorsigle?tr("双面"):tr("单面"));
    /**********主罗拉*********************/
    lineEdit_zll->setText(QString::number(pattern->cnt_mainLuola(row)));
    /**********辅助罗拉*********************/
    lineEdit_fzll->setText(QString::number(pattern->cnt_fuzuLuola(row)));
    /**********速度*********************/
    lineEdit_sd->setText(QString::number(pattern->cnt_spead(row)));
    /**********送纱电机*********************/
    lineEdit_ssdj->setText(QString::number(pattern->cnt_songSha(row))); //送纱电机=副罗拉
    /**********沙嘴停放*********************/
    lineEdit_sztf->setText(QString::number(pattern->cnt_shazuiTf(row)));
    /**********压脚*********************/
    lineEdit_yj->setText(QString::number(pattern->cnt_yaJiao(row)));
    /**********停车*********************/
    lineEdit_tc->setText(pattern->cnt_tingChe(row)?tr("是"):tr("否"));
    /**********摇床*********************/
    QPattern::YCPOSITION pos;
    signed char yaochuangval;
    patternData.cnt_yaoChuang(row,pos,yaochuangval);
    QString yaochuangstr;
    yaochuangstr.append(QString::number(yaochuangval));
    if((pos==QPattern::FANZHENFU)||(pos==QPattern::FANZHENZHE)){
        QPalette pa;
        pa.setColor(QPalette::WindowText,Qt::red);
        lineEdit_yc->setPalette(pa);
    }
    lineEdit_yc->setText(yaochuangstr);
    /**********循环首*********************/
    lineEdit_xhs->setText(QString::number(pattern->cnt_FechData(row,CNT_LoopStart,2)));
    /**********循环次数*********************/
    lineEdit_xhcs->setText(QString::number(pattern->cnt_FechData(row,CNT_LoopNum,2)));
}
Example #12
0
void Q3TitleBarPrivate::readColors()
{
    Q_Q(Q3TitleBar);
    QPalette pal = q->palette();

    bool colorsInitialized = false;

#ifdef Q_WS_WIN // ask system properties on windows
    if (QApplication::desktopSettingsAware()) {
        pal.setColor(QPalette::Active, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_ACTIVECAPTION)));
        pal.setColor(QPalette::Inactive, QPalette::Highlight, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTION)));
        pal.setColor(QPalette::Active, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_CAPTIONTEXT)));
        pal.setColor(QPalette::Inactive, QPalette::HighlightedText, colorref2qrgb(GetSysColor(COLOR_INACTIVECAPTIONTEXT)));
        colorsInitialized = true;
        BOOL gradient = false;
        SystemParametersInfo(SPI_GETGRADIENTCAPTIONS, 0, &gradient, 0);
        if (gradient) {
            pal.setColor(QPalette::Active, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTACTIVECAPTION)));
            pal.setColor(QPalette::Inactive, QPalette::Base, colorref2qrgb(GetSysColor(COLOR_GRADIENTINACTIVECAPTION)));
        } else {
            pal.setColor(QPalette::Active, QPalette::Base, pal.color(QPalette::Active, QPalette::Highlight));
            pal.setColor(QPalette::Inactive, QPalette::Base, pal.color(QPalette::Inactive, QPalette::Highlight));
        }
    }
#endif // Q_WS_WIN
    if (!colorsInitialized) {
        pal.setColor(QPalette::Active, QPalette::Highlight,
                      pal.color(QPalette::Active, QPalette::Highlight));
        pal.setColor(QPalette::Active, QPalette::Base,
                      pal.color(QPalette::Active, QPalette::Highlight));
        pal.setColor(QPalette::Inactive, QPalette::Highlight,
                      pal.color(QPalette::Inactive, QPalette::Dark));
        pal.setColor(QPalette::Inactive, QPalette::Base,
                      pal.color(QPalette::Inactive, QPalette::Dark));
        pal.setColor(QPalette::Inactive, QPalette::HighlightedText,
                      pal.color(QPalette::Inactive, QPalette::Window));
    }

    q->setPalette(pal);
    q->setActive(act);
}
Example #13
0
void TextShow::setForeground(const QColor& c)
{
    QPalette pal = palette();
    pal.setColor(QPalette::Active, QColorGroup::Text, c);
    setPalette(pal);
}
Example #14
0
void DGLPixelRectangleView::onMouseLeft() {
    m_Ui->labelColorText->clear();
    QPalette pal;
    pal.setColor(m_Ui->widgetColor->backgroundRole(), QColor(0, 0, 0, 0));
    m_Ui->widgetColor->setPalette(pal);
}
Example #15
0
LxQtSensors::LxQtSensors(ILxQtPanelPlugin *plugin, QWidget* parent):
    QFrame(parent),
    mPlugin(plugin),
    mSettings(plugin->settings())
{

    mDetectedChips = mSensors.getDetectedChips();

    /**
     * We have all needed data to initialize default settings, we have to do it here as later
     * we are using them.
     */
    initDefaultSettings();

    // Add GUI elements
    ProgressBar* pg = NULL;

    mLayout = new QBoxLayout(QBoxLayout::LeftToRight, this);
    mLayout->setSpacing(0);
    mLayout->setContentsMargins(0, 0, 0, 0);

    QString chipFeatureLabel;

    mSettings->beginGroup("chips");

    for (int i = 0; i < mDetectedChips.size(); ++i)
    {
        mSettings->beginGroup(mDetectedChips[i].getName());
        const QList<Feature>& features = mDetectedChips[i].getFeatures();

        for (int j = 0; j < features.size(); ++j)
        {
            if (features[j].getType() == SENSORS_FEATURE_TEMP)
            {
                chipFeatureLabel = features[j].getLabel();
                mSettings->beginGroup(chipFeatureLabel);

                pg = new ProgressBar(this);
                pg->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);

                // Hide progress bar if it is not enabled
                if (!mSettings->value("enabled").toBool())
                {
                    pg->hide();
                }

                pg->setToolTip(chipFeatureLabel);
                pg->setTextVisible(false);

                QPalette pal = pg->palette();
                QColor color(mSettings->value("color").toString());
                pal.setColor(QPalette::Active, QPalette::Highlight, color);
                pal.setColor(QPalette::Inactive, QPalette::Highlight, color);
                pg->setPalette(pal);

                mTemperatureProgressBars.push_back(pg);
                mLayout->addWidget(pg);

                mSettings->endGroup();
            }
        }
        mSettings->endGroup();
    }

    mSettings->endGroup();

    // Fit plugin to current panel
    realign();

    // Updated sensors readings to display actual values at start
    updateSensorReadings();

    // Run timer that will be updating sensor readings
    mUpdateSensorReadingsTimer.setParent(this);
    connect(&mUpdateSensorReadingsTimer, SIGNAL(timeout()), this, SLOT(updateSensorReadings()));
    mUpdateSensorReadingsTimer.start(mSettings->value("updateInterval").toInt() * 1000);

    // Run timer that will be showin warning
    mWarningAboutHighTemperatureTimer.setParent(this);
    connect(&mWarningAboutHighTemperatureTimer, SIGNAL(timeout()), this,
            SLOT(warningAboutHighTemperature()));
    if (mSettings->value("warningAboutHighTemperature").toBool())
    {
        mWarningAboutHighTemperatureTimer.start(mWarningAboutHighTemperatureTimerFreq);
    }
}
Example #16
0
void LxQtSensors::settingsChanged()
{
    mUpdateSensorReadingsTimer.setInterval(mSettings->value("updateInterval").toInt() * 1000);

    // Iterator for temperature progress bars
    QList<ProgressBar*>::iterator temperatureProgressBarsIt =
        mTemperatureProgressBars.begin();

    mSettings->beginGroup("chips");

    for (int i = 0; i < mDetectedChips.size(); ++i)
    {
        mSettings->beginGroup(mDetectedChips[i].getName());
        const QList<Feature>& features = mDetectedChips[i].getFeatures();

        for (int j = 0; j < features.size(); ++j)
        {
            if (features[j].getType() == SENSORS_FEATURE_TEMP)
            {
                mSettings->beginGroup(features[j].getLabel());

                if (mSettings->value("enabled").toBool())
                {
                    (*temperatureProgressBarsIt)->show();
                }
                else
                {
                    (*temperatureProgressBarsIt)->hide();
                }

                QPalette pal = (*temperatureProgressBarsIt)->palette();
                QColor color(mSettings->value("color").toString());
                pal.setColor(QPalette::Active, QPalette::Highlight, color);
                pal.setColor(QPalette::Inactive, QPalette::Highlight, color);
                (*temperatureProgressBarsIt)->setPalette(pal);

                mSettings->endGroup();

                // Go to the next temperature progress bar
                ++temperatureProgressBarsIt;
            }
        }

        mSettings->endGroup();
    }

    mSettings->endGroup();


    if (mSettings->value("warningAboutHighTemperature").toBool())
    {
        // Update sensors readings to get the list of high temperature progress bars
        updateSensorReadings();

        mWarningAboutHighTemperatureTimer.start(mWarningAboutHighTemperatureTimerFreq);
    }
    else if (mWarningAboutHighTemperatureTimer.isActive())
    {
        mWarningAboutHighTemperatureTimer.stop();

        // Update sensors readings to set progress bar values to "normal" height
        updateSensorReadings();
    }

    realign();
    update();
}
Example #17
0
aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c)
	: QDialog(parent), myConfig(c)
{
#ifdef __APPLE__
	setWindowModality(Qt::ApplicationModal);
	setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
#endif
	setupUi(this);

	myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());

	QPalette myPalette = textBrowser_licence->palette();
#ifdef GUI_800x480
#ifdef ANDROID
	myPalette.setColor(QPalette::Base, QColor(255,255,255,255));
	myPalette.setColor(QPalette::Text, QColor(0,0,0,255));
#else
	myPalette.setColor(QPalette::Base, QColor(0,0,0,255));
	myPalette.setColor(QPalette::Text, QColor(255,255,255,255));
#endif
#else
	QColor myColor = myPalette.color(QPalette::Window);
	myPalette.setColor(QPalette::Base, myColor);
#endif
	textBrowser_licence->setPalette(myPalette);
	textBrowser_2->setPalette(myPalette);
	textBrowser_3->setPalette(myPalette);
	textBrowser_4->setPalette(myPalette);

	QFile gplFile(QDir::toNativeSeparators(myAppDataPath+"misc/agpl.html"));
	QString gplString;
	if(gplFile.exists()) {
		if (gplFile.open( QIODevice::ReadOnly)) {
			QTextStream stream( &gplFile );
			gplString = stream.readAll();
			textBrowser_licence->setHtml(gplString);
		}
	}


	label_logo->setPixmap(QPixmap(":/gfx/logoChip3D.png"));

#ifdef GUI_800x480
	label_pokerthVersion->setStyleSheet("QLabel { font-size: 30px; font-weight: bold;}");
#else
	label_pokerthVersion->setStyleSheet("QLabel { font-size: 16px; font-weight: bold;}");
#endif

#ifdef ANDROID
	int api = -2;
	#ifndef ANDROID_TEST
		JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0);
		JNIEnv* env;
		if (currVM->AttachCurrentThread(&env, NULL)<0) {
			qCritical()<<"AttachCurrentThread failed";
		} else {
			jclass jclassApplicationClass = env->FindClass("android/os/Build$VERSION");
			if (jclassApplicationClass) {
				api = env->GetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"SDK_INT", "I"));
			}
			currVM->DetachCurrentThread();
		}
	#endif
	label_pokerthVersion->setText(QString(tr("PokerTH %1 for Android (API%2)").arg(POKERTH_BETA_RELEASE_STRING).arg(api)));
#else
	label_pokerthVersion->setText(QString(tr("PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));
#endif
	this->setWindowTitle(QString(tr("About PokerTH %1").arg(POKERTH_BETA_RELEASE_STRING)));

	//add text to lables and textbrowsers
	QString thxToInfos;
	thxToInfos.append(tr("- Wikimedia Commons: for different popular avatar picture resources")+"<br>");
	thxToInfos.append(tr("- Benedikt, Erhard, Felix, Florian, Linus, Lothar, Steffi, Caro: for people avatar pictures")+"<br>");
	thxToInfos.append(tr("- ZeiZei: for misc avatar pictures")+"<br>");
	thxToInfos.append(tr("- kde-look.org: for different gpl licensed sounds")+"<br>");
	thxToInfos.append(tr("- doc_dos: for self recorded chip sounds")+"<br>");
	thxToInfos.append(tr("- thiger, dunkanx, BerndA, coldz, drull: for different patches")+"<br>");
	thxToInfos.append(tr("- kraut: for internet-game-server hosting and administration")+"<br>");
	thxToInfos.append(tr("- danuxi: for startwindow background gfx and danuxi1 table background")+"<br>");
	thxToInfos.append(tr("- heyn: for moderating forum and organise bugtracker and feature requests")+"<br>");
	thxToInfos.append(tr("- texas_outlaw: for new table sounds")+"<br>");
	textBrowser_3->setHtml(thxToInfos);

	QString infoText;
	infoText.append(tr("- Poker engine for the popular Texas Hold'em Poker")+"\n");
	infoText.append(tr("- Singleplayer games with up to 9 computer-opponents")+"\n");
	infoText.append(tr("- Multiplayer network games")+"\n");
	infoText.append(tr("- Internet online games")+"\n");
	infoText.append(tr("- Changeable gui with online style gallery")+"\n");
	infoText.append(tr("- Online ranking website with result tables")+"\n");
	infoText.append("\n");
	QString thisYear = QDate::currentDate().toString("yyyy");
	infoText.append("(c)2006-"+thisYear+", Felix Hammer, Florian Thauer, Lothar May");
	label_infotext->setText(infoText);

	QString projectText;
	projectText.append("<b>"+tr("Project page:")+"</b><br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;<a href='http://www.pokerth.net'>http://www.pokerth.net</a><br>");
	projectText.append("<b>IRC:</b><br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;#pokerth (irc.freenode.net)<br>");
	projectText.append("<b>"+tr("Authors:")+"</b><br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Felix Hammer (<a href=mailto:[email protected]>[email protected]</a>)<br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial idea, basic architecture, gui implementation, gui graphics editing, linux package")+"<br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Florian Thauer (<a href=mailto:[email protected]>[email protected]</a>)<br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial idea, basic architecture, engine development")+"<br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Lothar May (<a href=mailto:[email protected]>[email protected]</a>)<br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("basic architecture, network development, windows package, MacOS package")+"<br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;Oskar Lindqvist (<a href=mailto:[email protected]>[email protected]</a>)<br>");
	projectText.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- "+tr("initial gui graphics design")+"<br>");
	textBrowser_2->setHtml(projectText);
}
Example #18
0
AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::AlbumInfoWidget )
{
    QWidget* widget = new QWidget;
    ui->setupUi( widget );

    m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::Original, QSize( 48, 48 ) );
    ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::Grid, ui->cover->size() ) );
    ui->cover->setShowText( true );

    ui->lineAbove->setStyleSheet( QString( "QFrame { border: 1px solid %1; }" ).arg( TomahawkStyle::HEADER_BACKGROUND.name() ) );
    ui->lineBelow->setStyleSheet( QString( "QFrame { border: 1px solid black; }" ) );

    {
        m_tracksModel = new TreeModel( ui->tracks );
        m_tracksModel->setMode( Mixed );

        AlbumItemDelegate* del = new AlbumItemDelegate( ui->tracks, ui->tracks->proxyModel() );
        ui->tracks->setPlaylistItemDelegate( del );
        ui->tracks->setEmptyTip( tr( "Sorry, we could not find any tracks for this album!" ) );
        ui->tracks->proxyModel()->setStyle( PlayableProxyModel::Large );
        ui->tracks->setAutoResize( true );
        ui->tracks->setPlayableModel( m_tracksModel );
        ui->tracks->setAlternatingRowColors( false );

        QPalette p = ui->tracks->palette();
        p.setColor( QPalette::Text, TomahawkStyle::PAGE_TRACKLIST_TRACK_SOLVED );
        p.setColor( QPalette::BrightText, TomahawkStyle::PAGE_TRACKLIST_TRACK_UNRESOLVED );
        p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_TRACKLIST_NUMBER );
        p.setColor( QPalette::Highlight, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT );
        p.setColor( QPalette::HighlightedText, TomahawkStyle::PAGE_TRACKLIST_HIGHLIGHT_TEXT );

        ui->tracks->setPalette( p );
        ui->tracks->setFrameShape( QFrame::NoFrame );
        ui->tracks->setAttribute( Qt::WA_MacShowFocusRect, 0 );
        ui->tracks->setStyleSheet( "QTreeView#tracks { background-color: transparent; }" );

        TomahawkStyle::styleScrollBar( ui->tracks->horizontalScrollBar() );
        TomahawkStyle::stylePageFrame( ui->trackFrame );
    }

    {
        m_albumsModel = new PlayableModel( ui->albums );
        ui->albums->setPlayableModel( m_albumsModel );
        ui->albums->setEmptyTip( tr( "Sorry, we could not find any other albums for this artist!" ) );

        /*    ui->albums->setAutoFitItems( true );
         *    ui->albums->setWrapping( false );
         *    ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
         *    ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );*/
        ui->albums->delegate()->setItemSize( QSize( 170, 170 ) );
        ui->albums->proxyModel()->setHideDupeItems( true );

        ui->albums->setStyleSheet( "QListView { background-color: transparent; }" );
        TomahawkStyle::styleScrollBar( ui->albums->verticalScrollBar() );
        TomahawkStyle::stylePageFrame( ui->albumFrame );
    }

    {
        QFont f = ui->biography->font();
        f.setFamily( "Titillium Web" );

        QPalette p = ui->biography->palette();
        p.setColor( QPalette::Text, TomahawkStyle::HEADER_TEXT );

        ui->biography->setFont( f );
        ui->biography->setPalette( p );
        ui->biography->setOpenLinks( false );
        ui->biography->setOpenExternalLinks( true );
        ui->biography->setFrameShape( QFrame::NoFrame );
        ui->biography->setAttribute( Qt::WA_MacShowFocusRect, 0 );

        ui->biography->setStyleSheet( "QTextBrowser#biography { background-color: transparent; }" );
        ui->biography->document()->setDefaultStyleSheet( QString( "a { text-decoration: none; font-weight: bold; color: %1; }" ).arg( TomahawkStyle::HEADER_LINK.name() ) );
        TomahawkStyle::styleScrollBar( ui->biography->verticalScrollBar() );

//        connect( ui->biography, SIGNAL( anchorClicked( QUrl ) ), SLOT( onBiographyLinkClicked( QUrl ) ) );
    }

    {
        QFont f = ui->label->font();
        f.setFamily( "Pathway Gothic One"  );

        QPalette p = ui->label->palette();
        p.setColor( QPalette::Foreground, TomahawkStyle::PAGE_CAPTION );

        ui->label->setFont( f );
        ui->label_2->setFont( f );
        ui->label->setPalette( p );
        ui->label_2->setPalette( p );
    }

    {
        QScrollArea* area = new QScrollArea();
        area->setWidgetResizable( true );
        area->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
        area->setWidget( widget );

        QPalette pal = palette();
        pal.setBrush( backgroundRole(), TomahawkStyle::HEADER_BACKGROUND );
        area->setPalette( pal );
        area->setAutoFillBackground( true );
        area->setFrameShape( QFrame::NoFrame );
        area->setAttribute( Qt::WA_MacShowFocusRect, 0 );

        QVBoxLayout* layout = new QVBoxLayout();
        layout->addWidget( area );
        setLayout( layout );
        TomahawkUtils::unmarginLayout( layout );
    }

    {
        QPalette pal = palette();
        pal.setBrush( backgroundRole(), TomahawkStyle::PAGE_BACKGROUND );
        ui->widget->setPalette( pal );
        ui->widget->setAutoFillBackground( true );
    }

    MetaPlaylistInterface* mpl = new MetaPlaylistInterface();
    mpl->addChildInterface( ui->tracks->playlistInterface() );
    mpl->addChildInterface( ui->albums->playlistInterface() );
    m_playlistInterface = playlistinterface_ptr( mpl );

    load( album );
}
// ---
VSWAEImportContentWindow::VSWAEImportContentWindow (QWidget* parent, Qt::WFlags flags)
	: QDialog (parent, flags),
	  _contentNames (), // Name of the contents already exist...
	  _basicPath ()
{
	// Setup the basic elements in the window
	// which are: the icon, and the central widget...
	setWindowIcon (QIcon (tr (":/VSWAdvancedEditor/AEditorICO.ico")));
	setWindowTitle (tr ("Import Content"));
	setGeometry (QCursor::pos ().x (), QCursor::pos ().y (), 500, 340);
	setMinimumSize (500, 340);
	setMaximumSize (500, 340);

	QVBoxLayout* mainLayout = new QVBoxLayout;

	// Create the title...
	VSWAEWindowTitle* title = new VSWAEWindowTitle;
	title -> initialize (tr ("Import Content"), tr ("Introduce data to import a content"), 
		QString (":/VSWAdvancedEditor/Resources/TitleImport.png"));
	
	// Set up the labels to introduce data...
	QLabel* nameF = new QLabel (tr ("Name:"));
	nameF -> setFont (VSWAEFontLabel ());
	_nameTF = new QLabel (__NULL_STRING__);
	_nameTF -> setFont (VSWAEFontData ());
	QLabel* definitionDirNameF = new QLabel (tr ("Definition dir:"));
	definitionDirNameF -> setFont (VSWAEFontLabel ());
	_definitionDirNameTF = new QLabel (__NULL_STRING__);
	_definitionDirNameTF -> setFont (VSWAEFontData ());
	QLabel* implementationDirNameF = new QLabel (tr ("Implementation dir:"));
	implementationDirNameF -> setFont (VSWAEFontLabel ());
	_implementationDirNameTF = new QLabel (__NULL_STRING__);
	_implementationDirNameTF -> setFont (VSWAEFontData ());
	QLabel* implementationFileF = new QLabel (tr ("Implementation File:"));
	implementationFileF -> setFont (VSWAEFontLabel ());
	QLabel* iconFileF = new QLabel (tr ("Icon File:"));
	iconFileF -> setFont (VSWAEFontLabel ());
	_iconFileTF = new QLabel (__NULL_STRING__);
	_iconFileTF -> setFont (VSWAEFontData ());
	QLabel* resumeFileF = new QLabel (tr ("Resume File:"));
	resumeFileF -> setFont (VSWAEFontLabel ());
	_resumeFileTF = new QLabel (__NULL_STRING__);
	_resumeFileTF -> setFont (VSWAEFontData ());
	QLabel* typeF = new QLabel (tr ("Type:"));
	typeF -> setFont (VSWAEFontLabel ());

	// Set up the line edits to introduce data...
	QPalette bkPalette; 
	bkPalette.setColor (QPalette::Base, __COLORMANDATORYFIELD);
	_name = new QLineEdit; 
	_name -> setMaximumWidth (100); _name -> setMinimumWidth (100);
	_name -> setEnabled (true); _name -> setAlignment (Qt::AlignLeft);
	_name -> setFont (VSWAEFontData ());
	_name -> setPalette (bkPalette);
	_definitionDirName = new VSWAEDirInputLineEdit; 
	_definitionDirName -> setMaximumWidth (400); _definitionDirName -> setMinimumWidth (400);
	_definitionDirName -> setEnabled (true);
	_definitionDirName -> setFont (VSWAEFontData ());
	_definitionDirName -> setPalette (bkPalette);
	_implementationDirName = new VSWAEDirInputLineEdit; 
	_implementationDirName -> setMaximumWidth (400); _implementationDirName -> setMinimumWidth (400);
	_implementationDirName -> setEnabled (true);
	_implementationDirName -> setFont (VSWAEFontData ());
	_implementationDirName -> setPalette (bkPalette);
	_implementationFile = new VSWAEFileInputLineEdit; 
	_implementationFile -> setMaximumWidth (400); _implementationFile -> setMinimumWidth (400);
	_implementationFile -> setEnabled (true); 
	_implementationFile -> setFont (VSWAEFontData ());
	_implementationFile -> setPalette (bkPalette);
	_iconFile = new VSWAEFileInputLineEdit; 
	_iconFile -> setMaximumWidth (400); _iconFile -> setMinimumWidth (400);
	_iconFile -> setEnabled (true); 
	_iconFile -> setFont (VSWAEFontData ());
	_resumeFile = new VSWAEFileInputLineEdit; 
	_resumeFile -> setMaximumWidth (400); _resumeFile -> setMinimumWidth (400);
	_resumeFile -> setEnabled (true); 
	_resumeFile -> setFont (VSWAEFontData ());
	_type = new QComboBox; 
	_type -> setMaximumWidth (150); _type -> setMinimumWidth (150);
	_type -> setEnabled (true);
	_type -> setFont (VSWAEFontData ());
	_type -> setPalette (bkPalette);

	// Set up the cancel and the ok button...
	_okButton = new QPushButton (tr ("Ok"));;
	_okButton -> setIcon (QIcon (":/VSWAdvancedEditor/Resources/Ok.ico"));
	_okButton -> setFont (VSWAEFontData ());
	_okButton -> setEnabled (false);
	QPushButton* cancelButton = new QPushButton ("Cancel");
	cancelButton -> setIcon (QIcon (":/VSWAdvancedEditor/Resources/Cancel.ico"));
	cancelButton -> setFont (VSWAEFontData ());

	// The title is put ion a layout...
	QHBoxLayout* titleLayout = new QHBoxLayout;
	titleLayout -> setContentsMargins (__NOMARGINS);
	titleLayout -> setSpacing (__NOSPACING);
	titleLayout -> addWidget (title);

	// The entry fields are put together in a grid layout...
	QGridLayout* entryLayout = new QGridLayout;
	entryLayout -> addWidget (nameF, 0, 0);
	entryLayout -> setAlignment (nameF, Qt::AlignRight);
	entryLayout -> addWidget (definitionDirNameF, 1, 0);
	entryLayout -> setAlignment (definitionDirNameF, Qt::AlignRight);
	entryLayout -> addWidget (implementationDirNameF, 2, 0);
	entryLayout -> setAlignment (implementationDirNameF, Qt::AlignRight);
	entryLayout -> addWidget (implementationFileF, 3, 0);
	entryLayout -> setAlignment (implementationFileF, Qt::AlignRight);
	entryLayout -> addWidget (iconFileF, 4, 0);
	entryLayout -> setAlignment (iconFileF, Qt::AlignRight);
	entryLayout -> addWidget (resumeFileF, 5, 0);
	entryLayout -> setAlignment (resumeFileF, Qt::AlignRight);
	entryLayout -> addWidget (typeF, 6, 0);
	entryLayout -> setAlignment (typeF, Qt::AlignRight);
	entryLayout -> addWidget (_name, 0, 1);
	entryLayout -> setAlignment (_name, Qt::AlignLeft);
	entryLayout -> addWidget (_definitionDirName, 1, 1);
	entryLayout -> setAlignment (_definitionDirName, Qt::AlignLeft);
	entryLayout -> addWidget (_implementationDirName, 2, 1);
	entryLayout -> setAlignment (_implementationDirName, Qt::AlignLeft);
	entryLayout -> addWidget (_implementationFile, 3, 1);
	entryLayout -> setAlignment (_implementationFile, Qt::AlignLeft);
	entryLayout -> addWidget (_iconFile, 4, 1);
	entryLayout -> setAlignment (_iconFile, Qt::AlignLeft);
	entryLayout -> addWidget (_resumeFile, 5, 1);
	entryLayout -> setAlignment (_resumeFile, Qt::AlignLeft);
	entryLayout -> addWidget (_type, 6, 1);
	entryLayout -> setAlignment (_type, Qt::AlignLeft);
	entryLayout -> addWidget (_nameTF, 0, 2);
	entryLayout -> setAlignment (_nameTF, Qt::AlignLeft);
	entryLayout -> addWidget (_definitionDirNameTF, 1, 2);
	entryLayout -> setAlignment (_definitionDirNameTF, Qt::AlignLeft);
	entryLayout -> addWidget (_implementationDirNameTF, 2, 2);
	entryLayout -> setAlignment (_implementationDirNameTF, Qt::AlignLeft);
	entryLayout -> addWidget (_iconFileTF, 4, 2);
	entryLayout -> setAlignment (_iconFileTF, Qt::AlignLeft);
	entryLayout -> addWidget (_resumeFileTF, 5, 2);
	entryLayout -> setAlignment (_resumeFileTF, Qt::AlignLeft);

	// Creates a group of data for the content information...
	QGroupBox* contentGroup = new QGroupBox (tr ("Content Data"));
	contentGroup -> setFont (VSWAEFontLabel ());
	contentGroup -> setLayout (entryLayout);

	// The ok and the cancel button are pushed into a hbox...
	QHBoxLayout* buttonsLayout = new QHBoxLayout;
	buttonsLayout -> setContentsMargins (__STDMARGINS);
	buttonsLayout -> setSpacing (__STDSPACING);
	buttonsLayout -> setAlignment (Qt::AlignRight);
	buttonsLayout -> addWidget (_okButton);
	buttonsLayout -> addWidget (cancelButton);

	// Everything to the main layout...
	mainLayout -> addLayout (titleLayout);
	mainLayout -> addWidget (contentGroup);
	mainLayout -> addLayout (buttonsLayout);

	// Set up the conexions...
	connect (_name, SIGNAL (textChanged (const QString&)), 
		this, SLOT (actualizeOkButtonAction (const QString&)));
	connect (_definitionDirName, SIGNAL (dirSelectedSignal (const QString&)),
		this, SLOT (actualizeOkButtonAction (const QString&)));
	connect (_implementationDirName, SIGNAL (dirSelectedSignal (const QString&)),
		this, SLOT (actualizeOkButtonAction (const QString&)));
	connect (_implementationFile, SIGNAL (fileSelectedSignal (const QString&)), 
		this, SLOT (actualizeOkButtonAction (const QString&)));
	connect (_iconFile, SIGNAL (fileSelectedSignal (const QString&)), 
		this, SLOT (actualizeOkButtonAction (const QString&)));
	connect (_resumeFile, SIGNAL (fileSelectedSignal (const QString&)), 
		this, SLOT (actualizeOkButtonAction (const QString&)));
	connect (_type, SIGNAL (textChanged (const QString&)), 
		this, SLOT (actualizeOkButtonAction (const QString&)));
	connect (_okButton, SIGNAL (clicked()), this, SLOT (accept ()));
	connect (cancelButton, SIGNAL (clicked()), this, SLOT (reject ()));

	setLayout (mainLayout);
}
Example #20
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool Application::initConfiguration() {
	if ( !Client::Application::initConfiguration() )
		return false;

	QPalette pal;
	_scheme.colors.background = pal.color(QPalette::Window);
	_scheme.fetch();

	pal.setColor(QPalette::Window, _scheme.colors.background);
#if QT_VERSION >= 0x040300
	// Keep original Qt settings for buttons. This can be achieved by
	// using a custom StyleSheet:
	//   appname -stylesheet=mystyle.qss
	// mystyle.qcc
	//  QPushButton { background-color: red }
	//pal.setColor(QPalette::Button, _scheme.colors.background.lighter(110));
#endif
	setPalette(pal);

	try { _mapsDesc.location = configGetString("map.location").c_str(); }
	catch (...) { _mapsDesc.location = "@DATADIR@/maps/world%s.png"; }

	_mapsDesc.type = QString();
	try { _mapsDesc.type = configGetString("map.type").c_str(); }
	catch (...) {}

	_mapsDesc.isMercatorProjected = false;

	try {
		string proj = configGetString("map.format");
		if ( proj == "mercator" )
			_mapsDesc.isMercatorProjected = true;
		else if ( proj == "rectangular" )
			_mapsDesc.isMercatorProjected = false;
		else {
			cerr << "Unknown map format: " << proj << endl;
			return false;
		}
	}
	catch (...) {}

	_mapsDesc.cacheSize = 0;
	try { _mapsDesc.cacheSize = configGetInt("map.cacheSize"); }
	catch ( ... ) {}

	_mapsDesc.location = Environment::Instance()->absolutePath(_mapsDesc.location.toStdString()).c_str();

	_eventTimeAgo = 0.0;
	bool setTimeAgo = false;
	try {
		_eventTimeAgo += double(configGetInt("events.timeAgo.days")*24*60*60);
		setTimeAgo = true;
	}
	catch (...) {}
	try {
		_eventTimeAgo += double(configGetInt("events.timeAgo.hours")*60*60);
		setTimeAgo = true;
	}
	catch (...) {}
	try {
		_eventTimeAgo += double(configGetInt("events.timeAgo.minutes")*60);
		setTimeAgo = true;
	}
	catch (...) {}
	try {
		_eventTimeAgo += double(configGetInt("events.timeAgo.seconds"));
		setTimeAgo = true;
	}
	catch (...) {}
	try {
		_nonInteractive = configGetBool("mode.interactive") == false;
	}
	catch (...) {}
	try {
		_startFullScreen = configGetBool("mode.fullscreen");
	}
	catch (...) {}

	// Default is: display events from 1 day ago until 'now'
	if ( !setTimeAgo )
		_eventTimeAgo = double(24*60*60);

	_commandTargetClient = "";
	try {
		_commandTargetClient = configGetString("commands.target");
	}
	catch (...) {}

	setOrganizationName(agencyID().c_str());
	setApplicationName(name().c_str());

	return true;
}
Example #21
0
void MainWindow::updateBackgroundColor(){
    QPalette palette;
    palette.setColor(QPalette::Window, backgroundColor());
    ui.centralWidget->window()->setPalette(palette);
}
Example #22
0
int main(int argc, char *argv[])
{
    AsemanApplication app(argc, argv);
    app.setApplicationName("Cutegram");
    app.setApplicationDisplayName("Cutegram");
    app.setApplicationVersion("2.4.0");
    app.setOrganizationDomain("land.aseman");
    app.setOrganizationName("Aseman");
    app.setWindowIcon(QIcon(":/qml/Cutegram/files/icon.png"));
    app.setQuitOnLastWindowClosed(false);

    QCommandLineOption verboseOption(QStringList() << "V" << "verbose",
            QCoreApplication::translate("main", "Verbose Mode."));
    QCommandLineOption forceOption(QStringList() << "f" << "force",
            QCoreApplication::translate("main", "Force to run multiple instance of Cutegram."));
    QCommandLineOption dcIdOption(QStringList() << "dc-id",
            QCoreApplication::translate("main", "Sets default DC ID to <id>"), "id");
    QCommandLineOption ipAdrsOption(QStringList() << "ip-address",
            QCoreApplication::translate("main", "Sets default IP Address to <ip>"), "ip");

    QCommandLineParser parser;
    parser.setApplicationDescription(ABOUT_TEXT);
    parser.addHelpOption();
    parser.addVersionOption();
    parser.addOption(forceOption);
    parser.addOption(verboseOption);
    parser.addOption(dcIdOption);
    parser.addOption(ipAdrsOption);
    parser.process(app);

    if(!parser.isSet(verboseOption))
        qputenv("QT_LOGGING_RULES", "tg.*=false");
    else
        qputenv("QT_LOGGING_RULES", "tg.core.settings=false\n"
                                    "tg.core.outboundpkt=false\n"
                                    "tg.core.inboundpkt=false");

    Telegram::setDefaultHostAddress( parser.isSet(ipAdrsOption)? parser.value(ipAdrsOption) : "149.154.167.50");
    Telegram::setDefaultHostPort(443);
    Telegram::setDefaultHostDcId(parser.isSet(dcIdOption)? parser.value(dcIdOption).toInt() : 2);
    Telegram::setAppId(13682);
    Telegram::setAppHash("de37bcf00f4688de900510f4f87384bb");

    if(app.readSetting("Proxy/enable",false).toBool())
    {
        const int type = app.readSetting("Proxy/type",QNetworkProxy::HttpProxy).toInt();
        const QString host = app.readSetting("Proxy/host").toString();
        const quint16 port = app.readSetting("Proxy/port").toInt();
        const QString user = app.readSetting("Proxy/user").toString();
        const QString pass = app.readSetting("Proxy/pass").toString();

        QNetworkProxy proxy;
        proxy.setType( static_cast<QNetworkProxy::ProxyType>(type) );
        proxy.setHostName(host);
        proxy.setPort(port);
        proxy.setUser(user);
        proxy.setPassword(pass);
        QNetworkProxy::setApplicationProxy(proxy);
    }

#ifdef Q_OS_MAC
    QPalette palette;
    palette.setColor(QPalette::Highlight, "#0d80ec");
    palette.setColor(QPalette::HighlightedText, "#ffffff");
    app.setPalette(palette);
#endif

#ifdef DESKTOP_DEVICE
    if( !parser.isSet(forceOption) && app.isRunning() )
    {
        app.sendMessage("show");
        return 0;
    }
#endif

    CompabilityTools::version1();

    Cutegram cutegram;
    cutegram.start( parser.isSet(forceOption) );

#ifdef DESKTOP_DEVICE
    QObject::connect( &app, SIGNAL(messageReceived(QString)), &cutegram, SLOT(incomingAppMessage(QString)) );
    QObject::connect( &app, SIGNAL(clickedOnDock())         , &cutegram, SLOT(incomingAppMessage())        );
#endif

    return app.exec();
}
Example #23
0
AutoImportWindow::AutoImportWindow(QWidget* parent)
: QWidget(parent) {
    resultsTable_ = setupFilesTable();
    
    fileNameParser_ = new FileNameParserDialog(this);
    filePatternLabel_ = new QLabel();
    
    safeIntervalBox = new QSpinBox();
    safeIntervalBox->setMinimum(30);
    safeIntervalBox->setMaximum(84600);
    safeIntervalBox->setValue(ProjectPreferences().importSafeInterval());

    statusLabel_ = new QLabel(this);
    statusLabel_->setWordWrap(true);
    QFont font = statusLabel_->font();
    font.setBold(true);
    statusLabel_->setFont(font);
    
    deleteLabel_ = new QLabel("Original images will be DELETED after import! If not intended, change the option on left.");
    deleteLabel_->setWordWrap(true);
    deleteLabel_->hide();
    QPalette pal = deleteLabel_->palette();
    pal.setColor(QPalette::WindowText, Qt::red);
    deleteLabel_->setPalette(pal);

    importButton_ = new QPushButton(ApplicationData::icon("play"), tr("Start Import"));
    importButton_->setCheckable(true);
    importButton_->setChecked(false);
    connect(importButton_, &QAbstractButton::clicked, this, &AutoImportWindow::executeImport);
    
    refreshButton_ = new QPushButton(ApplicationData::icon("refresh"), tr("Rescan Import Folder"));
    connect(refreshButton_, &QAbstractButton::clicked, this, &AutoImportWindow::analyzeImport);
    
    priorityQueueOption_ = new QCheckBox("Prioritize the processing of imported images");
    priorityQueueOption_->setChecked(true);
    
    continuous = new QCheckBox("Continuously import new images in the import folder");
    continuous->setChecked(false);
    connect(continuous, &QCheckBox::toggled, [ = ] (bool check){
        if(check) timer_.start(safeIntervalBox->value()*1000);
        else timer_.stop();
    });
    
    inputContiner_ = setupInputContainer();

    QSplitter* mainSplitter = new QSplitter(Qt::Horizontal);
    mainSplitter->setHandleWidth(4);
    mainSplitter->addWidget(inputContiner_);
    mainSplitter->addWidget(setupStatusContinaer());
    
    mainSplitter->setStretchFactor(0, 1);
    mainSplitter->setStretchFactor(1, 1);
    
    int width = mainSplitter->width();
    mainSplitter->setSizes(QList<int>() << width/2 << width/2);

    QGridLayout* mainLayout = new QGridLayout;
    mainLayout->setMargin(0);
    mainLayout->setSpacing(0);
    mainLayout->addWidget(mainSplitter);
    setLayout(mainLayout);

    analyzeImport();
    if(ProjectPreferences().importRestartCheck()) executeImport(true);
    
    connect(&process_, static_cast<void(QProcess::*)(int)>(&QProcess::finished), this, &AutoImportWindow::continueExecution);
    
    connect(&watcher_, &QFileSystemWatcher::directoryChanged, [=] {
        analyzeImport();
        if(continuous->isChecked()) executeImport(true);
    });
    
    connect(&timer_, &QTimer::timeout, [=] {
        analyzeImport();
        if(continuous->isChecked()) executeImport(true);
    });
    
}
ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::ArtistInfoWidget )
    , m_artist( artist )
{
    QWidget* widget = new QWidget;
    ui->setupUi( widget );

    QPalette pal = palette();
    pal.setColor( QPalette::Window, QColor( "#454e59" ) );

    widget->setPalette( pal );
    widget->setAutoFillBackground( true );

    m_plInterface = Tomahawk::playlistinterface_ptr( new MetaArtistInfoInterface( this ) );

/*    TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() );
    TomahawkUtils::unmarginLayout( ui->layoutWidget1->layout() );
    TomahawkUtils::unmarginLayout( ui->layoutWidget2->layout() );
    TomahawkUtils::unmarginLayout( ui->albumHeader->layout() );*/

    m_albumsModel = new PlayableModel( ui->albums );
    ui->albums->setPlayableModel( m_albumsModel );
    ui->topHits->setEmptyTip( tr( "Sorry, we could not find any albums for this artist!" ) );

    m_relatedModel = new PlayableModel( ui->relatedArtists );
    ui->relatedArtists->setPlayableModel( m_relatedModel );
    ui->relatedArtists->proxyModel()->sort( -1 );
    ui->topHits->setEmptyTip( tr( "Sorry, we could not find any related artists!" ) );

    m_topHitsModel = new PlaylistModel( ui->topHits );
    ui->topHits->proxyModel()->setStyle( PlayableProxyModel::Short );
    ui->topHits->setPlayableModel( m_topHitsModel );
    ui->topHits->setSortingEnabled( false );
    ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) );

    ui->relatedArtists->setAutoFitItems( false );
    ui->relatedArtists->setWrapping( false );
    ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
    ui->relatedArtists->delegate()->setItemSize( QSize( 170, 170 ) );

    ui->albums->setAutoFitItems( false );
    ui->albums->setWrapping( false );
    ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
    ui->albums->delegate()->setItemSize( QSize( 170, 170 ) );
    ui->albums->proxyModel()->setHideDupeItems( true );

    ui->topHits->setFrameShape( QFrame::StyledPanel );
    ui->topHits->setAttribute( Qt::WA_MacShowFocusRect, 0 );

    m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
    ui->cover->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultArtistImage, TomahawkUtils::ScaledCover, QSize( ui->cover->sizeHint() ) ) );

    ui->biography->setFrameShape( QFrame::NoFrame );
    ui->biography->setAttribute( Qt::WA_MacShowFocusRect, 0 );
    TomahawkUtils::styleScrollBar( ui->biography->verticalScrollBar() );

    QFont f = font();
    f.setBold( true );
    f.setPointSize( 14 );
    ui->artistLabel->setFont( f );

    QPalette p = ui->biography->palette();
    p.setColor( QPalette::Foreground, Qt::white );
    p.setColor( QPalette::Text, Qt::white );

    ui->artistLabel->setPalette( p );
    ui->biography->setPalette( p );
    ui->label->setPalette( p );
    ui->label_2->setPalette( p );
    ui->label_3->setPalette( p );

    QScrollArea* area = new QScrollArea();
    area->setWidgetResizable( true );
    area->setWidget( widget );

    area->setStyleSheet( "QScrollArea { background-color: #454e59; }" );
    area->setFrameShape( QFrame::NoFrame );
    area->setAttribute( Qt::WA_MacShowFocusRect, 0 );

    QVBoxLayout* layout = new QVBoxLayout();
    layout->addWidget( area );
    setLayout( layout );
    TomahawkUtils::unmarginLayout( layout );

    TomahawkUtils::styleScrollBar( ui->albums->horizontalScrollBar() );
    TomahawkUtils::styleScrollBar( ui->relatedArtists->horizontalScrollBar() );

    ui->biography->setStyleSheet( "QTextBrowser#biography { background-color: transparent; }" );

    ui->albums->setStyleSheet( "QListView { background-color: transparent; }" );
    ui->albumFrame->setStyleSheet( "QFrame#albumFrame { background-color: transparent; }"
                               "QFrame#albumFrame { "
                               "border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;"
                               "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );

    ui->relatedArtists->setStyleSheet( "QListView { background-color: transparent; }" );
    ui->artistFrame->setStyleSheet( "QFrame#artistFrame { background-color: transparent; }"
                               "QFrame#artistFrame { "
                               "border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;"
                               "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );

//    ui->topHits->setStyleSheet( "QTreeView#topHits { background-color: transparent; }" );
    ui->trackFrame->setStyleSheet( "QFrame#trackFrame { background-color: transparent; }"
                               "QFrame#trackFrame { "
                               "border-image: url(" RESPATH "images/scrollbar-vertical-handle.png) 3 3 3 3 stretch stretch;"
                               "border-top: 3px transparent; border-bottom: 3px transparent; border-right: 3px transparent; border-left: 3px transparent; }" );

    load( artist );
}
Example #25
0
void AcpiWidget::slotTimer()
{
	adapter_t *ac = &global_acpi.adapt;

	QString message;
	QPalette palette;

	if(check_acpi_support() == NOT_SUPPORTED){
		qDebug () << notr ("No acpi support for your system?") << endl;
		return;
	}

	/* initialize battery, thermal zones, fans and ac state */
	int battstate = init_acpi_batt(&global_acpi);
	int acstate = init_acpi_acadapt(&global_acpi);

	// TODO improve

	if(acstate == SUCCESS && ac->ac_state == P_BATT) {
		message = tr ("Battery: ", "With traling space");
		palette.setColor(QPalette::Window, Qt::red);
	}
	else if(acstate == SUCCESS && ac->ac_state == P_AC) {
		message = tr ("External ", "With trailing space");
		palette.setColor (QPalette::Window, Qt::white);
	}
	else {
		message = tr ("Unknown ", "With trailing space");
		palette.setColor(QPalette::Window, Qt::red);
	}
	setPalette(palette);

	if(battstate == SUCCESS){
		for(int i=0;i<global_acpi.batt_count;i++){
			battery_t *binfo = &batteries[i];
			/* read current battery values */
			read_acpi_batt(i);

			if(binfo->present)
			{
				if (ac->ac_state == P_BATT)
					message += qnotr ("%1% %2:%3").arg(binfo->percentage).arg(binfo->remaining_time/60).arg(binfo->remaining_time%60, 2, 10, QChar('0'));
				else
					message += qnotr ("%1%").arg(binfo->percentage);
				QString tooltip = qnotr ("%1: %2mAh\n").arg(binfo->name).arg(binfo->design_cap);
				tooltip += qnotr("%1mAh / %2mAh\n").arg(binfo->last_full_cap).arg(binfo->remaining_cap);
				tooltip += qnotr("%1mV / %2mV\n").arg(binfo->design_voltage).arg(binfo->present_voltage);
/*
				printf("\n%s:\tpresent: %d\n"
						"\tdesign capacity: %d\n"
						"\tlast full capacity: %d\n"
						"\tdesign voltage: %d\n"
						"\tpresent rate: %d\n"
						"\tremaining capacity: %d\n"
						"\tpresent voltage: %d\n"
						"\tcharge state: %d\n"
						"\tbattery state: %d\n"
						"\tpercentage: %d%%\n"
						"\tremaining charge time: %02d:%02d h\n"
						"\tremaining time: %02d:%02d h\n",
						binfo->name, binfo->present, binfo->design_cap,
						binfo->last_full_cap, binfo->design_voltage,
						binfo->present_rate, binfo->remaining_cap,
						binfo->present_voltage, binfo->charge_state,
						binfo->batt_state, binfo->percentage,
						binfo->charge_time / 60, binfo->charge_time % 60,
						binfo->remaining_time / 60, binfo->remaining_time % 60);
*/
				setToolTip (tooltip);
			}
		}
	}
	else
		message += tr ("Unknown ", "With trailing space");

	setText (message);
	//update ();
}
Example #26
0
void MaraSettingsDialog::loadSettings()
{
	// Fonts/Colors
	QPalette lineEditPalette;

	QColor test = getSetting<QColor>(MaraClientSettings::Color::Background);
	lineEditPalette.setColor(QPalette::Base, getSetting<QColor>(MaraClientSettings::Color::Background));
	lineEditPalette.setColor(QPalette::Background, getSetting<QColor>(MaraClientSettings::Color::Background));

	lineEditPalette.setColor(QPalette::Text, getSetting<QColor>(MaraClientSettings::Color::User));
	qleUserExample->setPalette(lineEditPalette);
	qleUserExample->setFont(getSetting<QFont>(MaraClientSettings::Font::User));
	qleUserExample->setCursorPosition(0);

	lineEditPalette.setColor(QPalette::Text, getSetting<QColor>(MaraClientSettings::Color::Default));
	qleDefaultExample->setPalette(lineEditPalette);
	qleDefaultExample->setFont(getSetting<QFont>(MaraClientSettings::Font::Default));
	qleDefaultExample->setCursorPosition(0);

	lineEditPalette.setColor(QPalette::Text, getSetting<QColor>(MaraClientSettings::Color::Message));
	qleMessageExample->setPalette(lineEditPalette);
	qleMessageExample->setFont(getSetting<QFont>(MaraClientSettings::Font::Message));
	qleMessageExample->setCursorPosition(0);

	lineEditPalette.setColor(QPalette::Text, getSetting<QColor>(MaraClientSettings::Color::System));
	qleSystemExample->setPalette(lineEditPalette);
	qleSystemExample->setFont(getSetting<QFont>(MaraClientSettings::Font::System));
	qleSystemExample->setCursorPosition(0);

	lineEditPalette.setColor(QPalette::Text, getSetting<QColor>(MaraClientSettings::Color::Link));
	qleLinkExample->setPalette(lineEditPalette);
	QFont linkFont = getSetting<QFont>(MaraClientSettings::Font::Default);
	linkFont.setUnderline(true);
	qleLinkExample->setFont(linkFont);
	qleLinkExample->setCursorPosition(0);

	updateNames(qleUserName->text());

	_defaultStyle.setColor(getSetting<QColor>(MaraClientSettings::Color::Default));
	_systemStyle.setColor(getSetting<QColor>(MaraClientSettings::Color::System));
	_userStyle.setColor(getSetting<QColor>(MaraClientSettings::Color::User));
	_messageStyle.setColor(getSetting<QColor>(MaraClientSettings::Color::Message));
	_defaultStyle.setFont(getSetting<QFont>(MaraClientSettings::Font::Default));
	_systemStyle.setFont(getSetting<QFont>(MaraClientSettings::Font::System));
	_userStyle.setFont(getSetting<QFont>(MaraClientSettings::Font::User));
	_messageStyle.setFont(getSetting<QFont>(MaraClientSettings::Font::Message));

	QString styleSheet = _defaultStyle.toCss() + _systemStyle.toCss() + _userStyle.toCss() + _messageStyle.toCss();

	QPalette templatePalette;
	templatePalette.setColor(QPalette::Base, getSetting<QColor>(MaraClientSettings::Color::Background));
	templatePalette.setColor(QPalette::Text, getSetting<QColor>(MaraClientSettings::Color::Default));

	mtbChatTemplate->setPalette(templatePalette);
	mtbChatTemplate->setFont(getSetting<QFont>(MaraClientSettings::Font::Default));
	mtbChatTemplate->document()->setDefaultStyleSheet(styleSheet);

	mtbEmoteTemplate->setPalette(templatePalette);
	mtbEmoteTemplate->setFont(getSetting<QFont>(MaraClientSettings::Font::Default));
	mtbEmoteTemplate->document()->setDefaultStyleSheet(styleSheet);

	mtbMessageTemplate->setPalette(templatePalette);
	mtbMessageTemplate->setFont(getSetting<QFont>(MaraClientSettings::Font::Default));
	mtbMessageTemplate->document()->setDefaultStyleSheet(styleSheet);

	mtbPlainTemplate->setPalette(templatePalette);
	mtbPlainTemplate->setFont(getSetting<QFont>(MaraClientSettings::Font::Default));
	mtbPlainTemplate->document()->setDefaultStyleSheet(styleSheet);
}
Example #27
0
EigenPlotDlg::EigenPlotDlg(QWidget* parent) :
   QDialog(parent),
   mpPlot(NULL),
   mpCurve(NULL),
   mpComponentsSpin(NULL)
{
   // Eigen plot
   mpPlot = new QwtPlot(this);
   mpPlot->installEventFilter(this);
   mpPlot->setAutoFillBackground(true);

   QFont ftAxis = QApplication::font();
   ftAxis.setBold(true);
   ftAxis.setPointSize(10);

   QwtText bottomText("Number of Components");
   bottomText.setFont(ftAxis);
   mpPlot->setAxisTitle(QwtPlot::xBottom, bottomText);

   QwtText leftText("Eigen Values");
   leftText.setFont(ftAxis);
   mpPlot->setAxisTitle(QwtPlot::yLeft, leftText);

   QwtScaleEngine* pLinearScale = mpPlot->axisScaleEngine(QwtPlot::xBottom);
   pLinearScale->setAttribute(QwtScaleEngine::Floating);

   QwtLog10ScaleEngine* pLogScale = new QwtLog10ScaleEngine();
   pLogScale->setAttribute(QwtScaleEngine::Floating);
   mpPlot->setAxisScaleEngine(QwtPlot::yLeft, pLogScale);

   QPalette plotPalette = mpPlot->palette();
   plotPalette.setColor(QPalette::Window, Qt::white);
   mpPlot->setPalette(plotPalette);

   QwtPlotCanvas* pPlotCanvas = mpPlot->canvas();
   pPlotCanvas->setFrameStyle(QFrame::NoFrame);

   QwtPlotLayout* pPlotLayout = mpPlot->plotLayout();
   pPlotLayout->setMargin(5);

   QwtPlotGrid* pPlotGrid = new QwtPlotGrid();
   pPlotGrid->setPen(QPen(Qt::DotLine));
   pPlotGrid->attach(mpPlot);
   mpPlot->replot();

   // Number of components
   QLabel* pComponentsLabel = new QLabel("Number of Components:", this);
   mpComponentsSpin = new QSpinBox(this);
   mpComponentsSpin->setFixedWidth(50);
   mpComponentsSpin->setMinimum(1);

   QLabel* pDescriptionLabel = new QLabel("To set, left click in the plot or enter a value.", this);
   pDescriptionLabel->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
   pDescriptionLabel->setWordWrap(true);

   QFont descriptionFont(pDescriptionLabel->font());
   descriptionFont.setItalic(true);
   pDescriptionLabel->setFont(descriptionFont);

   QHBoxLayout* pComponentsLayout = new QHBoxLayout();
   pComponentsLayout->setMargin(0);
   pComponentsLayout->setSpacing(5);
   pComponentsLayout->addWidget(pComponentsLabel);
   pComponentsLayout->addWidget(mpComponentsSpin);
   pComponentsLayout->addWidget(pDescriptionLabel, 10);

   // Horizontal line
   QFrame* pLine = new QFrame(this);
   pLine->setFrameStyle(QFrame::HLine | QFrame::Sunken);

   // Buttons
   QPushButton* pOk = new QPushButton("&OK", this);
   QPushButton* pCancel = new QPushButton("&Cancel", this);
   connect(pOk, SIGNAL(clicked()), this, SLOT(accept()));
   connect(pCancel, SIGNAL(clicked()), this, SLOT(reject()));

   QHBoxLayout* pButtonLayout = new QHBoxLayout();
   pButtonLayout->setMargin(0);
   pButtonLayout->setSpacing(5);
   pButtonLayout->addStretch(10);
   pButtonLayout->addWidget(pOk);
   pButtonLayout->addWidget(pCancel);

   // Layout
   QGridLayout* pGrid = new QGridLayout(this);
   pGrid->setMargin(10);
   pGrid->setSpacing(10);
   pGrid->addWidget(mpPlot, 0, 0);
   pGrid->addLayout(pComponentsLayout, 1, 0);
   pGrid->addWidget(pLine, 2, 0);
   pGrid->addLayout(pButtonLayout, 3, 0);
   pGrid->setRowStretch(0, 10);

   // Initialization
   setWindowTitle("PCA Components");
   setModal(true);
   resize(440, 300);
}
Example #28
0
SettingDialog::SettingDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SettingDialog)
{
    ui->setupUi(this);
    connect(this, SIGNAL(noMatchPwd()), this, SLOT(repaint()));

    ui->enc_url->setText("./shell/enc");
    ui->dec_url->setText("./shell/dec");

    // dark fusion 테마
    qApp->setStyle(QStyleFactory::create("Fusion"));
    QPalette darkPalette;
    darkPalette.setColor(QPalette::Window, QColor(53,53,53));
    darkPalette.setColor(QPalette::WindowText, Qt::white);
    darkPalette.setColor(QPalette::Base, QColor(25,25,25));
    darkPalette.setColor(QPalette::AlternateBase, QColor(53,53,53));
    darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
    darkPalette.setColor(QPalette::ToolTipText, Qt::white);
    darkPalette.setColor(QPalette::Text, Qt::white);
    darkPalette.setColor(QPalette::Button, QColor(53,53,53));
    darkPalette.setColor(QPalette::ButtonText, Qt::white);
    darkPalette.setColor(QPalette::BrightText, Qt::red);
    darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
    darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
    darkPalette.setColor(QPalette::HighlightedText, Qt::black);
    qApp->setPalette(darkPalette);
    qApp->setStyleSheet("QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }");
    this->setWindowTitle("ShellUSB");
}
SetColValuesDialog::SetColValuesDialog( ScriptingEnv *env, QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl ), scripted(env)
{
    setName( "SetColValuesDialog" );
	setWindowTitle( tr( "QtiPlot - Set column values" ) );
	setSizeGripEnabled(true);

	QHBoxLayout *hbox1 = new QHBoxLayout();
	hbox1->addWidget(new QLabel(tr("For row (i)")));
	start = new QSpinBox();
	start->setMinValue(1);
	hbox1->addWidget(start);

	hbox1->addWidget(new QLabel(tr("to")));

	end = new QSpinBox();
	end->setMinValue(1);
	hbox1->addWidget(end);

	if (sizeof(int)==2)
	{ // 16 bit signed integer
		start->setMaxValue(0x7fff);
		end->setMaxValue(0x7fff);
	}
	else
	{ // 32 bit signed integer
		start->setMaxValue(0x7fffffff);
		end->setMaxValue(0x7fffffff);
	}

	QGridLayout *gl1 = new QGridLayout();
	functions = new QComboBox(false);
	gl1->addWidget(functions, 0, 0);
	btnAddFunction = new QPushButton(tr( "Add function" ));
	gl1->addWidget(btnAddFunction, 0, 1);
	boxColumn = new QComboBox(false);
	gl1->addWidget(boxColumn, 1, 0);
	btnAddCol = new QPushButton(tr( "Add column" ));
	gl1->addWidget(btnAddCol, 1, 1);

	QHBoxLayout *hbox3 = new QHBoxLayout();
	hbox3->addStretch();
	buttonPrev = new QPushButton("&<<");
	hbox3->addWidget(buttonPrev);
	buttonNext = new QPushButton("&>>");
	hbox3->addWidget(buttonNext);
	gl1->addLayout(hbox3, 2, 0);
	addCellButton = new QPushButton(tr( "Add cell" ));
	gl1->addWidget(addCellButton, 2, 1);

	QGroupBox *gb = new QGroupBox();
	QVBoxLayout *vbox1 = new QVBoxLayout();
	vbox1->addLayout(hbox1);
	vbox1->addLayout(gl1);
	gb->setLayout(vbox1);
	gb->setSizePolicy(QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred));

	explain = new QTextEdit();
	explain->setReadOnly (true);
	explain->setSizePolicy(QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred));
	QPalette palette = explain->palette();
	palette.setColor(QPalette::Active, QPalette::Base, Qt::lightGray);
	explain->setPalette(palette);

	QHBoxLayout *hbox2 = new QHBoxLayout();
	hbox2->addWidget(explain);
	hbox2->addWidget(gb);

	commands = new ScriptEdit( scriptEnv);

	QVBoxLayout *vbox2 = new QVBoxLayout();
	btnApply = new QPushButton(tr( "&Apply" ));
	vbox2->addWidget(btnApply);
	btnCancel = new QPushButton(tr( "&Close" ));
	vbox2->addWidget(btnCancel);
	vbox2->addStretch();

	QHBoxLayout *hbox4 = new QHBoxLayout();
	hbox4->addWidget(commands);
	hbox4->addLayout(vbox2);

	QVBoxLayout* vbox3 = new QVBoxLayout();
	vbox3->addLayout(hbox2);
#ifdef SCRIPTING_PYTHON
	boxMuParser = NULL;
	if (env->name() != QString("muParser")){
		boxMuParser = new QCheckBox(tr("Use built-in muParser (much faster)"));
		boxMuParser->setChecked(true);
		vbox3->addWidget(boxMuParser);
	}
#endif

	colNameLabel = new QLabel();
	vbox3->addWidget(colNameLabel);
	vbox3->addLayout(hbox4);

	setLayout(vbox3);
	setFocusProxy (commands);
	commands->setFocus();

	functions->insertStringList(scriptEnv->mathFunctions(), -1);
	if (functions->count() > 0)
		insertExplain(0);

	connect(btnAddFunction, SIGNAL(clicked()),this, SLOT(insertFunction()));
	connect(btnAddCol, SIGNAL(clicked()),this, SLOT(insertCol()));
	connect(addCellButton, SIGNAL(clicked()),this, SLOT(insertCell()));
	connect(btnApply, SIGNAL(clicked()),this, SLOT(apply()));
	connect(btnCancel, SIGNAL(clicked()),this, SLOT(close()));
	connect(functions, SIGNAL(activated(int)),this, SLOT(insertExplain(int)));
	connect(buttonPrev, SIGNAL(clicked()), this, SLOT(prevColumn()));
	connect(buttonNext, SIGNAL(clicked()), this, SLOT(nextColumn()));
}
Example #30
-1
Collection::Collection() :
  _current_library(0),
  _stdout(stdout)
{

  actionGroup = new QActionGroup(this);

  statusBar();

  QWidget::setWindowTitle( "Qt Papers" );

  QMenu* fileMenu = new QMenu("&File", this);    

  libraryOpen = addChoice("libraryOpen", "Open Library");
  libraryOpen->setStatusTip("Open a library");
  libraryOpen->setEnabled(true);
  libraryOpen->setIcon(QIcon(":/images/libopen.png"));
  connect(libraryOpen, SIGNAL(triggered()), this, SLOT(open_library()));
  fileMenu->addAction(libraryOpen);

  libraryNew = addChoice("libraryNew", "New Library");
  libraryNew->setStatusTip("Create a new library");
  libraryNew->setEnabled(true);
  libraryNew->setIcon(QIcon(":/images/document2.png"));
  connect(libraryNew, SIGNAL(triggered()), this, SLOT(new_library()));
  fileMenu->addAction(libraryNew);


  librarySave = addChoice("librarySave", "Save Library");
  librarySave->setStatusTip("Save the library");
  librarySave->setEnabled(true);
  librarySave->setIcon(QIcon(":/images/save.png"));
  connect(librarySave, SIGNAL(triggered()), this, SLOT(save_library()));
  fileMenu->addAction(librarySave);

  libraryDelete = addChoice("libraryDelete", "Delete Library");
  libraryDelete->setStatusTip("Delete library");
  libraryDelete->setEnabled(true);
  libraryDelete->setIcon(QIcon(":/images/libremove.png"));
  connect(libraryDelete, SIGNAL(triggered()), this, SLOT(delete_library()));
  fileMenu->addAction(libraryDelete);

  libraryImport = addChoice("libraryImport", "Import Library");
  libraryImport->setStatusTip("Import library");
  libraryImport->setEnabled(true);
  libraryImport->setIcon(QIcon(":/images/import.png"));
  connect(libraryImport, SIGNAL(triggered()), this, SLOT(scan_directory_and_import_papers()));

  fileMenu->addAction(libraryImport);

  preferences = addChoice("preferences", "Preferences");
  preferences->setStatusTip("Preferences");
  preferences->setEnabled(true);
  preferences->setIcon(QIcon(":/images/pref.png"));
  connect(preferences, SIGNAL(triggered()), this, SLOT(modify_preferences()));
  fileMenu->addAction(preferences);
  
  exit = addChoice("exit", "Exit");
  exit->setStatusTip("Exit");
  exit->setEnabled(true);
  exit->setIcon(QIcon(":/images/exit.png"));
  connect(exit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
  fileMenu->addAction(exit);

  QMenu* paperMenu = new QMenu("&Paper", this);    
  paperImport = addChoice("paperImport", "Import Paper");
  paperImport->setStatusTip("Import a paper");
  paperImport->setEnabled(false);
  paperImport->setIcon(QIcon(":/images/import.png"));

  paperScanDirectory = addChoice("paperScanDirectory", "Paper Scan");
  paperScanDirectory->setIcon(QIcon(":/images/scan.png"));
  paperScanDirectory->setStatusTip("Scan for papers.");
  paperScanDirectory->setEnabled(true);

  talkImport = addChoice("talkImport", "Import Talk");
  talkImport->setStatusTip("Import a talk");
  talkImport->setEnabled(false);

  paperNew = addChoice("paperNew", "New Paper");
  paperNew->setStatusTip("New paper");
  paperNew->setEnabled(true);
  paperNew->setIcon(QIcon(":/images/new.png"));

  paperDelete = addChoice("paperDelete", "Delete Paper");
  paperDelete->setStatusTip("Delete paper");
  paperDelete->setIcon(QIcon(":/images/remove.png"));
  paperDelete->setEnabled(false);

  paperEdit = addChoice("paperEdit", "Edit Paper");
  paperEdit->setStatusTip("Edit paper");
  paperEdit->setEnabled(false);
  paperEdit->setIcon(QIcon(":/images/edit.png"));

  paperOpen = addChoice("paperOpen", "Open Paper");
  paperOpen->setStatusTip("Open paper");
  paperOpen->setEnabled(false);
  paperOpen->setIcon(QIcon(":/images/open.png"));

  talkNew = addChoice("talkNew", "New Talk");
  talkNew->setStatusTip("New talk");
  talkNew->setEnabled(false);

  connect(paperNew, SIGNAL(triggered()), this, SLOT(new_paper()));
  connect(paperEdit, SIGNAL(triggered()), this, SLOT(edit_paper()));
  connect(paperDelete, SIGNAL(triggered()), this, SLOT(delete_paper()));
  connect(paperOpen, SIGNAL(triggered()), this, SLOT(open_paper()));
  connect(paperImport, SIGNAL(triggered()), this, SLOT(import_paper()));
  // need to implement this

  paperMenu->addAction(paperNew);
  paperMenu->addAction(paperImport);
  paperMenu->addAction(paperEdit);
  paperMenu->addAction(paperDelete);
  paperMenu->addAction(paperOpen);
  paperMenu->addAction(paperScanDirectory);
  paperMenu->addAction(talkNew);
  paperMenu->addAction(talkImport);




  QMenu* helpMenu = new QMenu("&Help", this);    
  showAbout = addChoice("showAbout","About");
  showAbout->setStatusTip("About");
  showAbout->setEnabled(true);
  showAbout->setIcon(QIcon(":/images/about.png"));
  connect(showAbout, SIGNAL(triggered()), this, SLOT(about()));
  helpMenu->addAction(showAbout);

  //Add a menu bar
  menuBar()->addMenu(fileMenu);
  menuBar()->addMenu(paperMenu);
  menuBar()->addMenu(helpMenu);

  //button to trigger find box
  paperFind = new QAction("Find Paper",this);
  paperFind->setStatusTip("Find paper");
  paperFind->setEnabled(true);
  paperFind->setIcon(QIcon(":/images/find.png"));
  connect(paperFind, SIGNAL(triggered()), this, SLOT(find_paper()));

  //add a tool bar
  QPushButton * find_clear = new QPushButton();
  find_clear->setStatusTip("Find paper");
  find_clear->setEnabled(true);
  find_clear->setIcon(QIcon(":/images/clear.png"));
  connect(find_clear, SIGNAL(clicked()), this, SLOT(reset_find()));

  QLabel * find = new QLabel();
  find->setText("Find: ");
  find->setLayoutDirection(Qt::LeftToRight);
  QLabel * in = new QLabel();
  in->setText(" in ");
  _find_edit = new QLineEdit;
  _find_edit->setFixedSize(_find_edit->sizeHint());
  _find_edit->setLayoutDirection(Qt::LeftToRight);
  connect(_find_edit, SIGNAL(returnPressed()), this, SLOT(find_paper()));

  _find_type = new QComboBox();
  QStringList find_names;
  find_names << "Author" << "Title" << "Abstract" << "Any";
  _find_type->insertItems(0,find_names);
  _find_type->setLayoutDirection(Qt::LeftToRight);
  find->setBuddy(_find_edit);
  paperToolBar = addToolBar(tr("Paper"));
  paperToolBar->setLayoutDirection(Qt::RightToLeft);
  paperToolBar->addAction(paperFind);
  paperToolBar->addWidget(_find_type);
  paperToolBar->addWidget(in);
  paperToolBar->addWidget(find_clear);
  paperToolBar->addWidget(_find_edit);
  paperToolBar->addWidget(find);
  paperToolBar->addAction(paperDelete);
  paperToolBar->addAction(paperEdit);
  paperToolBar->addAction(paperNew);
  paperToolBar->addAction(paperOpen);
  paperToolBar->addAction(paperImport);
  paperToolBar->addAction(paperScanDirectory);

  _rss_box = new RssWidget;
  connect(_rss_box, SIGNAL(urlChanged(const QUrl& )), 
	  this, SLOT(check_url(const QUrl& )));

  QAction * rssForward  = new QAction("rssForward",this);
  rssForward->setStatusTip("Forward");
  rssForward->setEnabled(true);
  rssForward->setIcon(QIcon(":/images/forward.png"));
  connect(rssForward, SIGNAL(triggered()), _rss_box, SLOT(forward()));
  paperToolBar->addAction(rssForward);

  QAction * rssBack  = new QAction("rssBack",this);
  rssBack->setStatusTip("Back");
  rssBack->setEnabled(true);
  rssBack->setIcon(QIcon(":/images/back.png"));
  connect(rssBack, SIGNAL(triggered()), _rss_box, SLOT(back()));
  paperToolBar->addAction(rssBack);

  //Set up a central widget that will have a layout in it

  _library_list = new LibraryList(this,this);
  QFont font;
  font.setBold(true);
  font.setCapitalization(QFont::SmallCaps);
  _library_list->setFont(font);
  connect(_library_list, SIGNAL(itemClicked( QListWidgetItem *)), this, SLOT(select_library(QListWidgetItem *)));
  
  
  _abstract_box = new QTextBrowser();
  _abstract_box->setAlignment(Qt::AlignJustify);
  _abstract_box->setFontWeight(QFont::DemiBold);
  _abstract_box->setPlainText("No Paper Selected");
  _paper_list = new PaperList(this,this);

  QStringList sl;
  // The following seems like a non-intuitive operator
  // overload but that is how they do it...
  sl << "Author" << "Title" << "Date";
  _paper_list->setColumnCount(3);
  _paper_list->setHorizontalHeaderLabels(sl);
  _paper_list->setAlternatingRowColors(true);
  _paper_list->horizontalHeader()->setStretchLastSection(true);
  _paper_list->verticalHeader()->hide();
  //  _paper_list->setSortingEnabled(true);
  //need to make the paper_list its own class for drag and drop
  //  _paper_list->setAcceptDrops(true);

  connect(_paper_list, SIGNAL(cellClicked(int , int )), 
	  this, SLOT(select_paper(int, int)));
  //  update_paper_list();
  

  _top_layout = new QSplitter();  
  _top_layout->addWidget(_library_list);
  _top_layout->addWidget(_paper_list);
  _top_layout->setStretchFactor(0,1);
  _top_layout->setStretchFactor(1,3);
  _top_layout->setContentsMargins(0,0,5,0);
  _top_layout->setOrientation(Qt::Horizontal);

  _bot_layout = new QSplitter();  
  _bot_layout->addWidget(_abstract_box);
  _bot_layout->addWidget(_rss_box);
  _bot_layout->setContentsMargins(0,0,0,0);
  _bot_layout->setStretchFactor(0,1);
  _bot_layout->setStretchFactor(1,3);
  _bot_layout->setOrientation(Qt::Horizontal);

  _total_layout = new QSplitter();
  _total_layout->addWidget(_top_layout);
  _total_layout->addWidget(_bot_layout);
  _total_layout->setStretchFactor(0,1);
  _total_layout->setStretchFactor(1,3);
  _total_layout->setOrientation(Qt::Vertical);

  //this splitter window is my central widget
  setCentralWidget(_total_layout);


  QPalette  palette;
  palette.setColor(QPalette::Background,Qt::white);
  centralWidget()->setPalette(palette);
  centralWidget()->setAutoFillBackground(true);
  centralWidget()->setWindowOpacity(0.8);
  centralWidget()->setMinimumSize(300, 200);
  setMinimumSize(700, 500);

  readSettings();
}