예제 #1
0
파일: party.cpp 프로젝트: Fir3element/035
bool Party::passLeadership(Player* player)
{
    if(!player || getLeader() == player || !isPlayerMember(player))
        return false;

    //Remove it before to broadcast the message correctly
    PlayerVector::iterator it = std::find(memberList.begin(), memberList.end(), player);
    if(it != memberList.end())
        memberList.erase(it);

    Player* oldLeader = getLeader();
    setLeader(player);
    memberList.insert(memberList.begin(), oldLeader);

    char buffer[125];
    sprintf(buffer, "%s is now the leader of the party.", player->getName().c_str());
    broadcastMessage(MSG_INFO_DESCR, buffer, true);

    player->sendTextMessage(MSG_INFO_DESCR, "You are now the leader of the party.");
    updateSharedExperience();

    updateIcons(oldLeader);
    updateIcons(player);
    return true;
}
예제 #2
0
파일: main.cpp 프로젝트: HenryHu/lumina
int  main(int argc, char *argv[]) {
   LTHEME::LoadCustomEnvSettings();
   LSingleApplication a(argc, argv, "lumina-terminal");
    if( !a.isPrimaryProcess() ){ return 0; } //poked the current process instead
	
   //First make sure a system tray is available
  /*qDebug() << "Checking for system tray";
   bool ready = false;
   for(int i=0; i<60 && !ready; i++){
      ready = QSystemTrayIcon::isSystemTrayAvailable();
      if(!ready){
	//Pause for 5 seconds
        sleep(5); //don't worry about stopping event handling - nothing running yet
      }
   }
   if(!ready){
     qDebug() << "Could not find any available system tray after 5 minutes: exiting....";
     return 1;
   }*/
   
   //Now go ahead and setup the app
   LuminaThemeEngine theme(&a);
     QApplication::setQuitOnLastWindowClosed(false);   
     
   //Now start the tray icon
   TrayIcon tray;
    QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &tray, SLOT(slotSingleInstance(QStringList)) );
    QObject::connect(&theme, SIGNAL(updateIcons()), &tray, SLOT(updateIcons()) );
    tray.parseInputs(a.inputlist);
   tray.show();
   return  a.exec();
}
예제 #3
0
파일: main.cpp 프로젝트: jbenden/lumina
int main(int argc, char ** argv)
{
    bool CLIdone = false;
    for(int i=1; i<argc; i++){ //skip the first arg (app binary)
      if(QString(argv[i]) == "--reset-monitors"){
        RRSettings::ApplyPrevious();
        CLIdone = true;
        break;
      }
    }
    if(CLIdone){ return 0; }
   LTHEME::LoadCustomEnvSettings();
    LSingleApplication a(argc, argv, "lumina-xconfig"); //loads translations inside constructor
      if( !a.isPrimaryProcess()){ return 0; }
    //qDebug() << "Loaded QApplication";
    a.setApplicationName("Lumina Screen Configuration");
    LuminaThemeEngine themes(&a);

    //Start the UI
    MainUI w;
    QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) );
    QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(loadIcons()) );
    w.show();

    int retCode = a.exec();
    return retCode;
}
예제 #4
0
//==========
//    PUBLIC
//==========
page_session_options::page_session_options(QWidget *parent) : PageWidget(parent), ui(new Ui::page_session_options()){
  ui->setupUi(this);
  loading = false;
  //Display formats for panel clock
  ui->combo_session_datetimeorder->clear();
  ui->combo_session_datetimeorder->addItem( tr("Time (Date as tooltip)"), "timeonly");
  ui->combo_session_datetimeorder->addItem( tr("Date (Time as tooltip)"), "dateonly");
  ui->combo_session_datetimeorder->addItem( tr("Time first then Date"), "timedate");
  ui->combo_session_datetimeorder->addItem( tr("Date first then Time"), "datetime");

  connect(ui->push_session_setUserIcon, SIGNAL(clicked()), this, SLOT(sessionChangeUserIcon()) );
  connect(ui->push_session_resetSysDefaults, SIGNAL(clicked()), this, SLOT(sessionResetSys()) );
  connect(ui->push_session_resetLuminaDefaults, SIGNAL(clicked()), this, SLOT(sessionResetLumina()) );
  connect(ui->tool_help_time, SIGNAL(clicked()), this, SLOT(sessionShowTimeCodes()) );
  connect(ui->tool_help_date, SIGNAL(clicked()), this, SLOT(sessionShowDateCodes()) );
  connect(ui->line_session_time, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadTimeSample()) );
  connect(ui->line_session_date, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadDateSample()) );
  connect(ui->combo_session_datetimeorder, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) );
  connect(ui->check_session_numlock, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) );
  connect(ui->check_session_playloginaudio, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) );
  connect(ui->check_session_playlogoutaudio, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) );
  connect(ui->check_autoapplinks, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) );
  connect(ui->check_watch_app_procs, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) );
 updateIcons();
 
}
예제 #5
0
void EWIconBoxFrame::drawContents(QPainter *p)
{
  static const QPixmap alarmPxmp = Icon("bell.xpm");
  static const QPixmap recurPxmp = Icon("recur.xpm");
  static const QPixmap readonlyPxmp = Icon("readonlyevent.xpm");
  QRect cr(contentsRect());
  register int xOff, yOff;

  updateIcons();

  xOff = cr.left();
  yOff = cr.top();

  if (showReadOnly) {
    p->drawPixmap(xOff, yOff, readonlyPxmp);
    xOff += readonlyPxmp.width() + PMMARGIN;
  }

  if (showRecurs) {
    p->drawPixmap(xOff, yOff, recurPxmp);
    xOff += recurPxmp.width() + PMMARGIN;
  }

  if (showAlarm) {
    p->drawPixmap(xOff, yOff, alarmPxmp);
    xOff += recurPxmp.width() + PMMARGIN;
  }
  
}
예제 #6
0
파일: widget.cpp 프로젝트: AWeinb/qTox
void Widget::onEventIconTick()
{
    if (eventFlag)
    {
        eventIcon ^= true;
        updateIcons();
    }
}
예제 #7
0
void KAnimWidget::setIcons( const QString& icons )
{
  if ( d->icon_name == icons )
    return;

  d->icon_name = icons;
  updateIcons();
}
예제 #8
0
//==========
//    PUBLIC
//==========
page_interface_desktop::page_interface_desktop(QWidget *parent) : PageWidget(parent), ui(new Ui::page_interface_desktop()){
  ui->setupUi(this);
  PINFO = new LPlugins();
  connect(ui->tool_desktop_addplugin, SIGNAL(clicked()), this, SLOT(deskplugadded()) );
  connect(ui->tool_desktop_rmplugin, SIGNAL(clicked()), this, SLOT(deskplugremoved()) );
  connect(ui->check_desktop_autolaunchers, SIGNAL(clicked()), this, SLOT(settingChanged()) );
  updateIcons();
}
예제 #9
0
파일: updater.cpp 프로젝트: Anderty/qutim
void UpdaterPlugin::timerEvent(QTimerEvent *event)
{
	if (event->timerId() == m_timer.timerId()) {
		updateIcons();
		return;
	}
	Plugin::timerEvent(event);
}
예제 #10
0
void FindToolBar::findFlagsChanged()
{
    updateIcons();
    updateFlagMenus();
    invokeClearResults();
    if (isVisible())
        m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags());
}
예제 #11
0
//==========
//    PUBLIC
//==========
page_interface_panels::page_interface_panels(QWidget *parent) : PageWidget(parent), ui(new Ui::page_interface_panels()) {
    ui->setupUi(this);
    loading = false;
    PINFO = new LPlugins();
    settings = new QSettings("lumina-desktop","desktopsettings");
    connect(ui->tool_panels_add, SIGNAL(clicked()), this, SLOT(newPanel()) );
    updateIcons();
}
예제 #12
0
void KAnimWidget::setSize( int size )
{
  if ( d->size == size )
    return;

  d->size = size;
  updateIcons();
}
예제 #13
0
void KAnimWidget::showEvent(QShowEvent* e)
{
  if (!d->initDone)
  {
     d->initDone = true;
     updateIcons();
  }
  QFrame::showEvent(e);
}
예제 #14
0
//==========
//    PUBLIC
//==========
page_autostart::page_autostart(QWidget *parent) : PageWidget(parent), ui(new Ui::page_autostart()){
  ui->setupUi(this);
  ui->list_session_start->setMouseTracking(true);
  updateIcons();
  connect(ui->tool_session_addapp, SIGNAL(clicked()), this, SLOT(addsessionstartapp()) );
  connect(ui->tool_session_addbin, SIGNAL(clicked()), this, SLOT(addsessionstartbin()) );
  connect(ui->tool_session_addfile, SIGNAL(clicked()), this, SLOT(addsessionstartfile()) );
  connect(ui->list_session_start, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(settingChanged()) );
}
예제 #15
0
void MuseScore::changeWorkspace(Workspace* p, bool first)
      {
      Workspace::currentWorkspace->save();
      p->read();
      Workspace::currentWorkspace = p;
      if (!first) {
            updateIcons();
            preferencesChanged(true);
            }
      }
예제 #16
0
void LuminaThemeEngine::reloadFiles(){
  //Check the Theme file/settings
  if(lastcheck < QFileInfo(QDir::homePath()+"/.lumina/themesettings.cfg").lastModified() ){
    QStringList current = LTHEME::currentSettings();
    application->setStyleSheet( LTHEME::assembleStyleSheet(current[0], current[1], current[3], current[4]) );	
    if(icons!=current[2]){
      QIcon::setThemeName(current[2]); //make sure this sets set within this environment
      emit updateIcons();
    }
    //save the settings for comparison later
    theme = current[0]; colors=current[1]; icons=current[2];

    if(font!=current[3] || fontsize!=current[4]){
      font=current[3]; fontsize=current[4];
      QFont tmp = application->font();
        tmp.setStyleStrategy(QFont::PreferOutline);
        tmp.setFamily(font);
        if(fontsize.endsWith("pt")){ tmp.setPointSize(fontsize.section("pt",0,0).toInt()); }
        else if(fontsize.endsWith("px")){ tmp.setPixelSize(fontsize.section("px",0,0).toInt()); }
      application->setFont(tmp);
    }
  }
  //Check the Cursor file/settings
  if(lastcheck < QFileInfo(QDir::homePath()+"/.icons/default/index.theme").lastModified()){
    QString ccurs = LTHEME::currentCursor();
    if(cursors != ccurs){
      emit updateCursors();
      //Might be something we can do automatically here as well - since we have the QApplication handy
      // - Note: setting/unsetting an override cursor does not update the current cursor bitmap
      // Qt created a background database/hash/mapping of the theme pixmaps on startup 
      //   So Qt itself needs to be prodded to update that mapping
      /*QXcbCursor::cursorThemePropertyChanged( \
	  new QXcbVirtualDesktop(QX11Info::connection(), application->screen()->handle(), QX11Info::appScreen()),
	  ccurs.toData(), QVariant("Inherits"), NULL);*/
      //QCursorData::cleanup();
      //QCursorData::initialize();
      //setenv("XCURSOR_THEME", ccurs.toLocal8Bit(),1);
    }
    cursors = ccurs;
  }
  
  
  //Environment Changes
  if( lastcheck < QFileInfo(QDir::homePath()+"/.lumina/envsettings.conf").lastModified()){
    LTHEME::LoadCustomEnvSettings();
    emit EnvChanged();
  }
  lastcheck = QDateTime::currentDateTime();
  
  //Now update the watched files to ensure nothing is missed
  watcher->removePaths( QStringList() << theme << colors << QDir::homePath()+"/.icons/default/index.theme" << QDir::homePath()+"/.lumina/envsettings.conf");
  watcher->addPaths( QStringList() << theme << colors << QDir::homePath()+"/.icons/default/index.theme" << QDir::homePath()+"/.lumina/envsettings.conf");
}
예제 #17
0
파일: browser.c 프로젝트: Tomwi/FeOSMusic
void updateBrowser(void)
{
	if(keysPres & KEY_TOUCH) {
		drgY[0] = stylus.y;
	}
	if(keysHold & KEY_TOUCH) {
		drgY[1] = stylus.y;
		drgTime++;
	}

	if(keysReleased & KEY_TOUCH) {
		if(drgTime < 30 && abs(drgY[1]-drgY[0])<3) {
			if(!(TouchedArea(256-FL_ICONSZ, 0, 256, FL_ICONSZ))){
				int selected = (scrollY + drgY[0])/ICON_SZ;
				CLAMP(selected, 0, numEnt);
				if(list[selected][ENTRY_TYPE]==DT_DIR)
					retrieveDir(&list[selected][ENTRY_NAME]);
				else {
					if(getStreamState() == STREAM_STOP) {
						char * file = &list[selected][ENTRY_NAME];
						if(playFile(file))
							return;
					}
				}
			}
		}
		scrollY+=(drgY[0]-drgY[1]);
		CLAMP(scrollY, 0, ((numEnt+1)<=(192/ICON_SZ))? 0 :  ((numEnt * ICON_SZ)-192));
		kinEn = ((drgY[0]-drgY[1])/(drgTime))<<SCHUIF;
		if(abs(kinEn) > MAX_EN ) {
			if(kinEn >0)
				kinEn = MAX_EN;
			else
				kinEn = -MAX_EN;
		}
		drgY[1] = drgY[0] = 0;
		drgTime = 0;
	}
	scrollY += (kinEn>>SCHUIF);
	if(kinEn > 0)
		kinEn--;
	else if(kinEn < 0)
		kinEn++;
	// Update scrolling variables used by drawList() in the next frame
	CLAMP(scrollY, 0, ((numEnt+1)<=(192/ICON_SZ))? 0 :  ((numEnt * ICON_SZ)-192));
	scrolly = (scrollY + (drgY[0]-drgY[1]));
	CLAMP(scrolly, 0, ((numEnt+1)<=(192/ICON_SZ))? 0 :  ((numEnt * ICON_SZ)-192));
	beginY = -(scrolly%ICON_SZ);
	begin = (scrolly/ICON_SZ);
	CLAMP(begin, 0, numEnt);
	setConsoleCooAbs(0, -beginY);
	updateIcons();
}
예제 #18
0
파일: main.cpp 프로젝트: abishai/lumina
int main(int argc, char ** argv)
{
    LTHEME::LoadCustomEnvSettings();
    QApplication a(argc, argv);
    LUtils::LoadTranslation(&a, "lumina-fileinfo");
    LuminaThemeEngine theme(&a);


    //Read the input variables
    QString path = "";
    QString flag = "";
    if (argc==2) {
        path = QString::fromLocal8Bit(argv[1]);
    } else if (argc==3) {
        flag = QString::fromLocal8Bit(argv[1]);
        path = QString::fromLocal8Bit(argv[2]);
    }
    //Check the input variables
    // - path
    if(!path.isEmpty()) {
        path = LUtils::PathToAbsolute(path);
    }
    // - flag
    if(!flag.isEmpty()) {
        if(flag=="-application") {
            flag = "APP"; //for internal use
        } else if(flag=="-link") {
            flag = "LINK"; //for internal use
        } else {
            //Invalid flag - clear the path as well
            path.clear();
        }
    }
    if(!path.isEmpty()) {
        //if(!QFile::exists(path)){ LUtils::writeFile(path,QStringList()); } //create an empty file
        MainUI w;
        QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
        w.LoadFile(path, flag);
        w.show();
        int retCode = a.exec();
        return retCode;
    } else {
        //Show an error text and exit
        QStringList msg;
        msg << "ERROR: Invalid input arguments";
        msg << "Usage: \"lumina-fileinfo [-application | -link] <file>";
        qDebug() << msg.join("\n");
        return 1;
    }


}
예제 #19
0
파일: updater.cpp 프로젝트: Anderty/qutim
bool UpdaterPlugin::load()
{
	m_manager.reset(new QNetworkAccessManager);
	connect(m_manager.data(), SIGNAL(finished(QNetworkReply*)), SLOT(onReplyFinished(QNetworkReply*)));
	m_watcher.reset(new QFutureWatcher<FileInfo>());
	connect(m_watcher.data(), SIGNAL(finished()), this, SLOT(onCheckFinished()));
	
	// Check for updates once per day
	m_timer.start(1000 * 60 * 60 * 24, this);
	
	updateIcons();
	return true;
}
예제 #20
0
//==========
//    PUBLIC
//==========
page_fluxbox_settings::page_fluxbox_settings(QWidget *parent) : PageWidget(parent), ui(new Ui::page_fluxbox_settings()){
  ui->setupUi(this);
  loading= false;
  ui->radio_simple->setChecked(true);
  ui->radio_advanced->setChecked(false);
  connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) );
  connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) );
  connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) );
  connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()) );
  connect(ui->text_file, SIGNAL(textChanged()), this, SLOT(settingChanged()) );
  connect(ui->radio_simple, SIGNAL(toggled(bool)), this, SLOT(switchEditor()) );
  updateIcons();
}
예제 #21
0
파일: party.cpp 프로젝트: Fir3element/035
bool Party::leave(Player* player)
{
    if(!player)
        return false;

    if(!isPlayerMember(player) && getLeader() != player)
        return false;

    bool missingLeader = false;
    if(getLeader() == player)
    {
        if(!memberList.empty())
        {
            if(memberList.size() == 1 && inviteList.empty())
                missingLeader = true;
            else
                passLeadership(memberList.front());
        }
        else
            missingLeader = true;
    }

    //since we already passed the leadership, we remove the player from the list
    PlayerVector::iterator it = std::find(memberList.begin(), memberList.end(), player);
    if(it != memberList.end())
        memberList.erase(it);

    it = std::find(inviteList.begin(), inviteList.end(), player);
    if(it != inviteList.end())
        inviteList.erase(it);

    player->setParty(NULL);
    player->sendClosePrivate(CHANNEL_PARTY);

    player->sendTextMessage(MSG_INFO_DESCR, "You have left the party.");
    player->sendPlayerPartyIcons(player);

    updateSharedExperience();
    updateIcons(player);
    clearPlayerPoints(player);

    char buffer[105];
    sprintf(buffer, "%s has left the party.", player->getName().c_str());

    broadcastMessage(MSG_INFO_DESCR, buffer);
    if(missingLeader || canDisband())
        disband();

    return true;
}
예제 #22
0
int LoopButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QToolButton::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: updateIcons((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
예제 #23
0
void MuseScore::changeWorkspace(QAction* a)
      {
      for (Workspace* p :Workspace::workspaces()) {
            if (qApp->translate("Ms::Workspace", p->name().toUtf8()) == a->text()) {
                  changeWorkspace(p);
                  preferences.setPreference(PREF_APP_WORKSPACE, Workspace::currentWorkspace->name());
                  PaletteBox* pb = mscore->getPaletteBox();
                  pb->updateWorkspaces();
                  updateIcons();
                  return;
                  }
            }
      qDebug("   workspace \"%s\" not found", qPrintable(a->text()));
      }
예제 #24
0
//==========
//    PUBLIC
//==========
page_defaultapps::page_defaultapps(QWidget *parent) : PageWidget(parent), ui(new Ui::page_defaultapps()){
  ui->setupUi(this);

  connect(ui->tool_default_filemanager, SIGNAL(clicked()), this, SLOT(changeDefaultFileManager()) );
  connect(ui->tool_default_terminal, SIGNAL(clicked()), this, SLOT(changeDefaultTerminal()) );
  connect(ui->tool_default_webbrowser, SIGNAL(clicked()), this, SLOT(changeDefaultBrowser()) );
  connect(ui->tool_default_email, SIGNAL(clicked()), this, SLOT(changeDefaultEmail()) );
  connect(ui->tool_defaults_clear, SIGNAL(clicked()), this, SLOT(cleardefaultitem()) );
  connect(ui->tool_defaults_set, SIGNAL(clicked()), this, SLOT(setdefaultitem()) );
  connect(ui->tool_defaults_setbin, SIGNAL(clicked()), this, SLOT(setdefaultbinary()) );
  connect(ui->tree_defaults, SIGNAL(itemSelectionChanged()), this, SLOT(checkdefaulticons()) );
  updateIcons();
  ui->tabWidget_apps->setCurrentWidget(ui->tab_auto);
}
예제 #25
0
void FindFadLineEdit::invokeFindFlagsChanged()
{
    findFlags = 0;

    if ( actionCaseSensitive->isChecked() )
        findFlags |= Shared::CaseSensitive;

    if ( actionWholeWords->isChecked() )
        findFlags |= Shared::WholeWords;

    if ( actionRegExp->isChecked() )
        findFlags |= Shared::RegExp;

    updateIcons();
    emit findFlagsChanged();
}
예제 #26
0
KAnimWidget::KAnimWidget( const QString& icons, int size, QWidget *parent,
                          const char *name )
  : QFrame( parent, name ),
    d( new KAnimWidgetPrivate )
{
  connect( &d->timer, SIGNAL(timeout()), this, SLOT(slotTimerUpdate()));

  if (parent && parent->inherits( "KToolBar" ))
    connect(parent, SIGNAL(modechange()), this, SLOT(updateIcons()));

  d->loadingCompleted = false;
  d->size = size;
  d->initDone = false;
  setIcons( icons );
  setFrameStyle( StyledPanel | Sunken );
}
예제 #27
0
파일: main.cpp 프로젝트: KhuramAli/lumina
int main(int argc, char ** argv)
{
    QStringList in;
    for(int i=1; i<argc; i++){ //skip the first arg (app binary)
      QString path = argv[i];
      if(path=="."){
	//Insert the current working directory
	in << QDir::currentPath();
      }else{
	if(!path.startsWith("/")){ path.prepend(QDir::currentPath()+"/"); }
        in << path;
      }
    }
    if(in.isEmpty()){ in << QDir::homePath(); }
    #ifdef __FreeBSD__
    QtSingleApplication a(argc, argv);
    if( a.isRunning() ){
      return !(a.sendMessage(in.join("\n")));
    }
    #else
    QApplication a(argc, argv);
    #endif
    a.setApplicationName("Insight File Manager");
    LuminaThemeEngine themes(&a);
    //Load current Locale
    QTranslator translator;
    QLocale mylocale;
    QString langCode = mylocale.name();

    if ( ! QFile::exists(LOS::LuminaShare()+"i18n/lumina-fm_" + langCode + ".qm" ) )  langCode.truncate(langCode.indexOf("_"));
    translator.load( QString("lumina-fm_") + langCode, LOS::LuminaShare()+"i18n/" );
    a.installTranslator( &translator );
    qDebug() << "Locale:" << langCode;

    //Load current encoding for this locale
    QTextCodec::setCodecForTr( QTextCodec::codecForLocale() ); //make sure to use the same codec
    qDebug() << "Locale Encoding:" << QTextCodec::codecForLocale()->name();

    MainUI w;
    QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &w, SLOT(slotSingleInstance(const QString&)) );
    QObject::connect(&themes, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) );
    w.OpenDirs(in);
    w.show();

    int retCode = a.exec();
    return retCode;
}
예제 #28
0
파일: MainUI.cpp 프로젝트: yamajun/lumina
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
  ui->setupUi(this);
  settings = new QSettings("lumina-desktop","lumina-textedit");
  Custom_Syntax::SetupDefaultColors(settings); //pre-load any color settings as needed
  colorDLG = new ColorDialog(settings, this);
  this->setWindowTitle(tr("Text Editor"));
  ui->tabWidget->clear();
  closeFindS = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    connect(closeFindS, SIGNAL(activated()), this, SLOT(closeFindReplace()) );
  ui->groupReplace->setVisible(false);
  //Update the menu of available syntax highlighting modes
  QStringList smodes = Custom_Syntax::availableRules();
  for(int i=0; i<smodes.length(); i++){
    ui->menuSyntax_Highlighting->addAction(smodes[i]);
  }
  ui->actionLine_Numbers->setChecked( settings->value("showLineNumbers",true).toBool() );
  ui->actionWrap_Lines->setChecked( settings->value("wrapLines",true).toBool() );
  //Setup any connections
  connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) );
  connect(ui->actionNew_File, SIGNAL(triggered()), this, SLOT(NewFile()) );
  connect(ui->actionOpen_File, SIGNAL(triggered()), this, SLOT(OpenFile()) );
  connect(ui->actionClose_File, SIGNAL(triggered()), this, SLOT(CloseFile()) );
  connect(ui->actionSave_File, SIGNAL(triggered()), this, SLOT(SaveFile()) );
  connect(ui->actionSave_File_As, SIGNAL(triggered()), this, SLOT(SaveFileAs()) );
  connect(ui->menuSyntax_Highlighting, SIGNAL(triggered(QAction*)), this, SLOT(UpdateHighlighting(QAction*)) );
  connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged()) );
  connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) );
  connect(ui->actionLine_Numbers, SIGNAL(toggled(bool)), this, SLOT(showLineNumbers(bool)) );
  connect(ui->actionWrap_Lines, SIGNAL(toggled(bool)), this, SLOT(wrapLines(bool)) );
  connect(ui->actionCustomize_Colors, SIGNAL(triggered()), this, SLOT(ModifyColors()) );
  connect(ui->actionFind, SIGNAL(triggered()), this, SLOT(openFind()) );
  connect(ui->actionReplace, SIGNAL(triggered()), this, SLOT(openReplace()) );
  connect(ui->tool_find_next, SIGNAL(clicked()), this, SLOT(findNext()) );
  connect(ui->tool_find_prev, SIGNAL(clicked()), this, SLOT(findPrev()) );
  connect(ui->tool_replace, SIGNAL(clicked()), this, SLOT(replaceOne()) );
  connect(ui->tool_replace_all, SIGNAL(clicked()), this, SLOT(replaceAll()) );
  connect(ui->line_find, SIGNAL(returnPressed()), this, SLOT(findNext()) );
  connect(ui->line_replace, SIGNAL(returnPressed()), this, SLOT(replaceOne()) );
  connect(colorDLG, SIGNAL(colorsChanged()), this, SLOT(UpdateHighlighting()) );
  updateIcons();
  //Now load the initial size of the window
  QSize lastSize = settings->value("lastSize",QSize()).toSize();
  if(lastSize.width() > this->sizeHint().width() && lastSize.height() > this->sizeHint().height() ){
    this->resize(lastSize);
  }
}
예제 #29
0
파일: LDeskBar.cpp 프로젝트: yamajun/lumina
// =======================
//   PRIVATE FUNCTIONS
// =======================
void LDeskBarPlugin::initializeDesktop(){
  //Applications on the desktop
  appB = new QToolButton(this);
    appB->setToolButtonStyle(Qt::ToolButtonIconOnly);
    appB->setAutoRaise(true);
    appB->setPopupMode(QToolButton::InstantPopup);
  appM = new QMenu(this);
    appB->setMenu(appM);
    this->layout()->addWidget(appB);
    connect(appM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) );
    connect(appM, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
  //Directories on the desktop
  dirB = new QToolButton(this);
    dirB->setToolButtonStyle(Qt::ToolButtonIconOnly);
    dirB->setAutoRaise(true);
    dirB->setPopupMode(QToolButton::InstantPopup);
  dirM = new QMenu(this);
    dirB->setMenu(dirM);
    this->layout()->addWidget(dirB);
    connect(dirM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) );
    connect(dirM, SIGNAL(aboutToHide()), this, SIGNAL(MenuClosed()));
  //Audio Files on the desktop
  audioM = new QMenu(this);
    connect(audioM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) );
  //Video Files on the desktop
  videoM = new QMenu(this);
    connect(videoM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) );
  //Picture Files on the desktop
  pictureM = new QMenu(this);
    connect(pictureM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) );
  //Other Files on the desktop
  otherM = new QMenu(this);
    connect(otherM,SIGNAL(triggered(QAction*)),this,SLOT(ActionTriggered(QAction*)) );
  docM = new QMenu(this);
    connect(docM,SIGNAL(triggered(QAction*)), this,SLOT(ActionTriggered(QAction*)) );
  //All Files Button
  fileB = new QToolButton(this);
    fileB->setToolButtonStyle(Qt::ToolButtonIconOnly);
    fileB->setAutoRaise(true);
    fileB->setPopupMode(QToolButton::InstantPopup);
  fileM = new QMenu(this);
    fileB->setMenu(fileM);
    this->layout()->addWidget(fileB);
    
    updateIcons(); //set all the text/icons
}
예제 #30
0
파일: main.cpp 프로젝트: yamajun/lumina
int main(int argc, char ** argv)
{
  LTHEME::LoadCustomEnvSettings();
  QApplication a(argc, argv);
  LUtils::LoadTranslation(&a, "lumina-fileinfo");
  LuminaThemeEngine theme(&a);


  //Read the input variables
  QString path = "";
  QString flag = "";
  for(int i=1; i<argc; i++){
    if( QString(argv[i]).startsWith("-") ){ flag = QString(argv[i]); }
    else{ path = QString(argv[i]); break; }
  }
  //Check the input variables
  // - path
  if(!path.isEmpty()){ path = LUtils::PathToAbsolute(path); }
  // - flag
  if(!flag.isEmpty()){
    if(flag=="-application"){
      flag = "APP"; //for internal use
    }else if(flag=="-link"){
      flag = "LINK"; //for internal use
    }else{
      //Invalid flag - clear the path as well
      flag.clear();
      path.clear();
    }
  }
  if(!path.isEmpty() || !flag.isEmpty()){ 
    MainUI w;
      QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(UpdateIcons()) );
    w.LoadFile(path, flag);
    w.show();
    int retCode = a.exec();
    return retCode;
  }else{
    //Show an error text and exit
    qDebug() << "ERROR: Invalid input arguments";
    qDebug() << "Usage: \"lumina-fileinfo [-application | -link] [file]";
    return 1;
  }


}