code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
/* * Copyright 2004 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. */ /* * @test * @bug 4984872 * @summary Basic tests of toPlainString method * @author Joseph D. Darcy */ import java.math.*; public class ToPlainStringTests { public static void main(String argv[]) { String [][] testCases = { {"0", "0"}, {"1", "1"}, {"10", "10"}, {"2e1", "20"}, {"3e2", "300"}, {"4e3", "4000"}, {"5e4", "50000"}, {"6e5", "600000"}, {"7e6", "7000000"}, {"8e7", "80000000"}, {"9e8", "900000000"}, {"1e9", "1000000000"}, {".0", "0.0"}, {".1", "0.1"}, {".10", "0.10"}, {"1e-1", "0.1"}, {"1e-1", "0.1"}, {"2e-2", "0.02"}, {"3e-3", "0.003"}, {"4e-4", "0.0004"}, {"5e-5", "0.00005"}, {"6e-6", "0.000006"}, {"7e-7", "0.0000007"}, {"8e-8", "0.00000008"}, {"9e-9", "0.000000009"}, {"9000e-12", "0.000000009000"}, }; int errors = 0; for(String[] testCase: testCases) { BigDecimal bd = new BigDecimal(testCase[0]); String s; if (!(s=bd.toPlainString()).equals(testCase[1])) { errors++; System.err.println("Unexpected plain result ``" + s + "'' from BigDecimal " + bd); } if (!(s=("-"+bd.toPlainString())).equals("-"+testCase[1])) { errors++; System.err.println("Unexpected plain result ``" + s + "'' from BigDecimal " + bd); } } if(errors > 0) throw new RuntimeException(errors + " errors during run."); } }
TheTypoMaster/Scaper
openjdk/jdk/test/java/math/BigDecimal/ToPlainStringTests.java
Java
gpl-2.0
3,442
################################################################################ ################################### Class ###################################### ################################################################################ from brain import BrainException,Brain class LookUpTableBrainException(BrainException): pass class LookUpTableBrain(Brain): """ Brain class based on Lookup table Attributes: _table - Look up table """ def __init__(self): self._table = {} def configure(self,**kargs): """ This method is not used Input: Nothing Returns: Nothing """ pass def learn(self,dataset): """ This method trains network Input: dataset - Dataset to train Returns: Nothing """ if dataset == {}: raise LookUpTableBrainException("Dataset for learning is empty.") self._table = dataset def think(self,data): """ Activates brain with data and produces response Input: data - Input data (request) Returns: output data (answer) """ try: return self._table[data] except KeyError: raise LookUpTableBrainException("Don't know.")
0x1001/jarvis
jarvis/neural/lookuptablebrain.py
Python
gpl-2.0
1,385
// Generated on 02/23/2017 16:53:42 using System; using System.Collections.Generic; using System.Linq; using DarkSoul.Network.Protocol.Types; using DarkSoul.Network.Protocol.Message; using DarkSoul.Core.Interfaces; using DarkSoul.Core.IO; namespace DarkSoul.Network.Protocol.Messages { public class PartyMemberRemoveMessage : AbstractPartyEventMessage { public override ushort Id => 5579; public double leavingPlayerId; public PartyMemberRemoveMessage() { } public PartyMemberRemoveMessage(uint partyId, double leavingPlayerId) : base(partyId) { this.leavingPlayerId = leavingPlayerId; } public override void Serialize(IWriter writer) { base.Serialize(writer); writer.WriteVarLong(leavingPlayerId); } public override void Deserialize(IReader reader) { base.Deserialize(reader); leavingPlayerId = reader.ReadVarUhLong(); } } }
LDOpenSource/DarkSoul
DarkSoul.Network/Protocol/Message/Messages/game/context/roleplay/party/PartyMemberRemoveMessage.cs
C#
gpl-2.0
1,089
from __future__ import division, print_function, absolute_import import csv import numpy as np from sklearn import metrics, cross_validation # import pandas import tensorflow as tf import tflearn from tflearn.layers.core import input_data, dropout, fully_connected from tflearn.layers.conv import conv_1d from tflearn.layers.merge_ops import merge from tflearn.layers.estimator import regression from tflearn.data_utils import to_categorical, pad_sequences import getopt import sys import os data_dir = "text" # directory contains text documents model_size = 2000 # length of output vectors nb_epochs = 10 # number of training epochs embedding_size = 300 label_file = "enwikilabel" MAX_FILE_ID = 50000 cnn_size = 128 dropout_ratio = 0.5 dynamic = True activation_function = "relu" try: opts, args = getopt.getopt(sys.argv[1:],"hd:model_size:epoch:lb:es:",["model_size=","epoch=","es=","cnn_size=","dropout=","dynamic=","activation="]) except getopt.GetoptError as e: print ("Error of parameters") print (e) print (sys.argv[0] + " -h for help") sys.exit(2) for opt, arg in opts: if opt == '-h': print ('LSTM for Wikipedia classification') print (sys.argv[0] + " -h for help") sys.exit () elif opt in ("-model_size","--model_size"): model_size = int (arg) elif opt in ("-epoch","--epoch"): nb_epochs = int (arg) elif opt in ["-es","--es"]: embedding_size = int (arg) elif opt in ["--cnn_size"]: cnn_size = int (arg) elif opt in ["--dropout"]: dropout_ratio = float (arg) elif opt in ["--dynamic"]: dynamic = bool (arg) elif opt in ["--activation"]: activation_function = arg ### Training data qualities = ["stub","start","c","b","ga","fa"] print('Read labels') def load_label (label_file): with open (label_file) as f: return f.read().splitlines() Y = load_label(label_file) for i in range(len(Y)): Y[i] = qualities.index(Y[i]) print('Read content') def load_content (file_name): with open(file_name) as f: return f.read() X = [] for i in range (MAX_FILE_ID): file_name = data_dir + '/' + str(i + 1) if os.path.isfile (file_name): X.append (load_content(file_name)) X_train, X_test, Y_train, Y_test = cross_validation.train_test_split(X, Y, test_size=0.2, random_state=2017) Y_train = to_categorical (Y_train, nb_classes = len (qualities)) Y_test = to_categorical (Y_test, nb_classes = len (qualities)) ### Process vocabulary print('Process vocabulary') vocab_processor = tflearn.data_utils.VocabularyProcessor(max_document_length = model_size, min_frequency = 0) X_train = np.array(list(vocab_processor.fit_transform(X_train))) X_test = np.array(list(vocab_processor.fit_transform(X_test))) X_train = pad_sequences(X_train, maxlen=model_size, value=0.) X_test = pad_sequences(X_test, maxlen=model_size, value=0.) n_words = len(vocab_processor.vocabulary_) print('Total words: %d' % n_words) # pickle.dump (X_train, open ("xtrain.p", b)) # pickle.dump (X_test, open ("xtest.p", b)) # X_train = pickle.load (open ("xtrain.p", rb)) # X_test = pickle.load (open ("xtest.p", rb)) ### Models # Building convolutional network print ('Build CNN') network = input_data(shape=[None, model_size], name='input') network = tflearn.embedding(network, input_dim=n_words, output_dim=cnn_size) branch1 = conv_1d(network, cnn_size, 3, padding='valid', activation=activation_function, regularizer="L2") branch2 = conv_1d(network, cnn_size, 4, padding='valid', activation=activation_function, regularizer="L2") branch3 = conv_1d(network, cnn_size, 5, padding='valid', activation=activation_function, regularizer="L2") network = merge([branch1, branch2, branch3], mode='concat', axis=1) network = tf.expand_dims(network, 2) network = global_max_pool(network) network = dropout(network, dropout_ratio) network = fully_connected(network, len(qualities), activation='softmax') network = regression(network, optimizer='adam', learning_rate=0.001, loss='categorical_crossentropy', name='target') # Training print ('Training') model = tflearn.DNN(network, tensorboard_verbose=0) print ('Testing') model.fit(trainX, trainY, n_epoch = nb_epochs, shuffle=True, validation_set=(testX, testY), show_metric=True, batch_size=32)
vinhqdang/wikipedia_analysis
lang_model/enwiki/cnn.py
Python
gpl-2.0
4,343
<?php namespace Elementor; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * Elementor color picker scheme. * * Elementor color picker scheme class is responsible for initializing a scheme * for color pickers. * * @since 1.0.0 */ class Scheme_Color_Picker extends Scheme_Color { /** * 5th color scheme. */ const COLOR_5 = '5'; /** * 6th color scheme. */ const COLOR_6 = '6'; /** * 7th color scheme. */ const COLOR_7 = '7'; /** * 9th color scheme. */ const COLOR_8 = '8'; /** * Get color picker scheme type. * * Retrieve the color picker scheme type. * * @since 1.0.0 * @access public * @static * * @return string Color picker scheme type. */ public static function get_type() { return 'color-picker'; } /** * Get color picker scheme description. * * Retrieve the color picker scheme description. * * @since 1.0.0 * @access public * @static * * @return string Color picker scheme description. */ public static function get_description() { return ___elementor_adapter( 'Choose which colors appear in the editor\'s color picker. This makes accessing the colors you chose for the site much easier.', 'elementor' ); } /** * Get default color picker scheme. * * Retrieve the default color picker scheme. * * @since 1.0.0 * @access public * * @return array Default color picker scheme. */ public function get_default_scheme() { return array_replace( parent::get_default_scheme(), [ self::COLOR_5 => '#4054b2', self::COLOR_6 => '#23a455', self::COLOR_7 => '#000', self::COLOR_8 => '#fff', ] ); } /** * Get color picker scheme titles. * * Retrieve the color picker scheme titles. * * @since 1.0.0 * @access public * * @return array Color picker scheme titles. */ public function get_scheme_titles() { return []; } /** * Init system color picker schemes. * * Initialize the system color picker schemes. * * @since 1.0.0 * @access protected * * @return array System color picker schemes. */ protected function _init_system_schemes() { $schemes = parent::_init_system_schemes(); $additional_schemes = [ 'joker' => [ 'items' => [ self::COLOR_5 => '#4b4646', self::COLOR_6 => '#e2e2e2', ], ], 'ocean' => [ 'items' => [ self::COLOR_5 => '#154d80', self::COLOR_6 => '#8c8c8c', ], ], 'royal' => [ 'items' => [ self::COLOR_5 => '#ac8e4d', self::COLOR_6 => '#e2cea1', ], ], 'violet' => [ 'items' => [ self::COLOR_5 => '#9c9ea6', self::COLOR_6 => '#c184d0', ], ], 'sweet' => [ 'items' => [ self::COLOR_5 => '#41aab9', self::COLOR_6 => '#ffc72f', ], ], 'urban' => [ 'items' => [ self::COLOR_5 => '#aa4039', self::COLOR_6 => '#94dbaf', ], ], 'earth' => [ 'items' => [ self::COLOR_5 => '#aa6666', self::COLOR_6 => '#efe5d9', ], ], 'river' => [ 'items' => [ self::COLOR_5 => '#7b8c93', self::COLOR_6 => '#eb6d65', ], ], 'pastel' => [ 'items' => [ self::COLOR_5 => '#f5a46c', self::COLOR_6 => '#6e6f71', ], ], ]; $schemes = array_replace_recursive( $schemes, $additional_schemes ); foreach ( $schemes as & $scheme ) { $scheme['items'] += [ self::COLOR_7 => '#000', self::COLOR_8 => '#fff', ]; } return $schemes; } /** * Get system color picker schemes to print. * * Retrieve the system color picker schemes * * @since 1.0.0 * @access protected * * @return string The system color picker schemes. */ protected function _get_system_schemes_to_print() { $schemes = $this->get_system_schemes(); $items_to_print = [ self::COLOR_1, self::COLOR_5, self::COLOR_2, self::COLOR_3, self::COLOR_6, self::COLOR_4, ]; $items_to_print = array_flip( $items_to_print ); foreach ( $schemes as $scheme_key => $scheme ) { $schemes[ $scheme_key ]['items'] = array_replace( $items_to_print, array_intersect_key( $scheme['items'], $items_to_print ) ); } return $schemes; } /** * Get current color picker scheme title. * * Retrieve the current color picker scheme title. * * @since 1.0.0 * @access protected * * @return string The current color picker scheme title. */ protected function _get_current_scheme_title() { return ___elementor_adapter( 'Color Picker', 'elementor' ); } }
dekisha/dartlamp
modules/contrib/elementor/elementor/includes/schemes/color-picker.php
PHP
gpl-2.0
4,477
package org.pac.tapestry.oauth.models; import org.pac.tapestry.oauth.OAuthVersions; import org.scribe.model.Token; /** * Session State Object for Authenticating and obtaining User Tokens * @author vladimir */ public class OAuthSession { private AccessToken accessToken; private final Token token; private final OAuthVersions version; public OAuthSession(Token token, OAuthVersions version) { this.token = token; this.version = version; } public Token getToken() { return token; } public boolean isValidToken(String token) { if(version.equals(OAuthVersions.V2_0)) return true; return this.token.getToken().equals(token); } public void setAccessToken(AccessToken accessToken) { this.accessToken = accessToken; } public AccessToken getAccessToken() { return accessToken; } public boolean isDeniedAccess() { return accessToken == null; } @Override public String toString() { return "OAuthSession [token=" + token + "]"; } }
vladaspasic/tapestry-oauth
src/main/java/org/pac/tapestry/oauth/models/OAuthSession.java
Java
gpl-2.0
992
<?php App::uses('AutoresPublicacione', 'Model'); /** * AutoresPublicacione Test Case * */ class AutoresPublicacioneTest extends CakeTestCase { /** * Fixtures * * @var array */ public $fixtures = array( 'app.autores_publicacione', 'app.publicacione', 'app.autore', 'app.user', 'app.unidadinvestigacione', 'app.profesione', 'app.otroestudio' ); /** * setUp method * * @return void */ public function setUp() { parent::setUp(); $this->AutoresPublicacione = ClassRegistry::init('AutoresPublicacione'); } /** * tearDown method * * @return void */ public function tearDown() { unset($this->AutoresPublicacione); parent::tearDown(); } }
wuilliam321/cake_memory
Test/Case/Model/AutoresPublicacioneTest.php
PHP
gpl-2.0
679
package org.dolphinemu.ishiiruka.ui.settings.viewholder; import android.view.View; import android.widget.TextView; import org.dolphinemu.ishiiruka.R; import org.dolphinemu.ishiiruka.model.settings.view.SettingsItem; import org.dolphinemu.ishiiruka.model.settings.view.SubmenuSetting; import org.dolphinemu.ishiiruka.ui.settings.SettingsAdapter; public final class SubmenuViewHolder extends SettingViewHolder { private SubmenuSetting mItem; private TextView mTextSettingName; private TextView mTextSettingDescription; public SubmenuViewHolder(View itemView, SettingsAdapter adapter) { super(itemView, adapter); } @Override protected void findViews(View root) { mTextSettingName = (TextView) root.findViewById(R.id.text_setting_name); mTextSettingDescription = (TextView) root.findViewById(R.id.text_setting_description); } @Override public void bind(SettingsItem item) { mItem = (SubmenuSetting) item; mTextSettingName.setText(item.getNameId()); if (item.getDescriptionId() > 0) { mTextSettingDescription.setText(item.getDescriptionId()); } } @Override public void onClick(View clicked) { getAdapter().onSubmenuClick(mItem); } }
Tinob/Ishiiruka
Source/Android/app/src/main/java/org/dolphinemu/ishiiruka/ui/settings/viewholder/SubmenuViewHolder.java
Java
gpl-2.0
1,177
<?php /** * https://09source.kicks-ass.net:8443/svn/installer09/ * Licence Info: GPL * Copyright (C) 2010 Installer09 v.1 * A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. * Project Leaders: Mindless,putyn,kidvision. **/ if ( ! defined( 'IN_TBDEV_ADMIN' ) ) { $HTMLOUT=''; $HTMLOUT .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>Error!</title> </head> <body> <div style='font-size:33px;color:white;background-color:red;text-align:center;'>Incorrect access<br />You cannot access this file directly.</div> </body></html>"; print $HTMLOUT; exit(); } require_once ("include/user_functions.php"); require_once ("include/html_functions.php"); require_once ("include/bbcode_functions.php"); if ($CURUSER['class'] < UC_MODERATOR) stderr("Error", "Access denied."); $lang = array_merge( $lang ); $HTMLOUT = ''; $limit = 25; if (isset($_GET["amount"]) && (int)$_GET["amount"]) { if (intval($_GET["amount"]) != $_GET["amount"]) { stderr("Error", "Amount wasn't an integer."); } $limit = 0 + $_GET["amount"]; if ($limit > 999) $limit = 1000; if ($limit < 10) $limit = 10; } $HTMLOUT .="<p align=\"center\">Showing&nbsp;{$limit}&nbsp;latest&nbsp;comments.</p>\n"; $subres = sql_query("SELECT comments.id, torrent, text, user, comments.added , editedby, editedat, avatar, warned, " . "username, title, class FROM comments LEFT JOIN users ON comments.user = users.id " . " ORDER BY comments.id DESC limit 0," . $limit) or sqlerr(__FILE__, __LINE__); $allrows = array(); while ($subrow = mysql_fetch_assoc($subres)) $allrows[] = $subrow; function commenttable_new($rows) { global $CURUSER; $htmlout=''; $htmlout .= begin_main_frame(); $htmlout .= begin_frame(); $count = 0; foreach ($rows as $row) { $subres = sql_query("SELECT name from torrents where id=" . sqlesc($row["torrent"])) or sqlerr(__FILE__, __LINE__); $subrow = mysql_fetch_assoc($subres); $htmlout .="<br /><a href=\"details.php?id=" . htmlspecialchars($row["torrent"]) . "\">" . htmlspecialchars($subrow["name"]) . "</a><br />\n"; $htmlout .="<p class='sub'>#" . $row["id"] . "&nbsp;by&nbsp;"; if (isset($row["username"])) { $htmlout .="<a name='comm" . $row["id"] . "' href='./userdetails.php?id=" . htmlspecialchars($row["user"]) . "'><b>" . htmlspecialchars($row["username"]) . "</b></a>" . ($row["warned"] == "yes" ? "<img src=\"pic/warned.png\" alt=\"Warned\" />" : ""); } else { $htmlout .="<a name=\"comm" . htmlspecialchars($row["id"]) . "\"><i>(orphaned)</i></a>\n"; } $htmlout .="&nbsp;at&nbsp;" . get_date($row["added"], 'DATE',0,1) . "" . "&nbsp;-&nbsp;[<a href='./comment.php?action=edit&amp;cid=$row[id]'>Edit</a>]" . "&nbsp;-&nbsp;[<a href='comment.php?action=delete&amp;cid=$row[id]'>Delete</a>]</p>\n"; $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($row["avatar"]) : ""); if (!$avatar) { $avatar = "./pic/default_avatar.gif"; } $htmlout .= begin_table(true); $htmlout .="<tr valign='top'>\n"; $htmlout .="<td align='center' width='150' style='padding: 0px'><img width='150' src='$avatar' alt='Avatar' title='Avatar' /></td>\n"; $htmlout .="<td class='text'>" . format_comment($row["text"]) . "</td>\n"; $htmlout .="</tr>\n"; $htmlout .= end_table(); } $htmlout .= end_frame(); $htmlout .= end_main_frame(); return $htmlout; } $HTMLOUT .= commenttable_new($allrows); print stdhead("Comments") . $HTMLOUT . stdfoot(); die; ?>
Bigjoos/U-232-V1
admin/comment_overview.php
PHP
gpl-2.0
3,860
''' Created on Jul 9, 2018 @author: lqp ''' import json import os import re from util import TrackUtil from util.TrackUtil import current_milli_time from util.TrackUtil import mongoUri from util.TrackUtil import todayMillis from pymongo.mongo_client import MongoClient import pymongo from xlrd.book import colname class MongoBatch(): def __init__(self, trackMongoConf, stormMongoConf, batchMongoConf): client = MongoClient(mongoUri(stormMongoConf)) self.stormDb = client.storm_db client = MongoClient(mongoUri(trackMongoConf)) self.trackDb = client.track_1v1fudao client = MongoClient(mongoUri(batchMongoConf)) self.batchDb = client.batch_db pass def storm2Batch(self, colName): pl = self.stormDb[colName].find() for p in pl: print('mv: ' + str(p)) ts = p['ts'] self.batchDb[colName].update({'ts': ts}, p, True) #self.batchDb[colName].insert(p) if __name__ == '__main__': os.chdir('../../') with open('conf/server.json') as f: content = f.read() conf = json.loads(content) batch = MongoBatch(conf['mongoTrack'], conf['mongoStorm'], conf['mongoBatch']) batch.storm2Batch('alert_batch') pass
lqp276/repo_lqp
repopy/src/batch/collection_move.py
Python
gpl-2.0
1,299
<?php /** * @file * Drupal site-specific configuration file. * * IMPORTANT NOTE: * This file may have been set to read-only by the Drupal installation program. * If you make changes to this file, be sure to protect it again after making * your modifications. Failure to remove write permissions to this file is a * security risk. * * The configuration file to be loaded is based upon the rules below. However * if the multisite aliasing file named sites/sites.php is present, it will be * loaded, and the aliases in the array $sites will override the default * directory rules below. See sites/example.sites.php for more information about * aliases. * * The configuration directory will be discovered by stripping the website's * hostname from left to right and pathname from right to left. The first * configuration file found will be used and any others will be ignored. If no * other configuration file is found then the default configuration file at * 'sites/default' will be used. * * For example, for a fictitious site installed at * http://www.drupal.org:8080/mysite/test/, the 'settings.php' file is searched * for in the following directories: * * - sites/8080.www.drupal.org.mysite.test * - sites/www.drupal.org.mysite.test * - sites/drupal.org.mysite.test * - sites/org.mysite.test * * - sites/8080.www.drupal.org.mysite * - sites/www.drupal.org.mysite * - sites/drupal.org.mysite * - sites/org.mysite * * - sites/8080.www.drupal.org * - sites/www.drupal.org * - sites/drupal.org * - sites/org * * - sites/default * * Note that if you are installing on a non-standard port number, prefix the * hostname with that number. For example, * http://www.drupal.org:8080/mysite/test/ could be loaded from * sites/8080.www.drupal.org.mysite.test/. * * @see example.sites.php * @see conf_path() */ /** * Database settings: * * The $databases array specifies the database connection or * connections that Drupal may use. Drupal is able to connect * to multiple databases, including multiple types of databases, * during the same request. * * Each database connection is specified as an array of settings, * similar to the following: * @code * array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'port' => 3306, * 'prefix' => 'myprefix_', * 'collation' => 'utf8_general_ci', * ); * @endcode * * The "driver" property indicates what Drupal database driver the * connection should use. This is usually the same as the name of the * database type, such as mysql or sqlite, but not always. The other * properties will vary depending on the driver. For SQLite, you must * specify a database file name in a directory that is writable by the * webserver. For most other drivers, you must specify a * username, password, host, and database name. * * Transaction support is enabled by default for all drivers that support it, * including MySQL. To explicitly disable it, set the 'transactions' key to * FALSE. * Note that some configurations of MySQL, such as the MyISAM engine, don't * support it and will proceed silently even if enabled. If you experience * transaction related crashes with such configuration, set the 'transactions' * key to FALSE. * * For each database, you may optionally specify multiple "target" databases. * A target database allows Drupal to try to send certain queries to a * different database if it can but fall back to the default connection if not. * That is useful for master/slave replication, as Drupal may try to connect * to a slave server when appropriate and if one is not available will simply * fall back to the single master server. * * The general format for the $databases array is as follows: * @code * $databases['default']['default'] = $info_array; * $databases['default']['slave'][] = $info_array; * $databases['default']['slave'][] = $info_array; * $databases['extra']['default'] = $info_array; * @endcode * * In the above example, $info_array is an array of settings described above. * The first line sets a "default" database that has one master database * (the second level default). The second and third lines create an array * of potential slave databases. Drupal will select one at random for a given * request as needed. The fourth line creates a new database with a name of * "extra". * * For a single database configuration, the following is sufficient: * @code * $databases['default']['default'] = array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'prefix' => 'main_', * 'collation' => 'utf8_general_ci', * ); * @endcode * * For handling full UTF-8 in MySQL, including multi-byte characters such as * emojis, Asian symbols, and mathematical symbols, you may set the collation * and charset to "utf8mb4" prior to running install.php: * @code * $databases['default']['default'] = array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'charset' => 'utf8mb4', * 'collation' => 'utf8mb4_general_ci', * ); * @endcode * When using this setting on an existing installation, ensure that all existing * tables have been converted to the utf8mb4 charset, for example by using the * utf8mb4_convert contributed project available at * https://www.drupal.org/project/utf8mb4_convert, so as to prevent mixing data * with different charsets. * Note this should only be used when all of the following conditions are met: * - In order to allow for large indexes, MySQL must be set up with the * following my.cnf settings: * [mysqld] * innodb_large_prefix=true * innodb_file_format=barracuda * innodb_file_per_table=true * These settings are available as of MySQL 5.5.14, and are defaults in * MySQL 5.7.7 and up. * - The PHP MySQL driver must support the utf8mb4 charset (libmysqlclient * 5.5.3 and up, as well as mysqlnd 5.0.9 and up). * - The MySQL server must support the utf8mb4 charset (5.5.3 and up). * * You can optionally set prefixes for some or all database table names * by using the 'prefix' setting. If a prefix is specified, the table * name will be prepended with its value. Be sure to use valid database * characters only, usually alphanumeric and underscore. If no prefixes * are desired, leave it as an empty string ''. * * To have all database names prefixed, set 'prefix' as a string: * @code * 'prefix' => 'main_', * @endcode * To provide prefixes for specific tables, set 'prefix' as an array. * The array's keys are the table names and the values are the prefixes. * The 'default' element is mandatory and holds the prefix for any tables * not specified elsewhere in the array. Example: * @code * 'prefix' => array( * 'default' => 'main_', * 'users' => 'shared_', * 'sessions' => 'shared_', * 'role' => 'shared_', * 'authmap' => 'shared_', * ), * @endcode * You can also use a reference to a schema/database as a prefix. This may be * useful if your Drupal installation exists in a schema that is not the default * or you want to access several databases from the same code base at the same * time. * Example: * @code * 'prefix' => array( * 'default' => 'main.', * 'users' => 'shared.', * 'sessions' => 'shared.', * 'role' => 'shared.', * 'authmap' => 'shared.', * ); * @endcode * NOTE: MySQL and SQLite's definition of a schema is a database. * * Advanced users can add or override initial commands to execute when * connecting to the database server, as well as PDO connection settings. For * example, to enable MySQL SELECT queries to exceed the max_join_size system * variable, and to reduce the database connection timeout to 5 seconds: * * @code * $databases['default']['default'] = array( * 'init_commands' => array( * 'big_selects' => 'SET SQL_BIG_SELECTS=1', * ), * 'pdo' => array( * PDO::ATTR_TIMEOUT => 5, * ), * ); * @endcode * * WARNING: These defaults are designed for database portability. Changing them * may cause unexpected behavior, including potential data loss. * * @see DatabaseConnection_mysql::__construct * @see DatabaseConnection_pgsql::__construct * @see DatabaseConnection_sqlite::__construct * * Database configuration format: * @code * $databases['default']['default'] = array( * 'driver' => 'mysql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'prefix' => '', * ); * $databases['default']['default'] = array( * 'driver' => 'pgsql', * 'database' => 'databasename', * 'username' => 'username', * 'password' => 'password', * 'host' => 'localhost', * 'prefix' => '', * ); * $databases['default']['default'] = array( * 'driver' => 'sqlite', * 'database' => '/path/to/databasefilename', * ); * @endcode */ if (!defined('PANTHEON_ENVIRONMENT')) { $databases = array ( 'default' => array ( 'default' => array ( 'database' => 'DATABASE_HERE', 'username' => 'USER_HERE', 'password' => 'PASSWORD_HERE', 'host' => 'localhost', 'port' => '', 'driver' => 'mysql', 'prefix' => '', ), ), ); } /** * Access control for update.php script. * * If you are updating your Drupal installation using the update.php script but * are not logged in using either an account with the "Administer software * updates" permission or the site maintenance account (the account that was * created during installation), you will need to modify the access check * statement below. Change the FALSE to a TRUE to disable the access check. * After finishing the upgrade, be sure to open this file again and change the * TRUE back to a FALSE! */ $update_free_access = FALSE; /** * Salt for one-time login links and cancel links, form tokens, etc. * * This variable will be set to a random value by the installer. All one-time * login links will be invalidated if the value is changed. Note that if your * site is deployed on a cluster of web servers, you must ensure that this * variable has the same value on each server. If this variable is empty, a hash * of the serialized database credentials will be used as a fallback salt. * * For enhanced security, you may set this variable to a value using the * contents of a file outside your docroot that is never saved together * with any backups of your Drupal files and database. * * Example: * $drupal_hash_salt = file_get_contents('/home/example/salt.txt'); * */ $drupal_hash_salt = 'dj2lVZYA8PYe_MZ5XKMOXtSky4QHC7_H9R5aaerONQ4'; /** * Base URL (optional). * * If Drupal is generating incorrect URLs on your site, which could * be in HTML headers (links to CSS and JS files) or visible links on pages * (such as in menus), uncomment the Base URL statement below (remove the * leading hash sign) and fill in the absolute URL to your Drupal installation. * * You might also want to force users to use a given domain. * See the .htaccess file for more information. * * Examples: * $base_url = 'http://www.example.com'; * $base_url = 'http://www.example.com:8888'; * $base_url = 'http://www.example.com/drupal'; * $base_url = 'https://www.example.com:8888/drupal'; * * It is not allowed to have a trailing slash; Drupal will add it * for you. */ # $base_url = 'http://www.example.com'; // NO trailing slash! /** * PHP settings: * * To see what PHP settings are possible, including whether they can be set at * runtime (by using ini_set()), read the PHP documentation: * http://www.php.net/manual/en/ini.list.php * See drupal_environment_initialize() in includes/bootstrap.inc for required * runtime settings and the .htaccess file for non-runtime settings. Settings * defined there should not be duplicated here so as to avoid conflict issues. */ /** * Some distributions of Linux (most notably Debian) ship their PHP * installations with garbage collection (gc) disabled. Since Drupal depends on * PHP's garbage collection for clearing sessions, ensure that garbage * collection occurs by using the most common settings. */ ini_set('session.gc_probability', 1); ini_set('session.gc_divisor', 100); /** * Set session lifetime (in seconds), i.e. the time from the user's last visit * to the active session may be deleted by the session garbage collector. When * a session is deleted, authenticated users are logged out, and the contents * of the user's $_SESSION variable is discarded. */ ini_set('session.gc_maxlifetime', 200000); /** * Set session cookie lifetime (in seconds), i.e. the time from the session is * created to the cookie expires, i.e. when the browser is expected to discard * the cookie. The value 0 means "until the browser is closed". */ ini_set('session.cookie_lifetime', 2000000); /** * If you encounter a situation where users post a large amount of text, and * the result is stripped out upon viewing but can still be edited, Drupal's * output filter may not have sufficient memory to process it. If you * experience this issue, you may wish to uncomment the following two lines * and increase the limits of these variables. For more information, see * http://php.net/manual/en/pcre.configuration.php. */ # ini_set('pcre.backtrack_limit', 200000); # ini_set('pcre.recursion_limit', 200000); /** * Drupal automatically generates a unique session cookie name for each site * based on its full domain name. If you have multiple domains pointing at the * same Drupal site, you can either redirect them all to a single domain (see * comment in .htaccess), or uncomment the line below and specify their shared * base domain. Doing so assures that users remain logged in as they cross * between your various domains. Make sure to always start the $cookie_domain * with a leading dot, as per RFC 2109. */ # $cookie_domain = '.example.com'; /** * Variable overrides: * * To override specific entries in the 'variable' table for this site, * set them here. You usually don't need to use this feature. This is * useful in a configuration file for a vhost or directory, rather than * the default settings.php. Any configuration setting from the 'variable' * table can be given a new value. Note that any values you provide in * these variable overrides will not be modifiable from the Drupal * administration interface. * * The following overrides are examples: * - site_name: Defines the site's name. * - theme_default: Defines the default theme for this site. * - anonymous: Defines the human-readable name of anonymous users. * Remove the leading hash signs to enable. */ # $conf['site_name'] = 'My Drupal site'; # $conf['theme_default'] = 'garland'; # $conf['anonymous'] = 'Visitor'; /** * A custom theme can be set for the offline page. This applies when the site * is explicitly set to maintenance mode through the administration page or when * the database is inactive due to an error. It can be set through the * 'maintenance_theme' key. The template file should also be copied into the * theme. It is located inside 'modules/system/maintenance-page.tpl.php'. * Note: This setting does not apply to installation and update pages. */ # $conf['maintenance_theme'] = 'bartik'; /** * Reverse Proxy Configuration: * * Reverse proxy servers are often used to enhance the performance * of heavily visited sites and may also provide other site caching, * security, or encryption benefits. In an environment where Drupal * is behind a reverse proxy, the real IP address of the client should * be determined such that the correct client IP address is available * to Drupal's logging, statistics, and access management systems. In * the most simple scenario, the proxy server will add an * X-Forwarded-For header to the request that contains the client IP * address. However, HTTP headers are vulnerable to spoofing, where a * malicious client could bypass restrictions by setting the * X-Forwarded-For header directly. Therefore, Drupal's proxy * configuration requires the IP addresses of all remote proxies to be * specified in $conf['reverse_proxy_addresses'] to work correctly. * * Enable this setting to get Drupal to determine the client IP from * the X-Forwarded-For header (or $conf['reverse_proxy_header'] if set). * If you are unsure about this setting, do not have a reverse proxy, * or Drupal operates in a shared hosting environment, this setting * should remain commented out. * * In order for this setting to be used you must specify every possible * reverse proxy IP address in $conf['reverse_proxy_addresses']. * If a complete list of reverse proxies is not available in your * environment (for example, if you use a CDN) you may set the * $_SERVER['REMOTE_ADDR'] variable directly in settings.php. * Be aware, however, that it is likely that this would allow IP * address spoofing unless more advanced precautions are taken. */ # $conf['reverse_proxy'] = TRUE; /** * Specify every reverse proxy IP address in your environment. * This setting is required if $conf['reverse_proxy'] is TRUE. */ # $conf['reverse_proxy_addresses'] = array('a.b.c.d', ...); /** * Set this value if your proxy server sends the client IP in a header * other than X-Forwarded-For. */ # $conf['reverse_proxy_header'] = 'HTTP_X_CLUSTER_CLIENT_IP'; /** * Page caching: * * By default, Drupal sends a "Vary: Cookie" HTTP header for anonymous page * views. This tells a HTTP proxy that it may return a page from its local * cache without contacting the web server, if the user sends the same Cookie * header as the user who originally requested the cached page. Without "Vary: * Cookie", authenticated users would also be served the anonymous page from * the cache. If the site has mostly anonymous users except a few known * editors/administrators, the Vary header can be omitted. This allows for * better caching in HTTP proxies (including reverse proxies), i.e. even if * clients send different cookies, they still get content served from the cache. * However, authenticated users should access the site directly (i.e. not use an * HTTP proxy, and bypass the reverse proxy if one is used) in order to avoid * getting cached pages from the proxy. */ # $conf['omit_vary_cookie'] = TRUE; /** * CSS/JS aggregated file gzip compression: * * By default, when CSS or JS aggregation and clean URLs are enabled Drupal will * store a gzip compressed (.gz) copy of the aggregated files. If this file is * available then rewrite rules in the default .htaccess file will serve these * files to browsers that accept gzip encoded content. This allows pages to load * faster for these users and has minimal impact on server load. If you are * using a webserver other than Apache httpd, or a caching reverse proxy that is * configured to cache and compress these files itself you may want to uncomment * one or both of the below lines, which will prevent gzip files being stored. */ # $conf['css_gzip_compression'] = FALSE; # $conf['js_gzip_compression'] = FALSE; /** * Block caching: * * Block caching may not be compatible with node access modules depending on * how the original block cache policy is defined by the module that provides * the block. By default, Drupal therefore disables block caching when one or * more modules implement hook_node_grants(). If you consider block caching to * be safe on your site and want to bypass this restriction, uncomment the line * below. */ # $conf['block_cache_bypass_node_grants'] = TRUE; /** * String overrides: * * To override specific strings on your site with or without enabling the Locale * module, add an entry to this list. This functionality allows you to change * a small number of your site's default English language interface strings. * * Remove the leading hash signs to enable. */ # $conf['locale_custom_strings_en'][''] = array( # 'forum' => 'Discussion board', # '@count min' => '@count minutes', # ); /** * * IP blocking: * * To bypass database queries for denied IP addresses, use this setting. * Drupal queries the {blocked_ips} table by default on every page request * for both authenticated and anonymous users. This allows the system to * block IP addresses from within the administrative interface and before any * modules are loaded. However on high traffic websites you may want to avoid * this query, allowing you to bypass database access altogether for anonymous * users under certain caching configurations. * * If using this setting, you will need to add back any IP addresses which * you may have blocked via the administrative interface. Each element of this * array represents a blocked IP address. Uncommenting the array and leaving it * empty will have the effect of disabling IP blocking on your site. * * Remove the leading hash signs to enable. */ # $conf['blocked_ips'] = array( # 'a.b.c.d', # ); /** * Fast 404 pages: * * Drupal can generate fully themed 404 pages. However, some of these responses * are for images or other resource files that are not displayed to the user. * This can waste bandwidth, and also generate server load. * * The options below return a simple, fast 404 page for URLs matching a * specific pattern: * - 404_fast_paths_exclude: A regular expression to match paths to exclude, * such as images generated by image styles, or dynamically-resized images. * The default pattern provided below also excludes the private file system. * If you need to add more paths, you can add '|path' to the expression. * - 404_fast_paths: A regular expression to match paths that should return a * simple 404 page, rather than the fully themed 404 page. If you don't have * any aliases ending in htm or html you can add '|s?html?' to the expression. * - 404_fast_html: The html to return for simple 404 pages. * * Add leading hash signs if you would like to disable this functionality. */ $conf['404_fast_paths_exclude'] = '/\/(?:styles)|(?:system\/files)\//'; $conf['404_fast_paths'] = '/\.(?:txt|png|gif|jpe?g|css|js|ico|swf|flv|cgi|bat|pl|dll|exe|asp)$/i'; $conf['404_fast_html'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>'; /** * By default the page request process will return a fast 404 page for missing * files if they match the regular expression set in '404_fast_paths' and not * '404_fast_paths_exclude' above. 404 errors will simultaneously be logged in * the Drupal system log. * * You can choose to return a fast 404 page earlier for missing pages (as soon * as settings.php is loaded) by uncommenting the line below. This speeds up * server response time when loading 404 error pages and prevents the 404 error * from being logged in the Drupal system log. In order to prevent valid pages * such as image styles and other generated content that may match the * '404_fast_paths' regular expression from returning 404 errors, it is * necessary to add them to the '404_fast_paths_exclude' regular expression * above. Make sure that you understand the effects of this feature before * uncommenting the line below. */ # drupal_fast_404(); /** * External access proxy settings: * * If your site must access the Internet via a web proxy then you can enter * the proxy settings here. Currently only basic authentication is supported * by using the username and password variables. The proxy_user_agent variable * can be set to NULL for proxies that require no User-Agent header or to a * non-empty string for proxies that limit requests to a specific agent. The * proxy_exceptions variable is an array of host names to be accessed directly, * not via proxy. */ # $conf['proxy_server'] = ''; # $conf['proxy_port'] = 8080; # $conf['proxy_username'] = ''; # $conf['proxy_password'] = ''; # $conf['proxy_user_agent'] = ''; # $conf['proxy_exceptions'] = array('127.0.0.1', 'localhost'); /** * Authorized file system operations: * * The Update manager module included with Drupal provides a mechanism for * site administrators to securely install missing updates for the site * directly through the web user interface. On securely-configured servers, * the Update manager will require the administrator to provide SSH or FTP * credentials before allowing the installation to proceed; this allows the * site to update the new files as the user who owns all the Drupal files, * instead of as the user the webserver is running as. On servers where the * webserver user is itself the owner of the Drupal files, the administrator * will not be prompted for SSH or FTP credentials (note that these server * setups are common on shared hosting, but are inherently insecure). * * Some sites might wish to disable the above functionality, and only update * the code directly via SSH or FTP themselves. This setting completely * disables all functionality related to these authorized file operations. * * @see http://drupal.org/node/244924 * * Remove the leading hash signs to disable. */ # $conf['allow_authorize_operations'] = FALSE; /** * Smart start: * * If you would prefer to be redirected to the installation system when a * valid settings.php file is present but no tables are installed, remove * the leading hash sign below. */ # $conf['pressflow_smart_start'] = TRUE; /** * Theme debugging: * * When debugging is enabled: * - The markup of each template is surrounded by HTML comments that contain * theming information, such as template file name suggestions. * - Note that this debugging markup will cause automated tests that directly * check rendered HTML to fail. * * For more information about debugging theme templates, see * https://www.drupal.org/node/223440#theme-debug. * * Not recommended in production environments. * * Remove the leading hash sign to enable. */ # $conf['theme_debug'] = TRUE; /** * CSS identifier double underscores allowance: * * To allow CSS identifiers to contain double underscores (.example__selector) * for Drupal's BEM-style naming standards, uncomment the line below. * Note that if you change this value in existing sites, existing page styles * may be broken. * * @see drupal_clean_css_identifier() */ # $conf['allow_css_double_underscores'] = TRUE;
LibraryofVA/Book-Points-Virginia
public_html/sites/default/settings.php
PHP
gpl-2.0
26,865
#quiznavigation .qnbutton.flagged { background-image: url('<?php echo $PAGE->theme->old_icon_url('i/ne_red_mark') ?>'); }
ajv/Offline-Caching
mod/quiz/styles.php
PHP
gpl-2.0
124
<?php /** * Taxonomy for Football Region page */ get_header(); $m_table=$wpdb->prefix."adverts"; $advertQuery="select * from $m_table where page='football-regions' and isactive='1' order by adId DESC LIMIT 0,1"; $advertSql=$wpdb->get_results($advertQuery); if(sizeof($advertSql)>0) { foreach($advertSql as $adsql) { ?> <div class="ad_1" align="center"><a href="<?php echo urldecode($adsql->adlink1);?>" target="_blank"><img width="731" height="93" alt="" class="attachment-full" style="max-width: 100%;" src="<?php echo plugins_url();?>/advertisement/<?php echo $adsql->adimage1;?>" /></a> <label style="font-size:9px;">ADVERTISEMENT</label> </div> <?php } } ?> <div class="left"> <h2>Football > <?php echo $wp_query->queried_object->name; ?> </h2> <?php $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1; $ad =1; global $wp_query; if(have_posts()) { while ( have_posts() ) : the_post(); if($ad == 1){?> <div class="sigle-football-title"> <a href="<?php the_permalink() ?>"> <h1> <?php the_title(); ?> </h1> </a> <p style="font-weight:bold;"> <?php $youtubtagline_value = get_post_meta($post->ID, '_cmb_footballs_tagline_text',true ); echo $youtubtagline_value;?> </p> </div> <?php $postID = get_the_ID(); $mytermArray = array(); $term_list_reg = wp_get_post_terms($postID, 'footballregions'); $as =1; if(!empty($term_list_reg)) { foreach($term_list_reg as $row) { $mytermArray[$as]['term_id']= $row->term_id; $mytermArray[$as]['name']= $row->name; $mytermArray[$as]['slug']= $row->slug; $mytermArray[$as]['term_taxonomy_id']= $row->term_taxonomy_id; $mytermArray[$as]['link']= get_term_link( $row ); $as++; } } ?> <div class="date"> <?php if(!empty($mytermArray)){ $is =1; $arraycount = count($mytermArray); foreach($mytermArray as $row){ if($is == $arraycount) { ?> <a href="<?php echo $row['link']?>"><?php echo $row['name']?></a> <?php } else { ?> <a href="<?php echo $row['link']?>"><?php echo $row['name']?></a>, <?php } ?> <?php $is++; ?> <?php } } ?> <span> <?php the_time('l, F j, Y'); ?> </span> <div id="social_3"> <a onclick="javascript:window.open(this.href,'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=400');return false;" href="http://www.facebook.com/share.php?u=<?php echo get_permalink( $article->ID);?>&description=<?php the_title(); ?> via @RedCardConnect" title="Share on Facebook" > <div class="facebook" ></div> </a> <a href="http://twitter.com/intent/tweet?text= <?php the_title(); ?> <?php echo get_permalink( $article->ID);?> via @RedCardConnect&url=" onclick="javascript:window.open(this.href,'','menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=400');return false;"> <div class="twitter"></div> </a> <a href="<?php echo get_permalink( $article->ID);?>#dis_comment"> <div class="message"></div> </a> </div> </div> <div class="footballs-top-image-latest"> <?php twentyfourteen_post_thumbnail();?> </div> <div class="f_text"> <?php /*?><?php echo get_the_excerpt(); ?> <a href="<?php the_permalink() ?>">Read More</a><?php */?> </div> <div class="c_list"> <ul> <?php } if($ad > 1) { ?> <li> <div class="img"> <?php twentyfourteen_post_thumbnail( 'thumbnail', array( 'class' => 'post-feature-image' ) );?> <span><?php echo $wp_query->queried_object->name; ?></span> </div> <div class="text"> <a href="<?php the_permalink() ?>"> <?php the_title(); ?> </a> <p> <?php $youtubtagline_value = get_post_meta($post->ID, '_cmb_footballs_tagline_text',true ); echo $youtubtagline_value;?> </p> </div> </li> <?php } $ad++; endwhile; ?> </ul> </div> <?php if (function_exists(custom_pagination)) { custom_pagination($wp_query->max_num_pages,"",$current_page); } ?> <?php } else { ?> <h3 style="font-family: 'FF DIN';">You are offside!</h3> <h4 style="font-family: 'FF DIN';">Keep trying and watch this space, you will find the goal soon enough!</h4> <?php } ?> </div> <div class="right"> <?php $m_table=$wpdb->prefix."adverts"; $advertQuery="select * from $m_table where page='football-regions' and isactive='1' order by adId DESC LIMIT 0,1"; $advertSql=$wpdb->get_results($advertQuery); if(sizeof($advertSql)>0) { foreach($advertSql as $adsql) { ?> <h2>&nbsp;</h2> <div class="ad_right" align="center"> <a href="<?php echo urldecode($adsql->adlink2);?>" target="_blank"><img width="302" height="252" alt="" class="attachment-full" style="max-width: 100%;" src="<?php echo plugins_url();?>/advertisement/<?php echo $adsql->adimage2;?>" /></a> <label style="font-size:10px;">ADVERTISEMENT</label> </div> <?php } } ?> <h2>Popular Posts</h2> <div class="popular"> <ul> <?php /* For Popular Posts*/ if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Sidebar 1') ) ?> </ul> </div> </div> <?php get_footer();?>
amolc/redcard
wp-content/themes/redcard/taxonomy-footballregions.php
PHP
gpl-2.0
5,380
/** * IRCAnywhere server/irchandler.js * * @title IRCHandler * @copyright (c) 2013-2014 http://ircanywhere.com * @license GPL v2 * @author Ricki Hastings */ var _ = require('lodash'), hooks = require('hooks'), helper = require('../lib/helpers').Helpers; /** * The object responsible for handling an event from IRCFactory * none of these should be called directly, however they can be hooked onto * or have their actions prevented or replaced. The function names equal directly * to irc-factory events and are case sensitive to them. * * @class IRCHandler * @method IRCHandler * @return void */ function IRCHandler() { } /** * @member {Array} blacklisted An array of blacklisted commands which should be ignored */ IRCHandler.prototype.blacklisted = ['PING', 'RPL_CREATIONTIME']; /** * Formats an array of RAW IRC strings, taking off the :leguin.freenode.net 251 ricki- : * at the start, returns an array of strings with it removed * * @method _formatRaw * @param {Array} raw An array of raw IRC strings to format * @return {Array} A formatted array of the inputted strings */ IRCHandler.prototype._formatRaw = function(raw) { var output = []; raw.forEach(function(line) { var split = line.split(' '); split.splice(0, 3); var string = split.join(' '); string = (string.substr(0, 1) === ':') ? string.substr(1) : string; output.push(string); }); return output; }; /** * Handles the opened event from `irc-factory` which just tells us what localPort and any other * information relating to the client so we can make sure the identd server is working. * * @method opened * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.opened = function(client, message) { if (!application.config.identd.enable) { return; } // not enabled, don't fill the cache if it isn't needed if (!message.username || !message.port || !message.localPort) { return; } // we need to make sure we've got all our required items IdentdCache[message.localPort] = message; delete client.forcedDisconnect; }; /** * Handles the registered event, this will only ever be called when an IRC connection has been * fully established and we've recieved the `registered` events. This means when we reconnect to * an already established connection we won't get this event again. * * @method registered * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.registered = function(client, message) { client.internal.capabilities = message.capabilities; // set this immediately so the other stuff works application.Networks.update({_id: client._id}, {$set: { 'nick': message.nickname, 'name': message.capabilities.network.name, 'internal.status': networkManager.flags.connected, 'internal.capabilities': message.capabilities }}, {safe: false}); //networkManager.changeStatus({_id: client._id}, networkManager.flags.connected); // commented this out because we do other changes to the network object here // so we don't use this but we use a straight update to utilise 1 query instead of 2 application.Tabs.update({target: client.name.toLowerCase(), network: client._id}, {$set: { title: message.capabilities.network.name, target: message.capabilities.network.name.toLowerCase(), active: true }}, {multi: true, safe: false}); // update the tab application.Tabs.update({network: client._id, type: {$ne: 'channel'}}, {$set: { networkName: message.capabilities.network.name, active: true }}, {multi: true, safe: false}); // update any sub tabs that are not channels eventManager.insertEvent(client, { nickname: message.nickname, time: new Date(new Date(message.time).getTime() - 15).toJSON(), message: this._formatRaw(message.raw), raw: message.raw }, 'registered', function() { // a bit of a hack here we'll spin the timestamp back 15ms to make sure it // comes in order, it's because we've gotta wait till we've recieved all the capab // stuff in irc-factory before we send it out, which can create a race condition // which causes lusers to be sent through first // XXX - send our connect commands, things that the user defines // nickserv identify or something _.each(client.channels, function(channel) { var chan = channel.channel, password = channel.password || ''; ircFactory.send(client._id, 'join', [chan, password]); ircFactory.send(client._id, 'mode', [chan]); // request the mode aswell.. I thought this was sent out automatically anyway? Seems no. }); // find our channels to automatically join from the network setup }); }; /** * Handles a closed connection * * @method closed * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.closed = function(client, message) { networkManager.changeStatus({_id: client._id, 'internal.status': {$ne: networkManager.flags.disconnected}}, networkManager.flags.closed); // Whats happening is were looking for networks that match the id and their status has not been set to disconnected // which means someone has clicked disconnected, if not, just set it as closed (means we've disconnected for whatever reason) networkManager.activeTab(client, false); // now lets update the tabs to inactive eventManager.insertEvent(client, { time: new Date().toJSON(), message: (message.reconnecting) ? 'Connection closed. Attempting reconnect number ' + message.attempts : 'You have disconnected.', }, networkManager.flags.closed); if (!message.reconnecting) { ircFactory.destroy(client._id, false); } // destroy the client if we're not coming back }; /** * Handles a failed event, which is emitted when the retry attempts are exhaused * * @method failed * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.failed = function(client) { networkManager.changeStatus({_id: client._id}, networkManager.flags.failed); // mark tab as failed networkManager.activeTab(client, false); // now lets update the tabs to inactive eventManager.insertEvent(client, { time: new Date().toJSON(), message: 'Connection closed. Retry attempts exhausted.', }, networkManager.flags.closed); ircFactory.destroy(client._id, false); // destroy the client }; /** * Handles an incoming lusers event * * @method lusers * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.lusers = function(client, message) { eventManager.insertEvent(client, { time: message.time, message: this._formatRaw(message.raw), raw: message.raw }, 'lusers'); }; /** * Handles an incoming motd event * * @method motd * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.motd = function(client, message) { eventManager.insertEvent(client, { time: message.time, message: this._formatRaw(message.raw), raw: message.raw }, 'motd'); // again spin this back 15ms to prevent a rare but possible race condition where // motd is the last thing that comes through, because we wait till we've recieved // it all before sending it out, javascripts async nature causes this. }; /** * Handles an incoming join event * * @method join * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.join = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.channel) { return false; } var user = { username: message.username, hostname: message.hostname, nickname: message.nickname, modes: {} }; // just a standard user object, although with a modes object aswell if (message.nickname === client.nick) { networkManager.addTab(client, message.channel, 'channel', true); ircFactory.send(client._id, 'mode', [message.channel]); ircFactory.send(client._id, 'names', [message.channel]); insertEvent(); } else { channelManager.insertUsers(client._id, message.channel, [user]) .then(insertEvent); } // if it's us joining a channel we'll create a tab for it and request a mode function insertEvent() { eventManager.insertEvent(client, message, 'join'); } }; /** * Handles an incoming part event * * @method part * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.part = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.channel) { return false; } eventManager.insertEvent(client, message, 'part', function() { channelManager.removeUsers(client._id, message.channel, [message.nickname]); if (message.nickname === client.nick) { networkManager.activeTab(client, message.channel, false); } // we're leaving, mark the tab as inactive }); }; /** * Handles an incoming kick event * * @method kick * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.kick = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.channel || !message.kicked) { return false; } eventManager.insertEvent(client, message, 'kick', function() { channelManager.removeUsers(client._id, message.channel, [message.kicked]); if (message.kicked === client.nick) { networkManager.activeTab(client, message.channel, false); } // we're leaving, remove the tab }); }; /** * Handles an incoming quit event * * @method quit * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.quit = function(client, message) { if (!message.username || !message.hostname || !message.nickname) { return false; } eventManager.insertEvent(client, message, 'quit', function() { channelManager.removeUsers(client._id, [message.nickname]); }); }; /** * Handles an incoming nick change event * * @method nick * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.nick = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.newnick) { return false; } if (message.nickname === client.nick) { application.Networks.update({_id: client._id}, {$set: {nick: message.newnick}}, {safe: false}); } // update the nickname because its us changing our nick if (_.has(client.internal.tabs, message.nickname)) { var mlower = message.nickname.toLowerCase(); application.Tabs.update({user: client.internal.userId, network: client._id, target: mlower}, {$set: {title: message.nickname, target: mlower, url: client.url + '/' + mlower}}, {safe: false}); } // is this a client we're chatting to whos changed their nickname? eventManager.insertEvent(client, message, 'nick', function() { channelManager.updateUsers(client._id, [message.nickname], {nickname: message.newnick}); }); }; /** * Handles an incoming who event * * @method who * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.who = function(client, message) { if (!message.who || !message.channel) { return false; } var users = [], prefixes = _.invert(client.internal.capabilities.modes.prefixmodes); networkManager.addTab(client, message.channel, 'channel'); // we'll update our internal channels cause we might be reconnecting after inactivity _.each(message.who, function(u) { var split = u.prefix.split('@'), mode = u.mode.replace(/[a-z0-9]/i, ''), user = {}; user.username = split[0]; user.hostname = split[1]; user.nickname = u.nickname; user.modes = {}; for (var i = 0, len = mode.length; i < len; i++) { var prefix = mode.charAt(i); user.modes[prefix] = prefixes[prefix]; } // set the modes // normal for loop here cause we're just iterating a string, other cases I would use // _.each() user.prefix = eventManager.getPrefix(client, user).prefix; // set the current most highest ranking prefix users.push(user); }); channelManager.insertUsers(client._id, message.channel, users, true) .then(function(inserts) { rpcHandler.push(client.internal.userId, 'channelUsers', inserts); // burst emit these instead of letting the oplog tailer handle it, it's too heavy }); }; /** * Handles an incoming names event * * @method names * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.names = function(client, message) { if (!message.names || !message.channel) { return false; } application.ChannelUsers.find({network: client._id, channel: message.channel.toLowerCase()}).toArray(function(err, channelUsers) { if (err || !channelUsers) { return false; } var users = [], keys = [], regex = new RegExp('[' + helper.escape(client.internal.capabilities.modes.prefixes) + ']', 'g'); channelUsers.forEach(function(u) { keys.push(u.nickname); }); _.each(message.names, function(user) { users.push(user.replace(regex, '')); }); // strip prefixes keys.sort(); users.sort(); if (!_.isEqual(keys, users) && message.channel !== '*') { ircFactory.send(client._id, 'raw', ['WHO', message.channel]); } // different lists.. lets do a /WHO }); }; /** * Handles an incoming mode notify event * * @method mode * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.mode = function(client, message) { if (!message.mode || !message.channel) { return false; } channelManager.updateModes(client._id, client.internal.capabilities.modes, message.channel, message.mode); }; /** * Handles an incoming mode change event * * @method mode_change * @param {Object} client A valid client object * @param {Object} message A valid message object * @return */ IRCHandler.prototype.mode_change = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.mode || !message.channel) { return false; } eventManager.insertEvent(client, message, 'mode', function() { channelManager.updateModes(client._id, client.internal.capabilities.modes, message.channel, message.mode); }); }; /** * Handles an incoming topic notify event * * @method topic * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.topic = function(client, message) { if (!message.topic || !message.topicBy || !message.channel) { return false; } var split = message.topicBy.split(/[!@]/); message.nickname = split[0]; message.username = split[1]; message.hostname = split[2]; // reform this object eventManager.insertEvent(client, message, 'topic', function() { channelManager.updateTopic(client._id, message.channel, message.topic, message.topicBy); }); }; /** * Handles an incoming topic change event * * @method topic_change * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.topic_change = function(client, message) { if (!message.topic || !message.topicBy || !message.channel) { return false; } var split = message.topicBy.split(/[!@]/); message.nickname = split[0]; message.username = split[1]; message.hostname = split[2]; // reform this object eventManager.insertEvent(client, message, 'topic_change', function() { channelManager.updateTopic(client._id, message.channel, message.topic, message.topicBy); }); }; /** * Handles an incoming privmsg event * * @method privmsg * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.privmsg = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.target || !message.message) { return false; } eventManager.insertEvent(client, message, 'privmsg'); }; /** * Handles an incoming action event * * @method action * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.action = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.target || !message.message) { return false; } eventManager.insertEvent(client, message, 'action'); }; /** * Handles an incoming notice event * * @method notice * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.notice = function(client, message) { if (!message.target || !message.message) { return false; } eventManager.insertEvent(client, message, 'notice'); }; /** * Handles an incoming usermode event * * @method usermode * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.usermode = function(client, message) { if (!message.nickname || !message.mode) { return false; } eventManager.insertEvent(client, message, 'usermode'); }; /** * Handles an incoming ctcp_response event * * @method ctcp_response * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.ctcp_response = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.target || !message.type || !message.message) { return false; } eventManager.insertEvent(client, message, 'ctcp_response'); }; /** * Handles an incoming ctcp request event * * @method ctcp_request * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.ctcp_request = function(client, message) { if (!message.username || !message.hostname || !message.nickname || !message.target || !message.type || !message.message) { return false; } if (message.type.toUpperCase() == 'VERSION') { var version = 'IRCAnywhere v' + application.packagejson.version + ' ' + application.packagejson.homepage; ircFactory.send(client._id, 'ctcp', [message.nickname, 'VERSION', version]); } eventManager.insertEvent(client, message, 'ctcp_request'); }; /** * Handles an incoming unknown event * * @method unknown * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.unknown = function(client, message) { if (this.blacklisted.indexOf(message.command) === -1) { message.message = message.params.join(' '); eventManager.insertEvent(client, message, 'unknown'); } }; /** * Handles an incoming banlist event * * @method banlist * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.banlist = function(client, message) { if (!message.channel || !message.banlist) { return false; } rpcHandler.push(client.internal.userId, 'banList', {channel: message.channel, items: message.banlist, type: 'banList'}); }; /** * Handles an incoming invitelist event * * @method invitelist * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.invitelist = function(client, message) { if (!message.channel || !message.invitelist) { return false; } rpcHandler.push(client.internal.userId, 'inviteList', {channel: message.channel, items: message.invitelist, type: 'inviteList'}); }; /** * Handles an incoming exceptlist event * * @method exceptlist * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.exceptlist = function(client, message) { if (!message.channel || !message.exceptlist) { return false; } rpcHandler.push(client.internal.userId, 'exceptList', {channel: message.channel, items: message.exceptlist, type: 'exceptList'}); }; /** * Handles an incoming quietlist event * * @method quietlist * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.quietlist = function(client, message) { if (!message.channel || !message.quietlist) { return false; } rpcHandler.push(client.internal.userId, 'quietList', {channel: message.channel, items: message.quietlist, type: 'quietList'}); }; /** * Handles an incoming list event * * @method list * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.list = function(client, message) { if (!message.list || !message.search || !message.page || !message.limit) { return false; } client.internal._listBlock = false; // mark list block as false now we have the response rpcHandler.push(client.internal.userId, 'list', {search: message.search, page: message.page, limit: message.limit, channels: message.list, network: client.name}); }; /** * Handles an incoming whois event * * @method whois * @param {Object} client A valid client object * @param {Object} message A valid message object * @return void */ IRCHandler.prototype.whois = function(client, message) { if (!message.nickname || !message.username || !message.hostname) { return false; } message.network = client._id; rpcHandler.push(client.internal.userId, 'whois', message); }; /* XXX - Events TODO away - maybe this should alter the network status? unaway - ^ names - kinda done, need to determine whether they've ran /names or not and show it as a model maybe links - still needs to be implemented, although the basis in irc-factory is there */ IRCHandler.prototype = _.extend(IRCHandler.prototype, hooks); exports.IRCHandler = IRCHandler;
Alvuea/ircanywhere
server/irchandler.js
JavaScript
gpl-2.0
23,082
/* * $Id$ * * Copyright (C) 2008-2010 Kengo Sato * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H #include "../config.h" #endif #include <cassert> #include <cmath> #include <stack> #include <iostream> #include <fstream> #include <boost/algorithm/string.hpp> #include "bp.h" template < class Table > struct IgnoreAlonePair { IgnoreAlonePair(Table& bp) : bp_(bp) { } void operator()(uint i, uint j) { if (i<j && bp_(i,j)>0) { uint c=0; if (i+1<j-1 && bp_(i+1,j-1)>0) c++; if (i>0 && j+1<bp_.size() && bp_(i-1,j+1)>0) c++; if (c==0) bp_.update(i, j, 0); } } Table& bp_; }; template < class V > bool BPTableTmpl<V>:: parse(const std::string& str, bool ignore_alone_pair/*=false*/, uint min_loop /*=3*/) { resize(str.size()); std::stack<uint> st; for (uint i=0; i!=str.size(); ++i) { switch (str[i]) { case '(': st.push(i); break; case ')': if (st.empty()) return false; if (min_loop+st.top()<i) update(st.top(), i, 1); st.pop(); break; default: break; } } if (ignore_alone_pair) { IgnoreAlonePair<BPTableTmpl<V> > f(*this); inside_traverse(0, size()-1, f); } return st.empty(); } template < class V > bool BPTableTmpl<V>:: load(const char* filename) { std::string l; uint len=0; std::ifstream in(filename); if (!in) return false; while (std::getline(in, l)) ++len; resize(len); in.clear(); in.seekg(0, std::ios::beg); while (std::getline(in, l)) { std::vector<std::string> v; boost::algorithm::split(v, l, boost::is_space(), boost::algorithm::token_compress_on); uint up = atoi(v[0].c_str()); for (uint i=2; i!=v.size(); ++i) { uint down; float p; if (sscanf(v[i].c_str(), "%u:%f", &down, &p)==2) { update(up-1, down-1, p); } } } return true; } template < class V > bool BPTableTmpl<V>:: save(const char* filename, const std::string& seq, float th) const { std::ofstream out(filename); if (!out) return false; return save(out, seq, th); } template < class V > bool BPTableTmpl<V>:: save(std::ostream& out, const std::string& seq, float th) const { for (uint i=0; i!=seq.size(); ++i) { out << (i+1) << ' ' << seq[i] << ' '; uint l = max_dist()==0 ? seq.size() : std::min(size_t(i+max_dist()), seq.size()); for (uint j=i; j!=l; ++j) { if ((*this)(i,j)>=th && (*this)(i,j)>0.0) out << (j+1) << ':' << (*this)(i,j) << ' '; } out << std::endl; } return true; } template <class V> struct Updater { Updater(const CYKTable<V>& bp, uint sz) : bp_(bp), q(sz, 1.0) { } void operator()(uint i, uint j) { if (i<j && bp_(i,j)>0.0) { q[i]-=bp_(i,j); q[j]-=bp_(i,j); } } const CYKTable<V>& bp_; std::vector<V> q; }; template < class V > std::vector<V> BPTableTmpl<V>:: calc_nonbp_prob() const { Updater<V> updater(bp_, size_); inside_traverse(0, size()-1, updater); return updater.q; } // instantiate template class BPTableTmpl<float>; template bool BPTableTmpl<uint>:: parse(const std::string& str, bool ignore_alone_pair, uint min_loop);
satoken/centroid-rna-package
src/bp.cpp
C++
gpl-2.0
3,857
<?php /* +--------------------------------------------------------------------+ | CiviCRM version 3.1 | +--------------------------------------------------------------------+ | Copyright CiviCRM LLC (c) 2004-2010 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | | CiviCRM is free software; you can copy, modify, and distribute it | | under the terms of the GNU Affero General Public License | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | | | CiviCRM is distributed in the hope that it will be useful, but | | WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | See the GNU Affero General Public License for more details. | | | | You should have received a copy of the GNU Affero General Public | | License and the CiviCRM Licensing Exception along | | with this program; if not, contact CiviCRM LLC | | at info[AT]civicrm[DOT]org. If you have questions about the | | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ */ /** * * @package CRM * @copyright CiviCRM LLC (c) 2004-2010 * $Id$ * */ require_once 'CRM/Core/DAO.php'; require_once 'CRM/Utils/Type.php'; class CRM_ACL_DAO_Cache extends CRM_Core_DAO { /** * static instance to hold the table name * * @var string * @static */ static $_tableName = 'civicrm_acl_cache'; /** * static instance to hold the field values * * @var array * @static */ static $_fields = null; /** * static instance to hold the FK relationships * * @var string * @static */ static $_links = null; /** * static instance to hold the values that can * be imported / apu * * @var array * @static */ static $_import = null; /** * static instance to hold the values that can * be exported / apu * * @var array * @static */ static $_export = null; /** * static value to see if we should log any modifications to * this table in the civicrm_log table * * @var boolean * @static */ static $_log = false; /** * Unique table ID * * @var int unsigned */ public $id; /** * Foreign Key to Contact * * @var int unsigned */ public $contact_id; /** * Foreign Key to ACL * * @var int unsigned */ public $acl_id; /** * When was this cache entry last modified * * @var date */ public $modified_date; /** * class constructor * * @access public * @return civicrm_acl_cache */ function __construct() { parent::__construct(); } /** * return foreign links * * @access public * @return array */ function &links() { if (!(self::$_links)) { self::$_links = array( 'contact_id' => 'civicrm_contact:id', 'acl_id' => 'civicrm_acl:id', ); } return self::$_links; } /** * returns all the column names of this table * * @access public * @return array */ function &fields() { if (!(self::$_fields)) { self::$_fields = array( 'id' => array( 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, 'required' => true, ) , 'contact_id' => array( 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, 'FKClassName' => 'CRM_Contact_DAO_Contact', ) , 'acl_id' => array( 'name' => 'acl_id', 'type' => CRM_Utils_Type::T_INT, 'required' => true, 'FKClassName' => 'CRM_ACL_DAO_ACL', ) , 'modified_date' => array( 'name' => 'modified_date', 'type' => CRM_Utils_Type::T_DATE, 'title' => ts('Modified Date') , ) , ); } return self::$_fields; } /** * returns the names of this table * * @access public * @return string */ function getTableName() { return self::$_tableName; } /** * returns if this table needs to be logged * * @access public * @return boolean */ function getLog() { return self::$_log; } /** * returns the list of fields that can be imported * * @access public * return array */ function &import($prefix = false) { if (!(self::$_import)) { self::$_import = array(); $fields = & self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('import', $field)) { if ($prefix) { self::$_import['acl_cache'] = & $fields[$name]; } else { self::$_import[$name] = & $fields[$name]; } } } } return self::$_import; } /** * returns the list of fields that can be exported * * @access public * return array */ function &export($prefix = false) { if (!(self::$_export)) { self::$_export = array(); $fields = & self::fields(); foreach($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { self::$_export['acl_cache'] = & $fields[$name]; } else { self::$_export[$name] = & $fields[$name]; } } } } return self::$_export; } }
bhirsch/voipdev
sites/all/modules/civicrm/CRM/ACL/DAO/Cache.php
PHP
gpl-2.0
6,567
jQuery(document).ready(function(){ var date = new Date(); date.setTime(date.getTime() + 2*3600*1000); document.cookie = "visited=true;expires=" + date.toGMTString(); });
yangxuanxing/bubbfil
wp-content/themes/responsive/core/js/bubbfil.js
JavaScript
gpl-2.0
178
var fs = require('fs'), path = require('path'), async = require('../support/async.min.js'), os = require('os').platform(), exec = require('child_process').exec, spawn = require('child_process').spawn, Registry = require('./registry'), exports = module.exports = function Processor(command) { // constant for timeout checks this.E_PROCESSTIMEOUT = -99; this._codecDataAlreadySent = false; this.saveToFile = function(targetfile, callback) { callback = callback || function() {}; this.options.outputfile = targetfile; var self = this; var options = this.options; // parse options to command this._prepare(function(err, meta) { if (err) { return callback(null, null, err); } var args = self.buildFfmpegArgs(false, meta); if (!args instanceof Array) { return callback (null, null, args); } // start conversion of file using spawn var ffmpegProc = self._spawnProcess(args); if (options.inputstream) { // pump input stream to stdin options.inputstream.resume(); options.inputstream.pipe(ffmpegProc.stdin); } //handle timeout if set var processTimer; if (options.timeout) { processTimer = setTimeout(function() { ffmpegProc.removeAllListeners('exit'); ffmpegProc.kill('SIGKILL'); options.logger.warn('process ran into a timeout (' + self.options.timeout + 's)'); callback(self.E_PROCESSTIMEOUT, 'timeout'); }, options.timeout * 1000); } var stdout = ''; var stderr = ''; ffmpegProc.on('exit', function(code) { if (processTimer) { clearTimeout(processTimer); } // check if we have to run flvtool2 to update flash video meta data if (self.options._updateFlvMetadata === true) { // make sure we didn't try to determine this capability before if (!Registry.instance.get('capabilityFlvTool2')) { // check if flvtool2 is installed exec('which flvtool2', function(whichErr, whichStdOut, whichStdErr) { if (whichStdOut !== '') { Registry.instance.set('capabilityFlvTool2', true); // update metadata in flash video exec('flvtool2 -U ' + self.options.outputfile, function(flvtoolErr, flvtoolStdout, flvtoolStderr) { callback(stdout, stderr, null); }); } else { // flvtool2 is not installed, skip further checks Registry.instance.set('capabilityFlvTool2', false); callback(stdout, stderr, null); } }); } else if (!Registry.instance.get('capabilityFlvTool2')) { // flvtool2 capability was checked before, execute update exec('flvtool2 -U ' + self.options.outputfile, function(flvtoolErr, flvtoolStdout, flvtoolStderr) { callback(stdout, stderr, null); }); } else { // flvtool2 not installed, skip update callback(stdout, stderr, null); } } else { callback(stdout, stderr, null); } }); ffmpegProc.stdout.on('data', function (data) { stdout += data; }); ffmpegProc.stderr.on('data', function (data) { stderr += data; if (options.onCodecData) { self._checkStdErrForCodec(stderr); } if (options.onProgress) { self._getProgressFromStdErr(stderr, meta.durationsec); } }); }); }; this.mergeToFile = function(targetfile,callback){ this.options.outputfile = targetfile; var self = this; var options = this.options; var getExtension = function(filename) { var ext = path.extname(filename||'').split('.'); return ext[ext.length - 1]; }; // creates intermediate copies of each video. var makeIntermediateFile = function(_mergeSource,_callback){ var fname = _mergeSource+".temp.mpg"; var command = [ self.ffmpegPath, [ '-i', _mergeSource, '-qscale:v',1, fname ].join(' ') ]; exec(command.join(' '),function(err, stdout, stderr) { if(err)throw err; _callback(fname); }); }; // concat all created intermediate copies var concatIntermediates = function(target,intermediatesList,_callback){ var fname = target+".temp.merged.mpg"; // unescape paths for(var i=0; i<intermediatesList.length; i++){ intermediatesList[i] = unescapePath(intermediatesList[i]); } var command = [ self.ffmpegPath, [ '-loglevel','panic', //Generetes too much muxing warnings and fills default buffer of exec. This is to ignore them. '-i', 'concat:"'+intermediatesList.join("|")+'"', '-c',"copy", fname ].join(' ') ]; exec(command.join(' '), function(err, stdout, stderr) { if(err)throw err; _callback(fname); }); }; var quantizeConcat = function(concatResult,numFiles,_callback){ var command = [ self.ffmpegPath, [ '-i', concatResult, '-qscale:v',numFiles, targetfile ].join(' ') ]; exec(command.join(' '), function(err, stdout, stderr) { if(err)throw err; _callback(); }); } var deleteIntermediateFiles = function(intermediates){ for(var i=0 ; i<intermediates.length ; i++){ fs.unlinkSync( unescapePath(intermediates[i])); } } var unescapePath = function(path){ var f = path+""; if(f.indexOf('"')==0)f = f.substring(1); if(f.lastIndexOf('"')== f.length-1)f = f.substring(0, f.length-1); return f; } if(options.mergeList.length<=0)throw new Error("No file added to be merged"); var mergeList = options.mergeList; mergeList.unshift(options.inputfile) var intermediateFiles = []; async.whilst(function(){ return (mergeList.length != 0); },function(callback){ makeIntermediateFile(mergeList.shift(),function(createdIntermediateFile){ if(!createdIntermediateFile)throw new Error("Invalid intermediate file"); intermediateFiles.push(createdIntermediateFile); callback(); }) },function(err){ if(err)throw err; concatIntermediates(targetfile,intermediateFiles,function(concatResult){ if(!concatResult)throw new Error("Invalid concat result file"); quantizeConcat(concatResult,intermediateFiles.length,function(){ intermediateFiles.push(concatResult); // add concatResult to intermediates list so it can be deleted too. deleteIntermediateFiles(intermediateFiles); callback(); // completed; }); }); }); } this.writeToStream = function(stream, callback) { callback = callback || function(){}; if (!this.options._isStreamable) { this.options.logger.error('selected output format is not streamable'); return callback(null, new Error('selected output format is not streamable')); } var self = this; var options = this.options; // parse options to command this._prepare(function(err, meta) { if (err) { return callback(null, err); } var args = self.buildFfmpegArgs(true, meta); if (!args instanceof Array) { return callback(null, args); } // write data to stdout args.push('pipe:1'); // start conversion of file using spawn var ffmpegProc = self._spawnProcess(args); if (options.inputstream) { // pump input stream to stdin options.inputstream.resume(); options.inputstream.pipe(ffmpegProc.stdin); options.inputstream.on('error', function(){ options.logger.debug("input stream closed, killing ffmpgeg process"); ffmpegProc.kill(); }); } //handle timeout if set var processTimer; if (options.timeout) { processTimer = setTimeout(function() { ffmpegProc.removeAllListeners('exit'); ffmpegProc.kill('SIGKILL'); options.logger.warn('process ran into a timeout (' + options.timeout + 's)'); callback(self.E_PROCESSTIMEOUT, 'timeout'); }, options.timeout * 1000); } var stderr = ''; ffmpegProc.stderr.on('data', function(data) { stderr += data; if (options.onCodecData) { self._checkStdErrForCodec(stderr); } if (options.onProgress) { self._getProgressFromStdErr(stderr, meta.durationsec); } }); ffmpegProc.stdout.on('data', function(chunk) { stream.write(chunk); }); ffmpegProc.on('exit', function(code, signal) { if (processTimer) { clearTimeout(processTimer); } // close file descriptor on outstream if(/^[a-z]+:\/\//.test(options.inputfile)) { return callback(code, stderr); } var cb_ = function() { if (!options.inputstream || !options.inputstream.fd) { return callback(code, stderr); } fs.close(options.inputstream.fd, function() { callback(code, stderr); }); }; if (stream.fd) { return fs.close(stream.fd, cb_); } if (stream.end) { stream.end(); } else { callback(code, "stream will not be closed"); } cb_(); }); stream.on("close", function() { options.logger.debug("Output stream closed, killing ffmpgeg process"); ffmpegProc.kill(); }); }); }; this.takeScreenshots = function(config, folder, callback) { callback = callback || function(){}; function _zeroPad(number, len) { len = len-String(number).length+2; return new Array(len<0?0:len).join('0')+number; } function _renderOutputName(j, offset) { var result = filename; if(/%0*i/.test(result)) { var numlen = String(result.match(/%(0*)i/)[1]).length; result = result.replace(/%0*i/, _zeroPad(j, numlen)); } result = result.replace('%s', offset); result = result.replace('%w', self.options.video.width); result = result.replace('%h', self.options.video.height); result = result.replace('%r', self.options.video.width+'x'+self.options.video.height); result = result.replace('%f', self.options.inputfile); result = result.replace('%b', self.options.inputfile.substr(0,self.options.inputfile.lastIndexOf('.'))); return result; } function _screenShotInternal(callback) { // get correct dimensions self._prepare(function(err, meta) { if (!meta.durationsec) { var errString = 'meta data contains no duration, aborting screenshot creation'; self.options.logger.warn(errString); return callback(new Error(errString)); } // check if all timemarks are inside duration if (Array.isArray(timemarks)) { for (var i = 0; i < timemarks.length; i++) { /* convert percentage to seconds */ if( timemarks[i].indexOf('%') > 0 ) { timemarks[i] = (parseInt(timemarks[i], 10) / 100) * meta.durationsec; } if (parseInt(timemarks[i], 10) > meta.durationsec) { // remove timemark from array timemarks.splice(i, 1); --i; } } // if there are no more timemarks around, add one at end of the file if (timemarks.length === 0) { timemarks[0] = (meta.durationsec * 0.9); } } // get positions for screenshots (using duration of file minus 10% to remove fade-in/fade-out) var secondOffset = (meta.durationsec * 0.9) / screenshotcount; var donecount = 0; var series = []; // reset iterator var j = 1; var filenames = []; // use async helper function to generate all screenshots and // fire callback just once after work is done async.until( function() { return j > screenshotcount; }, function(taskcallback) { var offset; if (Array.isArray(timemarks)) { // get timemark for current iteration offset = timemarks[(j - 1)]; } else { offset = secondOffset * j; } var fname = _renderOutputName(j, offset) + '.jpg'; var target = self.escapedPath(path.join(folder, fname), true); var input = self.escapedPath(self.options.inputfile, true); // build screenshot command var command = [ self.ffmpegPath, [ '-ss', Math.floor(offset * 100) / 100, '-i', input, '-vcodec', 'mjpeg', '-vframes', '1', '-an', '-f', 'rawvideo', '-s', self.options.video.size, '-y', target ].join(' ') ]; j++; // only set niceness if running on a non-windows platform if (self.options.hasOwnProperty('_nice.level') && !os.match(/win(32|64)/)) { // execute ffmpeg through nice command.unshift('nice -n', self.options._nice.level||0); } exec(command.join(' '), taskcallback); filenames.push(fname); }, function(err) { callback(err, filenames); } ); }); } var timemarks, screenshotcount, filename; if (typeof config === 'object') { // use json object as config if (config.count) { screenshotcount = config.count; } if (config.timemarks) { timemarks = config.timemarks; } } else { // assume screenshot count as parameter screenshotcount = config; timemarks = null; } if (!this.options.video.size) { this.options.logger.warn("set size of thumbnails using 'withSize' method"); callback(new Error("set size of thumbnails using 'withSize' method")); } filename = config.filename || 'tn_%ss'; if(!/%0*i/.test(filename) && Array.isArray(timemarks) && timemarks.length > 1 ) { // if there are multiple timemarks but no %i in filename add one // so we won't overwrite the same thumbnail with each timemark filename += '_%i'; } folder = folder || '.'; var self = this; // WORKAROUND: exists will be moved from path to fs with node v0.7 var check = fs.exists; if (!check) { check = path.exists; } // check target folder check(folder, function(exists) { if (!exists) { fs.mkdir(folder, '0755', function(err) { if (err !== null) { callback(err); } else { _screenShotInternal(callback); } }); } else { _screenShotInternal(callback); } }); }; this._getProgressFromStdErr = function(stderrString, totalDurationSec) { // get last stderr line var lastLine = stderrString.split(/\r\n|\r|\n/g); var ll = lastLine[lastLine.length - 2]; var progress; if (ll) { progress = ll.split(/frame=([0-9\s]+)fps=([0-9\.\s]+)q=([0-9\.\s]+)(L?)size=([0-9\s]+)kB time=(([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{2})) bitrate=([0-9\.\s]+)kbits/ig); } if (progress && progress.length > 10) { // build progress report object var ret = { frames: parseInt(progress[1], 10), currentFps: parseInt(progress[2], 10), currentKbps: parseFloat(progress[10]), targetSize: parseInt(progress[5], 10), timemark: progress[6] }; // calculate percent progress using duration if (totalDurationSec && totalDurationSec > 0) { ret.percent = (this.ffmpegTimemarkToSeconds(ret.timemark) / totalDurationSec) * 100; } this.options.onProgress(ret); } }; this._checkStdErrForCodec = function(stderrString) { var format= /Input #[0-9]+, ([^ ]+),/.exec(stderrString); var dur = /Duration\: ([^,]+)/.exec(stderrString); var audio = /Audio\: (.*)/.exec(stderrString); var video = /Video\: (.*)/.exec(stderrString); var codecObject = { format: '', audio: '', video: '', duration: '' }; if (format && format.length > 1) { codecObject.format = format[1]; } if (dur && dur.length > 1) { codecObject.duration = dur[1]; } if (audio && audio.length > 1) { audio = audio[1].split(', '); codecObject.audio = audio[0]; codecObject.audio_details = audio; } if (video && video.length > 1) { video = video[1].split(', '); codecObject.video = video[0]; codecObject.video_details = video; } var codecInfoPassed = /Press (\[q\]|ctrl-c) to stop/.test(stderrString); if (codecInfoPassed) { this.options.onCodecData(codecObject); this.options.onCodecData = null; } }; this._spawnProcess = function(args, options) { var retProc = spawn(this.ffmpegPath, args, options); // only re-nice if running on a non-windows platform if (this.options.hasOwnProperty('_nice.level') && !os.match(/win(32|64)/)) { var niceLevel = this.options._nice.level || 0; if (niceLevel > 0) { niceLevel = '+' + niceLevel; } // renice the spawned process without waiting for callback var self = this; var command = [ 'renice -n', niceLevel, '-p', retProc.pid ].join(' '); exec(command, function(err, stderr, stdout) { if (!err) { self.options.logger.info('successfully reniced process ' + retProc.pid + ' to ' + niceLevel + ' niceness!'); } }); } if (retProc.stderr) { retProc.stderr.setEncoding('utf8'); } return retProc; }; this.buildFfmpegArgs = function(overrideOutputCheck, meta) { var args = []; // add startoffset and duration if (this.options.starttime) { args.push('-ss', this.options.starttime); } if (this.options.video.loop) { args.push('-loop', 1); } // add input format if (this.options.fromFormat) { args.push('-f', this.options.fromFormat); } // add input file (if using fs mode) if (this.options.inputfile && !this.options.inputstream && !this.options.inputlive) { // add input file fps if (this.options.video.fpsInput) { args.push('-r', this.options.video.fpsInput); } if (/^[a-z]+:\/\//.test(this.options.inputfile)) { args.push('-i', this.options.inputfile.replace(' ', '%20')); } else if (/%\d*d/.test(this.options.inputfile)) { // multi-file format - http://ffmpeg.org/ffmpeg.html#image2-1 args.push('-i', this.options.inputfile.replace(' ', '\ ')); } else { var fstats = fs.statSync(this.options.inputfile); if (fstats.isFile()) { // fix for spawn call with path containing spaces and quotes args.push('-i', this.options.inputfile.replace(/ /g, "\ ") .replace(/'/g, "\'") .replace(/"/g, "\"")); } else { this.options.logger.error('input file is not readable'); throw new Error('input file is not readable'); } } // check for input stream } else if (this.options.inputstream) { // push args to make ffmpeg read from stdin args.push('-i', '-'); } else if (this.options.inputlive){ //Check if input URI if(/^[a-z]+:\/\//.test(this.options.inputfile)) { // add input with live flag args.push('-i', this.options.inputfile.replace(' ', '%20')+' live=1'); }else { this.options.logger.error('live input URI is not valid'); throw new Error('live input URI is not valid'); } } if (this.options.otherInputs) { if (this.options.otherInputs.length > 0) { this.options.otherInputs.forEach(function(el) { args.push('-i', el); }); } } if (this.options.duration) { args.push('-t', this.options.duration); } if (this.options.video.framecount) { args.push('-vframes', this.options.video.framecount); } // add format if (this.options.format) { args.push('-f', this.options.format); } // add video options if (this.options.video.skip) { // skip video stream completely (#45) args.push('-vn'); } else { if (this.options.video.bitrate) { args.push('-b', this.options.video.bitrate + 'k'); if (this.options._useConstantVideoBitrate) { // add parameters to ensure constant bitrate encoding args.push('-maxrate', this.options.video.bitrate + 'k'); args.push('-minrate', this.options.video.bitrate + 'k'); args.push('-bufsize', '3M'); } } if (this.options.video.codec) { args.push('-vcodec', this.options.video.codec); } if (this.options.video.fps) { args.push('-r', this.options.video.fps); } if (this.options.video.aspect) { args.push('-aspect', this.options.video.aspect); } } // add video options if (this.options.audio.skip) { // skip audio stream completely (#45) args.push('-an'); } else { if (this.options.audio.bitrate) { args.push('-ab', this.options.audio.bitrate + 'k'); } if (this.options.audio.channels) { args.push('-ac', this.options.audio.channels); } if (this.options.audio.codec) { args.push('-acodec', this.options.audio.codec); } if (this.options.audio.frequency) { args.push('-ar', this.options.audio.frequency); } if (this.options.audio.quality || this.options.audio.quality === 0) { args.push('-aq', this.options.audio.quality); } } // add additional options if (this.options.additional) { if (this.options.additional.length > 0) { this.options.additional.forEach(function(el) { args.push(el); }); } } if (this.options.video.pad && !this.options.video.skip) { // we have padding arguments, push if (this.atLeastVersion(meta.ffmpegversion, '0.7')) { // padding is not supported ffmpeg < 0.7 (only using legacy commands which were replaced by vfilter calls) args.push('-vf'); args.push('pad=' + this.options.video.pad.w + ':' + this.options.video.pad.h + ':' + this.options.video.pad.x + ':' + this.options.video.pad.y + ':' + this.options.video.padcolor); } else { return new Error("Your ffmpeg version " + meta.ffmpegversion + " does not support padding"); } } // add size and output file if (this.options.video.size && !this.options.video.skip) { args.push('-s', this.options.video.size); } // add output file fps if (this.options.video.fpsOutput) { args.push('-r', this.options.video.fpsOutput); } if (this.options.outputfile) { var target = this.escapedPath(this.options.outputfile, false); if (!os.match(/win(32|64)/)) { args.push('-y', target.replace(' ', '\\ ')); } else { args.push('-y', target); } } else { if (!overrideOutputCheck) { this.options.logger.error('no outputfile specified'); } } return args; }; };
opentune/opentune
node_modules/liquid-ffmpeg/lib/processor.js
JavaScript
gpl-2.0
23,995
package ca.cs.ualberta.rozsa_expensetracker; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; //Claim view. Did not implement because could not get claimlist to work. public class ClaimViewActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_claim_view); //Would have created a custom adapter as well as implemented onclick listeners //in order to access specifics of each expense. Button button = (Button) findViewById(R.id.addExpenseButton); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Toast.makeText(ClaimViewActivity.this, "New Claim", Toast.LENGTH_LONG).show(); Intent intent = new Intent(ClaimViewActivity.this, NewExpenseActivity.class); startActivity(intent); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.claim_view, menu); return true; } }
ChuckRozsa/rozsa-ExpenseTracker
src/ca/cs/ualberta/rozsa_expensetracker/ClaimViewActivity.java
Java
gpl-2.0
1,297
// SmoothScroll v1.2.1 // Licensed under the terms of the MIT license. // People involved // - Balazs Galambosi (maintainer) // - Patrick Brunner (original idea) // - Michael Herf (Pulse Algorithm) // Scroll Variables (tweakable) var defaultOptions = { // Scrolling Core frameRate : 150, // [Hz] animationTime : 600, // [px] stepSize : 120, // [px] // Pulse (less tweakable) // ratio of "tail" to "acceleration" pulseAlgorithm : true, pulseScale : 8, pulseNormalize : 1, // Acceleration accelerationDelta : 20, // 20 accelerationMax : 1, // 1 // Keyboard Settings keyboardSupport : true, // option arrowScroll : 50, // [px] // Other touchpadSupport : true, fixedBackground : true, excluded : "" }; var options = defaultOptions; // Other Variables var isExcluded = false; var isFrame = false; var direction = { x: 0, y: 0 }; var initDone = false; var root = document.documentElement; var activeElement; var observer; var deltaBuffer = [ 120, 120, 120 ]; var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36 }; /*********************************************** * SETTINGS ***********************************************/ if(typeof(chrome) !== 'undefined' && typeof(chrome.storage) !== 'undefined') { chrome.storage.sync.get(defaultOptions, function (syncedOptions) { options = syncedOptions; // it seems that sometimes settings come late // and we need to test again for excluded pages initTest(); }); } /*********************************************** * INITIALIZE ***********************************************/ /** * Tests if smooth scrolling is allowed. Shuts down everything if not. */ function initTest() { var disableKeyboard = false; // disable keys for google reader (spacebar conflict) if (document.URL.indexOf("google.com/reader/view") > -1) { disableKeyboard = true; } // disable everything if the page is blacklisted if (options.excluded) { var domains = options.excluded.split(/[,\n] ?/); domains.push("mail.google.com"); // exclude Gmail for now for (var i = domains.length; i--;) { if (document.URL.indexOf(domains[i]) > -1) { observer && observer.disconnect(); removeEvent("mousewheel", wheel); disableKeyboard = true; isExcluded = true; break; } } } // disable keyboard support if anything above requested it if (disableKeyboard) { removeEvent("keydown", keydown); } if (options.keyboardSupport && !disableKeyboard) { addEvent("keydown", keydown); } } /** * Sets up scrolls array, determines if frames are involved. */ function init() { if (!document.body) return; var body = document.body; var html = document.documentElement; var windowHeight = window.innerHeight; var scrollHeight = body.scrollHeight; // check compat mode for root element root = (document.compatMode.indexOf('CSS') >= 0) ? html : body; activeElement = body; initTest(); initDone = true; // Checks if this script is running in a frame if (top != self) { isFrame = true; } /** * This fixes a bug where the areas left and right to * the content does not trigger the onmousewheel event * on some pages. e.g.: html, body { height: 100% } */ else if (scrollHeight > windowHeight && (body.offsetHeight <= windowHeight || html.offsetHeight <= windowHeight)) { // DOMChange (throttle): fix height var pending = false; var refresh = function () { if (!pending && html.scrollHeight != document.height) { pending = true; // add a new pending action setTimeout(function () { html.style.height = document.height + 'px'; pending = false; }, 500); // act rarely to stay fast } }; html.style.height = 'auto'; setTimeout(refresh, 10); var config = { attributes: true, childList: true, characterData: false }; observer = new MutationObserver(refresh); observer.observe(body, config); // clearfix if (root.offsetHeight <= windowHeight) { var underlay = document.createElement("div"); underlay.style.clear = "both"; body.appendChild(underlay); } } // gmail performance fix if (document.URL.indexOf("mail.google.com") > -1) { var s = document.createElement("style"); s.innerHTML = ".iu { visibility: hidden }"; (document.getElementsByTagName("head")[0] || html).appendChild(s); } // facebook better home timeline performance // all the HTML resized images make rendering CPU intensive else if (document.URL.indexOf("www.facebook.com") > -1) { var home_stream = document.getElementById("home_stream"); home_stream && (home_stream.style.webkitTransform = "translateZ(0)"); } // disable fixed background if (!options.fixedBackground && !isExcluded) { body.style.backgroundAttachment = "scroll"; html.style.backgroundAttachment = "scroll"; } } /************************************************ * SCROLLING ************************************************/ var que = []; var pending = false; var lastScroll = +new Date; /** * Pushes scroll actions to the scrolling queue. */ function scrollArray(elem, left, top, delay) { delay || (delay = 1000); directionCheck(left, top); if (options.accelerationMax != 1) { var now = +new Date; var elapsed = now - lastScroll; if (elapsed < options.accelerationDelta) { var factor = (1 + (30 / elapsed)) / 2; if (factor > 1) { factor = Math.min(factor, options.accelerationMax); left *= factor; top *= factor; } } lastScroll = +new Date; } // push a scroll command que.push({ x: left, y: top, lastX: (left < 0) ? 0.99 : -0.99, lastY: (top < 0) ? 0.99 : -0.99, start: +new Date }); // don't act if there's a pending queue if (pending) { return; } var scrollWindow = (elem === document.body); var step = function (time) { var now = +new Date; var scrollX = 0; var scrollY = 0; for (var i = 0; i < que.length; i++) { var item = que[i]; var elapsed = now - item.start; var finished = (elapsed >= options.animationTime); // scroll position: [0, 1] var position = (finished) ? 1 : elapsed / options.animationTime; // easing [optional] if (options.pulseAlgorithm) { position = pulse(position); } // only need the difference var x = (item.x * position - item.lastX) >> 0; var y = (item.y * position - item.lastY) >> 0; // add this to the total scrolling scrollX += x; scrollY += y; // update last values item.lastX += x; item.lastY += y; // delete and step back if it's over if (finished) { que.splice(i, 1); i--; } } // scroll left and top if (scrollWindow) { window.scrollBy(scrollX, scrollY); } else { if (scrollX) elem.scrollLeft += scrollX; if (scrollY) elem.scrollTop += scrollY; } // clean up if there's nothing left to do if (!left && !top) { que = []; } if (que.length) { requestFrame(step, elem, (delay / options.frameRate + 1)); } else { pending = false; } }; // start a new queue of actions requestFrame(step, elem, 0); pending = true; } /*********************************************** * EVENTS ***********************************************/ /** * Mouse wheel handler. * @param {Object} event */ function wheel(event) { if (!initDone) { init(); } var target = event.target; var overflowing = overflowingAncestor(target); // use default if there's no overflowing // element or default action is prevented if (!overflowing || event.defaultPrevented || isNodeName(activeElement, "embed") || (isNodeName(target, "embed") && /\.pdf/i.test(target.src))) { return true; } var deltaX = event.wheelDeltaX || 0; var deltaY = event.wheelDeltaY || 0; // use wheelDelta if deltaX/Y is not available if (!deltaX && !deltaY) { deltaY = event.wheelDelta || 0; } // check if it's a touchpad scroll that should be ignored if (!options.touchpadSupport && isTouchpad(deltaY)) { return true; } // scale by step size // delta is 120 most of the time // synaptics seems to send 1 sometimes if (Math.abs(deltaX) > 1.2) { deltaX *= options.stepSize / 120; } if (Math.abs(deltaY) > 1.2) { deltaY *= options.stepSize / 120; } scrollArray(overflowing, -deltaX, -deltaY); event.preventDefault(); } /** * Keydown event handler. * @param {Object} event */ function keydown(event) { var target = event.target; var modifier = event.ctrlKey || event.altKey || event.metaKey || (event.shiftKey && event.keyCode !== key.spacebar); // do nothing if user is editing text // or using a modifier key (except shift) // or in a dropdown if ( /input|textarea|select|embed/i.test(target.nodeName) || target.isContentEditable || event.defaultPrevented || modifier ) { return true; } // spacebar should trigger button press if (isNodeName(target, "button") && event.keyCode === key.spacebar) { return true; } var shift, x = 0, y = 0; var elem = overflowingAncestor(activeElement); var clientHeight = elem.clientHeight; if (elem == document.body) { clientHeight = window.innerHeight; } switch (event.keyCode) { case key.up: y = -options.arrowScroll; break; case key.down: y = options.arrowScroll; break; case key.spacebar: // (+ shift) shift = event.shiftKey ? 1 : -1; y = -shift * clientHeight * 0.9; break; case key.pageup: y = -clientHeight * 0.9; break; case key.pagedown: y = clientHeight * 0.9; break; case key.home: y = -elem.scrollTop; break; case key.end: var damt = elem.scrollHeight - elem.scrollTop - clientHeight; y = (damt > 0) ? damt+10 : 0; break; case key.left: x = -options.arrowScroll; break; case key.right: x = options.arrowScroll; break; default: return true; // a key we don't care about } scrollArray(elem, x, y); event.preventDefault(); } /** * Mousedown event only for updating activeElement */ function mousedown(event) { activeElement = event.target; } /*********************************************** * OVERFLOW ***********************************************/ var cache = {}; // cleared out every once in while setInterval(function () { cache = {}; }, 10 * 1000); var uniqueID = (function () { var i = 0; return function (el) { return el.uniqueID || (el.uniqueID = i++); }; })(); function setCache(elems, overflowing) { for (var i = elems.length; i--;) cache[uniqueID(elems[i])] = overflowing; return overflowing; } function overflowingAncestor(el) { var elems = []; var rootScrollHeight = root.scrollHeight; do { var cached = cache[uniqueID(el)]; if (cached) { return setCache(elems, cached); } elems.push(el); if (rootScrollHeight === el.scrollHeight) { if (!isFrame || root.clientHeight + 10 < rootScrollHeight) { return setCache(elems, document.body); // scrolling root in WebKit } } else if (el.clientHeight + 10 < el.scrollHeight) { overflow = getComputedStyle(el, "").getPropertyValue("overflow-y"); if (overflow === "scroll" || overflow === "auto") { return setCache(elems, el); } } } while (el = el.parentNode); } /*********************************************** * HELPERS ***********************************************/ function addEvent(type, fn, bubble) { window.addEventListener(type, fn, (bubble||false)); } function removeEvent(type, fn, bubble) { window.removeEventListener(type, fn, (bubble||false)); } function isNodeName(el, tag) { return (el.nodeName||"").toLowerCase() === tag.toLowerCase(); } function directionCheck(x, y) { x = (x > 0) ? 1 : -1; y = (y > 0) ? 1 : -1; if (direction.x !== x || direction.y !== y) { direction.x = x; direction.y = y; que = []; lastScroll = 0; } } var deltaBufferTimer; function isTouchpad(deltaY) { if (!deltaY) return; deltaY = Math.abs(deltaY) deltaBuffer.push(deltaY); deltaBuffer.shift(); clearTimeout(deltaBufferTimer); deltaBufferTimer = setTimeout(function () { chrome.storage.local.set({ deltaBuffer: deltaBuffer }); }, 1000); var allEquals = (deltaBuffer[0] == deltaBuffer[1] && deltaBuffer[1] == deltaBuffer[2]); var allDivisable = (isDivisible(deltaBuffer[0], 120) && isDivisible(deltaBuffer[1], 120) && isDivisible(deltaBuffer[2], 120)); return !(allEquals || allDivisable); } function isDivisible(n, divisor) { return (Math.floor(n / divisor) == n / divisor); } if(typeof(chrome) !== 'undefined' && typeof(chrome.storage) !== 'undefined') { chrome.storage.local.get('deltaBuffer', function (stored) { if (stored.deltaBuffer) { deltaBuffer = stored.deltaBuffer; } }); } var requestFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (callback, element, delay) { window.setTimeout(callback, delay || (1000/60)); }; })(); var MutationObserver = window.MutationObserver || window.WebKitMutationObserver; /*********************************************** * PULSE ***********************************************/ /** * Viscous fluid with a pulse for part and decay for the rest. * - Applies a fixed force over an interval (a damped acceleration), and * - Lets the exponential bleed away the velocity over a longer interval * - Michael Herf, http://stereopsis.com/stopping/ */ function pulse_(x) { var val, start, expx; // test x = x * options.pulseScale; if (x < 1) { // acceleartion val = x - (1 - Math.exp(-x)); } else { // tail // the previous animation ended here: start = Math.exp(-1); // simple viscous drag x -= 1; expx = 1 - Math.exp(-x); val = start + (expx * (1 - start)); } return val * options.pulseNormalize; } function pulse(x) { if (x >= 1) return 1; if (x <= 0) return 0; if (options.pulseNormalize == 1) { options.pulseNormalize /= pulse_(1); } return pulse_(x); } addEvent("mousedown", mousedown); addEvent("mousewheel", wheel); addEvent("load", init);
davidHuanghw/david_blog
wp-content/themes/marroco/assets/js/vendors/jquery.smooth-scroll/jquery.smooth-scroll.js
JavaScript
gpl-2.0
16,306
<?php /** * @package AcyMailing for Joomla! * @version 4.6.0 * @author acyba.com * @copyright (C) 2009-2014 ACYBA S.A.R.L. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><?php class UserViewUser extends acymailingView { function display($tpl = null) { $function = $this->getLayout(); if(method_exists($this,$function)) $this->$function(); parent::display($tpl); } function modify(){ global $Itemid; $app = JFactory::getApplication(); $pathway = $app->getPathway(); $document = JFactory::getDocument(); $values = new stdClass(); $values->show_page_heading = 0; $listsClass = acymailing_get('class.list'); $subscriberClass = acymailing_get('class.subscriber'); $jsite = JFactory::getApplication('site'); $menus = $jsite->getMenu(); $menu = $menus->getActive(); if(empty($menu) AND !empty($Itemid)){ $menus->setActive($Itemid); $menu = $menus->getItem($Itemid); } if (is_object( $menu )) { jimport('joomla.html.parameter'); $menuparams = new acyParameter( $menu->params ); if(!empty($menuparams)){ $this->assign('introtext',$menuparams->get('introtext')); $this->assign('finaltext',$menuparams->get('finaltext')); if ($menuparams->get('menu-meta_description')) $document->setDescription($menuparams->get('menu-meta_description')); if ($menuparams->get('menu-meta_keywords')) $document->setMetadata('keywords',$menuparams->get('menu-meta_keywords')); if ($menuparams->get('robots')) $document->setMetadata('robots',$menuparams->get('robots')); if ($menuparams->get('page_title')) $document->setTitle($menuparams->get('page_title')); $values->suffix = $menuparams->get('pageclass_sfx',''); $values->page_heading = ACYMAILING_J16 ? $menuparams->get('page_heading') : $menuparams->get('page_title'); $values->show_page_heading = ACYMAILING_J16 ? $menuparams->get('show_page_heading',0) : $menuparams->get('show_page_title',0); } } $subscriber = $subscriberClass->identify(true); if(empty($subscriber)){ $subscription = $listsClass->getLists('listid'); $subscriber = new stdClass(); $subscriber->html = 1; $subscriber->subid = 0; $subscriber->key = 0; if(!empty($subscription)){ foreach($subscription as $id => $onesub){ $subscription[$id]->status = 1; if(!empty($menuparams) AND strtolower($menuparams->get('listschecked','all')) != 'all' AND !in_array($id,explode(',',$menuparams->get('listschecked','all')))){ $subscription[$id]->status = 0; } } } $pathway->addItem(JText::_('SUBSCRIPTION')); if(empty($menu)) $document->setTitle( JText::_('SUBSCRIPTION')); }else{ $subscription = $subscriberClass->getSubscription($subscriber->subid,'listid'); $pathway->addItem(JText::_('MODIFY_SUBSCRIPTION')); if(empty($menu)) $document->setTitle( JText::_('MODIFY_SUBSCRIPTION')); } acymailing_initJSStrings(); if(!empty($menuparams) AND strtolower($menuparams->get('lists','all')) != 'all'){ $visibleLists = strtolower($menuparams->get('lists','all')); if($visibleLists == 'none') $subscription = array(); else{ $newSubscription = array(); $visiblesListsArray = explode(',',$visibleLists); foreach($subscription as $id => $onesub){ if(in_array($id,$visiblesListsArray)) $newSubscription[$id] = $onesub; } $subscription = $newSubscription; } } if(!acymailing_level(3)){ if(!empty($menuparams) && strtolower($menuparams->get('customfields','default')) != 'default'){ $fieldsToDisplay = strtolower($menuparams->get('customfields','default')); $this->assignRef('fieldsToDisplay',$fieldsToDisplay); } else{ $this->assign('fieldsToDisplay','default'); } } $displayLists = false; foreach($subscription as $oneSub){ if(!empty( $oneSub->published) AND $oneSub->visible){ $displayLists = true; break; } } $this->assignRef('values',$values); $this->assign('status',acymailing_get('type.festatus')); $this->assignRef('subscription',$subscription); $this->assignRef('subscriber',$subscriber); $this->assignRef('displayLists',$displayLists); $this->assign('config',acymailing_config()); } function saveunsub(){ $subscriberClass = acymailing_get('class.subscriber'); $subscriber = $subscriberClass->identify(); $this->assignRef('subscriber',$subscriber); $listid = JRequest::getInt('listid'); if(!empty($listid)){ $listClass = acymailing_get('class.list'); $mylist = $listClass->get($listid); $this->assignRef('list',$mylist); } } function unsub(){ $subscriberClass = acymailing_get('class.subscriber'); $config = acymailing_config(); $this->assignRef('config',$config); $subscriber = $subscriberClass->identify(); $this->assignRef('subscriber',$subscriber); $mailid = JRequest::getInt('mailid'); $this->assignRef('mailid',$mailid); $replace = array(); $replace['{list:name}'] = ''; foreach($subscriber as $oneProp => $oneVal){ $replace['{user:'.$oneProp.'}'] = $oneVal; } if(!empty($mailid)){ $classListmail = acymailing_get('class.listmail'); $lists = $classListmail->getLists($mailid); $this->assignRef('lists',$lists); if(!empty($lists)){ $oneList = reset($lists); foreach($oneList as $oneProp => $oneVal){ $replace['{list:'.$oneProp.'}'] = $oneVal; } } } $intro = str_replace('UNSUB_INTRO',JText::_('UNSUB_INTRO'),$config->get('unsub_intro','UNSUB_INTRO')); $intro = '<div class="unsubintro">'.nl2br(str_replace(array_keys($replace),$replace,$intro)).'</div>'; $this->assignRef('intro',$intro); $this->assignRef('replace',$replace); $unsubtext = str_replace(array_keys($replace),$replace,JText::_('UNSUBSCRIBE')); $app = JFactory::getApplication(); $pathway = $app->getPathway(); $pathway->addItem($unsubtext); $document = JFactory::getDocument(); $document->setTitle($unsubtext); } }
Chaitra0209/csuf-biometrics2
components/com_acymailing/views/user/view.html.php
PHP
gpl-2.0
5,964
<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; class LoginController extends Controller { /* |-------------------------------------------------------------------------- | Login Controller |-------------------------------------------------------------------------- | | This controller handles authenticating users for the application and | redirecting them to your home screen. The controller uses a trait | to conveniently provide its functionality to your applications. | */ use AuthenticatesUsers; /** * Where to redirect users after login. * * @var string */ protected $redirectTo = '/articles/create'; /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('guest')->except('logout'); } }
seanachaidh/avalon
App/Http/Controllers/Auth/LoginController.php
PHP
gpl-2.0
954
/* * compiler/compemu_midfunc_arm.cpp - Native MIDFUNCS for ARM * * Copyright (c) 2014 Jens Heitmann of ARAnyM dev team (see AUTHORS) * * Inspired by Christian Bauer's Basilisk II * * Original 68040 JIT compiler for UAE, copyright 2000-2002 Bernd Meyer * * Adaptation for Basilisk II and improvements, copyright 2000-2002 * Gwenole Beauchesne * * Basilisk II (C) 1997-2002 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Note: * File is included by compemu_support.cpp * */ /******************************************************************** * CPU functions exposed to gencomp. Both CREATE and EMIT time * ********************************************************************/ /* * RULES FOR HANDLING REGISTERS: * * * In the function headers, order the parameters * - 1st registers written to * - 2nd read/modify/write registers * - 3rd registers read from * * Before calling raw_*, you must call readreg, writereg or rmw for * each register * * The order for this is * - 1st call remove_offset for all registers written to with size<4 * - 2nd call readreg for all registers read without offset * - 3rd call rmw for all rmw registers * - 4th call readreg_offset for all registers that can handle offsets * - 5th call get_offset for all the registers from the previous step * - 6th call writereg for all written-to registers * - 7th call raw_* * - 8th unlock2 all registers that were locked */ MIDFUNC(0,live_flags,(void)) { live.flags_on_stack=TRASH; live.flags_in_flags=VALID; live.flags_are_important=1; } MIDFUNC(0,dont_care_flags,(void)) { live.flags_are_important=0; } MIDFUNC(0,duplicate_carry,(void)) { evict(FLAGX); make_flags_live_internal(); COMPCALL(setcc_m)((uintptr)live.state[FLAGX].mem,NATIVE_CC_CS); log_vwrite(FLAGX); } MIDFUNC(0,restore_carry,(void)) { #if defined(USE_JIT2) RR4 r=readreg(FLAGX,4); MRS_CPSR(REG_WORK1); TEQ_ri(r,1); CC_BIC_rri(NATIVE_CC_NE, REG_WORK1, REG_WORK1, ARM_C_FLAG); CC_ORR_rri(NATIVE_CC_EQ, REG_WORK1, REG_WORK1, ARM_C_FLAG); MSR_CPSRf_r(REG_WORK1); unlock2(r); #else if (!have_rat_stall) { /* Not a P6 core, i.e. no partial stalls */ bt_l_ri_noclobber(FLAGX,0); } else { /* Avoid the stall the above creates. This is slow on non-P6, though. */ COMPCALL(rol_b_ri(FLAGX,8)); isclean(FLAGX); } #endif } MIDFUNC(0,start_needflags,(void)) { needflags=1; } MIDFUNC(0,end_needflags,(void)) { needflags=0; } MIDFUNC(0,make_flags_live,(void)) { make_flags_live_internal(); } MIDFUNC(2,bt_l_ri,(RR4 r, IMM i)) /* This is defined as only affecting C */ { int size=4; if (i<16) size=2; CLOBBER_BT; r=readreg(r,size); raw_bt_l_ri(r,i); unlock2(r); } MIDFUNC(2,bt_l_rr,(RR4 r, RR4 b)) /* This is defined as only affecting C */ { CLOBBER_BT; r=readreg(r,4); b=readreg(b,4); raw_bt_l_rr(r,b); unlock2(r); unlock2(b); } MIDFUNC(2,btc_l_rr,(RW4 r, RR4 b)) { CLOBBER_BT; b=readreg(b,4); r=rmw(r,4,4); raw_btc_l_rr(r,b); unlock2(r); unlock2(b); } MIDFUNC(2,btr_l_rr,(RW4 r, RR4 b)) { CLOBBER_BT; b=readreg(b,4); r=rmw(r,4,4); raw_btr_l_rr(r,b); unlock2(r); unlock2(b); } MIDFUNC(2,bts_l_rr,(RW4 r, RR4 b)) { CLOBBER_BT; b=readreg(b,4); r=rmw(r,4,4); raw_bts_l_rr(r,b); unlock2(r); unlock2(b); } MIDFUNC(2,mov_l_rm,(W4 d, IMM s)) { CLOBBER_MOV; d=writereg(d,4); raw_mov_l_rm(d,s); unlock2(d); } MIDFUNC(4,mov_l_rm_indexed,(W4 d, IMM base, RR4 index, IMM factor)) { CLOBBER_MOV; index=readreg(index,4); d=writereg(d,4); raw_mov_l_rm_indexed(d,base,index,factor); unlock2(index); unlock2(d); } MIDFUNC(2,mov_l_mi,(IMM d, IMM s)) { CLOBBER_MOV; raw_mov_l_mi(d,s); } MIDFUNC(2,mov_w_mi,(IMM d, IMM s)) { CLOBBER_MOV; raw_mov_w_mi(d,s); } MIDFUNC(2,mov_b_mi,(IMM d, IMM s)) { CLOBBER_MOV; raw_mov_b_mi(d,s); } MIDFUNC(2,rol_b_ri,(RW1 r, IMM i)) { if (!i && !needflags) return; CLOBBER_ROL; r=rmw(r,1,1); raw_rol_b_ri(r,i); unlock2(r); } MIDFUNC(2,rol_w_ri,(RW2 r, IMM i)) { if (!i && !needflags) return; CLOBBER_ROL; r=rmw(r,2,2); raw_rol_w_ri(r,i); unlock2(r); } MIDFUNC(2,rol_l_ri,(RW4 r, IMM i)) { if (!i && !needflags) return; CLOBBER_ROL; r=rmw(r,4,4); raw_rol_l_ri(r,i); unlock2(r); } MIDFUNC(2,rol_l_rr,(RW4 d, RR1 r)) { if (isconst(r)) { COMPCALL(rol_l_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_ROL; r=readreg(r,1); d=rmw(d,4,4); raw_rol_l_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,rol_w_rr,(RW2 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(rol_w_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_ROL; r=readreg(r,1); d=rmw(d,2,2); raw_rol_w_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,rol_b_rr,(RW1 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(rol_b_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_ROL; r=readreg(r,1); d=rmw(d,1,1); raw_rol_b_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shll_l_rr,(RW4 d, RR1 r)) { if (isconst(r)) { COMPCALL(shll_l_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHLL; r=readreg(r,1); d=rmw(d,4,4); raw_shll_l_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shll_w_rr,(RW2 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(shll_w_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHLL; r=readreg(r,1); d=rmw(d,2,2); raw_shll_w_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shll_b_rr,(RW1 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(shll_b_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHLL; r=readreg(r,1); d=rmw(d,1,1); raw_shll_b_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,ror_b_ri,(RR1 r, IMM i)) { if (!i && !needflags) return; CLOBBER_ROR; r=rmw(r,1,1); raw_ror_b_ri(r,i); unlock2(r); } MIDFUNC(2,ror_w_ri,(RR2 r, IMM i)) { if (!i && !needflags) return; CLOBBER_ROR; r=rmw(r,2,2); raw_ror_w_ri(r,i); unlock2(r); } MIDFUNC(2,ror_l_ri,(RR4 r, IMM i)) { if (!i && !needflags) return; CLOBBER_ROR; r=rmw(r,4,4); raw_ror_l_ri(r,i); unlock2(r); } MIDFUNC(2,ror_l_rr,(RR4 d, RR1 r)) { if (isconst(r)) { COMPCALL(ror_l_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_ROR; r=readreg(r,1); d=rmw(d,4,4); raw_ror_l_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,ror_w_rr,(RR2 d, RR1 r)) { if (isconst(r)) { COMPCALL(ror_w_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_ROR; r=readreg(r,1); d=rmw(d,2,2); raw_ror_w_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,ror_b_rr,(RR1 d, RR1 r)) { if (isconst(r)) { COMPCALL(ror_b_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_ROR; r=readreg(r,1); d=rmw(d,1,1); raw_ror_b_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shrl_l_rr,(RW4 d, RR1 r)) { if (isconst(r)) { COMPCALL(shrl_l_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHRL; r=readreg(r,1); d=rmw(d,4,4); raw_shrl_l_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shrl_w_rr,(RW2 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(shrl_w_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHRL; r=readreg(r,1); d=rmw(d,2,2); raw_shrl_w_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shrl_b_rr,(RW1 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(shrl_b_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHRL; r=readreg(r,1); d=rmw(d,1,1); raw_shrl_b_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shll_l_ri,(RW4 r, IMM i)) { if (!i && !needflags) return; if (isconst(r) && !needflags) { live.state[r].val<<=i; return; } CLOBBER_SHLL; r=rmw(r,4,4); raw_shll_l_ri(r,i); unlock2(r); } MIDFUNC(2,shll_w_ri,(RW2 r, IMM i)) { if (!i && !needflags) return; CLOBBER_SHLL; r=rmw(r,2,2); raw_shll_w_ri(r,i); unlock2(r); } MIDFUNC(2,shll_b_ri,(RW1 r, IMM i)) { if (!i && !needflags) return; CLOBBER_SHLL; r=rmw(r,1,1); raw_shll_b_ri(r,i); unlock2(r); } MIDFUNC(2,shrl_l_ri,(RW4 r, IMM i)) { if (!i && !needflags) return; if (isconst(r) && !needflags) { live.state[r].val>>=i; return; } CLOBBER_SHRL; r=rmw(r,4,4); raw_shrl_l_ri(r,i); unlock2(r); } MIDFUNC(2,shrl_w_ri,(RW2 r, IMM i)) { if (!i && !needflags) return; CLOBBER_SHRL; r=rmw(r,2,2); raw_shrl_w_ri(r,i); unlock2(r); } MIDFUNC(2,shrl_b_ri,(RW1 r, IMM i)) { if (!i && !needflags) return; CLOBBER_SHRL; r=rmw(r,1,1); raw_shrl_b_ri(r,i); unlock2(r); } MIDFUNC(2,shra_l_ri,(RW4 r, IMM i)) { if (!i && !needflags) return; CLOBBER_SHRA; r=rmw(r,4,4); raw_shra_l_ri(r,i); unlock2(r); } MIDFUNC(2,shra_w_ri,(RW2 r, IMM i)) { if (!i && !needflags) return; CLOBBER_SHRA; r=rmw(r,2,2); raw_shra_w_ri(r,i); unlock2(r); } MIDFUNC(2,shra_b_ri,(RW1 r, IMM i)) { if (!i && !needflags) return; CLOBBER_SHRA; r=rmw(r,1,1); raw_shra_b_ri(r,i); unlock2(r); } MIDFUNC(2,shra_l_rr,(RW4 d, RR1 r)) { if (isconst(r)) { COMPCALL(shra_l_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHRA; r=readreg(r,1); d=rmw(d,4,4); raw_shra_l_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shra_w_rr,(RW2 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(shra_w_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHRA; r=readreg(r,1); d=rmw(d,2,2); raw_shra_w_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,shra_b_rr,(RW1 d, RR1 r)) { /* Can only do this with r==1, i.e. cl */ if (isconst(r)) { COMPCALL(shra_b_ri)(d,(uae_u8)live.state[r].val); return; } CLOBBER_SHRA; r=readreg(r,1); d=rmw(d,1,1); raw_shra_b_rr(d,r); unlock2(r); unlock2(d); } MIDFUNC(2,setcc,(W1 d, IMM cc)) { CLOBBER_SETCC; d=writereg(d,1); raw_setcc(d,cc); unlock2(d); } MIDFUNC(2,setcc_m,(IMM d, IMM cc)) { CLOBBER_SETCC; raw_setcc_m(d,cc); } MIDFUNC(3,cmov_l_rr,(RW4 d, RR4 s, IMM cc)) { if (d==s) return; CLOBBER_CMOV; s=readreg(s,4); d=rmw(d,4,4); raw_cmov_l_rr(d,s,cc); unlock2(s); unlock2(d); } MIDFUNC(2,bsf_l_rr,(W4 d, W4 s)) { CLOBBER_BSF; s = readreg(s, 4); d = writereg(d, 4); raw_bsf_l_rr(d, s); unlock2(s); unlock2(d); } /* Set the Z flag depending on the value in s. Note that the value has to be 0 or -1 (or, more precisely, for non-zero values, bit 14 must be set)! */ MIDFUNC(2,simulate_bsf,(W4 tmp, RW4 s)) { CLOBBER_BSF; s=rmw_specific(s,4,4,FLAG_NREG3); tmp=writereg(tmp,4); raw_flags_set_zero(s, tmp); unlock2(tmp); unlock2(s); } MIDFUNC(2,imul_32_32,(RW4 d, RR4 s)) { CLOBBER_MUL; s=readreg(s,4); d=rmw(d,4,4); raw_imul_32_32(d,s); unlock2(s); unlock2(d); } MIDFUNC(2,imul_64_32,(RW4 d, RW4 s)) { CLOBBER_MUL; s=rmw_specific(s,4,4,MUL_NREG2); d=rmw_specific(d,4,4,MUL_NREG1); raw_imul_64_32(d,s); unlock2(s); unlock2(d); } MIDFUNC(2,mul_64_32,(RW4 d, RW4 s)) { CLOBBER_MUL; s=rmw_specific(s,4,4,MUL_NREG2); d=rmw_specific(d,4,4,MUL_NREG1); raw_mul_64_32(d,s); unlock2(s); unlock2(d); } MIDFUNC(2,sign_extend_16_rr,(W4 d, RR2 s)) { int isrmw; if (isconst(s)) { set_const(d,(uae_s32)(uae_s16)live.state[s].val); return; } CLOBBER_SE16; isrmw=(s==d); if (!isrmw) { s=readreg(s,2); d=writereg(d,4); } else { /* If we try to lock this twice, with different sizes, we are int trouble! */ s=d=rmw(s,4,2); } raw_sign_extend_16_rr(d,s); if (!isrmw) { unlock2(d); unlock2(s); } else { unlock2(s); } } MIDFUNC(2,sign_extend_8_rr,(W4 d, RR1 s)) { int isrmw; if (isconst(s)) { set_const(d,(uae_s32)(uae_s8)live.state[s].val); return; } isrmw=(s==d); CLOBBER_SE8; if (!isrmw) { s=readreg(s,1); d=writereg(d,4); } else { /* If we try to lock this twice, with different sizes, we are int trouble! */ s=d=rmw(s,4,1); } raw_sign_extend_8_rr(d,s); if (!isrmw) { unlock2(d); unlock2(s); } else { unlock2(s); } } MIDFUNC(2,zero_extend_16_rr,(W4 d, RR2 s)) { int isrmw; if (isconst(s)) { set_const(d,(uae_u32)(uae_u16)live.state[s].val); return; } isrmw=(s==d); CLOBBER_ZE16; if (!isrmw) { s=readreg(s,2); d=writereg(d,4); } else { /* If we try to lock this twice, with different sizes, we are int trouble! */ s=d=rmw(s,4,2); } raw_zero_extend_16_rr(d,s); if (!isrmw) { unlock2(d); unlock2(s); } else { unlock2(s); } } MIDFUNC(2,zero_extend_8_rr,(W4 d, RR1 s)) { int isrmw; if (isconst(s)) { set_const(d,(uae_u32)(uae_u8)live.state[s].val); return; } isrmw=(s==d); CLOBBER_ZE8; if (!isrmw) { s=readreg(s,1); d=writereg(d,4); } else { /* If we try to lock this twice, with different sizes, we are int trouble! */ s=d=rmw(s,4,1); } raw_zero_extend_8_rr(d,s); if (!isrmw) { unlock2(d); unlock2(s); } else { unlock2(s); } } MIDFUNC(2,mov_b_rr,(W1 d, RR1 s)) { if (d==s) return; if (isconst(s)) { COMPCALL(mov_b_ri)(d,(uae_u8)live.state[s].val); return; } CLOBBER_MOV; s=readreg(s,1); d=writereg(d,1); raw_mov_b_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,mov_w_rr,(W2 d, RR2 s)) { if (d==s) return; if (isconst(s)) { COMPCALL(mov_w_ri)(d,(uae_u16)live.state[s].val); return; } CLOBBER_MOV; s=readreg(s,2); d=writereg(d,2); raw_mov_w_rr(d,s); unlock2(d); unlock2(s); } /* read the long at the address contained in s+offset and store in d */ MIDFUNC(3,mov_l_rR,(W4 d, RR4 s, IMM offset)) { if (isconst(s)) { COMPCALL(mov_l_rm)(d,live.state[s].val+offset); return; } CLOBBER_MOV; s=readreg(s,4); d=writereg(d,4); raw_mov_l_rR(d,s,offset); unlock2(d); unlock2(s); } /* read the word at the address contained in s+offset and store in d */ MIDFUNC(3,mov_w_rR,(W2 d, RR4 s, IMM offset)) { if (isconst(s)) { COMPCALL(mov_w_rm)(d,live.state[s].val+offset); return; } CLOBBER_MOV; s=readreg(s,4); d=writereg(d,2); raw_mov_w_rR(d,s,offset); unlock2(d); unlock2(s); } /* read the long at the address contained in s+offset and store in d */ MIDFUNC(3,mov_l_brR,(W4 d, RR4 s, IMM offset)) { int sreg=s; if (isconst(s)) { COMPCALL(mov_l_rm)(d,live.state[s].val+offset); return; } CLOBBER_MOV; s=readreg_offset(s,4); offset+=get_offset(sreg); d=writereg(d,4); raw_mov_l_brR(d,s,offset); unlock2(d); unlock2(s); } /* read the word at the address contained in s+offset and store in d */ MIDFUNC(3,mov_w_brR,(W2 d, RR4 s, IMM offset)) { int sreg=s; if (isconst(s)) { COMPCALL(mov_w_rm)(d,live.state[s].val+offset); return; } CLOBBER_MOV; remove_offset(d,-1); s=readreg_offset(s,4); offset+=get_offset(sreg); d=writereg(d,2); raw_mov_w_brR(d,s,offset); unlock2(d); unlock2(s); } /* read the word at the address contained in s+offset and store in d */ MIDFUNC(3,mov_b_brR,(W1 d, RR4 s, IMM offset)) { int sreg=s; if (isconst(s)) { COMPCALL(mov_b_rm)(d,live.state[s].val+offset); return; } CLOBBER_MOV; remove_offset(d,-1); s=readreg_offset(s,4); offset+=get_offset(sreg); d=writereg(d,1); raw_mov_b_brR(d,s,offset); unlock2(d); unlock2(s); } MIDFUNC(3,mov_l_Ri,(RR4 d, IMM i, IMM offset)) { int dreg=d; if (isconst(d)) { COMPCALL(mov_l_mi)(live.state[d].val+offset,i); return; } CLOBBER_MOV; d=readreg_offset(d,4); offset+=get_offset(dreg); raw_mov_l_Ri(d,i,offset); unlock2(d); } MIDFUNC(3,mov_w_Ri,(RR4 d, IMM i, IMM offset)) { int dreg=d; if (isconst(d)) { COMPCALL(mov_w_mi)(live.state[d].val+offset,i); return; } CLOBBER_MOV; d=readreg_offset(d,4); offset+=get_offset(dreg); raw_mov_w_Ri(d,i,offset); unlock2(d); } /* Warning! OFFSET is byte sized only! */ MIDFUNC(3,mov_l_Rr,(RR4 d, RR4 s, IMM offset)) { if (isconst(d)) { COMPCALL(mov_l_mr)(live.state[d].val+offset,s); return; } if (isconst(s)) { COMPCALL(mov_l_Ri)(d,live.state[s].val,offset); return; } CLOBBER_MOV; s=readreg(s,4); d=readreg(d,4); raw_mov_l_Rr(d,s,offset); unlock2(d); unlock2(s); } MIDFUNC(3,mov_w_Rr,(RR4 d, RR2 s, IMM offset)) { if (isconst(d)) { COMPCALL(mov_w_mr)(live.state[d].val+offset,s); return; } if (isconst(s)) { COMPCALL(mov_w_Ri)(d,(uae_u16)live.state[s].val,offset); return; } CLOBBER_MOV; s=readreg(s,2); d=readreg(d,4); raw_mov_w_Rr(d,s,offset); unlock2(d); unlock2(s); } MIDFUNC(3,lea_l_brr,(W4 d, RR4 s, IMM offset)) { if (isconst(s)) { COMPCALL(mov_l_ri)(d,live.state[s].val+offset); return; } #if USE_OFFSET if (d==s) { add_offset(d,offset); return; } #endif CLOBBER_LEA; s=readreg(s,4); d=writereg(d,4); raw_lea_l_brr(d,s,offset); unlock2(d); unlock2(s); } MIDFUNC(5,lea_l_brr_indexed,(W4 d, RR4 s, RR4 index, IMM factor, IMM offset)) { if (!offset) { COMPCALL(lea_l_rr_indexed)(d,s,index,factor); return; } CLOBBER_LEA; s=readreg(s,4); index=readreg(index,4); d=writereg(d,4); raw_lea_l_brr_indexed(d,s,index,factor,offset); unlock2(d); unlock2(index); unlock2(s); } MIDFUNC(4,lea_l_rr_indexed,(W4 d, RR4 s, RR4 index, IMM factor)) { CLOBBER_LEA; s=readreg(s,4); index=readreg(index,4); d=writereg(d,4); raw_lea_l_rr_indexed(d,s,index,factor); unlock2(d); unlock2(index); unlock2(s); } /* write d to the long at the address contained in s+offset */ MIDFUNC(3,mov_l_bRr,(RR4 d, RR4 s, IMM offset)) { int dreg=d; if (isconst(d)) { COMPCALL(mov_l_mr)(live.state[d].val+offset,s); return; } CLOBBER_MOV; s=readreg(s,4); d=readreg_offset(d,4); offset+=get_offset(dreg); raw_mov_l_bRr(d,s,offset); unlock2(d); unlock2(s); } /* write the word at the address contained in s+offset and store in d */ MIDFUNC(3,mov_w_bRr,(RR4 d, RR2 s, IMM offset)) { int dreg=d; if (isconst(d)) { COMPCALL(mov_w_mr)(live.state[d].val+offset,s); return; } CLOBBER_MOV; s=readreg(s,2); d=readreg_offset(d,4); offset+=get_offset(dreg); raw_mov_w_bRr(d,s,offset); unlock2(d); unlock2(s); } MIDFUNC(3,mov_b_bRr,(RR4 d, RR1 s, IMM offset)) { int dreg=d; if (isconst(d)) { COMPCALL(mov_b_mr)(live.state[d].val+offset,s); return; } CLOBBER_MOV; s=readreg(s,1); d=readreg_offset(d,4); offset+=get_offset(dreg); raw_mov_b_bRr(d,s,offset); unlock2(d); unlock2(s); } MIDFUNC(1,mid_bswap_32,(RW4 r)) { if (isconst(r)) { uae_u32 oldv=live.state[r].val; live.state[r].val=reverse32(oldv); return; } CLOBBER_SW32; r=rmw(r,4,4); raw_bswap_32(r); unlock2(r); } MIDFUNC(1,mid_bswap_16,(RW2 r)) { if (isconst(r)) { uae_u32 oldv=live.state[r].val; live.state[r].val=((oldv>>8)&0xff) | ((oldv<<8)&0xff00) | (oldv&0xffff0000); return; } CLOBBER_SW16; r=rmw(r,2,2); raw_bswap_16(r); unlock2(r); } MIDFUNC(2,mov_l_rr,(W4 d, RR4 s)) { int olds; if (d==s) { /* How pointless! */ return; } if (isconst(s)) { COMPCALL(mov_l_ri)(d,live.state[s].val); return; } olds=s; disassociate(d); s=readreg_offset(s,4); live.state[d].realreg=s; live.state[d].realind=live.nat[s].nholds; live.state[d].val=live.state[olds].val; live.state[d].validsize=4; live.state[d].dirtysize=4; set_status(d,DIRTY); live.nat[s].holds[live.nat[s].nholds]=d; live.nat[s].nholds++; log_clobberreg(d); D2(panicbug("Added %d to nreg %d(%d), now holds %d regs", d,s,live.state[d].realind,live.nat[s].nholds)); unlock2(s); } MIDFUNC(2,mov_l_mr,(IMM d, RR4 s)) { if (isconst(s)) { COMPCALL(mov_l_mi)(d,live.state[s].val); return; } CLOBBER_MOV; s=readreg(s,4); raw_mov_l_mr(d,s); unlock2(s); } MIDFUNC(2,mov_w_mr,(IMM d, RR2 s)) { if (isconst(s)) { COMPCALL(mov_w_mi)(d,(uae_u16)live.state[s].val); return; } CLOBBER_MOV; s=readreg(s,2); raw_mov_w_mr(d,s); unlock2(s); } MIDFUNC(2,mov_w_rm,(W2 d, IMM s)) { CLOBBER_MOV; d=writereg(d,2); raw_mov_w_rm(d,s); unlock2(d); } MIDFUNC(2,mov_b_mr,(IMM d, RR1 s)) { if (isconst(s)) { COMPCALL(mov_b_mi)(d,(uae_u8)live.state[s].val); return; } CLOBBER_MOV; s=readreg(s,1); raw_mov_b_mr(d,s); unlock2(s); } MIDFUNC(2,mov_b_rm,(W1 d, IMM s)) { CLOBBER_MOV; d=writereg(d,1); raw_mov_b_rm(d,s); unlock2(d); } MIDFUNC(2,mov_l_ri,(W4 d, IMM s)) { set_const(d,s); return; } MIDFUNC(2,mov_w_ri,(W2 d, IMM s)) { CLOBBER_MOV; d=writereg(d,2); raw_mov_w_ri(d,s); unlock2(d); } MIDFUNC(2,mov_b_ri,(W1 d, IMM s)) { CLOBBER_MOV; d=writereg(d,1); raw_mov_b_ri(d,s); unlock2(d); } MIDFUNC(2,test_l_ri,(RR4 d, IMM i)) { CLOBBER_TEST; d=readreg(d,4); raw_test_l_ri(d,i); unlock2(d); } MIDFUNC(2,test_l_rr,(RR4 d, RR4 s)) { CLOBBER_TEST; d=readreg(d,4); s=readreg(s,4); raw_test_l_rr(d,s);; unlock2(d); unlock2(s); } MIDFUNC(2,test_w_rr,(RR2 d, RR2 s)) { CLOBBER_TEST; d=readreg(d,2); s=readreg(s,2); raw_test_w_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,test_b_rr,(RR1 d, RR1 s)) { CLOBBER_TEST; d=readreg(d,1); s=readreg(s,1); raw_test_b_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,and_l_ri,(RW4 d, IMM i)) { if (isconst(d) && !needflags) { live.state[d].val &= i; return; } CLOBBER_AND; d=rmw(d,4,4); raw_and_l_ri(d,i); unlock2(d); } MIDFUNC(2,and_l,(RW4 d, RR4 s)) { CLOBBER_AND; s=readreg(s,4); d=rmw(d,4,4); raw_and_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,and_w,(RW2 d, RR2 s)) { CLOBBER_AND; s=readreg(s,2); d=rmw(d,2,2); raw_and_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,and_b,(RW1 d, RR1 s)) { CLOBBER_AND; s=readreg(s,1); d=rmw(d,1,1); raw_and_b(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,or_l_ri,(RW4 d, IMM i)) { if (isconst(d) && !needflags) { live.state[d].val|=i; return; } CLOBBER_OR; d=rmw(d,4,4); raw_or_l_ri(d,i); unlock2(d); } MIDFUNC(2,or_l,(RW4 d, RR4 s)) { if (isconst(d) && isconst(s) && !needflags) { live.state[d].val|=live.state[s].val; return; } CLOBBER_OR; s=readreg(s,4); d=rmw(d,4,4); raw_or_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,or_w,(RW2 d, RR2 s)) { CLOBBER_OR; s=readreg(s,2); d=rmw(d,2,2); raw_or_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,or_b,(RW1 d, RR1 s)) { CLOBBER_OR; s=readreg(s,1); d=rmw(d,1,1); raw_or_b(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,adc_l,(RW4 d, RR4 s)) { CLOBBER_ADC; s=readreg(s,4); d=rmw(d,4,4); raw_adc_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,adc_w,(RW2 d, RR2 s)) { CLOBBER_ADC; s=readreg(s,2); d=rmw(d,2,2); raw_adc_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,adc_b,(RW1 d, RR1 s)) { CLOBBER_ADC; s=readreg(s,1); d=rmw(d,1,1); raw_adc_b(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,add_l,(RW4 d, RR4 s)) { if (isconst(s)) { COMPCALL(add_l_ri)(d,live.state[s].val); return; } CLOBBER_ADD; s=readreg(s,4); d=rmw(d,4,4); raw_add_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,add_w,(RW2 d, RR2 s)) { if (isconst(s)) { COMPCALL(add_w_ri)(d,(uae_u16)live.state[s].val); return; } CLOBBER_ADD; s=readreg(s,2); d=rmw(d,2,2); raw_add_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,add_b,(RW1 d, RR1 s)) { if (isconst(s)) { COMPCALL(add_b_ri)(d,(uae_u8)live.state[s].val); return; } CLOBBER_ADD; s=readreg(s,1); d=rmw(d,1,1); raw_add_b(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,sub_l_ri,(RW4 d, IMM i)) { if (!i && !needflags) return; if (isconst(d) && !needflags) { live.state[d].val-=i; return; } #if USE_OFFSET if (!needflags) { add_offset(d,-i); return; } #endif CLOBBER_SUB; d=rmw(d,4,4); raw_sub_l_ri(d,i); unlock2(d); } MIDFUNC(2,sub_w_ri,(RW2 d, IMM i)) { if (!i && !needflags) return; CLOBBER_SUB; d=rmw(d,2,2); raw_sub_w_ri(d,i); unlock2(d); } MIDFUNC(2,sub_b_ri,(RW1 d, IMM i)) { if (!i && !needflags) return; CLOBBER_SUB; d=rmw(d,1,1); raw_sub_b_ri(d,i); unlock2(d); } MIDFUNC(2,add_l_ri,(RW4 d, IMM i)) { if (!i && !needflags) return; if (isconst(d) && !needflags) { live.state[d].val+=i; return; } #if USE_OFFSET if (!needflags) { add_offset(d,i); return; } #endif CLOBBER_ADD; d=rmw(d,4,4); raw_add_l_ri(d,i); unlock2(d); } MIDFUNC(2,add_w_ri,(RW2 d, IMM i)) { if (!i && !needflags) return; CLOBBER_ADD; d=rmw(d,2,2); raw_add_w_ri(d,i); unlock2(d); } MIDFUNC(2,add_b_ri,(RW1 d, IMM i)) { if (!i && !needflags) return; CLOBBER_ADD; d=rmw(d,1,1); raw_add_b_ri(d,i); unlock2(d); } MIDFUNC(2,sbb_l,(RW4 d, RR4 s)) { CLOBBER_SBB; s=readreg(s,4); d=rmw(d,4,4); raw_sbb_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,sbb_w,(RW2 d, RR2 s)) { CLOBBER_SBB; s=readreg(s,2); d=rmw(d,2,2); raw_sbb_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,sbb_b,(RW1 d, RR1 s)) { CLOBBER_SBB; s=readreg(s,1); d=rmw(d,1,1); raw_sbb_b(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,sub_l,(RW4 d, RR4 s)) { if (isconst(s)) { COMPCALL(sub_l_ri)(d,live.state[s].val); return; } CLOBBER_SUB; s=readreg(s,4); d=rmw(d,4,4); raw_sub_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,sub_w,(RW2 d, RR2 s)) { if (isconst(s)) { COMPCALL(sub_w_ri)(d,(uae_u16)live.state[s].val); return; } CLOBBER_SUB; s=readreg(s,2); d=rmw(d,2,2); raw_sub_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,sub_b,(RW1 d, RR1 s)) { if (isconst(s)) { COMPCALL(sub_b_ri)(d,(uae_u8)live.state[s].val); return; } CLOBBER_SUB; s=readreg(s,1); d=rmw(d,1,1); raw_sub_b(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,cmp_l,(RR4 d, RR4 s)) { CLOBBER_CMP; s=readreg(s,4); d=readreg(d,4); raw_cmp_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,cmp_w,(RR2 d, RR2 s)) { CLOBBER_CMP; s=readreg(s,2); d=readreg(d,2); raw_cmp_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,cmp_b,(RR1 d, RR1 s)) { CLOBBER_CMP; s=readreg(s,1); d=readreg(d,1); raw_cmp_b(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,xor_l,(RW4 d, RR4 s)) { CLOBBER_XOR; s=readreg(s,4); d=rmw(d,4,4); raw_xor_l(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,xor_w,(RW2 d, RR2 s)) { CLOBBER_XOR; s=readreg(s,2); d=rmw(d,2,2); raw_xor_w(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,xor_b,(RW1 d, RR1 s)) { CLOBBER_XOR; s=readreg(s,1); d=rmw(d,1,1); raw_xor_b(d,s); unlock2(d); unlock2(s); } #if defined(UAE) MIDFUNC(5,call_r_02,(RR4 r, RR4 in1, RR4 in2, IMM isize1, IMM isize2)) { clobber_flags(); in1=readreg_specific(in1,isize1,REG_PAR1); in2=readreg_specific(in2,isize2,REG_PAR2); r=readreg(r,4); prepare_for_call_1(); unlock2(r); unlock2(in1); unlock2(in2); prepare_for_call_2(); compemu_raw_call_r(r); } #endif #if defined(UAE) MIDFUNC(5,call_r_11,(W4 out1, RR4 r, RR4 in1, IMM osize, IMM isize)) { clobber_flags(); if (osize==4) { if (out1!=in1 && out1!=r) { COMPCALL(forget_about)(out1); } } else { tomem_c(out1); } in1=readreg_specific(in1,isize,REG_PAR1); r=readreg(r,4); prepare_for_call_1(); unlock2(in1); unlock2(r); prepare_for_call_2(); compemu_raw_call_r(r); live.nat[REG_RESULT].holds[0]=out1; live.nat[REG_RESULT].nholds=1; live.nat[REG_RESULT].touched=touchcnt++; live.state[out1].realreg=REG_RESULT; live.state[out1].realind=0; live.state[out1].val=0; live.state[out1].validsize=osize; live.state[out1].dirtysize=osize; set_status(out1,DIRTY); } #endif MIDFUNC(0,nop,(void)) { raw_emit_nop(); } /* forget_about() takes a mid-layer register */ MIDFUNC(1,forget_about,(W4 r)) { if (isinreg(r)) disassociate(r); live.state[r].val=0; set_status(r,UNDEF); } MIDFUNC(1,f_forget_about,(FW r)) { if (f_isinreg(r)) f_disassociate(r); live.fate[r].status=UNDEF; } // ARM optimized functions MIDFUNC(2,arm_ADD_l,(RW4 d, RR4 s)) { if (isconst(s)) { COMPCALL(arm_ADD_l_ri)(d,live.state[s].val); return; } s=readreg(s,4); d=rmw(d,4,4); raw_ADD_l_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_ADD_l_ri,(RW4 d, IMM i)) { if (!i) return; if (isconst(d)) { live.state[d].val+=i; return; } #if USE_OFFSET add_offset(d,i); return; #endif d=rmw(d,4,4); raw_LDR_l_ri(REG_WORK1, i); raw_ADD_l_rr(d,REG_WORK1); unlock2(d); } MIDFUNC(2,arm_ADD_l_ri8,(RW4 d, IMM i)) { if (!i) return; if (isconst(d)) { live.state[d].val+=i; return; } #if USE_OFFSET add_offset(d,i); return; #endif d=rmw(d,4,4); raw_ADD_l_rri(d,d,i); unlock2(d); } MIDFUNC(2,arm_SUB_l_ri8,(RW4 d, IMM i)) { if (!i) return; if (isconst(d)) { live.state[d].val-=i; return; } #if USE_OFFSET add_offset(d,-i); return; #endif d=rmw(d,4,4); raw_SUB_l_rri(d,d,i); unlock2(d); } MIDFUNC(2,arm_AND_l,(RW4 d, RR4 s)) { s=readreg(s,4); d=rmw(d,4,4); raw_AND_l_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_AND_w,(RW2 d, RR2 s)) { s=readreg(s,2); d=rmw(d,2,2); raw_AND_w_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_AND_b,(RW1 d, RR1 s)) { s=readreg(s,1); d=rmw(d,1,1); raw_AND_b_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_AND_l_ri8,(RW4 d, IMM i)) { if (isconst(d)) { live.state[d].val &= i; return; } d=rmw(d,4,4); raw_AND_l_ri(d,i); unlock2(d); } MIDFUNC(2,arm_EOR_b,(RW1 d, RR1 s)) { s=readreg(s,1); d=rmw(d,1,1); raw_EOR_b_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_EOR_l,(RW4 d, RR4 s)) { s=readreg(s,4); d=rmw(d,4,4); raw_EOR_l_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_EOR_w,(RW2 d, RR2 s)) { s=readreg(s,2); d=rmw(d,2,2); raw_EOR_w_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_ORR_b,(RW1 d, RR1 s)) { s=readreg(s,1); d=rmw(d,1,1); raw_ORR_b_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_ORR_l,(RW4 d, RR4 s)) { if (isconst(d) && isconst(s)) { live.state[d].val|=live.state[s].val; return; } s=readreg(s,4); d=rmw(d,4,4); raw_ORR_l_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_ORR_w,(RW2 d, RR2 s)) { s=readreg(s,2); d=rmw(d,2,2); raw_ORR_w_rr(d,s); unlock2(d); unlock2(s); } MIDFUNC(2,arm_ROR_l_ri8,(RW4 r, IMM i)) { if (!i) return; r=rmw(r,4,4); raw_ROR_l_ri(r,i); unlock2(r); } // Other static inline void flush_cpu_icache(void *start, void *stop) { register void *_beg __asm ("a1") = start; register void *_end __asm ("a2") = stop; register void *_flg __asm ("a3") = 0; #ifdef __ARM_EABI__ register unsigned long _scno __asm ("r7") = 0xf0002; __asm __volatile ("swi 0x0 @ sys_cacheflush" : "=r" (_beg) : "0" (_beg), "r" (_end), "r" (_flg), "r" (_scno)); #else __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" : "=r" (_beg) : "0" (_beg), "r" (_end), "r" (_flg)); #endif } static inline void write_jmp_target(uae_u32* jmpaddr, cpuop_func* a) { *(jmpaddr) = (uae_u32) a; flush_cpu_icache((void *) jmpaddr, (void *) &jmpaddr[1]); } static inline void emit_jmp_target(uae_u32 a) { emit_long((uae_u32) a); }
aranym/aranym
src/uae_cpu/compiler/compemu_midfunc_arm.cpp
C++
gpl-2.0
30,786
/* * VoiceEqualityRangeFeature.java * Version 1.2 * * Last modified on April 11, 2010. * McGill University */ package jsymbolic.features; import java.util.LinkedList; import javax.sound.midi.*; import ace.datatypes.FeatureDefinition; import jsymbolic.processing.MIDIIntermediateRepresentations; /** * A feature exractor that finds the standard deviation of the differences * between the highest and lowest pitches in each channel that contains at least * one note. * * <p>No extracted feature values are stored in objects of this class. * * @author Cory McKay */ public class VoiceEqualityRangeFeature extends MIDIFeatureExtractor { /* CONSTRUCTOR ***********************************************************/ /** * Basic constructor that sets the definition and dependencies (and their * offsets) of this feature. */ public VoiceEqualityRangeFeature() { String name = "Voice Equality - Range"; String description = "Standard deviation of the differences between the highest and lowest\n" + "pitches in each channel that contains at least one note."; boolean is_sequential = true; int dimensions = 1; definition = new FeatureDefinition( name, description, is_sequential, dimensions ); dependencies = null; offsets = null; } /* PUBLIC METHODS ********************************************************/ /** * Extracts this feature from the given MIDI sequence given the other * feature values. * * <p>In the case of this feature, the other_feature_values parameters * are ignored. * * @param sequence The MIDI sequence to extract the feature * from. * @param sequence_info Additional data about the MIDI sequence. * @param other_feature_values The values of other features that are * needed to calculate this value. The * order and offsets of these features * must be the same as those returned by * this class's getDependencies and * getDependencyOffsets methods * respectively. The first indice indicates * the feature/window and the second * indicates the value. * @return The extracted feature value(s). * @throws Exception Throws an informative exception if the * feature cannot be calculated. */ public double[] extractFeature( Sequence sequence, MIDIIntermediateRepresentations sequence_info, double[][] other_feature_values ) throws Exception { double value; if (sequence_info != null) { // Find the number of channels with no note ons int silent_count = 0; for (int chan = 0; chan < sequence_info.channel_statistics.length; chan++) if (sequence_info.channel_statistics[chan][0] == 0 || chan == (10 - 1)) silent_count++; // Store the number of note ons in each channel with note ons double[] range = new double[sequence_info.channel_statistics.length - silent_count]; int count = 0; for (int chan = 0; chan < sequence_info.channel_statistics.length; chan++) if (sequence_info.channel_statistics[chan][0] != 0 && chan != (10 - 1)) { int lowest = sequence_info.channel_statistics[chan][4]; int highest = sequence_info.channel_statistics[chan][5]; range[count] = (double) (highest - lowest); count++; } // Calculate the standard deviation value = mckay.utilities.staticlibraries.MathAndStatsMethods.getStandardDeviation(range); } else value = -1.0; double[] result = new double[1]; result[0] = value; return result; } }
dmcennis/jMir
jMIR_2_4_developer/jSymbolic/src/jsymbolic/features/VoiceEqualityRangeFeature.java
Java
gpl-2.0
4,264
<?php /** * $Id$ * Module: SmartPartner * Author: The SmartFactory <www.smartfactory.ca> * Licence: GNU */ /** *Ceci nous produira un tableau de forme: * *PartnersArray[] = * PartnersArray[TopCat1][info] = (nom, description) * PartnersArray[TopCat1][partners] = array de partner (via fct get_partners_array()) * PartnersArray[TopCat1][subcats][0][info] = (nom, description) * PartnersArray[TopCat1][subcats][0][partners] = array de partner * PartnersArray[TopCat1][subcats][0][subcats].... * Ainsi de suite * *ex: PartnersArray[TopCat1][partners][0][nom] contiendra le nom du 1er partenaire de TopCat1 * */ /** *Loop inside the array of all partners to match with current category * *param $categoryid - id of the current category *return array of partners for the current category */ function get_partners_array($categoryid){ global $every_partners_array , $count, $xoopsModuleConfig, $view_category_id; $partners = array(); foreach ($every_partners_array as $partnerObj ){ if(in_array($categoryid, explode('|',$partnerObj->categoryid())) && ($view_category_id || (!$view_category_id && sizeof($partners) < $xoopsModuleConfig['percat_user']))){ $partner = $partnerObj->toArray('index'); $partners[] = $partner; } } return $partners; } /** *Loop inside the array of all categories to find subcats for current category *recusrive function: for each subcat found, call to function getcontent to *get partners and subcats within it * *param $categoryid - id of the current category *return array of subcats for the current category */ function get_subcats($every_categories_array,$categoryid, $level){ //global $every_categories_array; $subcatArray = array(); $level++; foreach ($every_categories_array as $subcatObj) { if($subcatObj->parentid() == $categoryid ){ $subcatArray[] = get_cat_content($every_categories_array,$subcatObj,$level); } } return $subcatArray; } /** *Retrieve content for the current category * *param $categoryid - id of the current category *return array of content for the current category */ function get_cat_content($every_categories_array, $categoryObj,$level){ $category = array(); $decalage=''; /*for($i=0;$i<$level;$i++){ $decalage .= '--'; }*/ $decalage .= ' '; $category['title'] = $decalage.''.$categoryObj->name(); $category['categoryid'] = $categoryObj->categoryid(); $category['description'] = $categoryObj->description(); $category['link_view'] = $categoryObj->getCategoryUrl(); $category['partners'] = get_partners_array($categoryObj->categoryid()); $category['partner_count'] = count($category['partners']); $category['image_url'] = $categoryObj->getImageUrl(true); $category['subcats'] = get_subcats($every_categories_array,$categoryObj->categoryid(),$level); return $category; } include "header.php"; $xoopsOption['template_main'] = 'smartpartner_index.html'; include XOOPS_ROOT_PATH."/header.php"; include "footer.php"; // At which record shall we start $start = isset($_GET['start']) ? intval($_GET['start']) : 0; $view_category_id = isset($_GET['view_category_id']) ? intval($_GET['view_category_id']) : 0; $partners_total = $smartpartner_partner_handler->getPartnerCount(); if($xoopsModuleConfig['index_sortby']== 'title' || $xoopsModuleConfig['index_sortby']== 'weight'){ $order = 'ASC'; } else{ $order = 'DESC'; } //Retreive all records from database $every_categories_array = $smartpartner_category_handler->getCategories(0,0,-1,'weight', 'ASC', true); $every_partners_array = $smartpartner_partner_handler->getPartnersForIndex(-1, _SPARTNER_STATUS_ACTIVE, $xoopsModuleConfig['index_sortby'], $order); $partnersArray = array(); //display All categories and partners if(!$view_category_id){ //get orphan first if preference says so if($xoopsModuleConfig['orphan_first']){ $partnersArray['orphan']['partners']= get_partners_array(0); } //get all categories and content foreach ( $every_categories_array as $categoryObj){ if ($categoryObj->parentid()==0){ $partnersArray[] = get_cat_content($every_categories_array, $categoryObj,0); } } //get orphan last if preference says so if(!$xoopsModuleConfig['orphan_first']){ $partnersArray['orphan']['partners']= get_partners_array(0); } $categoryPath = ''; } //viewing a specific category else{ $currentCategoryObj = $every_categories_array[$view_category_id]; $partnersArray[] = get_cat_content($every_categories_array, $currentCategoryObj, 0); if (!$partnersArray[0]['partners'] && !$partnersArray[0]['subcats']) { redirect_header(SMARTPARTNER_URL, 3, _MD_SPARTNER_CATEGORY_EMPTY); } // Retreiving the category path $categoryPath = $currentCategoryObj->getCategoryPath(); } //$partners_total_onpage = $count;.partners $xoopsTpl->assign('partners', $partnersArray); //end new code to implement categories // Partners Navigation Bar //$pagenav = new XoopsPageNav($partners_total_onpage, $xoopsModuleConfig['perpage_user'], $start, 'start', ''); //$xoopsTpl->assign('pagenav', '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'); $xoopsTpl->assign('view_deteils_cat', _MD_SPARTNER_DETAIL_CAT); $xoopsTpl->assign('on_index_page', $view_category_id == 0); $xoopsTpl->assign('sitename', $xoopsConfig['sitename']); $xoopsTpl->assign("displayjoin" , $xoopsModuleConfig['allowsubmit'] && (is_object($xoopsUser) || $xoopsModuleConfig['anonpost'])); $xoopsTpl->assign("img_max_width" , $xoopsModuleConfig['img_max_width']); $xoopsTpl->assign('module_home', '<a href="' . SMARTPARTNER_URL . '">' . $smartpartner_moduleName . '</a>'); $xoopsTpl->assign('categoryPath', $categoryPath); $xoopsTpl->assign('lang_intro_text' , $myts->displayTarea($xoopsModuleConfig['welcomemsg'])); $xoopsTpl->assign('lang_partner', _MD_SPARTNER_PARTNER); $xoopsTpl->assign('lang_desc', _MD_SPARTNER_DESCRIPTION); $xoopsTpl->assign('lang_edit', _MD_SPARTNER_EDIT); $xoopsTpl->assign('lang_delete', _MD_SPARTNER_DELETE); $xoopsTpl->assign('lang_hits', _MD_SPARTNER_HITS); $xoopsTpl->assign('lang_join' , _MD_SPARTNER_JOIN); $xoopsTpl->assign('lang_no_partners', _MD_SPARTNER_NOPART); $xoopsTpl->assign('lang_main_partner', _MD_SPARTNER_PARTNERS); $xoopsTpl->assign('lang_readmore', _MD_SPARTNER_READMORE); $xoopsTpl->assign('partview_msg', $xoopsModuleConfig['partview_msg']); $xoopsTpl->assign('show_partners_table', $xoopsModuleConfig['show_partners_index']); if($xoopsModuleConfig['footer_display'] == 'index' || $xoopsModuleConfig['footer_display'] == 'both'){ $xoopsTpl->assign('footer', $xoopsModuleConfig['footer'] ); } if(!$xoopsModuleConfig['hide_module_name']){ $xoopsTpl->assign('lang_partnerstitle', $myts->displayTarea($xoopsModule->getVar('name'))); } include_once XOOPS_ROOT_PATH.'/footer.php'; ?>
ImpressCMS/impresscms-module-smartpartner
index.php
PHP
gpl-2.0
6,702
<?php $sm_label = ot_get_option('h_sm_label'); $pinterest = ot_get_option('h_pinterest'); $dropbox = ot_get_option('h_dropbox'); $google_plus = ot_get_option('h_google_plus'); $jolicloud = ot_get_option('h_jolicloud'); $yahoo = ot_get_option('h_yahoo'); $blogger = ot_get_option('h_blogger'); $picasa = ot_get_option('h_picasa'); $amazon = ot_get_option('h_amazon'); $tumblr = ot_get_option('h_tumblr'); $wordpress = ot_get_option('h_wordpress'); $instapaper = ot_get_option('h_instapaper'); $evernote = ot_get_option('h_evernote'); $xing = ot_get_option('h_xing'); $zootool = ot_get_option('h_zootool'); $dribbble = ot_get_option('h_dribbble'); $deviantart = ot_get_option('h_deviantart'); $read_it_later = ot_get_option('h_read_it_later'); $linked_in = ot_get_option('h_linked_in'); $forrst = ot_get_option('h_forrst'); $pinboard = ot_get_option('h_pinboard'); $behance = ot_get_option('h_behance'); $github = ot_get_option('h_github'); $youtube = ot_get_option('h_youtube'); $skitch = ot_get_option('h_skitch'); $foursquare = ot_get_option('h_foursquare'); $quora = ot_get_option('h_quora'); $badoo = ot_get_option('h_badoo'); $spotify = ot_get_option('h_spotify'); $stumbleupon = ot_get_option('h_stumbleupon'); $readability = ot_get_option('h_readability'); $facebook = ot_get_option('h_facebook'); $twitter = ot_get_option('h_twitter'); $instagram = ot_get_option('h_instagram'); $posterous_spaces = ot_get_option('h_posterous_spaces'); $vimeo = ot_get_option('h_vimeo'); $flickr = ot_get_option('h_flickr'); $last_fm = ot_get_option('h_last_fm'); $rss = ot_get_option('h_rss'); $skype = ot_get_option('h_skype'); $e_mail = ot_get_option('h_e_mail'); $vine = ot_get_option('h_vine'); $myspace = ot_get_option('h_myspace'); $goodreads = ot_get_option('h_goodreads'); $apple = ot_get_option('h_apple'); $windows = ot_get_option('h_windows'); $yelp = ot_get_option('h_yelp'); $playstation = ot_get_option('h_playstation'); $xbox = ot_get_option('h_xbox'); $android = ot_get_option('h_android'); $ios = ot_get_option('h_ios'); ?> <?php if($sm_label){?><span class="sm_label"><?php echo $sm_label;?></span><?php }?> <?php if($pinterest){?><a class="social social-icon pinterest" href="<?php echo $pinterest;?>"></a><?php }?> <?php if($dropbox){?><a class="social social-icon dropbox" href="<?php echo $dropbox;?>"></a><?php }?> <?php if($google_plus){?><a class="social social-icon google_plus" href="<?php echo $google_plus;?>"></a><?php }?> <?php if($jolicloud){?><a class="social social-icon jolicloud" href="<?php echo $jolicloud;?>"></a><?php }?> <?php if($yahoo){?><a class="social social-icon yahoo" href="<?php echo $yahoo;?>"></a><?php }?> <?php if($blogger){?><a class="social social-icon blogger" href="<?php echo $blogger;?>"></a><?php }?> <?php if($picasa){?><a class="social social-icon picasa" href="<?php echo $picasa;?>"></a><?php }?> <?php if($amazon){?><a class="social social-icon amazon" href="<?php echo $amazon;?>"></a><?php }?> <?php if($tumblr){?><a class="social social-icon tumblr" href="<?php echo $tumblr;?>"></a><?php }?> <?php if($wordpress){?><a class="social social-icon wordpress" href="<?php echo $wordpress;?>"></a><?php }?> <?php if($instapaper){?><a class="social social-icon instapaper" href="<?php echo $instapaper;?>"></a><?php }?> <?php if($evernote){?><a class="social social-icon evernote" href="<?php echo $evernote;?>"></a><?php }?> <?php if($xing){?><a class="social social-icon xing" href="<?php echo $xing;?>"></a><?php }?> <?php if($zootool){?><a class="social social-icon zootool" href="<?php echo $zootool;?>"></a><?php }?> <?php if($dribbble){?><a class="social social-icon dribbble" href="<?php echo $dribbble;?>"></a><?php }?> <?php if($deviantart){?><a class="social social-icon deviantart" href="<?php echo $deviantart;?>"></a><?php }?> <?php if($read_it_later){?><a class="social social-icon read_it_later" href="<?php echo $read_it_later;?>"></a><?php }?> <?php if($linked_in){?><a class="social social-icon linked_in" href="<?php echo $linked_in;?>"></a><?php }?> <?php if($forrst){?><a class="social social-icon forrst" href="<?php echo $forrst;?>"></a><?php }?> <?php if($pinboard){?><a class="social social-icon pinboard" href="<?php echo $pinboard;?>"></a><?php }?> <?php if($behance){?><a class="social social-icon behance" href="<?php echo $behance;?>"></a><?php }?> <?php if($github){?><a class="social social-icon github" href="<?php echo $github;?>"></a><?php }?> <?php if($youtube){?><a class="social social-icon youtube" href="<?php echo $youtube;?>"></a><?php }?> <?php if($skitch){?><a class="social social-icon skitch" href="<?php echo $skitch;?>"></a><?php }?> <?php if($foursquare){?><a class="social social-icon foursquare" href="<?php echo $foursquare;?>"></a><?php }?> <?php if($quora){?><a class="social social-icon quora" href="<?php echo $quora;?>"></a><?php }?> <?php if($badoo){?><a class="social social-icon badoo" href="<?php echo $badoo;?>"></a><?php }?> <?php if($spotify){?><a class="social social-icon spotify" href="<?php echo $spotify;?>"></a><?php }?> <?php if($stumbleupon){?><a class="social social-icon stumbleupon" href="<?php echo $stumbleupon;?>"></a><?php }?> <?php if($readability){?><a class="social social-icon readability" href="<?php echo $readability;?>"></a><?php }?> <?php if($facebook){?><a class="social social-icon facebook" href="<?php echo $facebook;?>"></a><?php }?> <?php if($twitter){?><a class="social social-icon twitter" href="<?php echo $twitter;?>"></a><?php }?> <?php if($instagram){?><a class="social social-icon instagram" href="<?php echo $instagram;?>"></a><?php }?> <?php if($posterous_spaces){?><a class="social social-icon posterous_spaces" href="<?php echo $posterous_spaces;?>"></a><?php }?> <?php if($vimeo){?><a class="social social-icon vimeo" href="<?php echo $vimeo;?>"></a><?php }?> <?php if($flickr){?><a class="social social-icon flickr" href="<?php echo $flickr;?>"></a><?php }?> <?php if($last_fm){?><a class="social social-icon last_fm" href="<?php echo $last_fm;?>"></a><?php }?> <?php if($rss){?><a class="social social-icon rss" href="<?php echo $st_javascript;?>"></a><?php }?> <?php if($skype){?><a class="social social-icon skype" href="<?php echo $skype;?>"></a><?php }?> <?php if($e_mail){?><a class="social social-icon e-mail" href="<?php echo $e_mail;?>"></a><?php }?> <?php if($vine){?><a class="social social-icon vine" href="<?php echo $vine;?>"></a><?php }?> <?php if($myspace){?><a class="social social-icon myspace" href="<?php echo $myspace;?>"></a><?php }?> <?php if($goodreads){?><a class="social social-icon goodreads" href="<?php echo $goodreads;?>"></a><?php }?> <?php if($apple){?><a class="social social-icon apple" href="<?php echo $apple;?>"></a><?php }?> <?php if($windows){?><a class="social social-icon windows" href="<?php echo $windows;?>"></a><?php }?> <?php if($yelp){?><a class="social social-icon yelp" href="<?php echo $yelp;?>"></a><?php }?> <?php if($playstation){?><a class="social social-icon playstation" href="<?php echo $playstation;?>"></a><?php }?> <?php if($xbox){?><a class="social social-icon xbox" href="<?php echo $xbox;?>"></a><?php }?> <?php if($android){?><a class="social social-icon android" href="<?php echo $android;?>"></a><?php }?> <?php if($ios){?><a class="social social-icon ios" href="<?php echo $ios;?>"></a><?php }?>
ronykader06/Badsha
wp-content/themes/dokan.me/includes/header-social-media.php
PHP
gpl-2.0
7,841
(function ($) { Drupal.behaviors.initColorbox = { attach: function (context, settings) { if (!$.isFunction($.colorbox)) { return; } $('a, area, input', context) .filter('.colorbox') .once('init-colorbox') .colorbox(settings.colorbox); } }; { $(document).bind('cbox_complete', function () { Drupal.attachBehaviors('#cboxLoadedContent'); }); } })(jQuery); ; (function ($) { Drupal.behaviors.initColorboxDefaultStyle = { attach: function (context, settings) { $(document).bind('cbox_complete', function () { // Only run if there is a title. if ($('#cboxTitle:empty', context).length == false) { setTimeout(function () { $('#cboxTitle', context).slideUp() }, 1500); $('#cboxLoadedContent img', context).bind('mouseover', function () { $('#cboxTitle', context).slideDown(); }); $('#cboxOverlay', context).bind('mouseover', function () { $('#cboxTitle', context).slideUp(); }); } else { $('#cboxTitle', context).hide(); } }); } }; })(jQuery); ; (function ($) { Drupal.behaviors.initColorboxLoad = { attach: function (context, settings) { if (!$.isFunction($.colorbox)) { return; } $.urlParams = function (url) { var p = {}, e, a = /\+/g, // Regex for replacing addition symbol with a space r = /([^&=]+)=?([^&]*)/g, d = function (s) { return decodeURIComponent(s.replace(a, ' ')); }, q = url.split('?'); while (e = r.exec(q[1])) { e[1] = d(e[1]); e[2] = d(e[2]); switch (e[2].toLowerCase()) { case 'true': case 'yes': e[2] = true; break; case 'false': case 'no': e[2] = false; break; } if (e[1] == 'width') { e[1] = 'innerWidth'; } if (e[1] == 'height') { e[1] = 'innerHeight'; } p[e[1]] = e[2]; } return p; }; $('a, area, input', context) .filter('.colorbox-load') .once('init-colorbox-load', function () { var params = $.urlParams($(this).attr('href')); $(this).colorbox($.extend({}, settings.colorbox, params)); }); } }; })(jQuery); ; (function ($) { Drupal.behaviors.initColorboxInline = { attach: function (context, settings) { if (!$.isFunction($.colorbox)) { return; } $.urlParam = function(name, url){ if (name == 'fragment') { var results = new RegExp('(#[^&#]*)').exec(url); } else { var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); } if (!results) { return ''; } return results[1] || ''; }; $('a, area, input', context).filter('.colorbox-inline').once('init-colorbox-inline').colorbox({ transition:settings.colorbox.transition, speed:settings.colorbox.speed, opacity:settings.colorbox.opacity, slideshow:settings.colorbox.slideshow, slideshowAuto:settings.colorbox.slideshowAuto, slideshowSpeed:settings.colorbox.slideshowSpeed, slideshowStart:settings.colorbox.slideshowStart, slideshowStop:settings.colorbox.slideshowStop, current:settings.colorbox.current, previous:settings.colorbox.previous, next:settings.colorbox.next, close:settings.colorbox.close, overlayClose:settings.colorbox.overlayClose, maxWidth:settings.colorbox.maxWidth, maxHeight:settings.colorbox.maxHeight, innerWidth:function(){ return $.urlParam('width', $(this).attr('href')); }, innerHeight:function(){ return $.urlParam('height', $(this).attr('href')); }, title:function(){ return decodeURIComponent($.urlParam('title', $(this).attr('href'))); }, iframe:function(){ return $.urlParam('iframe', $(this).attr('href')); }, inline:function(){ return $.urlParam('inline', $(this).attr('href')); }, href:function(){ return $.urlParam('fragment', $(this).attr('href')); } }); } }; })(jQuery); ; (function ($) { /** * A progressbar object. Initialized with the given id. Must be inserted into * the DOM afterwards through progressBar.element. * * method is the function which will perform the HTTP request to get the * progress bar state. Either "GET" or "POST". * * e.g. pb = new progressBar('myProgressBar'); * some_element.appendChild(pb.element); */ Drupal.progressBar = function (id, updateCallback, method, errorCallback) { var pb = this; this.id = id; this.method = method || 'GET'; this.updateCallback = updateCallback; this.errorCallback = errorCallback; // The WAI-ARIA setting aria-live="polite" will announce changes after users // have completed their current activity and not interrupt the screen reader. this.element = $('<div class="progress" aria-live="polite"></div>').attr('id', id); this.element.html('<div class="bar"><div class="filled"></div></div>' + '<div class="percentage"></div>' + '<div class="message">&nbsp;</div>'); }; /** * Set the percentage and status message for the progressbar. */ Drupal.progressBar.prototype.setProgress = function (percentage, message) { if (percentage >= 0 && percentage <= 100) { $('div.filled', this.element).css('width', percentage + '%'); $('div.percentage', this.element).html(percentage + '%'); } $('div.message', this.element).html(message); if (this.updateCallback) { this.updateCallback(percentage, message, this); } }; /** * Start monitoring progress via Ajax. */ Drupal.progressBar.prototype.startMonitoring = function (uri, delay) { this.delay = delay; this.uri = uri; this.sendPing(); }; /** * Stop monitoring progress via Ajax. */ Drupal.progressBar.prototype.stopMonitoring = function () { clearTimeout(this.timer); // This allows monitoring to be stopped from within the callback. this.uri = null; }; /** * Request progress data from server. */ Drupal.progressBar.prototype.sendPing = function () { if (this.timer) { clearTimeout(this.timer); } if (this.uri) { var pb = this; // When doing a post request, you need non-null data. Otherwise a // HTTP 411 or HTTP 406 (with Apache mod_security) error may result. $.ajax({ type: this.method, url: this.uri, data: '', dataType: 'json', success: function (progress) { // Display errors. if (progress.status == 0) { pb.displayError(progress.data); return; } // Update display. pb.setProgress(progress.percentage, progress.message); // Schedule next timer. pb.timer = setTimeout(function () { pb.sendPing(); }, pb.delay); }, error: function (xmlhttp) { pb.displayError(Drupal.ajaxError(xmlhttp, pb.uri)); } }); } }; /** * Display errors on the page. */ Drupal.progressBar.prototype.displayError = function (string) { var error = $('<div class="messages error"></div>').html(string); $(this.element).before(error).hide(); if (this.errorCallback) { this.errorCallback(this); } }; })(jQuery); ; /** * @file * * Implement a modal form. * * @see modal.inc for documentation. * * This javascript relies on the CTools ajax responder. */ (function ($) { // Make sure our objects are defined. Drupal.CTools = Drupal.CTools || {}; Drupal.CTools.Modal = Drupal.CTools.Modal || {}; /** * Display the modal * * @todo -- document the settings. */ Drupal.CTools.Modal.show = function(choice) { var opts = {}; if (choice && typeof choice == 'string' && Drupal.settings[choice]) { // This notation guarantees we are actually copying it. $.extend(true, opts, Drupal.settings[choice]); } else if (choice) { $.extend(true, opts, choice); } var defaults = { modalTheme: 'CToolsModalDialog', throbberTheme: 'CToolsModalThrobber', animation: 'show', animationSpeed: 'fast', modalSize: { type: 'scale', width: .8, height: .8, addWidth: 0, addHeight: 0, // How much to remove from the inner content to make space for the // theming. contentRight: 25, contentBottom: 45 }, modalOptions: { opacity: .55, background: '#fff' } }; var settings = {}; $.extend(true, settings, defaults, Drupal.settings.CToolsModal, opts); if (Drupal.CTools.Modal.currentSettings && Drupal.CTools.Modal.currentSettings != settings) { Drupal.CTools.Modal.modal.remove(); Drupal.CTools.Modal.modal = null; } Drupal.CTools.Modal.currentSettings = settings; var resize = function(e) { // When creating the modal, it actually exists only in a theoretical // place that is not in the DOM. But once the modal exists, it is in the // DOM so the context must be set appropriately. var context = e ? document : Drupal.CTools.Modal.modal; if (Drupal.CTools.Modal.currentSettings.modalSize.type == 'scale') { var width = $(window).width() * Drupal.CTools.Modal.currentSettings.modalSize.width; var height = $(window).height() * Drupal.CTools.Modal.currentSettings.modalSize.height; } else { var width = Drupal.CTools.Modal.currentSettings.modalSize.width; var height = Drupal.CTools.Modal.currentSettings.modalSize.height; } // Use the additionol pixels for creating the width and height. $('div.ctools-modal-content', context).css({ 'width': width + Drupal.CTools.Modal.currentSettings.modalSize.addWidth + 'px', 'height': height + Drupal.CTools.Modal.currentSettings.modalSize.addHeight + 'px' }); $('div.ctools-modal-content .modal-content', context).css({ 'width': (width - Drupal.CTools.Modal.currentSettings.modalSize.contentRight) + 'px', 'height': (height - Drupal.CTools.Modal.currentSettings.modalSize.contentBottom) + 'px' }); } if (!Drupal.CTools.Modal.modal) { Drupal.CTools.Modal.modal = $(Drupal.theme(settings.modalTheme)); if (settings.modalSize.type == 'scale') { $(window).bind('resize', resize); } } resize(); $('span.modal-title', Drupal.CTools.Modal.modal).html(Drupal.CTools.Modal.currentSettings.loadingText); Drupal.CTools.Modal.modalContent(Drupal.CTools.Modal.modal, settings.modalOptions, settings.animation, settings.animationSpeed); $('#modalContent .modal-content').html(Drupal.theme(settings.throbberTheme)); }; /** * Hide the modal */ Drupal.CTools.Modal.dismiss = function() { if (Drupal.CTools.Modal.modal) { Drupal.CTools.Modal.unmodalContent(Drupal.CTools.Modal.modal); } }; /** * Provide the HTML to create the modal dialog. */ Drupal.theme.prototype.CToolsModalDialog = function () { var html = '' html += ' <div id="ctools-modal">' html += ' <div class="ctools-modal-content">' // panels-modal-content html += ' <div class="modal-header">'; html += ' <a class="close" href="#">'; html += Drupal.CTools.Modal.currentSettings.closeText + Drupal.CTools.Modal.currentSettings.closeImage; html += ' </a>'; html += ' <span id="modal-title" class="modal-title">&nbsp;</span>'; html += ' </div>'; html += ' <div id="modal-content" class="modal-content">'; html += ' </div>'; html += ' </div>'; html += ' </div>'; return html; } /** * Provide the HTML to create the throbber. */ Drupal.theme.prototype.CToolsModalThrobber = function () { var html = ''; html += ' <div id="modal-throbber">'; html += ' <div class="modal-throbber-wrapper">'; html += Drupal.CTools.Modal.currentSettings.throbber; html += ' </div>'; html += ' </div>'; return html; }; /** * Figure out what settings string to use to display a modal. */ Drupal.CTools.Modal.getSettings = function (object) { var match = $(object).attr('class').match(/ctools-modal-(\S+)/); if (match) { return match[1]; } } /** * Click function for modals that can be cached. */ Drupal.CTools.Modal.clickAjaxCacheLink = function () { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); return Drupal.CTools.AJAX.clickAJAXCacheLink.apply(this); }; /** * Handler to prepare the modal for the response */ Drupal.CTools.Modal.clickAjaxLink = function () { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(this)); return false; }; /** * Submit responder to do an AJAX submit on all modal forms. */ Drupal.CTools.Modal.submitAjaxForm = function(e) { var $form = $(this); var url = $form.attr('action'); setTimeout(function() { Drupal.CTools.AJAX.ajaxSubmit($form, url); }, 1); return false; } /** * Bind links that will open modals to the appropriate function. */ Drupal.behaviors.ZZCToolsModal = { attach: function(context) { // Bind links // Note that doing so in this order means that the two classes can be // used together safely. /* * @todo remimplement the warm caching feature $('a.ctools-use-modal-cache', context).once('ctools-use-modal', function() { $(this).click(Drupal.CTools.Modal.clickAjaxCacheLink); Drupal.CTools.AJAX.warmCache.apply(this); }); */ $('area.ctools-use-modal, a.ctools-use-modal', context).once('ctools-use-modal', function() { var $this = $(this); $this.click(Drupal.CTools.Modal.clickAjaxLink); // Create a drupal ajax object var element_settings = {}; if ($this.attr('href')) { element_settings.url = $this.attr('href'); element_settings.event = 'click'; element_settings.progress = { type: 'throbber' }; } var base = $this.attr('href'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); }); // Bind buttons $('input.ctools-use-modal, button.ctools-use-modal', context).once('ctools-use-modal', function() { var $this = $(this); $this.click(Drupal.CTools.Modal.clickAjaxLink); var button = this; var element_settings = {}; // AJAX submits specified in this manner automatically submit to the // normal form action. element_settings.url = Drupal.CTools.Modal.findURL(this); element_settings.event = 'click'; var base = $this.attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); // Make sure changes to settings are reflected in the URL. $('.' + $(button).attr('id') + '-url').change(function() { Drupal.ajax[base].options.url = Drupal.CTools.Modal.findURL(button); }); }); // Bind our custom event to the form submit $('#modal-content form', context).once('ctools-use-modal', function() { var $this = $(this); var element_settings = {}; element_settings.url = $this.attr('action'); element_settings.event = 'submit'; element_settings.progress = { 'type': 'throbber' } var base = $this.attr('id'); Drupal.ajax[base] = new Drupal.ajax(base, this, element_settings); Drupal.ajax[base].form = $this; $('input[type=submit], button', this).click(function(event) { Drupal.ajax[base].element = this; this.form.clk = this; // An empty event means we were triggered via .click() and // in jquery 1.4 this won't trigger a submit. if (event.bubbles == undefined) { $(this.form).trigger('submit'); return false; } }); }); // Bind a click handler to allow elements with the 'ctools-close-modal' // class to close the modal. $('.ctools-close-modal', context).once('ctools-close-modal') .click(function() { Drupal.CTools.Modal.dismiss(); return false; }); } }; // The following are implementations of AJAX responder commands. /** * AJAX responder command to place HTML within the modal. */ Drupal.CTools.Modal.modal_display = function(ajax, response, status) { if ($('#modalContent').length == 0) { Drupal.CTools.Modal.show(Drupal.CTools.Modal.getSettings(ajax.element)); } $('#modal-title').html(response.title); // Simulate an actual page load by scrolling to the top after adding the // content. This is helpful for allowing users to see error messages at the // top of a form, etc. $('#modal-content').html(response.output).scrollTop(0); Drupal.attachBehaviors(); } /** * AJAX responder command to dismiss the modal. */ Drupal.CTools.Modal.modal_dismiss = function(command) { Drupal.CTools.Modal.dismiss(); $('link.ctools-temporary-css').remove(); } /** * Display loading */ //Drupal.CTools.AJAX.commands.modal_loading = function(command) { Drupal.CTools.Modal.modal_loading = function(command) { Drupal.CTools.Modal.modal_display({ output: Drupal.theme(Drupal.CTools.Modal.currentSettings.throbberTheme), title: Drupal.CTools.Modal.currentSettings.loadingText }); } /** * Find a URL for an AJAX button. * * The URL for this gadget will be composed of the values of items by * taking the ID of this item and adding -url and looking for that * class. They need to be in the form in order since we will * concat them all together using '/'. */ Drupal.CTools.Modal.findURL = function(item) { var url = ''; var url_class = '.' + $(item).attr('id') + '-url'; $(url_class).each( function() { var $this = $(this); if (url && $this.val()) { url += '/'; } url += $this.val(); }); return url; }; /** * modalContent * @param content string to display in the content box * @param css obj of css attributes * @param animation (fadeIn, slideDown, show) * @param speed (valid animation speeds slow, medium, fast or # in ms) */ Drupal.CTools.Modal.modalContent = function(content, css, animation, speed) { // If our animation isn't set, make it just show/pop if (!animation) { animation = 'show'; } else { // If our animation isn't "fadeIn" or "slideDown" then it always is show if (animation != 'fadeIn' && animation != 'slideDown') { animation = 'show'; } } if (!speed) { speed = 'fast'; } // Build our base attributes and allow them to be overriden css = jQuery.extend({ position: 'absolute', left: '0px', margin: '0px', background: '#000', opacity: '.55' }, css); // Add opacity handling for IE. css.filter = 'alpha(opacity=' + (100 * css.opacity) + ')'; content.hide(); // if we already ahve a modalContent, remove it if ( $('#modalBackdrop')) $('#modalBackdrop').remove(); if ( $('#modalContent')) $('#modalContent').remove(); // position code lifted from http://www.quirksmode.org/viewport/compatibility.html if (self.pageYOffset) { // all except Explorer var wt = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict var wt = document.documentElement.scrollTop; } else if (document.body) { // all other Explorers var wt = document.body.scrollTop; } // Get our dimensions // Get the docHeight and (ugly hack) add 50 pixels to make sure we dont have a *visible* border below our div var docHeight = $(document).height() + 50; var docWidth = $(document).width(); var winHeight = $(window).height(); var winWidth = $(window).width(); if( docHeight < winHeight ) docHeight = winHeight; // Create our divs $('body').append('<div id="modalBackdrop" style="z-index: 1000; display: none;"></div><div id="modalContent" style="z-index: 1001; position: absolute;">' + $(content).html() + '</div>'); // Keyboard and focus event handler ensures focus stays on modal elements only modalEventHandler = function( event ) { target = null; if ( event ) { //Mozilla target = event.target; } else { //IE event = window.event; target = event.srcElement; } var parents = $(target).parents().get(); for (var i in $(target).parents().get()) { var position = $(parents[i]).css('position'); if (position == 'absolute' || position == 'fixed') { return true; } } if( $(target).filter('*:visible').parents('#modalContent').size()) { // allow the event only if target is a visible child node of #modalContent return true; } if ( $('#modalContent')) $('#modalContent').get(0).focus(); return false; }; $('body').bind( 'focus', modalEventHandler ); $('body').bind( 'keypress', modalEventHandler ); // Create our content div, get the dimensions, and hide it var modalContent = $('#modalContent').css('top','-1000px'); var mdcTop = wt + ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); $('#modalBackdrop').css(css).css('top', 0).css('height', docHeight + 'px').css('width', docWidth + 'px').show(); modalContent.css({top: mdcTop + 'px', left: mdcLeft + 'px'}).hide()[animation](speed); // Bind a click for closing the modalContent modalContentClose = function(){close(); return false;}; $('.close').bind('click', modalContentClose); // Bind a keypress on escape for closing the modalContent modalEventEscapeCloseHandler = function(event) { if (event.keyCode == 27) { close(); return false; } }; $(document).bind('keypress', modalEventEscapeCloseHandler); // Close the open modal content and backdrop function close() { // Unbind the events $(window).unbind('resize', modalContentResize); $('body').unbind( 'focus', modalEventHandler); $('body').unbind( 'keypress', modalEventHandler ); $('.close').unbind('click', modalContentClose); $('body').unbind('keypress', modalEventEscapeCloseHandler); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); // Set our animation parameters and use them if ( animation == 'fadeIn' ) animation = 'fadeOut'; if ( animation == 'slideDown' ) animation = 'slideUp'; if ( animation == 'show' ) animation = 'hide'; // Close the content modalContent.hide()[animation](speed); // Remove the content $('#modalContent').remove(); $('#modalBackdrop').remove(); }; // Move and resize the modalBackdrop and modalContent on resize of the window modalContentResize = function(){ // Get our heights var docHeight = $(document).height(); var docWidth = $(document).width(); var winHeight = $(window).height(); var winWidth = $(window).width(); if( docHeight < winHeight ) docHeight = winHeight; // Get where we should move content to var modalContent = $('#modalContent'); var mdcTop = ( winHeight / 2 ) - ( modalContent.outerHeight() / 2); var mdcLeft = ( winWidth / 2 ) - ( modalContent.outerWidth() / 2); // Apply the changes $('#modalBackdrop').css('height', docHeight + 'px').css('width', docWidth + 'px').show(); modalContent.css('top', mdcTop + 'px').css('left', mdcLeft + 'px').show(); }; $(window).bind('resize', modalContentResize); $('#modalContent').focus(); }; /** * unmodalContent * @param content (The jQuery object to remove) * @param animation (fadeOut, slideUp, show) * @param speed (valid animation speeds slow, medium, fast or # in ms) */ Drupal.CTools.Modal.unmodalContent = function(content, animation, speed) { // If our animation isn't set, make it just show/pop if (!animation) { var animation = 'show'; } else { // If our animation isn't "fade" then it always is show if (( animation != 'fadeOut' ) && ( animation != 'slideUp')) animation = 'show'; } // Set a speed if we dont have one if ( !speed ) var speed = 'fast'; // Unbind the events we bound $(window).unbind('resize', modalContentResize); $('body').unbind('focus', modalEventHandler); $('body').unbind('keypress', modalEventHandler); $('.close').unbind('click', modalContentClose); $(document).trigger('CToolsDetachBehaviors', $('#modalContent')); // jQuery magic loop through the instances and run the animations or removal. content.each(function(){ if ( animation == 'fade' ) { $('#modalContent').fadeOut(speed, function() { $('#modalBackdrop').fadeOut(speed, function() { $(this).remove(); }); $(this).remove(); }); } else { if ( animation == 'slide' ) { $('#modalContent').slideUp(speed,function() { $('#modalBackdrop').slideUp(speed, function() { $(this).remove(); }); $(this).remove(); }); } else { $('#modalContent').remove(); $('#modalBackdrop').remove(); } } }); }; $(function() { Drupal.ajax.prototype.commands.modal_display = Drupal.CTools.Modal.modal_display; Drupal.ajax.prototype.commands.modal_dismiss = Drupal.CTools.Modal.modal_dismiss; }); })(jQuery); ; /** * Provide the HTML to create the modal dialog. */ Drupal.theme.prototype.ModalFormsPopup = function () { var html = ''; html += '<div id="ctools-modal" class="popups-box">'; html += ' <div class="ctools-modal-content modal-forms-modal-content">'; html += ' <div class="popups-container">'; html += ' <div class="modal-header popups-title clearfix">'; html += ' <h3 id="modal-title" class="modal-title"></h3>'; html += ' <span class="popups-close close">' + Drupal.CTools.Modal.currentSettings.closeText + '</span>'; html += ' </div>'; html += ' <div class="modal-scroll"><div id="modal-content" class="modal-content popups-body"></div></div>'; html += ' </div>'; html += ' </div>'; html += '</div>'; return html; } ; (function ($) { Drupal.viewsSlideshow = Drupal.viewsSlideshow || {}; /** * Views Slideshow Controls */ Drupal.viewsSlideshowControls = Drupal.viewsSlideshowControls || {}; /** * Implement the play hook for controls. */ Drupal.viewsSlideshowControls.play = function (options) { // Route the control call to the correct control type. // Need to use try catch so we don't have to check to make sure every part // of the object is defined. try { if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play == 'function') { Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].play(options); } } catch(err) { // Don't need to do anything on error. } try { if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play == 'function') { Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].play(options); } } catch(err) { // Don't need to do anything on error. } }; /** * Implement the pause hook for controls. */ Drupal.viewsSlideshowControls.pause = function (options) { // Route the control call to the correct control type. // Need to use try catch so we don't have to check to make sure every part // of the object is defined. try { if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause == 'function') { Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].top.type].pause(options); } } catch(err) { // Don't need to do anything on error. } try { if (typeof Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause == 'function') { Drupal[Drupal.settings.viewsSlideshowControls[options.slideshowID].bottom.type].pause(options); } } catch(err) { // Don't need to do anything on error. } }; /** * Views Slideshow Text Controls */ // Add views slieshow api calls for views slideshow text controls. Drupal.behaviors.viewsSlideshowControlsText = { attach: function (context) { // Process previous link $('.views_slideshow_controls_text_previous:not(.views-slideshow-controls-text-previous-processed)', context).addClass('views-slideshow-controls-text-previous-processed').each(function() { var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_previous_', ''); $(this).click(function() { Drupal.viewsSlideshow.action({ "action": 'previousSlide', "slideshowID": uniqueID }); return false; }); }); // Process next link $('.views_slideshow_controls_text_next:not(.views-slideshow-controls-text-next-processed)', context).addClass('views-slideshow-controls-text-next-processed').each(function() { var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_next_', ''); $(this).click(function() { Drupal.viewsSlideshow.action({ "action": 'nextSlide', "slideshowID": uniqueID }); return false; }); }); // Process pause link $('.views_slideshow_controls_text_pause:not(.views-slideshow-controls-text-pause-processed)', context).addClass('views-slideshow-controls-text-pause-processed').each(function() { var uniqueID = $(this).attr('id').replace('views_slideshow_controls_text_pause_', ''); $(this).click(function() { if (Drupal.settings.viewsSlideshow[uniqueID].paused) { Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID, "force": true }); } else { Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID, "force": true }); } return false; }); }); } }; Drupal.viewsSlideshowControlsText = Drupal.viewsSlideshowControlsText || {}; /** * Implement the pause hook for text controls. */ Drupal.viewsSlideshowControlsText.pause = function (options) { var pauseText = Drupal.theme.prototype['viewsSlideshowControlsPause'] ? Drupal.theme('viewsSlideshowControlsPause') : ''; $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(pauseText); }; /** * Implement the play hook for text controls. */ Drupal.viewsSlideshowControlsText.play = function (options) { var playText = Drupal.theme.prototype['viewsSlideshowControlsPlay'] ? Drupal.theme('viewsSlideshowControlsPlay') : ''; $('#views_slideshow_controls_text_pause_' + options.slideshowID + ' a').text(playText); }; // Theme the resume control. Drupal.theme.prototype.viewsSlideshowControlsPause = function () { return Drupal.t('Resume'); }; // Theme the pause control. Drupal.theme.prototype.viewsSlideshowControlsPlay = function () { return Drupal.t('Pause'); }; /** * Views Slideshow Pager */ Drupal.viewsSlideshowPager = Drupal.viewsSlideshowPager || {}; /** * Implement the transitionBegin hook for pagers. */ Drupal.viewsSlideshowPager.transitionBegin = function (options) { // Route the pager call to the correct pager type. // Need to use try catch so we don't have to check to make sure every part // of the object is defined. try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].transitionBegin(options); } } catch(err) { // Don't need to do anything on error. } try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].transitionBegin(options); } } catch(err) { // Don't need to do anything on error. } }; /** * Implement the goToSlide hook for pagers. */ Drupal.viewsSlideshowPager.goToSlide = function (options) { // Route the pager call to the correct pager type. // Need to use try catch so we don't have to check to make sure every part // of the object is defined. try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].goToSlide(options); } } catch(err) { // Don't need to do anything on error. } try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].goToSlide(options); } } catch(err) { // Don't need to do anything on error. } }; /** * Implement the previousSlide hook for pagers. */ Drupal.viewsSlideshowPager.previousSlide = function (options) { // Route the pager call to the correct pager type. // Need to use try catch so we don't have to check to make sure every part // of the object is defined. try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].previousSlide(options); } } catch(err) { // Don't need to do anything on error. } try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].previousSlide(options); } } catch(err) { // Don't need to do anything on error. } }; /** * Implement the nextSlide hook for pagers. */ Drupal.viewsSlideshowPager.nextSlide = function (options) { // Route the pager call to the correct pager type. // Need to use try catch so we don't have to check to make sure every part // of the object is defined. try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].top.type].nextSlide(options); } } catch(err) { // Don't need to do anything on error. } try { if (typeof Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type != "undefined" && typeof Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide == 'function') { Drupal[Drupal.settings.viewsSlideshowPager[options.slideshowID].bottom.type].nextSlide(options); } } catch(err) { // Don't need to do anything on error. } }; /** * Views Slideshow Pager Fields */ // Add views slieshow api calls for views slideshow pager fields. Drupal.behaviors.viewsSlideshowPagerFields = { attach: function (context) { // Process pause on hover. $('.views_slideshow_pager_field:not(.views-slideshow-pager-field-processed)', context).addClass('views-slideshow-pager-field-processed').each(function() { // Parse out the location and unique id from the full id. var pagerInfo = $(this).attr('id').split('_'); var location = pagerInfo[2]; pagerInfo.splice(0, 3); var uniqueID = pagerInfo.join('_'); // Add the activate and pause on pager hover event to each pager item. if (Drupal.settings.viewsSlideshowPagerFields[uniqueID][location].activatePauseOnHover) { $(this).children().each(function(index, pagerItem) { var mouseIn = function() { Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); Drupal.viewsSlideshow.action({ "action": 'pause', "slideshowID": uniqueID }); } var mouseOut = function() { Drupal.viewsSlideshow.action({ "action": 'play', "slideshowID": uniqueID }); } if (jQuery.fn.hoverIntent) { $(pagerItem).hoverIntent(mouseIn, mouseOut); } else { $(pagerItem).hover(mouseIn, mouseOut); } }); } else { $(this).children().each(function(index, pagerItem) { $(pagerItem).click(function() { Drupal.viewsSlideshow.action({ "action": 'goToSlide', "slideshowID": uniqueID, "slideNum": index }); }); }); } }); } }; Drupal.viewsSlideshowPagerFields = Drupal.viewsSlideshowPagerFields || {}; /** * Implement the transitionBegin hook for pager fields pager. */ Drupal.viewsSlideshowPagerFields.transitionBegin = function (options) { for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { // Remove active class from pagers $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); // Add active class to active pager. $('#views_slideshow_pager_field_item_'+ pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); } }; /** * Implement the goToSlide hook for pager fields pager. */ Drupal.viewsSlideshowPagerFields.goToSlide = function (options) { for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { // Remove active class from pagers $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); // Add active class to active pager. $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + options.slideNum).addClass('active'); } }; /** * Implement the previousSlide hook for pager fields pager. */ Drupal.viewsSlideshowPagerFields.previousSlide = function (options) { for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { // Get the current active pager. var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); // If we are on the first pager then activate the last pager. // Otherwise activate the previous pager. if (pagerNum == 0) { pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length() - 1; } else { pagerNum--; } // Remove active class from pagers $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); // Add active class to active pager. $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + pagerNum).addClass('active'); } }; /** * Implement the nextSlide hook for pager fields pager. */ Drupal.viewsSlideshowPagerFields.nextSlide = function (options) { for (pagerLocation in Drupal.settings.viewsSlideshowPager[options.slideshowID]) { // Get the current active pager. var pagerNum = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"].active').attr('id').replace('views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_', ''); var totalPagers = $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').length(); // If we are on the last pager then activate the first pager. // Otherwise activate the next pager. pagerNum++; if (pagerNum == totalPagers) { pagerNum = 0; } // Remove active class from pagers $('[id^="views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '"]').removeClass('active'); // Add active class to active pager. $('#views_slideshow_pager_field_item_' + pagerLocation + '_' + options.slideshowID + '_' + slideNum).addClass('active'); } }; /** * Views Slideshow Slide Counter */ Drupal.viewsSlideshowSlideCounter = Drupal.viewsSlideshowSlideCounter || {}; /** * Implement the transitionBegin for the slide counter. */ Drupal.viewsSlideshowSlideCounter.transitionBegin = function (options) { $('#views_slideshow_slide_counter_' + options.slideshowID + ' .num').text(options.slideNum + 1); }; /** * This is used as a router to process actions for the slideshow. */ Drupal.viewsSlideshow.action = function (options) { // Set default values for our return status. var status = { 'value': true, 'text': '' } // If an action isn't specified return false. if (typeof options.action == 'undefined' || options.action == '') { status.value = false; status.text = Drupal.t('There was no action specified.'); return error; } // If we are using pause or play switch paused state accordingly. if (options.action == 'pause') { Drupal.settings.viewsSlideshow[options.slideshowID].paused = 1; // If the calling method is forcing a pause then mark it as such. if (options.force) { Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 1; } } else if (options.action == 'play') { // If the slideshow isn't forced pause or we are forcing a play then play // the slideshow. // Otherwise return telling the calling method that it was forced paused. if (!Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce || options.force) { Drupal.settings.viewsSlideshow[options.slideshowID].paused = 0; Drupal.settings.viewsSlideshow[options.slideshowID].pausedForce = 0; } else { status.value = false; status.text += ' ' + Drupal.t('This slideshow is forced paused.'); return status; } } // We use a switch statement here mainly just to limit the type of actions // that are available. switch (options.action) { case "goToSlide": case "transitionBegin": case "transitionEnd": // The three methods above require a slide number. Checking if it is // defined and it is a number that is an integer. if (typeof options.slideNum == 'undefined' || typeof options.slideNum !== 'number' || parseInt(options.slideNum) != (options.slideNum - 0)) { status.value = false; status.text = Drupal.t('An invalid integer was specified for slideNum.'); } case "pause": case "play": case "nextSlide": case "previousSlide": // Grab our list of methods. var methods = Drupal.settings.viewsSlideshow[options.slideshowID]['methods']; // if the calling method specified methods that shouldn't be called then // exclude calling them. var excludeMethodsObj = {}; if (typeof options.excludeMethods !== 'undefined') { // We need to turn the excludeMethods array into an object so we can use the in // function. for (var i=0; i < excludeMethods.length; i++) { excludeMethodsObj[excludeMethods[i]] = ''; } } // Call every registered method and don't call excluded ones. for (i = 0; i < methods[options.action].length; i++) { if (Drupal[methods[options.action][i]] != undefined && typeof Drupal[methods[options.action][i]][options.action] == 'function' && !(methods[options.action][i] in excludeMethodsObj)) { Drupal[methods[options.action][i]][options.action](options); } } break; // If it gets here it's because it's an invalid action. default: status.value = false; status.text = Drupal.t('An invalid action "!action" was specified.', { "!action": options.action }); } return status; }; })(jQuery); ; /** * JavaScript behaviors for the front-end display of webforms. */ (function ($) { Drupal.behaviors.webform = Drupal.behaviors.webform || {}; Drupal.behaviors.webform.attach = function(context) { // Calendar datepicker behavior. Drupal.webform.datepicker(context); }; Drupal.webform = Drupal.webform || {}; Drupal.webform.datepicker = function(context) { $('div.webform-datepicker').each(function() { var $webformDatepicker = $(this); var $calendar = $webformDatepicker.find('input.webform-calendar'); var startDate = $calendar[0].className.replace(/.*webform-calendar-start-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-'); var endDate = $calendar[0].className.replace(/.*webform-calendar-end-(\d{4}-\d{2}-\d{2}).*/, '$1').split('-'); var firstDay = $calendar[0].className.replace(/.*webform-calendar-day-(\d).*/, '$1'); // Convert date strings into actual Date objects. startDate = new Date(startDate[0], startDate[1] - 1, startDate[2]); endDate = new Date(endDate[0], endDate[1] - 1, endDate[2]); // Ensure that start comes before end for datepicker. if (startDate > endDate) { var laterDate = startDate; startDate = endDate; endDate = laterDate; } var startYear = startDate.getFullYear(); var endYear = endDate.getFullYear(); // Set up the jQuery datepicker element. $calendar.datepicker({ dateFormat: 'yy-mm-dd', yearRange: startYear + ':' + endYear, firstDay: parseInt(firstDay), minDate: startDate, maxDate: endDate, onSelect: function(dateText, inst) { var date = dateText.split('-'); $webformDatepicker.find('select.year, input.year').val(+date[0]); $webformDatepicker.find('select.month').val(+date[1]); $webformDatepicker.find('select.day').val(+date[2]); }, beforeShow: function(input, inst) { // Get the select list values. var year = $webformDatepicker.find('select.year, input.year').val(); var month = $webformDatepicker.find('select.month').val(); var day = $webformDatepicker.find('select.day').val(); // If empty, default to the current year/month/day in the popup. var today = new Date(); year = year ? year : today.getFullYear(); month = month ? month : today.getMonth() + 1; day = day ? day : today.getDate(); // Make sure that the default year fits in the available options. year = (year < startYear || year > endYear) ? startYear : year; // jQuery UI Datepicker will read the input field and base its date off // of that, even though in our case the input field is a button. $(input).val(year + '-' + month + '-' + day); } }); // Prevent the calendar button from submitting the form. $calendar.click(function(event) { $(this).focus(); event.preventDefault(); }); }); } })(jQuery); ; (function ($) { $(document).ready(function() { // Expression to check for absolute internal links. var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); // Attach onclick event to document only and catch clicks on all elements. $(document.body).click(function(event) { // Catch the closest surrounding link of a clicked element. $(event.target).closest("a,area").each(function() { var ga = Drupal.settings.googleanalytics; // Expression to check for special links like gotwo.module /go/* links. var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); // Expression to check for download links. var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i"); // Is the clicked URL internal? if (isInternal.test(this.href)) { // Skip 'click' tracking, if custom tracking events are bound. if ($(this).is('.colorbox')) { // Do nothing here. The custom event will handle all tracking. } // Is download tracking activated and the file extension configured for download tracking? else if (ga.trackDownload && isDownload.test(this.href)) { // Download link clicked. var extension = isDownload.exec(this.href); _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]); } else if (isInternalSpecial.test(this.href)) { // Keep the internal URL for Google Analytics website overlay intact. _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]); } } else { if (ga.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { // Mailto link clicked. _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]); } else if (ga.trackOutbound && this.href.match(/^\w+:\/\//i)) { if (ga.trackDomainMode == 2 && isCrossDomain($(this).attr('hostname'), ga.trackCrossDomains)) { // Top-level cross domain clicked. document.location is handled by _link internally. event.preventDefault(); _gaq.push(["_link", this.href]); } else { // External link clicked. _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]); } } } }); }); // Colorbox: This event triggers when the transition has completed and the // newly loaded content has been revealed. $(document).bind("cbox_complete", function() { var href = $.colorbox.element().attr("href"); if (href) { _gaq.push(["_trackPageview", href.replace(isInternal, '')]); } }); }); /** * Check whether the hostname is part of the cross domains or not. * * @param string hostname * The hostname of the clicked URL. * @param array crossDomains * All cross domain hostnames as JS array. * * @return boolean */ function isCrossDomain(hostname, crossDomains) { /** * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is * `null` or `undefined`, http://bugs.jquery.com/ticket/10076, * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 * * @todo: Remove/Refactor in D8 */ if (!crossDomains) { return false; } else { return $.inArray(hostname, crossDomains) > -1 ? true : false; } } })(jQuery); ;
mikeusry/hgia
athens_ga/js/js_dYU5nuz6qyyjAASTaIu-FngprZm60naMXDmPgEyhE1Y.js
JavaScript
gpl-2.0
52,182
<?php class JConfig { public $MetaAuthor = '1'; public $MetaDesc = ''; public $MetaKeys = ''; public $MetaRights = ''; public $MetaTitle = '1'; public $MetaVersion = '0'; public $access = '1'; public $cache_handler = 'file'; public $cachetime = '15'; public $caching = '0'; public $captcha = '0'; public $cookie_domain = ''; public $cookie_path = ''; public $db = 'rdcma_uhade'; public $dbprefix = 'kc_'; public $dbtype = 'mysqli'; public $debug = '0'; public $debug_lang = '0'; public $display_offline_message = '1'; public $editor = 'tinymce'; public $error_reporting = 'default'; public $feed_email = 'author'; public $feed_limit = '10'; public $force_ssl = '0'; public $fromname = 'Uhade Company'; public $ftp_enable = '0'; public $ftp_host = ''; public $ftp_pass = 'root'; public $ftp_port = '21'; public $ftp_root = ''; public $ftp_user = 'admin'; public $gzip = '0'; public $helpurl = 'https://help.joomla.org/proxy/index.php?option=com_help&amp;keyref=Help{major}{minor}:{keyref}'; public $host = '192.185.16.56'; public $lifetime = '15'; public $list_limit = '20'; public $live_site = ''; public $log_path = '/home1/rdcma/public_html/subteam/uhade/log'; public $mailer = 'mail'; public $mailfrom = 'kitisummus@gmail.com'; public $memcache_compress = '1'; public $memcache_persist = '1'; public $memcache_server_host = 'localhost'; public $memcache_server_port = '11211'; public $offline = '0'; public $offline_image = ''; public $offline_message = 'Trang web này đang được bảo trì.</br>Xin quay trở lại sau. '; public $offset = 'UTC'; public $offset_user = 'UTC'; public $password = '2Lr8ycDVAPP0xik6'; public $robots = ''; public $secret = 'b41kVbxZNWXIlU7gIvtLrpwlnaE44n6e'; public $sef = '1'; public $sef_rewrite = '0'; public $sef_suffix = '0'; public $sendmail = '/usr/sbin/sendmail'; public $session_handler = 'database'; public $sitename = 'Uhade Company'; public $sitename_pagetitles = '1'; public $smtpauth = '0'; public $smtphost = 'localhost'; public $smtppass = ''; public $smtpport = '25'; public $smtpsecure = 'none'; public $smtpuser = ''; public $tmp_path = '/home1/rdcma/public_html/subteam/uhade/tmp'; public $unicodeslugs = '0'; public $user = 'rdcma'; public $mailonline = '1'; }
kitilink/helix3
configuration.php
PHP
gpl-2.0
2,291
<?php namespace DivideBV\PHPDivideIQ; /** * This file is part of PHPDivideIQ. * * PHPDivideIQ is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * PHPDivideIQ is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with PHPDivideIQ. If not, see <http://www.gnu.org/licenses/>. */ class Settings implements \JsonSerializable { /** * An array of the services this account has access to. * * @var string[] */ protected $services; /** * The updated date of this revision of the settings. * * @var int */ protected $updated; /** * Creates an object to represent Divide.IQ account settings. * * @param string[] $services * An array of services. * @param int $updated * The updated timestamp. */ public function __construct(array $services, $updated) { $this->services = $services; $this->updated = $updated; } /** * Gets the path of a service. * * @param string $serviceName * * @return string */ public function getPath($serviceName) { if (in_array($serviceName, $this->services)) { return str_replace('_', '/', $serviceName); } else { $services = implode(', ', $this->services); throw new \Exception("Service \"{$serviceName}\" is not one of: {$services}"); } } /** * Checks whether the settings are outdated. * * @param int $last_updated * Timestamp the settings were last updated. * * @return bool */ public function isOutdated($last_update) { return ($this->updated != $last_update); } /** * Serializes the object using JSON. * * @return string * The JSON representation of the object. */ public function toJson() { return json_encode($this); } /** * Unserializes the object from JSON. * * @param string $json * The object as serialized using JSON. * * @return Settings * The unserialized object. */ public static function fromJson($json) { $data = json_decode($json); // Recreate the object. return new static($data->services, $data->updated); } /** * Implements \JsonSerializable::jsonSerialize. */ public function jsonSerialize() { return [ 'services' => $this->services, 'updated' => $this->updated, ]; } }
DivideBV/PHPDivideIQ
src/Settings.php
PHP
gpl-2.0
2,976
// license:BSD-3-Clause // copyright-holders:R. Belmont, Acho A. Tang /*************************************************************************** Wild West C.O.W.boys of Moo Mesa Bucky O'Hare (c) 1992 Konami Driver by R. Belmont and Acho A. Tang based on xexex.c by Olivier Galibert. Moo Mesa protection information thanks to ElSemi and OG. These are the final Xexex hardware games before the pre-GX/Mystic Warriors hardware took over. Wild West C.O.W. Boys Of Moo Mesa Konami 1992 PCB Layout ---------- GX151 PWB353126 |--------------------------------------------------------| |LA4705 151A11.A8 151A11.A10| | 151A08.B6 151A10.B8 151A12.B10| | 054986 |------| 62256 |------| | | |054539| 62256 |053246A | |S_OUT | | 054744 5168 | | | | | | 5168 | | | | |------| | | | | YM2151 Z80E 151A07.F5 |------| | | | |J 051550 |------| | |A |053247A | |M 054573 |------| 2018 | | | |M 054753 |054338| 2018 | | | |A 054753 | | 2018 | | | | 054754 | | |------| |------| | | |------| 053252 |053251| 5168 | | |------| | | 5168 | | 18.432MHz |-----| |053990| |------| 5168 | | 32MHz |68000| | | |------| | | | | |------| |054157| |------| | | ER5911.N2|-----| 055373 | | |054156| | | | | | | | |005273(X10) 151B01.Q5 151AAB02.Q6 | | | | | |TEST_SW 62256 62256 |------| | | | | 151A03.T5 151A04.T6 |------| | |PL3 PL4 DSW(4) 151A05.T8 151A06.T10| |--------------------------------------------------------| Notes: 68000 - Clock 16.000MHz [32/2] Z80E - Clock 8.000MHz [32/4] YM2151 - Clock 4.000MHz [32/8] 62256 - KM62256 32kx8 SRAM (DIP28) 5168 - Sharp LH5168 8kx8 SRAM (DIP28) ER5911 - EEPROM (128 bytes) S_OUT - 4 pin connector for stereo sound output PL3/PL4 - 15 pin connectors for player 3 & player 4 controls 151* - EPROM/mask ROM LA4705 - Power AMP IC Custom Chips ------------ 053990 - ? (Connected to 68000, main program ROMs and 2018 RAM) 053251 - Priority encoder 053252 - Timing/Interrupt controller. Clock input 32MHz 054157 \ 054156 / Tilemap generators 053246A \ 053247A / Sprite generators 054539 - 8-Channel ADPCM sound generator. Clock input 18.432MHz. Clock outputs 18.432/4 & 18.432/8 054573 - Video DAC (one for each R,G,B video signal) 054574 - Possibly RGB mixer/DAC/filter? (connected to 054573) 054338 - Color mixer for special effects/alpha blending etc (connected to 054573 & 054574 and 2018 RAM) 051550 - EMI filter for credit/coin counter 005273 - Resistor array for player 3 & player 4 controls 054986 - Audio DAC/filter 054744 - PAL16L8 055373 - PAL20L10 Sync Measurements ----------------- HSync - 15.2036kHz VSync - 59.1858Hz **************************************************************************** Bug Fixes and Outstanding Issues -------------------------------- Moo: - 54338 color blender support. Works fine with Bucky but needs a correct enable/disable bit in Moo. (intro gfx missing and fog blocking view) - Enemies coming out of the jail cells in the last stage have wrong priority. Could be tile priority or the typical "small Z, big pri" sprite masking trick currently not supported by k053247_sprites_draw(). Moo (bootleg): - No sprites appear, and the game never enables '246 interrupts. Of course, they're using some copy of a '246 on FPGAs, so who knows what's going on... Bucky: - Shadows sometimes have wrong priority. (unsupported priority modes) - Gaps between zoomed sprites. (fraction round-off) - Rogue sprites keep popping on screen after stage 2. They can usually be found near 950000 with sprite code around 5e40 or f400. The GFX viewer only shows blanks at 5e40, however. Are they invalid data from bad sprite ROMs or markers that aren't supposed to be displayed? These artifacts have one thing in common: they all have zero zcode. In fact no other sprites in Bucky seems to have zero zcode. Update: More garbages seen in later stages with a great variety. There's enough indication to assume Bucky simply ignores sprites with zero Z. I wonder why nobody reported this. ***************************************************************************/ #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" #include "machine/eepromser.h" #include "sound/2151intf.h" #include "sound/okim6295.h" #include "sound/k054539.h" #include "includes/konamipt.h" #include "includes/moo.h" #define MOO_DEBUG 0 #define MOO_DMADELAY (100) READ16_MEMBER(moo_state::control2_r) { return m_cur_control2; } WRITE16_MEMBER(moo_state::control2_w) { /* bit 0 is data */ /* bit 1 is cs (active low) */ /* bit 2 is clock (active high) */ /* bit 5 is enable irq 5 (unconfirmed) */ /* bit 8 is enable sprite ROM reading */ /* bit 10 is watchdog */ /* bit 11 is enable irq 4 (unconfirmed) */ COMBINE_DATA(&m_cur_control2); ioport("EEPROMOUT")->write(m_cur_control2, 0xff); if (data & 0x100) m_k053246->k053246_set_objcha_line( ASSERT_LINE); else m_k053246->k053246_set_objcha_line( CLEAR_LINE); } void moo_state::moo_objdma() { int num_inactive; UINT16 *src, *dst; int counter = m_k053246->k053247_get_dy(); m_k053246->k053247_get_ram( &dst); src = m_spriteram; num_inactive = counter = 256; do { if ((*src & 0x8000) && (*src & m_zmask)) { memcpy(dst, src, 0x10); dst += 8; num_inactive--; } src += 0x80; } while (--counter); if (num_inactive) { do { *dst = 0; dst += 8; } while (--num_inactive); } } TIMER_CALLBACK_MEMBER(moo_state::dmaend_callback) { if (m_cur_control2 & 0x800) m_maincpu->set_input_line(4, HOLD_LINE); } INTERRUPT_GEN_MEMBER(moo_state::moo_interrupt) { if (m_k053246->k053246_is_irq_enabled()) { moo_objdma(); // schedule DMA end interrupt (delay shortened to catch up with V-blank) m_dmaend_timer->adjust(attotime::from_usec(MOO_DMADELAY)); } // trigger V-blank interrupt if (m_cur_control2 & 0x20) device.execute().set_input_line(5, HOLD_LINE); } INTERRUPT_GEN_MEMBER(moo_state::moobl_interrupt) { moo_objdma(); // schedule DMA end interrupt (delay shortened to catch up with V-blank) m_dmaend_timer->adjust(attotime::from_usec(MOO_DMADELAY)); // trigger V-blank interrupt device.execute().set_input_line(5, HOLD_LINE); } WRITE16_MEMBER(moo_state::sound_cmd1_w) { if ((data & 0x00ff0000) == 0) { data &= 0xff; m_soundlatch->write(space, 0, data); } } WRITE16_MEMBER(moo_state::sound_cmd2_w) { if ((data & 0x00ff0000) == 0) m_soundlatch2->write(space, 0, data & 0xff); } WRITE16_MEMBER(moo_state::sound_irq_w) { m_soundcpu->set_input_line(0, HOLD_LINE); } READ16_MEMBER(moo_state::sound_status_r) { return m_soundlatch3->read(space, 0); } WRITE8_MEMBER(moo_state::sound_bankswitch_w) { membank("bank1")->set_base(memregion("soundcpu")->base() + 0x10000 + (data&0xf)*0x4000); } #if 0 // (for reference; do not remove) /* the interface with the 053247 is weird. The chip can address only 0x1000 bytes */ /* of RAM, but they put 0x10000 there. The CPU can access them all. */ READ16_MEMBER(moo_state::k053247_scattered_word_r) { if (offset & 0x0078) return m_spriteram[offset]; else { offset = (offset & 0x0007) | ((offset & 0x7f80) >> 4); return k053247_word_r(m_k053246, offset, mem_mask); } } WRITE16_MEMBER(moo_state::k053247_scattered_word_w) { if (offset & 0x0078) COMBINE_DATA(m_spriteram + offset); else { offset = (offset & 0x0007) | ((offset & 0x7f80) >> 4); k053247_word_w(m_k053246, offset, data, mem_mask); } } #endif WRITE16_MEMBER(moo_state::moo_prot_w) { UINT32 src1, src2, dst, length, a, b, res; COMBINE_DATA(&m_protram[offset]); if (offset == 0xc) // trigger operation { src1 = (m_protram[1] & 0xff) << 16 | m_protram[0]; src2 = (m_protram[3] & 0xff) << 16 | m_protram[2]; dst = (m_protram[5] & 0xff) << 16 | m_protram[4]; length = m_protram[0xf]; while (length) { a = space.read_word(src1); b = space.read_word(src2); res = a + 2 * b; space.write_word(dst, res); src1 += 2; src2 += 2; dst += 2; length--; } } } WRITE16_MEMBER(moo_state::moobl_oki_bank_w) { logerror("%x to OKI bank\n", data); m_oki->set_bank_base((data & 0x0f) * 0x40000); } static ADDRESS_MAP_START( moo_map, AS_PROGRAM, 16, moo_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x0c0000, 0x0c003f) AM_DEVWRITE("k056832", k056832_device, word_w) AM_RANGE(0x0c2000, 0x0c2007) AM_DEVWRITE("k053246", k053247_device, k053246_word_w) AM_RANGE(0x0c4000, 0x0c4001) AM_DEVREAD("k053246", k053247_device, k053246_word_r) AM_RANGE(0x0ca000, 0x0ca01f) AM_DEVWRITE("k054338", k054338_device, word_w) /* K054338 alpha blending engine */ AM_RANGE(0x0cc000, 0x0cc01f) AM_DEVWRITE("k053251", k053251_device, lsb_w) AM_RANGE(0x0ce000, 0x0ce01f) AM_WRITE(moo_prot_w) AM_RANGE(0x0d0000, 0x0d001f) AM_DEVREADWRITE8("k053252", k053252_device, read, write, 0x00ff) /* CCU regs (ignored) */ AM_RANGE(0x0d4000, 0x0d4001) AM_WRITE(sound_irq_w) AM_RANGE(0x0d600c, 0x0d600d) AM_WRITE(sound_cmd1_w) AM_RANGE(0x0d600e, 0x0d600f) AM_WRITE(sound_cmd2_w) AM_RANGE(0x0d6014, 0x0d6015) AM_READ(sound_status_r) AM_RANGE(0x0d6000, 0x0d601f) AM_RAM /* sound regs fall through */ AM_RANGE(0x0d8000, 0x0d8007) AM_DEVWRITE("k056832", k056832_device, b_word_w) /* VSCCS regs */ AM_RANGE(0x0da000, 0x0da001) AM_READ_PORT("P1_P3") AM_RANGE(0x0da002, 0x0da003) AM_READ_PORT("P2_P4") AM_RANGE(0x0dc000, 0x0dc001) AM_READ_PORT("IN0") AM_RANGE(0x0dc002, 0x0dc003) AM_READ_PORT("IN1") AM_RANGE(0x0de000, 0x0de001) AM_READWRITE(control2_r, control2_w) AM_RANGE(0x100000, 0x17ffff) AM_ROM AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_SHARE("workram") /* Work RAM */ AM_RANGE(0x190000, 0x19ffff) AM_RAM AM_SHARE("spriteram") /* Sprite RAM */ AM_RANGE(0x1a0000, 0x1a1fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w) /* Graphic planes */ AM_RANGE(0x1a2000, 0x1a3fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w) /* Graphic planes mirror */ AM_RANGE(0x1b0000, 0x1b1fff) AM_DEVREAD("k056832", k056832_device, rom_word_r) /* Passthrough to tile roms */ AM_RANGE(0x1c0000, 0x1c1fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") #if MOO_DEBUG AM_RANGE(0x0c0000, 0x0c003f) AM_DEVREAD("k056832", k056832_device, word_r) AM_RANGE(0x0c2000, 0x0c2007) AM_DEVREAD("k053246", k053247_device, k053246_reg_word_r) AM_RANGE(0x0ca000, 0x0ca01f) AM_DEVREAD("k054338", k054338_device, word_r) AM_RANGE(0x0cc000, 0x0cc01f) AM_DEVREAD("k053251", k053251_device, lsb_r) AM_RANGE(0x0d8000, 0x0d8007) AM_DEVREAD("k056832", k056832_device, b_word_r) #endif ADDRESS_MAP_END static ADDRESS_MAP_START( moobl_map, AS_PROGRAM, 16, moo_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x0c0000, 0x0c003f) AM_DEVWRITE("k056832", k056832_device, word_w) AM_RANGE(0x0c2000, 0x0c2007) AM_DEVWRITE("k053246", k053247_device, k053246_word_w) AM_RANGE(0x0c2f00, 0x0c2f01) AM_READNOP /* heck if I know, but it's polled constantly */ AM_RANGE(0x0c4000, 0x0c4001) AM_DEVREAD("k053246", k053247_device, k053246_word_r) AM_RANGE(0x0ca000, 0x0ca01f) AM_DEVWRITE("k054338", k054338_device, word_w) /* K054338 alpha blending engine */ AM_RANGE(0x0cc000, 0x0cc01f) AM_DEVWRITE("k053251", k053251_device, lsb_w) AM_RANGE(0x0d0000, 0x0d001f) AM_WRITEONLY /* CCU regs (ignored) */ AM_RANGE(0x0d6ffc, 0x0d6ffd) AM_WRITE(moobl_oki_bank_w) AM_RANGE(0x0d6ffe, 0x0d6fff) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff) AM_RANGE(0x0d8000, 0x0d8007) AM_DEVWRITE("k056832", k056832_device, b_word_w) /* VSCCS regs */ AM_RANGE(0x0da000, 0x0da001) AM_READ_PORT("P1_P3") AM_RANGE(0x0da002, 0x0da003) AM_READ_PORT("P2_P4") AM_RANGE(0x0dc000, 0x0dc001) AM_READ_PORT("IN0") AM_RANGE(0x0dc002, 0x0dc003) AM_READ_PORT("IN1") AM_RANGE(0x0de000, 0x0de001) AM_READWRITE(control2_r, control2_w) AM_RANGE(0x100000, 0x17ffff) AM_ROM AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_SHARE("workram") /* Work RAM */ AM_RANGE(0x190000, 0x19ffff) AM_RAM AM_SHARE("spriteram") /* Sprite RAM */ AM_RANGE(0x1a0000, 0x1a1fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w) /* Graphic planes */ AM_RANGE(0x1a2000, 0x1a3fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w) /* Graphic planes mirror */ AM_RANGE(0x1b0000, 0x1b1fff) AM_DEVREAD("k056832", k056832_device, rom_word_r) /* Passthrough to tile roms */ AM_RANGE(0x1c0000, 0x1c1fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") ADDRESS_MAP_END static ADDRESS_MAP_START( bucky_map, AS_PROGRAM, 16, moo_state ) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x080000, 0x08ffff) AM_RAM AM_RANGE(0x090000, 0x09ffff) AM_RAM AM_SHARE("spriteram") /* Sprite RAM */ AM_RANGE(0x0a0000, 0x0affff) AM_RAM /* extra sprite RAM? */ AM_RANGE(0x0c0000, 0x0c003f) AM_DEVWRITE("k056832", k056832_device, word_w) AM_RANGE(0x0c2000, 0x0c2007) AM_DEVWRITE("k053246", k053247_device, k053246_word_w) AM_RANGE(0x0c4000, 0x0c4001) AM_DEVREAD("k053246", k053247_device, k053246_word_r) AM_RANGE(0x0ca000, 0x0ca01f) AM_DEVWRITE("k054338", k054338_device, word_w) /* K054338 alpha blending engine */ AM_RANGE(0x0cc000, 0x0cc01f) AM_DEVWRITE("k053251", k053251_device, lsb_w) AM_RANGE(0x0ce000, 0x0ce01f) AM_WRITE(moo_prot_w) AM_RANGE(0x0d0000, 0x0d001f) AM_DEVREADWRITE8("k053252", k053252_device, read, write, 0x00ff) /* CCU regs (ignored) */ AM_RANGE(0x0d2000, 0x0d20ff) AM_DEVREADWRITE("k054000", k054000_device, lsb_r, lsb_w) AM_RANGE(0x0d4000, 0x0d4001) AM_WRITE(sound_irq_w) AM_RANGE(0x0d600c, 0x0d600d) AM_WRITE(sound_cmd1_w) AM_RANGE(0x0d600e, 0x0d600f) AM_WRITE(sound_cmd2_w) AM_RANGE(0x0d6014, 0x0d6015) AM_READ(sound_status_r) AM_RANGE(0x0d6000, 0x0d601f) AM_RAM /* sound regs fall through */ AM_RANGE(0x0d8000, 0x0d8007) AM_DEVWRITE("k056832", k056832_device, b_word_w) /* VSCCS regs */ AM_RANGE(0x0da000, 0x0da001) AM_READ_PORT("P1_P3") AM_RANGE(0x0da002, 0x0da003) AM_READ_PORT("P2_P4") AM_RANGE(0x0dc000, 0x0dc001) AM_READ_PORT("IN0") AM_RANGE(0x0dc002, 0x0dc003) AM_READ_PORT("IN1") AM_RANGE(0x0de000, 0x0de001) AM_READWRITE(control2_r, control2_w) AM_RANGE(0x180000, 0x181fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w) /* Graphic planes */ AM_RANGE(0x182000, 0x183fff) AM_DEVREADWRITE("k056832", k056832_device, ram_word_r, ram_word_w) /* Graphic planes mirror */ AM_RANGE(0x184000, 0x187fff) AM_RAM /* extra tile RAM? */ AM_RANGE(0x190000, 0x191fff) AM_DEVREAD("k056832", k056832_device, rom_word_r) /* Passthrough to tile roms */ AM_RANGE(0x1b0000, 0x1b3fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x200000, 0x23ffff) AM_ROM /* data */ #if MOO_DEBUG AM_RANGE(0x0c0000, 0x0c003f) AM_DEVREAD("k056832", k056832_device, word_r) AM_RANGE(0x0c2000, 0x0c2007) AM_DEVREAD("k053246", k053247_device, k053246_reg_word_r) AM_RANGE(0x0ca000, 0x0ca01f) AM_DEVREAD("k054338", k054338_device, word_r) AM_RANGE(0x0cc000, 0x0cc01f) AM_DEVREAD("k053251", k053251_device, lsb_r) AM_RANGE(0x0d8000, 0x0d8007) AM_DEVREAD("k056832", k056832_device, b_word_r) #endif ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, moo_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") AM_RANGE(0xc000, 0xdfff) AM_RAM AM_RANGE(0xe000, 0xe22f) AM_DEVREADWRITE("k054539", k054539_device, read, write) AM_RANGE(0xec00, 0xec01) AM_DEVREADWRITE("ymsnd", ym2151_device,read,write) AM_RANGE(0xf000, 0xf000) AM_DEVWRITE("soundlatch3", generic_latch_8_device, write) AM_RANGE(0xf002, 0xf002) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xf003, 0xf003) AM_DEVREAD("soundlatch2", generic_latch_8_device, read) AM_RANGE(0xf800, 0xf800) AM_WRITE(sound_bankswitch_w) ADDRESS_MAP_END static INPUT_PORTS_START( moo ) PORT_START("IN0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 ) PORT_START("IN1") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, do_read) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, ready_read) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_SERVICE_NO_TOGGLE(0x08, IP_ACTIVE_LOW) PORT_DIPNAME( 0x10, 0x00, "Sound Output") PORT_DIPLOCATION("SW1:1") PORT_DIPSETTING( 0x10, DEF_STR( Mono ) ) PORT_DIPSETTING( 0x00, DEF_STR( Stereo ) ) PORT_DIPNAME( 0x20, 0x20, "Coin Mechanism") PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x20, "Common") PORT_DIPSETTING( 0x00, "Independent") PORT_DIPNAME( 0xc0, 0x80, "Number of Players") PORT_DIPLOCATION("SW1:3,4") PORT_DIPSETTING( 0xc0, "2") PORT_DIPSETTING( 0x40, "3") PORT_DIPSETTING( 0x80, "4") PORT_START( "EEPROMOUT" ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, di_write) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, cs_write) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_er5911_device, clk_write) PORT_START("P1_P3") KONAMI16_LSB( 1, IPT_UNKNOWN, IPT_START1 ) KONAMI16_MSB( 3, IPT_UNKNOWN, IPT_START3 ) PORT_START("P2_P4") KONAMI16_LSB( 2, IPT_UNKNOWN, IPT_START2 ) KONAMI16_MSB( 4, IPT_UNKNOWN, IPT_START4 ) INPUT_PORTS_END /* Same as 'moo', but additional "Button 3" for all players */ static INPUT_PORTS_START( bucky ) PORT_INCLUDE( moo ) PORT_MODIFY("P1_P3") KONAMI16_LSB( 1, IPT_BUTTON3, IPT_START1 ) KONAMI16_MSB( 3, IPT_BUTTON3, IPT_START3 ) PORT_MODIFY("P2_P4") KONAMI16_LSB( 2, IPT_BUTTON3, IPT_START2 ) KONAMI16_MSB( 4, IPT_BUTTON3, IPT_START4 ) INPUT_PORTS_END MACHINE_START_MEMBER(moo_state,moo) { save_item(NAME(m_cur_control2)); save_item(NAME(m_alpha_enabled)); save_item(NAME(m_sprite_colorbase)); save_item(NAME(m_layer_colorbase)); save_item(NAME(m_layerpri)); save_item(NAME(m_protram)); m_dmaend_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(moo_state::dmaend_callback),this)); } MACHINE_RESET_MEMBER(moo_state,moo) { int i; for (i = 0; i < 16; i++) m_protram[i] = 0; for (i = 0; i < 4; i++) m_layer_colorbase[i] = 0; for (i = 0; i < 3; i++) m_layerpri[i] = 0; m_cur_control2 = 0; m_alpha_enabled = 0; m_sprite_colorbase = 0; } static MACHINE_CONFIG_START( moo, moo_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_32MHz/2) // 16MHz verified MCFG_CPU_PROGRAM_MAP(moo_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", moo_state, moo_interrupt) MCFG_CPU_ADD("soundcpu", Z80, XTAL_32MHz/4) // 8MHz verified MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_MACHINE_START_OVERRIDE(moo_state,moo) MCFG_MACHINE_RESET_OVERRIDE(moo_state,moo) MCFG_EEPROM_SERIAL_ER5911_8BIT_ADD("eeprom") MCFG_DEVICE_ADD("k053252", K053252, XTAL_32MHz/4) // 8MHz MCFG_K053252_OFFSETS(40, 16) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1200)) // should give IRQ4 sufficient time to update scroll registers MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1) MCFG_SCREEN_UPDATE_DRIVER(moo_state, screen_update_moo) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(XRGB) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_ENABLE_HILIGHTS() MCFG_VIDEO_START_OVERRIDE(moo_state,moo) MCFG_DEVICE_ADD("k053246", K053246, 0) MCFG_K053246_CB(moo_state, sprite_callback) MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48+1, 23) MCFG_K053246_PALETTE("palette") MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(moo_state, tile_callback) MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") MCFG_K056832_PALETTE("palette") MCFG_K053251_ADD("k053251") MCFG_DEVICE_ADD("k054338", K054338, 0) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_GENERIC_LATCH_8_ADD("soundlatch") MCFG_GENERIC_LATCH_8_ADD("soundlatch2") MCFG_GENERIC_LATCH_8_ADD("soundlatch3") MCFG_YM2151_ADD("ymsnd", XTAL_32MHz/8) // 4MHz verified MCFG_SOUND_ROUTE(0, "lspeaker", 0.50) MCFG_SOUND_ROUTE(1, "rspeaker", 0.50) MCFG_DEVICE_ADD("k054539", K054539, XTAL_18_432MHz) MCFG_SOUND_ROUTE(0, "lspeaker", 0.75) MCFG_SOUND_ROUTE(1, "rspeaker", 0.75) MACHINE_CONFIG_END static MACHINE_CONFIG_START( moobl, moo_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 16100000) MCFG_CPU_PROGRAM_MAP(moobl_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", moo_state, moobl_interrupt) MCFG_MACHINE_START_OVERRIDE(moo_state,moo) MCFG_MACHINE_RESET_OVERRIDE(moo_state,moo) MCFG_EEPROM_SERIAL_ER5911_8BIT_ADD("eeprom") /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1200)) // should give IRQ4 sufficient time to update scroll registers MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1) MCFG_SCREEN_UPDATE_DRIVER(moo_state, screen_update_moo) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(XRGB) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_ENABLE_HILIGHTS() MCFG_VIDEO_START_OVERRIDE(moo_state,moo) MCFG_DEVICE_ADD("k053246", K053246, 0) MCFG_K053246_CB(moo_state, sprite_callback) MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48+1, 23) MCFG_K053246_PALETTE("palette") MCFG_DEVICE_ADD("k056832", K056832, 0) MCFG_K056832_CB(moo_state, tile_callback) MCFG_K056832_CONFIG("gfx1", K056832_BPP_4, 1, 0, "none") MCFG_K056832_PALETTE("palette") MCFG_K053251_ADD("k053251") MCFG_DEVICE_ADD("k054338", K054338, 0) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_OKIM6295_ADD("oki", 1056000, OKIM6295_PIN7_HIGH) // clock frequency & pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( bucky, moo ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(bucky_map) MCFG_K054000_ADD("k054000") MCFG_DEVICE_MODIFY("k053246") MCFG_K053246_CONFIG("gfx2", NORMAL_PLANE_ORDER, -48, 23) /* video hardware */ MCFG_PALETTE_MODIFY("palette") MCFG_PALETTE_ENTRIES(4096) MCFG_PALETTE_FORMAT(XRGB) MCFG_PALETTE_ENABLE_SHADOWS() MCFG_PALETTE_ENABLE_HILIGHTS() MCFG_VIDEO_START_OVERRIDE(moo_state,bucky) MACHINE_CONFIG_END ROM_START( moomesa ) /* Version EA */ ROM_REGION( 0x180000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "151b01.q5", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) /* B */ ROM_LOAD16_BYTE( "151eab02.q6", 0x000001, 0x40000, CRC(37b30c01) SHA1(cb91739097a4a36f8f8d92998d822ffc851e1279) ) /* EAB */ /* data */ ROM_LOAD16_BYTE( "151a03.t5", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) ROM_LOAD16_BYTE( "151a04.t6", 0x100001, 0x40000, CRC(3b24706a) SHA1(c2a77944284e35ff57f0774fa7b67e53d3b63e1f) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "151a07.f5", 0x000000, 0x040000, CRC(cde247fc) SHA1(cdee0228db55d53ae43d7cd2d9001dadd20c2c61) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "151a05.t8", 0x000000, 0x100000, CRC(bc616249) SHA1(58c1f1a03ce9bead8f79d12ce4b2d342432b24b5) ) ROM_LOAD32_WORD( "151a06.t10", 0x000002, 0x100000, CRC(38dbcac1) SHA1(c357779733921695b20ac586db5b475f5b2b8f4c) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "151a10.b8", 0x000000, 0x200000, CRC(376c64f1) SHA1(eb69c5a27f9795e28f04a503955132f0a9e4de12) ) ROM_LOAD64_WORD( "151a11.a8", 0x000002, 0x200000, CRC(e7f49225) SHA1(1255b214f29b6507540dad5892c60a7ae2aafc5c) ) ROM_LOAD64_WORD( "151a12.b10", 0x000004, 0x200000, CRC(4978555f) SHA1(d9871f21d0c8a512b408e137e2e80e9392c2bf6f) ) ROM_LOAD64_WORD( "151a13.a10", 0x000006, 0x200000, CRC(4771f525) SHA1(218d86b6230919b5db0304dac00513eb6b27ba9a) ) ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "151a08.b6", 0x000000, 0x200000, CRC(962251d7) SHA1(32dccf515d2ca8eeffb45cada3dcc60089991b77) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "moomesa.nv", 0x0000, 0x080, CRC(7bd904a8) SHA1(8747c5c62d1832e290be8ace73c61b1f228c0bec) ) ROM_END ROM_START( moomesauac ) /* Version UA */ ROM_REGION( 0x180000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "151c01.q5", 0x000000, 0x40000, CRC(10555732) SHA1(b67cb756c250ddd6f3291683b3f3449e13a2ee83) ) /* C */ ROM_LOAD16_BYTE( "151uac02.q6", 0x000001, 0x40000, CRC(52ae87b0) SHA1(552d41a2ddd040f92c6a3cfdc07f9d6e751ac9c1) ) /* UAC */ /* data */ ROM_LOAD16_BYTE( "151a03.t5", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) ROM_LOAD16_BYTE( "151a04.t6", 0x100001, 0x40000, CRC(3b24706a) SHA1(c2a77944284e35ff57f0774fa7b67e53d3b63e1f) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "151a07.f5", 0x000000, 0x040000, CRC(cde247fc) SHA1(cdee0228db55d53ae43d7cd2d9001dadd20c2c61) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "151a05.t8", 0x000000, 0x100000, CRC(bc616249) SHA1(58c1f1a03ce9bead8f79d12ce4b2d342432b24b5) ) ROM_LOAD32_WORD( "151a06.t10", 0x000002, 0x100000, CRC(38dbcac1) SHA1(c357779733921695b20ac586db5b475f5b2b8f4c) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "151a10.b8", 0x000000, 0x200000, CRC(376c64f1) SHA1(eb69c5a27f9795e28f04a503955132f0a9e4de12) ) ROM_LOAD64_WORD( "151a11.a8", 0x000002, 0x200000, CRC(e7f49225) SHA1(1255b214f29b6507540dad5892c60a7ae2aafc5c) ) ROM_LOAD64_WORD( "151a12.b10", 0x000004, 0x200000, CRC(4978555f) SHA1(d9871f21d0c8a512b408e137e2e80e9392c2bf6f) ) ROM_LOAD64_WORD( "151a13.a10", 0x000006, 0x200000, CRC(4771f525) SHA1(218d86b6230919b5db0304dac00513eb6b27ba9a) ) ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "151a08.b6", 0x000000, 0x200000, CRC(962251d7) SHA1(32dccf515d2ca8eeffb45cada3dcc60089991b77) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "moomesauac.nv", 0x0000, 0x080, CRC(a5cb137a) SHA1(119df859d6b5c366481305b1433eea0deadc3fa9) ) ROM_END ROM_START( moomesauab ) /* Version UA */ ROM_REGION( 0x180000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "151b01.q5", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) /* B */ ROM_LOAD16_BYTE( "151uab02.q6", 0x000001, 0x40000, CRC(3d9f4d59) SHA1(db47044bd4935fce94ec659242c9819c30eb6d0f) ) /* UAB */ /* data */ ROM_LOAD16_BYTE( "151a03.t5", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) ROM_LOAD16_BYTE( "151a04.t6", 0x100001, 0x40000, CRC(3b24706a) SHA1(c2a77944284e35ff57f0774fa7b67e53d3b63e1f) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "151a07.f5", 0x000000, 0x040000, CRC(cde247fc) SHA1(cdee0228db55d53ae43d7cd2d9001dadd20c2c61) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "151a05.t8", 0x000000, 0x100000, CRC(bc616249) SHA1(58c1f1a03ce9bead8f79d12ce4b2d342432b24b5) ) ROM_LOAD32_WORD( "151a06.t10", 0x000002, 0x100000, CRC(38dbcac1) SHA1(c357779733921695b20ac586db5b475f5b2b8f4c) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "151a10.b8", 0x000000, 0x200000, CRC(376c64f1) SHA1(eb69c5a27f9795e28f04a503955132f0a9e4de12) ) ROM_LOAD64_WORD( "151a11.a8", 0x000002, 0x200000, CRC(e7f49225) SHA1(1255b214f29b6507540dad5892c60a7ae2aafc5c) ) ROM_LOAD64_WORD( "151a12.b10", 0x000004, 0x200000, CRC(4978555f) SHA1(d9871f21d0c8a512b408e137e2e80e9392c2bf6f) ) ROM_LOAD64_WORD( "151a13.a10", 0x000006, 0x200000, CRC(4771f525) SHA1(218d86b6230919b5db0304dac00513eb6b27ba9a) ) ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "151a08.b6", 0x000000, 0x200000, CRC(962251d7) SHA1(32dccf515d2ca8eeffb45cada3dcc60089991b77) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "moomesauab.nv", 0x0000, 0x080, CRC(a5cb137a) SHA1(119df859d6b5c366481305b1433eea0deadc3fa9) ) ROM_END ROM_START( moomesaaab ) /* Version AA */ ROM_REGION( 0x180000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "151b01.q5", 0x000000, 0x40000, CRC(fb2fa298) SHA1(f03b24681a2b329ba797fd2780ac9a3cf862ebcb) ) /* B */ ROM_LOAD16_BYTE( "151aab02.q6", 0x000001, 0x40000, CRC(2162d593) SHA1(a6cfe4a57b3f22b2aa0f04f91acefe3b7bea9e76) ) /* AAB */ /* data */ ROM_LOAD16_BYTE( "151a03.t5", 0x100000, 0x40000, CRC(c896d3ea) SHA1(ea83c63e2c3dbc4f1e1d49f1852a78ffc1f0ea4b) ) ROM_LOAD16_BYTE( "151a04.t6", 0x100001, 0x40000, CRC(3b24706a) SHA1(c2a77944284e35ff57f0774fa7b67e53d3b63e1f) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "151a07.f5", 0x000000, 0x040000, CRC(cde247fc) SHA1(cdee0228db55d53ae43d7cd2d9001dadd20c2c61) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "151a05.t8", 0x000000, 0x100000, CRC(bc616249) SHA1(58c1f1a03ce9bead8f79d12ce4b2d342432b24b5) ) ROM_LOAD32_WORD( "151a06.t10", 0x000002, 0x100000, CRC(38dbcac1) SHA1(c357779733921695b20ac586db5b475f5b2b8f4c) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "151a10.b8", 0x000000, 0x200000, CRC(376c64f1) SHA1(eb69c5a27f9795e28f04a503955132f0a9e4de12) ) ROM_LOAD64_WORD( "151a11.a8", 0x000002, 0x200000, CRC(e7f49225) SHA1(1255b214f29b6507540dad5892c60a7ae2aafc5c) ) ROM_LOAD64_WORD( "151a12.b10", 0x000004, 0x200000, CRC(4978555f) SHA1(d9871f21d0c8a512b408e137e2e80e9392c2bf6f) ) ROM_LOAD64_WORD( "151a13.a10", 0x000006, 0x200000, CRC(4771f525) SHA1(218d86b6230919b5db0304dac00513eb6b27ba9a) ) ROM_REGION( 0x200000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "151a08.b6", 0x000000, 0x200000, CRC(962251d7) SHA1(32dccf515d2ca8eeffb45cada3dcc60089991b77) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "moomesaaab.nv", 0x0000, 0x080, CRC(7bd904a8) SHA1(8747c5c62d1832e290be8ace73c61b1f228c0bec) ) ROM_END ROM_START( bucky ) /* Version EA */ ROM_REGION( 0x240000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "173eab01.q5", 0x000000, 0x40000, CRC(7785ac8a) SHA1(ef78d14f54d3a0b724b9702a18c67891e2d366a7) ) /* EAB */ ROM_LOAD16_BYTE( "173eab02.q6", 0x000001, 0x40000, CRC(9b45f122) SHA1(325af1612e6f90ef9ae9353c43dc645be1f3465c) ) /* EAB */ /* data */ ROM_LOAD16_BYTE( "173a03.t5", 0x200000, 0x20000, CRC(cd724026) SHA1(525445499604b713da4d8bc0a88e428654ceab95) ) ROM_LOAD16_BYTE( "173a04.t6", 0x200001, 0x20000, CRC(7dd54d6f) SHA1(b0ee8ec445b92254bca881eefd4449972fed506a) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "173a07.f5", 0x000000, 0x040000, CRC(4cdaee71) SHA1(bdc05d4475415f6fac65d7cdbc48df398e57845e) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "173a05.t8", 0x000000, 0x100000, CRC(d14333b4) SHA1(d1a15ead2d156e1fceca0bf202ab3962411caf11) ) ROM_LOAD32_WORD( "173a06.t10", 0x000002, 0x100000, CRC(6541a34f) SHA1(15cf481498e3b7e0b2f7bfe5434121cc3bd65662) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "173a10.b8", 0x000000, 0x200000, CRC(42fb0a0c) SHA1(d68c932cfabdec7896698b433525fe47ef4698d0) ) ROM_LOAD64_WORD( "173a11.a8", 0x000002, 0x200000, CRC(b0d747c4) SHA1(0cf1ee1b9a35ded31a81c321df2a076f7b588971) ) ROM_LOAD64_WORD( "173a12.b10", 0x000004, 0x200000, CRC(0fc2ad24) SHA1(6eda1043ee1266b8ba938a03a90bc7787210a936) ) ROM_LOAD64_WORD( "173a13.a10", 0x000006, 0x200000, CRC(4cf85439) SHA1(8c298bf0e659a830a1830a1180f4ce71215ade45) ) ROM_REGION( 0x400000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "173a08.b6", 0x000000, 0x200000, CRC(dcdded95) SHA1(8eeb546a0b60a35a6dce36c5ee872e6c93c577c9) ) ROM_LOAD( "173a09.a6", 0x200000, 0x200000, CRC(c93697c4) SHA1(0528a604868267a30d281b822c187df118566691) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "bucky.nv", 0x0000, 0x080, CRC(6a5986f3) SHA1(3efddeed261b09031c582e12318f00c2cbb214ea) ) ROM_END ROM_START( buckyea ) /* Version EA */ ROM_REGION( 0x240000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "2.d5", 0x000000, 0x40000, CRC(e18518a6) SHA1(6b0bac8080032b7528b47e802c2f6a5264da5f55) ) /* 27C2001 EA prototype? */ ROM_LOAD16_BYTE( "3.d6", 0x000001, 0x40000, CRC(45ef9545) SHA1(370862e916410e7052e094033cc18ac727c75d8e) ) /* 27C2001 EA prototype? */ /* data */ ROM_LOAD16_BYTE( "173a03.t5", 0x200000, 0x20000, CRC(cd724026) SHA1(525445499604b713da4d8bc0a88e428654ceab95) ) ROM_LOAD16_BYTE( "173a04.t6", 0x200001, 0x20000, CRC(7dd54d6f) SHA1(b0ee8ec445b92254bca881eefd4449972fed506a) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "173a07.f5", 0x000000, 0x040000, CRC(4cdaee71) SHA1(bdc05d4475415f6fac65d7cdbc48df398e57845e) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "173a05.t8", 0x000000, 0x100000, CRC(d14333b4) SHA1(d1a15ead2d156e1fceca0bf202ab3962411caf11) ) ROM_LOAD32_WORD( "173a06.t10", 0x000002, 0x100000, CRC(6541a34f) SHA1(15cf481498e3b7e0b2f7bfe5434121cc3bd65662) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "173a10.b8", 0x000000, 0x200000, CRC(42fb0a0c) SHA1(d68c932cfabdec7896698b433525fe47ef4698d0) ) ROM_LOAD64_WORD( "173a11.a8", 0x000002, 0x200000, CRC(b0d747c4) SHA1(0cf1ee1b9a35ded31a81c321df2a076f7b588971) ) ROM_LOAD64_WORD( "173a12.b10", 0x000004, 0x200000, CRC(0fc2ad24) SHA1(6eda1043ee1266b8ba938a03a90bc7787210a936) ) ROM_LOAD64_WORD( "173a13.a10", 0x000006, 0x200000, CRC(4cf85439) SHA1(8c298bf0e659a830a1830a1180f4ce71215ade45) ) ROM_REGION( 0x400000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "173a08.b6", 0x000000, 0x200000, CRC(dcdded95) SHA1(8eeb546a0b60a35a6dce36c5ee872e6c93c577c9) ) ROM_LOAD( "173a09.a6", 0x200000, 0x200000, CRC(c93697c4) SHA1(0528a604868267a30d281b822c187df118566691) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "bucky.nv", 0x0000, 0x080, CRC(6a5986f3) SHA1(3efddeed261b09031c582e12318f00c2cbb214ea) ) ROM_END ROM_START( buckyuab ) /* Version UA */ ROM_REGION( 0x240000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "173uab01.q5", 0x000000, 0x40000, CRC(dcaecca0) SHA1(c41847c9d89cdaf7cfa81ad9cc018c32592a882f) ) /* UAB */ ROM_LOAD16_BYTE( "173uab02.q6", 0x000001, 0x40000, CRC(e3c856a6) SHA1(33cc8a29643e44b31ee280015c0c994bed72a0e3) ) /* UAB */ /* data */ ROM_LOAD16_BYTE( "173a03.t5", 0x200000, 0x20000, CRC(cd724026) SHA1(525445499604b713da4d8bc0a88e428654ceab95) ) ROM_LOAD16_BYTE( "173a04.t6", 0x200001, 0x20000, CRC(7dd54d6f) SHA1(b0ee8ec445b92254bca881eefd4449972fed506a) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "173a07.f5", 0x000000, 0x040000, CRC(4cdaee71) SHA1(bdc05d4475415f6fac65d7cdbc48df398e57845e) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "173a05.t8", 0x000000, 0x100000, CRC(d14333b4) SHA1(d1a15ead2d156e1fceca0bf202ab3962411caf11) ) ROM_LOAD32_WORD( "173a06.t10", 0x000002, 0x100000, CRC(6541a34f) SHA1(15cf481498e3b7e0b2f7bfe5434121cc3bd65662) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "173a10.b8", 0x000000, 0x200000, CRC(42fb0a0c) SHA1(d68c932cfabdec7896698b433525fe47ef4698d0) ) ROM_LOAD64_WORD( "173a11.a8", 0x000002, 0x200000, CRC(b0d747c4) SHA1(0cf1ee1b9a35ded31a81c321df2a076f7b588971) ) ROM_LOAD64_WORD( "173a12.b10", 0x000004, 0x200000, CRC(0fc2ad24) SHA1(6eda1043ee1266b8ba938a03a90bc7787210a936) ) ROM_LOAD64_WORD( "173a13.a10", 0x000006, 0x200000, CRC(4cf85439) SHA1(8c298bf0e659a830a1830a1180f4ce71215ade45) ) ROM_REGION( 0x400000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "173a08.b6", 0x000000, 0x200000, CRC(dcdded95) SHA1(8eeb546a0b60a35a6dce36c5ee872e6c93c577c9) ) ROM_LOAD( "173a09.a6", 0x200000, 0x200000, CRC(c93697c4) SHA1(0528a604868267a30d281b822c187df118566691) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "buckyuab.nv", 0x0000, 0x080, CRC(a5cb137a) SHA1(119df859d6b5c366481305b1433eea0deadc3fa9) ) ROM_END ROM_START( buckyaab ) /* Version AA */ ROM_REGION( 0x240000, "maincpu", 0 ) /* main program */ ROM_LOAD16_BYTE( "173aab01.q5", 0x000000, 0x40000, CRC(9193e89f) SHA1(574d6eb4097cd10c3dea99060ee09f220d41f1dc) ) /* AAB */ ROM_LOAD16_BYTE( "173aab02.q6", 0x000001, 0x40000, CRC(2567f3eb) SHA1(ccdb2a4b3ad1464f70d1442df8a3a7a7e34f6cd7) ) /* AAB */ /* data */ ROM_LOAD16_BYTE( "173a03.t5", 0x200000, 0x20000, CRC(cd724026) SHA1(525445499604b713da4d8bc0a88e428654ceab95) ) ROM_LOAD16_BYTE( "173a04.t6", 0x200001, 0x20000, CRC(7dd54d6f) SHA1(b0ee8ec445b92254bca881eefd4449972fed506a) ) ROM_REGION( 0x050000, "soundcpu", 0 ) /* Z80 sound program */ ROM_LOAD( "173a07.f5", 0x000000, 0x040000, CRC(4cdaee71) SHA1(bdc05d4475415f6fac65d7cdbc48df398e57845e) ) ROM_RELOAD( 0x010000, 0x040000 ) ROM_REGION( 0x200000, "gfx1", 0 ) /* tilemaps */ ROM_LOAD32_WORD( "173a05.t8", 0x000000, 0x100000, CRC(d14333b4) SHA1(d1a15ead2d156e1fceca0bf202ab3962411caf11) ) ROM_LOAD32_WORD( "173a06.t10", 0x000002, 0x100000, CRC(6541a34f) SHA1(15cf481498e3b7e0b2f7bfe5434121cc3bd65662) ) ROM_REGION( 0x800000, "gfx2", 0 ) /* sprites */ ROM_LOAD64_WORD( "173a10.b8", 0x000000, 0x200000, CRC(42fb0a0c) SHA1(d68c932cfabdec7896698b433525fe47ef4698d0) ) ROM_LOAD64_WORD( "173a11.a8", 0x000002, 0x200000, CRC(b0d747c4) SHA1(0cf1ee1b9a35ded31a81c321df2a076f7b588971) ) ROM_LOAD64_WORD( "173a12.b10", 0x000004, 0x200000, CRC(0fc2ad24) SHA1(6eda1043ee1266b8ba938a03a90bc7787210a936) ) ROM_LOAD64_WORD( "173a13.a10", 0x000006, 0x200000, CRC(4cf85439) SHA1(8c298bf0e659a830a1830a1180f4ce71215ade45) ) ROM_REGION( 0x400000, "k054539", 0 ) /* K054539 samples */ ROM_LOAD( "173a08.b6", 0x000000, 0x200000, CRC(dcdded95) SHA1(8eeb546a0b60a35a6dce36c5ee872e6c93c577c9) ) ROM_LOAD( "173a09.a6", 0x200000, 0x200000, CRC(c93697c4) SHA1(0528a604868267a30d281b822c187df118566691) ) ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "buckyaab.nv", 0x0000, 0x080, CRC(6a5986f3) SHA1(3efddeed261b09031c582e12318f00c2cbb214ea) ) ROM_END ROM_START( moomesabl ) ROM_REGION( 0x180000, "maincpu", 0 ) ROM_LOAD16_WORD_SWAP( "moo03.rom", 0x000000, 0x80000, CRC(fed6a1cb) SHA1(be58e266973930d643b5e15dcc974a82e1a3ae35) ) ROM_LOAD16_WORD_SWAP( "moo04.rom", 0x100000, 0x80000, CRC(ec45892a) SHA1(594330cbbfbca87e61ddf519e565018b6eaf5a20) ) ROM_REGION( 0x100000, "user1", 0 ) ROM_LOAD16_WORD_SWAP( "moo03.rom", 0x000000, 0x80000, CRC(fed6a1cb) SHA1(be58e266973930d643b5e15dcc974a82e1a3ae35) ) ROM_LOAD16_WORD_SWAP( "moo04.rom", 0x080000, 0x80000, CRC(ec45892a) SHA1(594330cbbfbca87e61ddf519e565018b6eaf5a20) ) ROM_REGION( 0x200000, "gfx1", 0 ) ROM_LOAD32_WORD( "moo05.rom", 0x000000, 0x080000, CRC(8c045f9c) SHA1(cde81a722a4bc2efac09a26d7e300664059ec7bb) ) ROM_LOAD32_WORD( "moo07.rom", 0x000002, 0x080000, CRC(b9e29f50) SHA1(c2af095df0af45064d49210085370425b319b82b) ) ROM_LOAD32_WORD( "moo06.rom", 0x100000, 0x080000, CRC(1261aa89) SHA1(b600916911bc0d8b6348e2ad4a16ed1a1c528261) ) ROM_LOAD32_WORD( "moo08.rom", 0x100002, 0x080000, CRC(e6937229) SHA1(089b3d4af33e8d8fbc1f3abb81e047a7a590567c) ) // sprites from bootleg not included in dump, taken from original game ROM_REGION( 0x800000, "gfx2", 0 ) ROM_LOAD64_WORD( "151a10", 0x000000, 0x200000, CRC(376c64f1) SHA1(eb69c5a27f9795e28f04a503955132f0a9e4de12) ) ROM_LOAD64_WORD( "151a11", 0x000002, 0x200000, CRC(e7f49225) SHA1(1255b214f29b6507540dad5892c60a7ae2aafc5c) ) ROM_LOAD64_WORD( "151a12", 0x000004, 0x200000, CRC(4978555f) SHA1(d9871f21d0c8a512b408e137e2e80e9392c2bf6f) ) ROM_LOAD64_WORD( "151a13", 0x000006, 0x200000, CRC(4771f525) SHA1(218d86b6230919b5db0304dac00513eb6b27ba9a) ) ROM_REGION( 0x340000, "oki", 0 ) ROM_LOAD( "moo01.rom", 0x000000, 0x040000, CRC(3311338a) SHA1(c0b5cd16f0275b5b93a2ea4fc64013c848c5fa43) )//bank 0 lo & hi ROM_CONTINUE( 0x040000+0x30000, 0x010000)//bank 1 hi ROM_CONTINUE( 0x080000+0x30000, 0x010000)//bank 2 hi ROM_CONTINUE( 0x0c0000+0x30000, 0x010000)//bank 3 hi ROM_CONTINUE( 0x100000+0x30000, 0x010000)//bank 4 hi ROM_RELOAD( 0x040000, 0x30000 )//bank 1 lo ROM_RELOAD( 0x080000, 0x30000 )//bank 2 lo ROM_RELOAD( 0x0c0000, 0x30000 )//bank 3 lo ROM_RELOAD( 0x100000, 0x30000 )//bank 4 lo ROM_RELOAD( 0x140000, 0x30000 )//bank 5 lo ROM_RELOAD( 0x180000, 0x30000 )//bank 6 lo ROM_RELOAD( 0x1c0000, 0x30000 )//bank 7 lo ROM_RELOAD( 0x200000, 0x30000 )//bank 8 lo ROM_RELOAD( 0x240000, 0x30000 )//bank 9 lo ROM_RELOAD( 0x280000, 0x30000 )//bank a lo ROM_RELOAD( 0x2c0000, 0x30000 )//bank b lo ROM_RELOAD( 0x300000, 0x30000 )//bank c lo ROM_LOAD( "moo02.rom", 0x140000+0x30000, 0x010000, CRC(2cf3a7c6) SHA1(06f495ba8250b34c32569d49c8b84e6edef562d3) )//bank 5 hi ROM_CONTINUE( 0x180000+0x30000, 0x010000)//bank 6 hi ROM_CONTINUE( 0x1c0000+0x30000, 0x010000)//bank 7 hi ROM_CONTINUE( 0x200000+0x30000, 0x010000)//bank 8 hi ROM_CONTINUE( 0x240000+0x30000, 0x010000)//bank 9 hi ROM_CONTINUE( 0x280000+0x30000, 0x010000)//bank a hi ROM_CONTINUE( 0x2c0000+0x30000, 0x010000)//bank b hi ROM_CONTINUE( 0x300000+0x30000, 0x010000)//bank c hi ROM_REGION( 0x80, "eeprom", 0 ) // default eeprom to prevent game booting upside down with error ROM_LOAD( "moo.nv", 0x0000, 0x080, CRC(7bd904a8) SHA1(8747c5c62d1832e290be8ace73c61b1f228c0bec) ) ROM_END GAME( 1992, moomesa, 0, moo, moo, driver_device, 0, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver EAB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1992, moomesauac, moomesa, moo, moo, driver_device, 0, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver UAC)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1992, moomesauab, moomesa, moo, moo, driver_device, 0, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver UAB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1992, moomesaaab, moomesa, moo, moo, driver_device, 0, ROT0, "Konami", "Wild West C.O.W.-Boys of Moo Mesa (ver AAB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1992, moomesabl, moomesa, moobl, moo, driver_device, 0, ROT0, "bootleg", "Wild West C.O.W.-Boys of Moo Mesa (bootleg)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // based on Version AA GAME( 1992, bucky, 0, bucky, bucky, driver_device, 0, ROT0, "Konami", "Bucky O'Hare (ver EAB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1992, buckyea, bucky, bucky, bucky, driver_device, 0, ROT0, "Konami", "Bucky O'Hare (ver EA)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1992, buckyuab, bucky, bucky, bucky, driver_device, 0, ROT0, "Konami", "Bucky O'Hare (ver UAB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1992, buckyaab, bucky, bucky, bucky, driver_device, 0, ROT0, "Konami", "Bucky O'Hare (ver AAB)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE )
Unrepentant-Atheist/mame
src/mame/drivers/moo.cpp
C++
gpl-2.0
45,347
// // Author: Vladimir Migashko <migashko@faslib.com>, (C) 2008 // // Copyright: See COPYING file that comes with this distribution // #ifndef FAS_ADV_AMF_SRV_STATE3_HPP #define FAS_ADV_AMF_SRV_STATE3_HPP #include <vector> #include <iostream> #include <fas/adv/amf/srv/tags.hpp> //#include <fas/amf/types.hpp> namespace fas{ namespace adv{ namespace amf{ namespace srv{ class ad_state3 { typedef std::vector<char> data_type; public: template<typename T> void activate(T&){} template<typename T> void operator()(T& t, const char* d, size_t s) { if ( s==0 ) return; t.get_aspect().template get<_chunk_splitter_>()(t, d, s); } private: data_type _handshake; }; }}}} #endif //TR_AMF_SPLITTER_H
mambaru/leveldb-daemon
fas/adv/amf/srv/ad_state3.hpp
C++
gpl-2.0
733
'use strict'; angular.module('restFrontendApp') .factory('MainSrvc', function ($resource) { return $resource('http://localhost:8080/RestBackEnd/services/rest/contact/:id',{id:'@_id'}, { getData: { method:'GET', isArray: false }, postData: { method:'POST' } }); });
davidetrapani/OracleDB_RestBackEnd
restFrontend/app/scripts/services/main.js
JavaScript
gpl-2.0
305
package leetcode; /** * 24. Swap Nodes in Pairs * * Given a linked list, swap every two adjacent nodes and return its head. * * Example: * * Given 1->2->3->4, you should return the list as 2->1->4->3. * Note: * * Your algorithm should use only constant extra space. * You may not modify the values in the list's nodes, only nodes itself may be changed. */ // [beats 100.00 % - 2ms]No.1 - 24. Swap Nodes in Pairs public class SwapNodesInPairs { /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ public class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } public ListNode swapPairs(ListNode head) { if (head == null || head.next == null) return head; ListNode newHead = new ListNode(0); ListNode cur = newHead; cur.next = head; ListNode tmpNode; while (cur != null && cur.next != null && cur.next.next != null) { tmpNode = cur.next; cur.next = cur.next.next; tmpNode.next = cur.next.next; cur.next.next = tmpNode; // move cur = cur.next.next; } return newHead.next; } public static void main(String[] args) { ListNode head1, node1; node1 = new SwapNodesInPairs().new ListNode(1); head1 = node1; node1.next = new SwapNodesInPairs().new ListNode(2); node1 = node1.next; node1.next = new SwapNodesInPairs().new ListNode(3); node1 = node1.next; node1.next = new SwapNodesInPairs().new ListNode(4); node1 = node1.next; node1.next = new SwapNodesInPairs().new ListNode(5); node1 = node1.next; ListNode printHead = new SwapNodesInPairs().new ListNode(0); printHead.next = new SwapNodesInPairs().swapPairs(head1); while (printHead.next != null) { printHead = printHead.next; System.out.println(printHead.val); } } }
MathactwFX/java
exercise/src/main/java/leetcode/SwapNodesInPairs.java
Java
gpl-2.0
2,107
tinyMCE.addI18n("sk.advlink_dlg", { target_name: "Názov cieľa", classes: "Triedy", style: "Štýl", id: "ID", popup_position: "Umiestnenie (X/Y)", langdir: "Smer textu", popup_size: "Veľkosť", popup_dependent: "Závislosť (iba Mozilla/Firefox)", popup_resizable: "Umožniť zmenu veľkosti", popup_location: "Zobraziť lištu umiestnení", popup_menubar: "Zobraziť ponuku", popup_toolbar: "Zobraziť nástrojovú lištu", popup_statusbar: "Zobraziť stavový riadok", popup_scrollbars: "Zobraziť posuvníky", popup_return: "Vložiť 'return false'", popup_name: "Názov okna", popup_url: "URL vyskakovacieho okna", popup: "JavaScriptové okno", target_blank: "Otvoriť v novom okne", target_top: "Otvoriť v hlavnom okne/ráme (nahradiť všetky rámy)", target_parent: "Otvoriť v nadradenom okne/ráme", target_same: "Otvoriť v rovnakom okne/ráme", anchor_names: "Záložka", popup_opts: "Možnosti", advanced_props: "Rozšírené parametre", event_props: "Udalosti", popup_props: "Vlastnosti vyskakovacieho okna", general_props: "Obecné parametre", advanced_tab: "Rozšírené", events_tab: "Udalosti", popup_tab: "Vyskakovacie okno", general_tab: "Obecné", list: "Zoznam odkazov", is_external: "Zadaná URL vyzerá ako externý odkaz, chcete doplniť povinný prefix http://?", is_email: "Zadaná URL vyzerá ako e-mailová adresa, chcete doplniť povinný prefix mailto:?", titlefield: "Titulok", target: "Cieľ", url: "URL odkazu", title: "Vložiť/upraviť odkaz", link_list: "Zoznam odkazov", rtl: "Sprava doľava", ltr: "Zľava doprava", accesskey: "Klávesová skratka", tabindex: "Poradie pre tabulátor", rev: "Vzťah cieľa k stránke", rel: "Vzťah stránky k cieľu", mime: "MIME typ", encoding: "Kódovanie", langcode: "Kód jazyka", target_langcode: "Jazyk cieľa" });
openacs/openacs-core
packages/acs-templating/www/resources/tinymce/jscripts/tiny_mce/plugins/advlink/langs/sk_dlg_src.js
JavaScript
gpl-2.0
1,996
// Load modules var NodeUtil = require('util'); var Hoek = require('hoek'); // Declare internals var internals = { flags: ['deep', 'not', 'once', 'only', 'part'], grammar: ['a', 'an', 'and', 'at', 'be', 'have', 'in', 'to'], locations: {}, count: 0 }; exports.settings = { truncateMessages: true }; exports.expect = function (value, prefix) { var at = internals.at(); var location = at.filename + ':' + at.line + '.' + at.column; internals.locations[location] = true; ++internals.count; return new internals.Assertion(value, prefix, location); }; exports.incomplete = function () { var locations = Object.keys(internals.locations); return locations.length ? locations : null; }; exports.count = function () { return internals.count; }; internals.Assertion = function (ref, prefix, location) { this._ref = ref; this._prefix = prefix || ''; this._location = location; this._flags = {}; }; internals.filterLocal = function (line) { return line.indexOf(__dirname) === -1; }; internals.Assertion.prototype.assert = function (result, verb, actual, expected) { delete internals.locations[this._location]; if (this._flags.not ? !result : result) { this._flags = {}; return this; } var message = (this._prefix ? this._prefix + ': ' : '') + 'Expected ' + internals.display(this._ref) + ' to ' + (this._flags.not ? 'not ' + verb : verb); if (arguments.length === 3) { // 'actual' without 'expected' message += ' but got ' + internals.display(actual); } var error = new Error(message); Error.captureStackTrace(error, this.assert); error.actual = actual; error.expected = expected; error.at = internals.at(error); throw error; }; [].concat(internals.flags, internals.grammar).forEach(function (word) { var method = internals.flags.indexOf(word) !== -1 ? function () { this._flags[word] = !this._flags[word]; return this; } : function () { return this; }; Object.defineProperty(internals.Assertion.prototype, word, { get: method, configurable: true }); }); internals.addMethod = function (names, fn) { names = [].concat(names); names.forEach(function (name) { internals.Assertion.prototype[name] = fn; }); }; ['arguments', 'array', 'boolean', 'buffer', 'date', 'function', 'number', 'regexp', 'string', 'object'].forEach(function (word) { var article = ['a', 'e', 'i', 'o', 'u'].indexOf(word[0]) !== -1 ? 'an ' : 'a '; internals.addMethod(word, function () { var type = internals.type(this._ref); return this.assert(type === word, 'be ' + article + word, type); }); }); [true, false, null, undefined].forEach(function (value) { var name = NodeUtil.inspect(value); internals.addMethod(name, function () { return this.assert(this._ref === value, 'be ' + name); }); }); internals.addMethod(['include', 'includes', 'contain', 'contains'], function (value) { return this.assert(Hoek.contain(this._ref, value, this._flags), 'include ' + internals.display(value)); }); internals.addMethod(['endWith', 'endsWith'], function (value) { internals.assert(this, typeof this._ref === 'string' && typeof value === 'string', 'Can only assert endsWith on a string, with a string'); var comparator = this._ref.slice(-value.length); return this.assert(comparator === value, 'endWith ' + internals.display(value)); }); internals.addMethod(['startWith', 'startsWith'], function (value) { internals.assert(this, typeof this._ref === 'string' && typeof value === 'string', 'Can only assert startsWith on a string, with a string'); var comparator = this._ref.slice(0, value.length); return this.assert(comparator === value, 'startWith ' + internals.display(value)); }); internals.addMethod(['exist', 'exists'], function () { return this.assert(this._ref !== null && this._ref !== undefined, 'exist'); }); internals.addMethod('empty', function () { internals.assert(this, typeof this._ref === 'object' || typeof this._ref === 'string', 'Can only assert empty on object, array or string'); var length = this._ref.length !== undefined ? this._ref.length : Object.keys(this._ref).length; return this.assert(!length, 'be empty'); }); internals.addMethod('length', function (size) { internals.assert(this, typeof this._ref === 'object' || typeof this._ref === 'string', 'Can only assert empty on object, array or string'); var length = this._ref.length !== undefined ? this._ref.length : Object.keys(this._ref).length; return this.assert(length === size, 'have a length of ' + size, length); }); internals.addMethod(['equal', 'equals'], function (value, options) { var compare = this._flags.deep ? function (a, b) { return Hoek.deepEqual(a, b, options); } : function (a, b) { return a === b; }; return this.assert(compare(this._ref, value), 'equal specified value', this._ref, value); }); internals.addMethod(['above', 'greaterThan'], function (value) { return this.assert(this._ref > value, 'be above ' + value); }); internals.addMethod(['least', 'min'], function (value) { return this.assert(this._ref >= value, 'be at least ' + value); }); internals.addMethod(['below', 'lessThan'], function (value) { return this.assert(this._ref < value, 'be below ' + value); }); internals.addMethod(['most', 'max'], function (value) { return this.assert(this._ref <= value, 'be at most ' + value); }); internals.addMethod(['within', 'range'], function (from, to) { return this.assert(this._ref >= from && this._ref <= to, 'be within ' + from + '..' + to); }); internals.addMethod('between', function (from, to) { return this.assert(this._ref > from && this._ref < to, 'be between ' + from + '..' + to); }); internals.addMethod('about', function (value, delta) { internals.assert(this, internals.type(this._ref) === 'number', 'Can only assert about on numbers'); internals.assert(this, internals.type(value) === 'number' && internals.type(delta) === 'number', 'About assertion requires two number arguments'); return this.assert(Math.abs(this._ref - value) <= delta, 'be about ' + value + ' \u00b1' + delta); }); internals.addMethod(['instanceof', 'instanceOf'], function (type) { return this.assert(this._ref instanceof type, 'be an instance of ' + (type.name || 'provided type')); }); internals.addMethod(['match', 'matches'], function (regex) { return this.assert(regex.exec(this._ref), 'match ' + regex); }); internals.addMethod(['satisfy', 'satisfies'], function (validator) { return this.assert(validator(this._ref), 'satisfy rule'); }); internals.addMethod(['throw', 'throws'], function (/* type, message */) { internals.assert(this, typeof this._ref === 'function', 'Can only assert throw on functions'); internals.assert(this, !this._flags.not || !arguments.length, 'Cannot specify arguments when expecting not to throw'); var type = arguments.length && typeof arguments[0] !== 'string' && !(arguments[0] instanceof RegExp) ? arguments[0] : null; var lastArg = arguments[1] || arguments[0]; var message = typeof lastArg === 'string' || lastArg instanceof RegExp ? lastArg : null; var thrown = false; try { this._ref(); } catch (err) { thrown = true; if (type) { this.assert(err instanceof type, 'throw ' + (type.name || 'provided type')); } if (message !== null) { var error = err.message || ''; this.assert(typeof message === 'string' ? error === message : error.match(message), 'throw an error with specified message', error, message); } this.assert(thrown, 'throw an error', err); } return this.assert(thrown, 'throw an error'); }); internals.display = function (value) { var string = NodeUtil.inspect(value); if (!exports.settings.truncateMessages || string.length <= 40) { return string; } if (Array.isArray(value)) { return '[Array(' + value.length + ')]'; } if (typeof value === 'object') { var keys = Object.keys(value); return '{ Object (' + (keys.length > 2 ? (keys.splice(0, 2).join(', ') + ', ...') : keys.join(', ')) + ') }'; } return string.slice(0, 40) + '...\''; }; internals.natives = { '[object Arguments]': 'arguments', '[object Array]': 'array', '[object Date]': 'date', '[object Function]': 'function', '[object Number]': 'number', '[object RegExp]': 'regexp', '[object String]': 'string' }; internals.type = function (value) { if (value === null) { return 'null'; } if (value === undefined) { return 'undefined'; } if (Buffer.isBuffer(value)) { return 'buffer'; } var name = Object.prototype.toString.call(value); if (internals.natives[name]) { return internals.natives[name]; } if (value === Object(value)) { return 'object'; } return typeof value; }; internals.at = function (error) { error = error || new Error(); var at = error.stack.split('\n').slice(1).filter(internals.filterLocal)[0].match(/^\s*at \(?(.+)\:(\d+)\:(\d+)\)?$/); return { filename: at[1], line: at[2], column: at[3] }; }; internals.assert = function (assertion, condition, error) { if (!condition) { delete internals.locations[assertion._location]; Hoek.assert(condition, error); } };
gvishnu06/insolent-wookie
node_modules/code/lib/index.js
JavaScript
gpl-2.0
9,674
package org.apache.xmlrpc; import java.io.InputStream; import java.io.OutputStream; import java.util.EmptyStackException; import java.util.Hashtable; import java.util.Stack; import java.util.Vector; import org.apache.log4j.Logger; /* * OctetServer.java * * Created on 2. Juli 2004, 15:09 */ /** * * @author oliver */ public class OctetServer { final static Logger logger = Logger.getLogger(OctetServer.class); private Hashtable handlers; private Stack pool; private int workers; /** Creates a new instance of OctetServer */ public OctetServer() { handlers = new Hashtable(); pool = new Stack(); workers = 0; } public void addHandler(String handlername, Object handler) { logger.debug("addHandler()"); handlers.put(handlername, handler); } public void removeHandler(String handlername) { logger.debug("removeHandler()"); handlers.remove(handlername); } /** * Parse the request and execute the handler method, if one is * found. If the invoked handler is SessionXmlRpcHandler, * use the credentials to authenticate the user. */ public void execute(InputStream is,OutputStream out, Integer sessionId, Integer userId) throws OctetServerException { if (logger.isDebugEnabled()) { logger.debug("execute(" + sessionId + "," + userId + ")"); } OctetWorker worker = getWorker(); worker.execute(is,out,sessionId,userId); pool.push(worker); } private final OctetWorker getWorker() { if (logger.isDebugEnabled()) { logger.debug("getWorker()"); } try { return(OctetWorker) pool.pop(); } catch(EmptyStackException x) { int maxThreads = XmlRpc.getMaxThreads(); if (workers < maxThreads) { workers += 1; if (workers >= maxThreads * .95) { logger.warn("95% of XML-RPC server threads in use"); } return new OctetWorker(); } throw new RuntimeException("System overload"); } } /** * Performs streaming, parsing, and handler execution. * Implementation is not thread-safe. */ class OctetWorker extends XmlRpc { private Vector inParams; private XmlWriter writer; /** * Creates a new instance. */ protected OctetWorker() { inParams = new Vector(); } /** * Given a request for the server, generates a response. */ public void execute(InputStream in, OutputStream out, Integer sessionId,Integer userId) throws OctetServerException { try { // Do the work executeInternal(in,out,sessionId,userId); } finally { // Release most of our resources inParams.removeAllElements(); } } /** * Called when an object to be added to the argument list has * been parsed. */ void objectParsed(Object what) { if (logger.isDebugEnabled()) { logger.debug("objectParsed()"); } inParams.addElement(what); } private void executeInternal(InputStream in,OutputStream out, Integer sessionId,Integer userId) throws OctetServerException { try { parse(in); // check for errors from the XML parser if (errorLevel > NONE) throw new OctetServerException(0, errorMsg); Object handler = null; String handlerName = null; int dot = methodName.lastIndexOf('.'); if (dot > -1) { handlerName = methodName.substring(0, dot); handler = handlers.get(handlerName); if (handler != null) { methodName = methodName.substring(dot + 1); } } if (handler == null) { if (dot > -1) { throw new OctetServerException(0, "OctetHandler object \""+ handlerName + "\" not found and no default handler registered."); } else { throw new OctetServerException(0, "OctetHandler object not found for \""+ methodName + "\": no default handler registered."); } } if (handler instanceof SessionHandler) { if (sessionId == null || userId == null) { throw new IllegalArgumentException("Session_Id or User_Id in header is null"); } ((SessionHandler)handler).checkSession(sessionId, userId); } ((OctetRpcHandler) handler).execute(out,methodName,inParams); } catch (Exception e){ logger.error(e.getMessage()); throw new OctetServerException(0, e.getMessage()); } } } // OctetWorker }
BayCEER/bayeos-xmlrpc
src/main/java/org/apache/xmlrpc/OctetServer.java
Java
gpl-2.0
5,601
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; public class Society { //Societies are built based on a BaseSociety for a specific World. //These are the societies players may meet in the real world. They share a pointer to their BaseSociety and that also determines acitons. private BaseSociety society; private World world; private Map<String, List<String>> domains; public Map<String, List<String>> domains(){ return domains; } private Map<AnimalSpecies, Integer> knownAnimals; public Map<AnimalSpecies, Integer>knownAnimals(){ return knownAnimals; } private AnimalSpecies species; public AnimalSpecies species(){ return species; } private Ethics ethics; private String societyType; public Ethics ethics() { return this.ethics; } private List<Religion> religions; public Society(World w, BaseSociety base){ society = base; world = w; societyType = base.getName(); domains = base.getComplexTag("DOMAINS",","); species = w.species().get(base.getBinaryTag("SPECIES")); knownAnimals = new HashMap<AnimalSpecies, Integer>(); } public static Society generateNewSociety(World w, BaseSociety base){ Society s = new Society(w, base); //Generates the basic society, which has a species, among other things. //After this, its ethics are decided. These are based off the Species ethics, but permutedd. s.ethics = new Ethics(s.society.getComplexTag("ETHICS")); s.ethics.permuteEthics(10); //Place the initial settlement somewhere appropriate on the map int x=0; int y=0; Random r = new Random(); for (int i=0; i<10000; i++){ x = r.nextInt(w.biomes().length); y = r.nextInt(w.biomes()[0].length); if (WorldGenBio.getBiomes(s.species()).contains(w.biomes()[x][y]) && w.societies()[x][y]==null){ w.societies()[x][y] = s; for (AnimalSpecies anim : w.animalMap()[x][y]){ s.knownAnimals().put(anim, 1); } break; } } if (s.knownAnimals().size() == 0) { s = null; } //Generate religions. :V s.religions = new ArrayList<Religion>(); for (int d=new Random().nextInt(4); d<10; d++){ s.religions().add(Religion.generateNewReligion(s)); } return s; } private List<Religion> religions() { return religions; } }
lries/worldgen-repo
WorldManagement/src/Society.java
Java
gpl-2.0
2,291
#! python import sys reader = open(sys.argv[1], 'r') writer = open(sys.argv[2], 'w') def calcIdentity(stringa,stringb): counter = 0 counter2 = 0 if len(stringa) != len(stringb): return 0 for x in range(len(stringa)): if stringa[x] == stringb[x]: #print stringa[x]+stringb[x] counter += 1 counter2 += 1 return float(counter)/len(stringa) b = "" for line in reader: if not line[:1] == ">": if not b == "": if len(line.split(': ')) < 2: print line s = calcIdentity(b,line.split(': ')[1]) writer.write(str(s) + " " + line.split(': ')[0][:-1] + "\n") else: b = line.split(': ')[1] else: b = "" reader.close() writer.close()
carstenuhlig/gobi
python/calc_Identity.py
Python
gpl-2.0
666
import logging from ConfigParser import ConfigParser, NoOptionError import settings from common.functional import LazyObject logger = logging.getLogger('user_prefs') class types(object): str = 'get' bool = 'getboolean' int = 'getint' float = 'getfloat' class UserPrefs(object): defaults = dict( logDateTimeFormat = ("at %H:%M", types.str), showWorkTill = (True, types.bool), logEditCommand = ('open -a TextEdit "%s"', types.str), showHelpMessageOnStart = (True, types.bool), dateFormat = ('%m-%d-%Y %H:%M', types.str), projectSeparator = ('::', types.str), timeFormat = ('%H:%M', types.str), workEndTime = ('06:00', types.str), workDayLength = (3600 * 8, types.int), timerInterval = (1, types.int), showDateTime = (False, types.bool), selectedProject = ('Default', types.str), soundOnNotification = (False, types.bool), notificationRepeatTime = (10, types.int), notificationTime = (40, types.int), showNotification = (False, types.bool), startPlaceholder = ("__start__", types.str), ) root_section = 'root' def __init__(self): self.config = ConfigParser() self.config.read(settings.USER_PREFS_PATH) if not self.config.has_section(self.root_section): self.config.add_section(self.root_section) def __getattr__(self, name): if name not in self.defaults: raise ValueError("No such prefernce '{0}'".format(name)) default, type_name = self.defaults[name] try: try: value = getattr(self.config, type_name)( self.root_section, name) except (TypeError, ValueError): logger.warn("Unable to cast type for '{0}', using default value". format(name, value)) value = default except NoOptionError: value = default return value def __setattr__(self, name, value): if name in self.defaults: self.config.set(self.root_section, name, unicode(value)) else: super(UserPrefs, self).__setattr__(name, value) def save(self): with open(settings.USER_PREFS_PATH, 'wb') as configfile: self.config.write(configfile) userPrefs = LazyObject(UserPrefs)
SPlyer/MacTimeLog
user_prefs.py
Python
gpl-2.0
2,419
#! /usr/bin/python # -*- coding: utf-8 -*- """ Copyright (C) 2013 Sebastien GALLET <bibi21000@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Install telldus-core : http://developer.telldus.com/wiki/TellStickInstallationUbuntu """ import sys,os try : sys.path.insert(0, os.path.abspath('/opt/agocontrol/bin/')) sys.path.insert(0, os.path.abspath('../../../agocontrol/shared')) except: pass import syslog import time from datetime import datetime import threading from threading import Timer import agoclient from ctypes import c_int, c_ubyte, c_void_p, POINTER, string_at, c_char_p from ctypes.util import find_library from ctypes import cdll, CFUNCTYPE import traceback def log_exception(exc): for line in exc.split('\n'): if len(line): syslog.syslog(syslog.LOG_ERR, line) # Device methods TELLSTICK_TURNON = 1 TELLSTICK_TURNOFF = 2 TELLSTICK_BELL = 4 TELLSTICK_TOGGLE = 8 TELLSTICK_DIM = 16 TELLSTICK_LEARN = 32 TELLSTICK_EXECUTE = 64 TELLSTICK_UP = 128 TELLSTICK_DOWN = 256 TELLSTICK_STOP = 512 #Sensor value types TELLSTICK_TEMPERATURE = 1 TELLSTICK_HUMIDITY = 2 #Error codes TELLSTICK_SUCCESS = 0 TELLSTICK_ERROR_NOT_FOUND = -1 TELLSTICK_ERROR_PERMISSION_DENIED = -2 TELLSTICK_ERROR_DEVICE_NOT_FOUND = -3 TELLSTICK_ERROR_METHOD_NOT_SUPPORTED = -4 TELLSTICK_ERROR_COMMUNICATION = -5 TELLSTICK_ERROR_CONNECTING_SERVICE = -6 TELLSTICK_ERROR_UNKNOWN_RESPONSE = -7 TELLSTICK_ERROR_UNKNOWN = -99 #Device typedef TELLSTICK_TYPE_DEVICE = 1 TELLSTICK_TYPE_GROUP = 2 TELLSTICK_TYPE_SCENE = 3 #Device changes TELLSTICK_DEVICE_ADDED = 1 TELLSTICK_DEVICE_CHANGED = 2 TELLSTICK_DEVICE_REMOVED = 3 TELLSTICK_DEVICE_STATE_CHANGED = 4 #Change types TELLSTICK_CHANGE_NAME = 1 TELLSTICK_CHANGE_PROTOCOL = 2 TELLSTICK_CHANGE_MODEL = 3 TELLSTICK_CHANGE_METHOD = 4 timers = {} #timerlist def sensor_callback(protocol, model, id, dataType, value, timestamp, callbackId, context): print "Sensor:", string_at(protocol), string_at(model), "id:", id if(dataType == TELLSTICK_TEMPERATURE): print "Temperature:", string_at(value), "C,", datetime.fromtimestamp(timestamp) elif(dataType == TELLSTICK_HUMIDITY): print "Humidity:", string_at(value), "%,", datetime.fromtimestamp(timestamp) print "" def nothing() : print "nothing called" def device_callback(deviceId, method, value, callbackId, context): global timers print "callback!" print method if (deviceId == 1): # is turning on deviceId 1 here, so just return if events for that device are picked up return t = 0 print "Received event for device %d" % (deviceId,) if (deviceId in timers): # a timer already exists for this device, it might be running so interrupt it # Many devices (for example motion detectors) resends their messages many times to ensure that they # are received correctly. In this example, we don't want to run the turnOn/turnOff methods every time, instead we # start a timer, and run the method when the timer is finished. For every incoming event on this device, the timer # is restarted. t = timers[deviceId] t.cancel() if (method == TELLSTICK_DIM): print int(float(string_at(value))/2.55)+1 t = Timer(delay_rf/1000.0, client.emitEvent,[lib.make_device_id(deviceId), "event.device.statechanged", int(float(string_at(value))/2.55)+1, ""]) elif (method == TELLSTICK_TURNON): t = Timer(delay_rf/1000.0, client.emitEvent,[lib.make_device_id(deviceId), "event.device.statechanged", "255", ""]) elif (method == TELLSTICK_TURNOFF): t = Timer(delay_rf/1000.0, client.emitEvent,[lib.make_device_id(deviceId), "event.device.statechanged", "0", ""]) else : syslog.syslog(syslog.LOG_ERR, 'Unknown command received for %s:' % deviceId) syslog.syslog(syslog.LOG_ERR, 'method = %s' % method) syslog.syslog(syslog.LOG_ERR, 'value = %s' % value) syslog.syslog(syslog.LOG_ERR, 'callbackId = %s' % callbackId) syslog.syslog(syslog.LOG_ERR, 'context = %s' % context) t.start() timers[deviceId] = t #put timer in list, to allow later cancellation #function to be called when device event occurs, even for unregistered devices def raw_callback(data, controllerId, callbackId, context): print string_at(data) print "callback!" SENSORFUNC = CFUNCTYPE(None, POINTER(c_ubyte), POINTER(c_ubyte), c_int, c_int, POINTER(c_ubyte), c_int, c_int, c_void_p) DEVICEFUNC = CFUNCTYPE(None, c_int, c_int, POINTER(c_ubyte), c_int, c_void_p) RAWFUNC = CFUNCTYPE(None, POINTER(c_ubyte), c_int, c_int, c_void_p) class TelldusException(Exception): """ telldus exception """ def __init__(self, value): ''' ''' Exception.__init__(self) self.value = value def __str__(self): ''' ''' return repr(self.value) class Telldusd: """ Interface to the telldusd daemon. It encapsulates ALL the calls to the telldus daemon. """ def __init__(self): ''' Init the class ''' self._tdlib = None self._device_event_cb = None self._device_event_cb_id = None self._sensor_event_cb = None self._sensor_event_cb_id = None self._device_change_event_cb = None self._device_change_event_cb_id = None ret = find_library("telldus-core") if ret != None: try: self._tdlib = cdll.LoadLibrary(ret) except: raise TelldusException("Could not load the telldus-core library : %s" % (traceback.format_exc())) else: raise TelldusException("Could not find the telldus-core library. Check if it is installed properly : %s" % (traceback.format_exc())) try: self._tdlib.tdInit() except: raise TelldusException("Could not initialize telldus-core library : %s" % (traceback.format_exc())) def register_device_event(self, callback): ''' Register the device event callback to telldusd ''' try: self._device_event_cb_id = \ self._tdlib.tdRegisterDeviceEvent(callback, 0) return self._device_event_cb_id except: raise TelldusException("Could not register the device event callback : %s" % (traceback.format_exc())) def unregister_device_event(self): ''' Unregister the device event callback to telldusd ''' try: self._tdlib.tdUnregisterCallback(self._device_event_cb_id) except: raise TelldusException("Could not unregister the device event callback : %s" % (traceback.format_exc())) def register_device_change_event(self, callback): ''' Register the device change event callback to telldusd ''' try: self._device_change_event_cb_id = \ self._tdlib.tdRegisterDeviceChangeEvent(callback,0) return self._device_change_event_cb_id except: raise TelldusException("Could not register the device change event callback : %s" % (traceback.format_exc())) def unregister_device_change_event(self): ''' Unregister the device change event callback to telldusd ''' try: self._tdlib.tdUnregisterCallback(self._device_change_event_cb_id) except: raise TelldusException("Could not unregister the device event change callback : %s" % (traceback.format_exc())) def register_sensor_event(self, callback): ''' Register the sensor event callback to telldusd ''' try: self._sensor_event_cb_id = \ self._tdlib.tdRegisterSensorEvent(callback, 0) return self._sensor_event_cb_id except: raise TelldusException("Could not register the sensor event callback : %s" % (traceback.format_exc())) def unregister_sensor_event(self): ''' Unregister the sensor event callback to telldusd ''' try: self._tdlib.tdUnregisterCallback(self._sensor_event_cb_id) except: raise TelldusException("Could not unregister the sensor event callback : %s" % (traceback.format_exc())) def get_devices(self): ''' Return a list of devices registered in telldus daemon ''' ret = {} for i in range(self._tdlib.tdGetNumberOfDevices()): iid = self._tdlib.tdGetDeviceId(c_int(i)) ret[iid] = { "name" : c_char_p(self._tdlib.tdGetName(c_int(iid))).value, "house" : c_char_p(self._tdlib.tdGetDeviceParameter(c_int(iid), c_char_p("house"), "")).value, "unit" : c_char_p(self._tdlib.tdGetDeviceParameter(c_int(iid), c_char_p("unit"), "")).value, "model" : "%s" % c_char_p(self._tdlib.tdGetModel(c_int(iid))).value, "protocol" : c_char_p(self._tdlib.tdGetProtocol(c_int(iid))).value } return ret def is_dimmer(self, deviceid): ''' Get the info on the device @param deviceid : id of the module ''' if self.methods(deviceid, TELLSTICK_DIM) == TELLSTICK_DIM: return True return False def is_switch(self, deviceid): ''' Get the info on the device @param deviceid : id of the module ''' if self.methods(deviceid, TELLSTICK_TURNON) == TELLSTICK_TURNON and \ self.methods(deviceid, TELLSTICK_TURNOFF) == TELLSTICK_TURNOFF and \ self.methods(deviceid, TELLSTICK_DIM) != TELLSTICK_DIM: return True return False def get_info(self, deviceid): ''' Get the info on the device @param deviceid : id of the module ''' sst = [] sst.append("%s : %s" % \ (deviceid, c_char_p(self._tdlib.tdGetName(c_int(deviceid))).value)) sst.append("model : %s" % \ (c_char_p(self._tdlib.tdGetModel(c_int(deviceid))).value)) sst.append("protocol : %s" % \ (c_char_p(self._tdlib.tdGetProtocol(c_int(deviceid))).value)) sst.append("house : %s / unit: %s" % (c_char_p(self._tdlib.tdGetDeviceParameter(c_int(deviceid), c_char_p("house"), "")).value, \ c_char_p(self._tdlib.tdGetDeviceParameter(c_int(deviceid), c_char_p("unit"), "")).value)) sst.append("Methods :") ss1, ss2, ss3 = "No", "No", "No" if self.methods(deviceid, TELLSTICK_TURNON) \ == TELLSTICK_TURNON: ss1 = "Yes" if self.methods(deviceid, TELLSTICK_TURNOFF) \ == TELLSTICK_TURNOFF: ss2 = "Yes" if self.methods(deviceid, TELLSTICK_DIM) \ == TELLSTICK_DIM: ss3 = "Yes" sst.append("ON : %s / OFF: %s / DIM: %s" % (ss1, ss2, ss3)) ss1, ss2, ss3, ss4 = "No", "No", "No", "No" if self.methods(deviceid, TELLSTICK_BELL) \ == TELLSTICK_BELL: ss1 = "Yes" if self.methods(deviceid, TELLSTICK_TOGGLE) \ == TELLSTICK_TOGGLE: ss2 = "Yes" if self.methods(deviceid, TELLSTICK_LEARN) \ == TELLSTICK_LEARN: ss3 = "Yes" if self.methods(deviceid, TELLSTICK_EXECUTE) \ == TELLSTICK_EXECUTE: ss4 = "Yes" sst.append("BELL : %s / TOGGLE: %s / LEARN: %s / EXECUTE: %s" % \ (ss1, ss2, ss3, ss4)) ss1, ss2, ss3 = "No", "No", "No" if self.methods(deviceid, TELLSTICK_UP) \ == TELLSTICK_UP: ss1 = "Yes" if self.methods(deviceid, TELLSTICK_DOWN) \ == TELLSTICK_DOWN: ss2 = "Yes" if self.methods(deviceid, TELLSTICK_STOP) \ == TELLSTICK_STOP: ss3 = "Yes" sst.append("UP : %s / DOWN: %s / STOP: %s" % (ss1, ss2, ss3)) return sst def check_device(self, device): ''' Check that the device exist in telldusd @param device : address of the device. Maybe malformed. ''' try: deviceid = int(device[2:]) name = c_char_p(self._tdlib.tdGetName(c_int(deviceid))).value #print "found name = %s" % name if name == None or name == "" : #print "bad device %s" % device return False else: #print "good device %s" % device return True except : #print "bad device %s" % device return False def get_device_id(self, devicestr): ''' Retrieve an id from HU address @param device : address of the module (ie TS14) @return : Id of the device (14) ''' return int(devicestr[2:]) def make_device_id(self, deviceint): ''' Retrieve an id from HU address @param device : address of the module (ie TS14) @return : Id of the device (14) ''' return "TS%s"%deviceint def get_device(self, deviceid): ''' Retrieve an address device from deviceid @param deviceid : id of the device (ie 14) @return : address of the device (ie TS14) ''' return 'TS'+str(deviceid) def turn_on(self, deviceid): ''' Turns the internal device On @param deviceid : id of the module ''' self._tdlib.tdTurnOn(c_int(deviceid)) def turn_off(self, deviceid): ''' Turns the internal device Off @param deviceid : id of the module ''' self._tdlib.tdTurnOff(c_int(deviceid)) def bell(self, deviceid): ''' Bells the device @param deviceid : id of the module ''' self._tdlib.tdBell(c_int(deviceid)) def learn(self, deviceid): ''' Sends a special Learn command to the device @param deviceid : id of the module ''' self._tdlib.tdLearn(c_int(deviceid)) def dim(self, deviceid, level): ''' Dims the device level should be between 0 and 100 tdlib use a level from 0 to 255. So we translate it. @param deviceid : id of the module @param level : level of light ''' self._tdlib.tdDim(c_int(deviceid), c_ubyte(int(int(level)*2.55))) def up(self, deviceid): ''' Move the shutter up. Test if the device support the up command If not try to send an on command @param deviceid : id of the module ''' self._tdlib.tdUp(c_int(deviceid)) def down(self, deviceid): ''' Move the shutter down. Test if the device support the up command If not try to send an on command @param deviceid : id of the module ''' self._tdlib.tdDown(c_int(deviceid)) def stop(self, deviceid): ''' Stop the shutter. Test if the device support the up command If not try to manage it supporting the on command @param deviceid : id of the module ''' self._tdlib.tdStop(c_int(deviceid)) def methods(self, deviceid, methods): ''' Stop the shutter. Test if the device support the up command If not try to manage it supporting the on command @param deviceid : id of the module ''' #int methods = tdMethods(id, TELLSTICK_TURNON | \ # TELLSTICK_TURNOFF | TELLSTICK_BELL); return self._tdlib.tdMethods(c_int(deviceid), methods) client = agoclient.AgoConnection("tellstick") device = agoclient.getConfigOption("tellstick", "device", "/dev/tellstick") delay_rf = float(agoclient.getConfigOption("tellstick", "delay_rf", "400")) lib = Telldusd() sensor_func = SENSORFUNC(sensor_callback) device_func = DEVICEFUNC(device_callback) raw_func = RAWFUNC(raw_callback) lib.register_sensor_event(sensor_func) lib.register_device_event(device_func) lib.register_device_change_event(raw_func) devices=lib.get_devices() for dev in devices.keys() : if lib.is_dimmer(dev) : client.addDevice(lib.make_device_id(dev), "dimmer") elif lib.is_switch(dev) : client.addDevice(lib.make_device_id(dev), "switch") else : syslog.syslog(syslog.LOG_ERR, 'Unknown device type for %s' % dev) log_exception(lib.get_info(dev)) print devices tellsticklock = threading.Lock() class command_send(threading.Thread): def __init__(self, id, command, level): threading.Thread.__init__(self) self.id = id self.command = command self.level = level def run(self): try : tellsticklock.acquire() if self.command == "on": if lib.is_dimmer(lib.get_device_id(self.id)) : lib.dim(lib.get_device_id(self.id), 255) else : lib.turn_on(lib.get_device_id(self.id)) elif self.command == "off": if lib.is_dimmer(lib.get_device_id(self.id)) : lib.dim(lib.get_device_id(self.id), 0) else : lib.turn_off(lib.get_device_id(self.id)) elif self.command == "setlevel": lib.dim(lib.get_device_id(self.id), self.level) except : error = traceback.format_exc() syslog.syslog(syslog.LOG_ERR, 'Error when calling telldus command %s for device %s' % (self.command, self.id)) log_exception(error) self.error=1 finally : tellsticklock.release() def messageHandler(internalid, content): print content if "command" in content: if "level" in content: background = command_send(internalid, content["command"], content["level"]) else: background = command_send(internalid, content["command"], "") background.setDaemon(True) background.start() # specify our message handler method client.addHandler(messageHandler) client.run()
bibi21000/agocontrol
debian/agocontrol-tellstick/opt/agocontrol/bin/agotellstick.py
Python
gpl-2.0
18,493
/*************************************************************************** qgsoptions.cpp Set user options and preferences ------------------- begin : May 28, 2004 copyright : (C) 2004 by Gary E.Sherman email : sherman at mrcc.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "qgsapplication.h" #include "qgsdistancearea.h" #include "qgsoptions.h" #include "qgis.h" #include "qgisapp.h" #include "qgisappstylesheet.h" #include "qgsgdalutils.h" #include "qgshighlight.h" #include "qgsmapcanvas.h" #include "qgsmaprendererjob.h" #include "qgsprojectionselectiondialog.h" #include "qgscoordinatereferencesystem.h" #include "qgstolerance.h" #include "qgsscaleutils.h" #include "qgsnetworkaccessmanager.h" #include "qgsauthconfigselect.h" #include "qgsproject.h" #include "qgsdualview.h" #include "qgsrasterlayer.h" #include "qgsrasterminmaxorigin.h" #include "qgscontrastenhancement.h" #include "qgsexpressioncontextutils.h" #include "qgslocaldefaultsettings.h" #include "qgsnumericformatwidget.h" #include "qgslayertreemodellegendnode.h" #include "qgsattributetablefiltermodel.h" #include "qgslocalizeddatapathregistry.h" #include "qgsrasterformatsaveoptionswidget.h" #include "qgsrasterpyramidsoptionswidget.h" #include "qgsdatumtransformtablewidget.h" #include "qgsdialog.h" #include "qgscolorschemeregistry.h" #include "qgssymbollayerutils.h" #include "qgscolordialog.h" #include "qgsexpressioncontext.h" #include "qgsunittypes.h" #include "qgsclipboard.h" #include "qgssettings.h" #include "qgssettingsregistrycore.h" #include "qgssettingsregistrygui.h" #include "qgsoptionswidgetfactory.h" #include "qgslocatorwidget.h" #include "qgslocatoroptionswidget.h" #include "qgsgui.h" #include "qgswelcomepage.h" #include "qgsnewsfeedparser.h" #include "qgsbearingnumericformat.h" #include "qgssublayersdialog.h" #include "options/qgsadvancedoptions.h" #include "qgslayout.h" #ifdef HAVE_OPENCL #include "qgsopenclutils.h" #endif #include <QInputDialog> #include <QFileDialog> #include <QColorDialog> #include <QLocale> #include <QProcess> #include <QToolBar> #include <QScrollBar> #include <QSize> #include <QStyleFactory> #include <QMessageBox> #include <QNetworkDiskCache> #include <QStandardPaths> #include <limits> #include <sqlite3.h> #include "qgslogger.h" #define CPL_SUPRESS_CPLUSPLUS //#spellok #include <gdal.h> #include <geos_c.h> #include <cpl_conv.h> // for setting gdal options #include "qgsconfig.h" /** * \class QgsOptions - Set user options and preferences * Constructor */ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOptionsWidgetFactory *> &optionsFactories ) : QgsOptionsDialogBase( QStringLiteral( "Options" ), parent, fl ) { setupUi( this ); mTreeModel = new QStandardItemModel( this ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "General" ), QCoreApplication::translate( "QgsOptionsBase", "General" ), QStringLiteral( "propertyicons/general.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "System" ), QCoreApplication::translate( "QgsOptionsBase", "System" ), QStringLiteral( "propertyicons/system.svg" ) ) ); QStandardItem *crsGroup = new QStandardItem( QCoreApplication::translate( "QgsOptionsBase", "CRS and Transforms" ) ); crsGroup->setData( QStringLiteral( "crs_and_transforms" ) ); crsGroup->setToolTip( tr( "CRS and Transforms" ) ); crsGroup->setSelectable( false ); crsGroup->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "CRS Handling" ), QCoreApplication::translate( "QgsOptionsBase", "General CRS handling" ), QStringLiteral( "propertyicons/CRS.svg" ) ) ); crsGroup->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Coordinate Transforms" ), QCoreApplication::translate( "QgsOptionsBase", "Coordinate transformations and operations" ), QStringLiteral( "transformation.svg" ) ) ); mTreeModel->appendRow( crsGroup ); QStandardItem *dataSources = createItem( QCoreApplication::translate( "QgsOptionsBase", "Data Sources" ), QCoreApplication::translate( "QgsOptionsBase", "Data sources" ), QStringLiteral( "propertyicons/attributes.svg" ) ); mTreeModel->appendRow( dataSources ); dataSources->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "GDAL" ), QCoreApplication::translate( "QgsOptionsBase", "GDAL" ), QStringLiteral( "propertyicons/gdal.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Rendering" ), QCoreApplication::translate( "QgsOptionsBase", "Rendering" ), QStringLiteral( "propertyicons/rendering.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Canvas & Legend" ), QCoreApplication::translate( "QgsOptionsBase", "Canvas and legend" ), QStringLiteral( "propertyicons/overlay.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Map Tools" ), QCoreApplication::translate( "QgsOptionsBase", "Map tools" ), QStringLiteral( "propertyicons/map_tools.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Colors" ), QCoreApplication::translate( "QgsOptionsBase", "Colors" ), QStringLiteral( "propertyicons/colors.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Digitizing" ), QCoreApplication::translate( "QgsOptionsBase", "Digitizing" ), QStringLiteral( "propertyicons/digitizing.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Layouts" ), QCoreApplication::translate( "QgsOptionsBase", "Print layouts" ), QStringLiteral( "mIconLayout.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Variables" ), QCoreApplication::translate( "QgsOptionsBase", "Variables" ), QStringLiteral( "mIconExpression.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Authentication" ), QCoreApplication::translate( "QgsOptionsBase", "Authentication" ), QStringLiteral( "locked.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Network" ), QCoreApplication::translate( "QgsOptionsBase", "Network" ), QStringLiteral( "propertyicons/network_and_proxy.svg" ) ) ); QStandardItem *gpsGroup = new QStandardItem( QCoreApplication::translate( "QgsOptionsBase", "GPS" ) ); gpsGroup->setData( QStringLiteral( "gps" ) ); gpsGroup->setToolTip( tr( "GPS" ) ); gpsGroup->setSelectable( false ); mTreeModel->appendRow( gpsGroup ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Locator" ), tr( "Locator" ), QStringLiteral( "search.svg" ) ) ); mTreeModel->appendRow( createItem( QCoreApplication::translate( "QgsOptionsBase", "Acceleration" ), tr( "GPU acceleration" ), QStringLiteral( "mIconGPU.svg" ) ) ); QStandardItem *ideGroup = new QStandardItem( QCoreApplication::translate( "QgsOptionsBase", "IDE" ) ); ideGroup->setData( QStringLiteral( "ide" ) ); ideGroup->setToolTip( tr( "Development and Scripting Settings" ) ); ideGroup->setSelectable( false ); mTreeModel->appendRow( ideGroup ); mOptionsTreeView->setModel( mTreeModel ); connect( cbxProjectDefaultNew, &QCheckBox::toggled, this, &QgsOptions::cbxProjectDefaultNew_toggled ); connect( leLayerGlobalCrs, &QgsProjectionSelectionWidget::crsChanged, this, &QgsOptions::leLayerGlobalCrs_crsChanged ); connect( lstRasterDrivers, &QTreeWidget::itemDoubleClicked, this, &QgsOptions::lstRasterDrivers_itemDoubleClicked ); connect( mProjectOnLaunchCmbBx, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsOptions::mProjectOnLaunchCmbBx_currentIndexChanged ); connect( spinFontSize, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsOptions::spinFontSize_valueChanged ); connect( mFontFamilyRadioQt, &QRadioButton::released, this, &QgsOptions::mFontFamilyRadioQt_released ); connect( mFontFamilyRadioCustom, &QRadioButton::released, this, &QgsOptions::mFontFamilyRadioCustom_released ); connect( mFontFamilyComboBox, &QFontComboBox::currentFontChanged, this, &QgsOptions::mFontFamilyComboBox_currentFontChanged ); connect( mProxyTypeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsOptions::mProxyTypeComboBox_currentIndexChanged ); connect( mCustomVariablesChkBx, &QCheckBox::toggled, this, &QgsOptions::mCustomVariablesChkBx_toggled ); connect( mCurrentVariablesQGISChxBx, &QCheckBox::toggled, this, &QgsOptions::mCurrentVariablesQGISChxBx_toggled ); connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsOptions::showHelp ); connect( cboGlobalLocale, qOverload< int >( &QComboBox::currentIndexChanged ), this, [ = ]( int ) { updateSampleLocaleText( ); } ); connect( cbShowGroupSeparator, &QCheckBox::toggled, this, [ = ]( bool ) { updateSampleLocaleText(); } ); // QgsOptionsDialogBase handles saving/restoring of geometry, splitter and current tab states, // switching vertical tabs between icon/text to icon-only modes (splitter collapsed to left), // and connecting QDialogButtonBox's accepted/rejected signals to dialog's accept/reject slots initOptionsBase( false ); // disconnect default connection setup by initOptionsBase for accepting dialog, and insert logic // to validate widgets before allowing dialog to be closed disconnect( mOptButtonBox, &QDialogButtonBox::accepted, this, &QDialog::accept ); connect( mOptButtonBox, &QDialogButtonBox::accepted, this, [ = ] { for ( QgsOptionsPageWidget *widget : std::as_const( mAdditionalOptionWidgets ) ) { if ( !widget->isValid() ) { setCurrentPage( widget->objectName() ); return; } } accept(); } ); // stylesheet setup mStyleSheetBuilder = QgisApp::instance()->styleSheetBuilder(); mStyleSheetNewOpts = mStyleSheetBuilder->defaultOptions(); mStyleSheetOldOpts = QMap<QString, QVariant>( mStyleSheetNewOpts ); connect( mFontFamilyRadioCustom, &QAbstractButton::toggled, mFontFamilyComboBox, &QWidget::setEnabled ); connect( cmbIconSize, static_cast<void ( QComboBox::* )( const QString & )>( &QComboBox::activated ), this, &QgsOptions::iconSizeChanged ); connect( cmbIconSize, static_cast<void ( QComboBox::* )( const QString & )>( &QComboBox::highlighted ), this, &QgsOptions::iconSizeChanged ); connect( cmbIconSize, &QComboBox::editTextChanged, this, &QgsOptions::iconSizeChanged ); connect( this, &QDialog::accepted, this, &QgsOptions::saveOptions ); connect( this, &QDialog::rejected, this, &QgsOptions::rejectOptions ); QStringList styles = QStyleFactory::keys(); QStringList filteredStyles = styles; for ( int i = filteredStyles.count() - 1; i >= 0; --i ) { // filter out the broken adwaita styles - see note in main.cpp if ( filteredStyles.at( i ).contains( QStringLiteral( "adwaita" ), Qt::CaseInsensitive ) ) { filteredStyles.removeAt( i ); } } if ( filteredStyles.isEmpty() ) { // oops - none left!.. have to let user use a broken style filteredStyles = styles; } cmbStyle->addItems( filteredStyles ); QStringList themes = QgsApplication::uiThemes().keys(); cmbUITheme->addItems( themes ); // non-default themes are best rendered using the Fusion style, therefore changing themes must require a restart to lblUITheme->setText( QStringLiteral( "%1 <i>(%2)</i>" ).arg( lblUITheme->text(), tr( "QGIS restart required" ) ) ); mEnableMacrosComboBox->addItem( tr( "Never" ), QVariant::fromValue( Qgis::PythonMacroMode::Never ) ); mEnableMacrosComboBox->addItem( tr( "Ask" ), QVariant::fromValue( Qgis::PythonMacroMode::Ask ) ); mEnableMacrosComboBox->addItem( tr( "For This Session Only" ), QVariant::fromValue( Qgis::PythonMacroMode::SessionOnly ) ); mEnableMacrosComboBox->addItem( tr( "Not During This Session" ), QVariant::fromValue( Qgis::PythonMacroMode::NotForThisSession ) ); mEnableMacrosComboBox->addItem( tr( "Always (Not Recommended)" ), QVariant::fromValue( Qgis::PythonMacroMode::Always ) ); mIdentifyHighlightColorButton->setColorDialogTitle( tr( "Identify Highlight Color" ) ); mIdentifyHighlightColorButton->setAllowOpacity( true ); mIdentifyHighlightColorButton->setContext( QStringLiteral( "gui" ) ); mIdentifyHighlightColorButton->setDefaultColor( Qgis::DEFAULT_HIGHLIGHT_COLOR ); mSettings = new QgsSettings(); double identifyValue = mSettings->value( QStringLiteral( "/Map/searchRadiusMM" ), Qgis::DEFAULT_SEARCH_RADIUS_MM ).toDouble(); QgsDebugMsgLevel( QStringLiteral( "Standard Identify radius setting read from settings file: %1" ).arg( identifyValue ), 3 ); if ( identifyValue <= 0.0 ) identifyValue = Qgis::DEFAULT_SEARCH_RADIUS_MM; spinBoxIdentifyValue->setMinimum( 0.0 ); spinBoxIdentifyValue->setClearValue( Qgis::DEFAULT_SEARCH_RADIUS_MM ); spinBoxIdentifyValue->setValue( identifyValue ); QColor highlightColor = QColor( mSettings->value( QStringLiteral( "/Map/highlight/color" ), Qgis::DEFAULT_HIGHLIGHT_COLOR.name() ).toString() ); int highlightAlpha = mSettings->value( QStringLiteral( "/Map/highlight/colorAlpha" ), Qgis::DEFAULT_HIGHLIGHT_COLOR.alpha() ).toInt(); highlightColor.setAlpha( highlightAlpha ); mIdentifyHighlightColorButton->setColor( highlightColor ); double highlightBuffer = mSettings->value( QStringLiteral( "/Map/highlight/buffer" ), Qgis::DEFAULT_HIGHLIGHT_BUFFER_MM ).toDouble(); mIdentifyHighlightBufferSpinBox->setClearValue( Qgis::DEFAULT_HIGHLIGHT_BUFFER_MM ); mIdentifyHighlightBufferSpinBox->setValue( highlightBuffer ); double highlightMinWidth = mSettings->value( QStringLiteral( "/Map/highlight/minWidth" ), Qgis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM ).toDouble(); mIdentifyHighlightMinWidthSpinBox->setClearValue( Qgis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM ); mIdentifyHighlightMinWidthSpinBox->setValue( highlightMinWidth ); // custom environment variables bool useCustomVars = mSettings->value( QStringLiteral( "qgis/customEnvVarsUse" ), QVariant( false ) ).toBool(); mCustomVariablesChkBx->setChecked( useCustomVars ); if ( !useCustomVars ) { mAddCustomVarBtn->setEnabled( false ); mRemoveCustomVarBtn->setEnabled( false ); mCustomVariablesTable->setEnabled( false ); } const QStringList customVarsList = mSettings->value( QStringLiteral( "qgis/customEnvVars" ) ).toStringList(); for ( const QString &varStr : customVarsList ) { int pos = varStr.indexOf( QLatin1Char( '|' ) ); if ( pos == -1 ) continue; QString varStrApply = varStr.left( pos ); QString varStrNameValue = varStr.mid( pos + 1 ); pos = varStrNameValue.indexOf( QLatin1Char( '=' ) ); if ( pos == -1 ) continue; QString varStrName = varStrNameValue.left( pos ); QString varStrValue = varStrNameValue.mid( pos + 1 ); addCustomEnvVarRow( varStrName, varStrValue, varStrApply ); } QFontMetrics fmCustomVar( mCustomVariablesTable->horizontalHeader()->font() ); int fmCustomVarH = fmCustomVar.height() + 8; mCustomVariablesTable->horizontalHeader()->setFixedHeight( fmCustomVarH ); mCustomVariablesTable->setColumnWidth( 0, 120 ); if ( mCustomVariablesTable->rowCount() > 0 ) { mCustomVariablesTable->resizeColumnToContents( 1 ); } else { mCustomVariablesTable->setColumnWidth( 1, 120 ); } // current environment variables mCurrentVariablesTable->horizontalHeader()->setFixedHeight( fmCustomVarH ); QMap<QString, QString> sysVarsMap = QgsApplication::systemEnvVars(); const QStringList currentVarsList = QProcess::systemEnvironment(); for ( const QString &varStr : currentVarsList ) { int pos = varStr.indexOf( QLatin1Char( '=' ) ); if ( pos == -1 ) continue; QStringList varStrItms; QString varStrName = varStr.left( pos ); QString varStrValue = varStr.mid( pos + 1 ); varStrItms << varStrName << varStrValue; // check if different than system variable QString sysVarVal; bool sysVarMissing = !sysVarsMap.contains( varStrName ); if ( sysVarMissing ) sysVarVal = tr( "not present" ); if ( !sysVarMissing && sysVarsMap.value( varStrName ) != varStrValue ) sysVarVal = sysVarsMap.value( varStrName ); if ( !sysVarVal.isEmpty() ) sysVarVal = tr( "System value: %1" ).arg( sysVarVal ); int rowCnt = mCurrentVariablesTable->rowCount(); mCurrentVariablesTable->insertRow( rowCnt ); QFont fItm; for ( int i = 0; i < varStrItms.size(); ++i ) { QTableWidgetItem *varNameItm = new QTableWidgetItem( varStrItms.at( i ) ); varNameItm->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable ); fItm = varNameItm->font(); if ( !sysVarVal.isEmpty() ) { fItm.setBold( true ); varNameItm->setFont( fItm ); varNameItm->setToolTip( sysVarVal ); } mCurrentVariablesTable->setItem( rowCnt, i, varNameItm ); } fItm.setBold( true ); QFontMetrics fmRow( fItm ); mCurrentVariablesTable->setRowHeight( rowCnt, fmRow.height() + 6 ); } if ( mCurrentVariablesTable->rowCount() > 0 ) mCurrentVariablesTable->resizeColumnToContents( 0 ); //local directories to search when loading c++ plugins const QStringList pluginsPathList = mSettings->value( QStringLiteral( "plugins/searchPathsForPlugins" ) ).toStringList(); for ( const QString &path : pluginsPathList ) { QListWidgetItem *newItem = new QListWidgetItem( mListPluginPaths ); newItem->setText( path ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mListPluginPaths->addItem( newItem ); } connect( mBtnAddPluginPath, &QAbstractButton::clicked, this, &QgsOptions::addPluginPath ); connect( mBtnRemovePluginPath, &QAbstractButton::clicked, this, &QgsOptions::removePluginPath ); //local directories to search when looking for an SVG with a given basename const QStringList svgPathList = QgsApplication::svgPaths(); for ( const QString &path : svgPathList ) { QListWidgetItem *newItem = new QListWidgetItem( mListSVGPaths ); newItem->setText( path ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mListSVGPaths->addItem( newItem ); } connect( mBtnAddSVGPath, &QAbstractButton::clicked, this, &QgsOptions::addSVGPath ); connect( mBtnRemoveSVGPath, &QAbstractButton::clicked, this, &QgsOptions::removeSVGPath ); //local directories to search when looking for a composer templates const QStringList composerTemplatePathList = QgsApplication::layoutTemplatePaths(); for ( const QString &path : composerTemplatePathList ) { QListWidgetItem *newItem = new QListWidgetItem( mListComposerTemplatePaths ); newItem->setText( path ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mListComposerTemplatePaths->addItem( newItem ); } connect( mBtnAddTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::addTemplatePath ); connect( mBtnRemoveTemplatePath, &QAbstractButton::clicked, this, &QgsOptions::removeTemplatePath ); // localized data paths connect( mLocalizedDataPathAddButton, &QAbstractButton::clicked, this, &QgsOptions::addLocalizedDataPath ); connect( mLocalizedDataPathRemoveButton, &QAbstractButton::clicked, this, &QgsOptions::removeLocalizedDataPath ); connect( mLocalizedDataPathUpButton, &QAbstractButton::clicked, this, &QgsOptions::moveLocalizedDataPathUp ); connect( mLocalizedDataPathDownButton, &QAbstractButton::clicked, this, &QgsOptions::moveLocalizedDataPathDown ); const QStringList localizedPaths = QgsApplication::localizedDataPathRegistry()->paths(); for ( const QString &path : localizedPaths ) { QListWidgetItem *newItem = new QListWidgetItem( mLocalizedDataPathListWidget ); newItem->setText( path ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mLocalizedDataPathListWidget->addItem( newItem ); } //paths hidden from browser const QStringList hiddenPathList = mSettings->value( QStringLiteral( "/browser/hiddenPaths" ) ).toStringList(); for ( const QString &path : hiddenPathList ) { QListWidgetItem *newItem = new QListWidgetItem( mListHiddenBrowserPaths ); newItem->setText( path ); mListHiddenBrowserPaths->addItem( newItem ); } connect( mBtnRemoveHiddenPath, &QAbstractButton::clicked, this, &QgsOptions::removeHiddenPath ); //locations of the QGIS help const QStringList helpPathList = mSettings->value( QStringLiteral( "help/helpSearchPath" ), "https://docs.qgis.org/$qgis_short_version/$qgis_locale/docs/user_manual/" ).toStringList(); for ( const QString &path : helpPathList ) { QTreeWidgetItem *item = new QTreeWidgetItem(); item->setText( 0, path ); item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable ); mHelpPathTreeWidget->addTopLevelItem( item ); } connect( mBtnAddHelpPath, &QAbstractButton::clicked, this, &QgsOptions::addHelpPath ); connect( mBtnRemoveHelpPath, &QAbstractButton::clicked, this, &QgsOptions::removeHelpPath ); connect( mBtnMoveHelpUp, &QAbstractButton::clicked, this, &QgsOptions::moveHelpPathUp ); connect( mBtnMoveHelpDown, &QAbstractButton::clicked, this, &QgsOptions::moveHelpPathDown ); //Network timeout mNetworkTimeoutSpinBox->setValue( QgsNetworkAccessManager::timeout() ); mNetworkTimeoutSpinBox->setClearValue( QgsNetworkAccessManager::settingsNetworkTimeout.defaultValue() ); leUserAgent->setText( mSettings->value( QStringLiteral( "/qgis/networkAndProxy/userAgent" ), "Mozilla/5.0" ).toString() ); // WMS capabilities expiry time mDefaultCapabilitiesExpirySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultCapabilitiesExpiry" ), 24 ).toInt() ); mDefaultCapabilitiesExpirySpinBox->setClearValue( 24 ); // WMS/WMS-C tile expiry time mDefaultTileExpirySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileExpiry" ), 24 ).toInt() ); mDefaultTileExpirySpinBox->setClearValue( 24 ); // WMS/WMS-C default max retry in case of tile request errors mDefaultTileMaxRetrySpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultTileMaxRetry" ), 3 ).toInt() ); mDefaultTileMaxRetrySpinBox->setClearValue( 3 ); // Proxy stored authentication configurations mAuthSettings->setDataprovider( QStringLiteral( "proxy" ) ); QString authcfg = mSettings->value( QStringLiteral( "proxy/authcfg" ) ).toString(); mAuthSettings->setConfigId( authcfg ); mAuthSettings->setWarningText( QgsAuthSettingsWidget::formattedWarning( QgsAuthSettingsWidget::UserSettings ) ); //Web proxy settings grpProxy->setChecked( mSettings->value( QStringLiteral( "proxy/proxyEnabled" ), false ).toBool() ); leProxyHost->setText( mSettings->value( QStringLiteral( "proxy/proxyHost" ), QString() ).toString() ); leProxyPort->setText( mSettings->value( QStringLiteral( "proxy/proxyPort" ), QString() ).toString() ); mAuthSettings->setPassword( mSettings->value( QStringLiteral( "proxy/proxyPassword" ), QString() ).toString() ); mAuthSettings->setUsername( mSettings->value( QStringLiteral( "proxy/proxyUser" ), QString() ).toString() ); //available proxy types mProxyTypeComboBox->insertItem( 0, QStringLiteral( "DefaultProxy" ) ); mProxyTypeComboBox->insertItem( 1, QStringLiteral( "Socks5Proxy" ) ); mProxyTypeComboBox->insertItem( 2, QStringLiteral( "HttpProxy" ) ); mProxyTypeComboBox->insertItem( 3, QStringLiteral( "HttpCachingProxy" ) ); mProxyTypeComboBox->insertItem( 4, QStringLiteral( "FtpCachingProxy" ) ); QString settingProxyType = mSettings->value( QStringLiteral( "proxy/proxyType" ), QStringLiteral( "DefaultProxy" ) ).toString(); mProxyTypeComboBox->setCurrentIndex( mProxyTypeComboBox->findText( settingProxyType ) ); //url with no proxy at all const QStringList noProxyUrlPathList = mSettings->value( QStringLiteral( "proxy/noProxyUrls" ) ).toStringList(); for ( const QString &path : noProxyUrlPathList ) { if ( path.trimmed().isEmpty() ) continue; QListWidgetItem *newItem = new QListWidgetItem( mNoProxyUrlListWidget ); newItem->setText( path ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mNoProxyUrlListWidget->addItem( newItem ); } connect( mAddUrlPushButton, &QAbstractButton::clicked, this, &QgsOptions::addNoProxyUrl ); connect( mRemoveUrlPushButton, &QAbstractButton::clicked, this, &QgsOptions::removeNoProxyUrl ); // cache settings mCacheDirectory->setText( mSettings->value( QStringLiteral( "cache/directory" ) ).toString() ); mCacheDirectory->setPlaceholderText( QStandardPaths::writableLocation( QStandardPaths::CacheLocation ) ); mCacheSize->setMinimum( 0 ); mCacheSize->setMaximum( std::numeric_limits<int>::max() ); mCacheSize->setSingleStep( 1024 ); qint64 cacheSize = mSettings->value( QStringLiteral( "cache/size" ), 50 * 1024 * 1024 ).toLongLong(); mCacheSize->setValue( static_cast<int>( cacheSize / 1024 ) ); mCacheSize->setClearValue( 50 * 1024 ); connect( mBrowseCacheDirectory, &QAbstractButton::clicked, this, &QgsOptions::browseCacheDirectory ); connect( mClearCache, &QAbstractButton::clicked, this, &QgsOptions::clearCache ); // Access (auth) cache settings mAutoClearAccessCache->setChecked( mSettings->value( QStringLiteral( "clear_auth_cache_on_errors" ), true, QgsSettings::Section::Auth ).toBool( ) ); connect( mClearAccessCache, &QAbstractButton::clicked, this, &QgsOptions::clearAccessCache ); connect( mAutoClearAccessCache, &QCheckBox::clicked, this, [ = ]( bool checked ) { mSettings->setValue( QStringLiteral( "clear_auth_cache_on_errors" ), checked, QgsSettings::Section::Auth ); } ); // set the attribute table default filter cmbAttrTableBehavior->clear(); cmbAttrTableBehavior->addItem( tr( "Show All Features" ), QgsAttributeTableFilterModel::ShowAll ); cmbAttrTableBehavior->addItem( tr( "Show Selected Features" ), QgsAttributeTableFilterModel::ShowSelected ); cmbAttrTableBehavior->addItem( tr( "Show Features Visible on Map" ), QgsAttributeTableFilterModel::ShowVisible ); cmbAttrTableBehavior->setCurrentIndex( cmbAttrTableBehavior->findData( mSettings->enumValue( QStringLiteral( "/qgis/attributeTableBehavior" ), QgsAttributeTableFilterModel::ShowAll ) ) ); mAttrTableViewComboBox->clear(); mAttrTableViewComboBox->addItem( tr( "Remember Last View" ), -1 ); mAttrTableViewComboBox->addItem( tr( "Table View" ), QgsDualView::AttributeTable ); mAttrTableViewComboBox->addItem( tr( "Form View" ), QgsDualView::AttributeEditor ); mAttrTableViewComboBox->setCurrentIndex( mAttrTableViewComboBox->findData( mSettings->value( QStringLiteral( "/qgis/attributeTableView" ), -1 ).toInt() ) ); spinBoxAttrTableRowCache->setValue( mSettings->value( QStringLiteral( "/qgis/attributeTableRowCache" ), 10000 ).toInt() ); spinBoxAttrTableRowCache->setClearValue( 10000 ); spinBoxAttrTableRowCache->setSpecialValueText( tr( "All" ) ); cmbPromptSublayers->clear(); cmbPromptSublayers->addItem( tr( "Always" ), static_cast< int >( Qgis::SublayerPromptMode::AlwaysAsk ) ); cmbPromptSublayers->addItem( tr( "If Needed" ), static_cast< int >( Qgis::SublayerPromptMode::AskExcludingRasterBands ) ); //this means, prompt if there are sublayers but no band in the main dataset cmbPromptSublayers->addItem( tr( "Never" ), static_cast< int >( Qgis::SublayerPromptMode::NeverAskSkip ) ); cmbPromptSublayers->addItem( tr( "Load All" ), static_cast< int >( Qgis::SublayerPromptMode::NeverAskLoadAll ) ); cmbPromptSublayers->setCurrentIndex( cmbPromptSublayers->findData( static_cast< int >( mSettings->enumValue( QStringLiteral( "/qgis/promptForSublayers" ), Qgis::SublayerPromptMode::AlwaysAsk ) ) ) ); // Scan for valid items in the browser dock cmbScanItemsInBrowser->clear(); cmbScanItemsInBrowser->addItem( tr( "Check File Contents" ), "contents" ); // 0 cmbScanItemsInBrowser->addItem( tr( "Check Extension" ), "extension" ); // 1 int index = cmbScanItemsInBrowser->findData( mSettings->value( QStringLiteral( "/qgis/scanItemsInBrowser2" ), QString() ) ); if ( index == -1 ) index = 1; cmbScanItemsInBrowser->setCurrentIndex( index ); // Scan for contents of compressed files (.zip) in browser dock cmbScanZipInBrowser->clear(); cmbScanZipInBrowser->addItem( tr( "No" ), QVariant( "no" ) ); // cmbScanZipInBrowser->addItem( tr( "Passthru" ) ); // 1 - removed cmbScanZipInBrowser->addItem( tr( "Basic Scan" ), QVariant( "basic" ) ); cmbScanZipInBrowser->addItem( tr( "Full Scan" ), QVariant( "full" ) ); index = cmbScanZipInBrowser->findData( mSettings->value( QStringLiteral( "/qgis/scanZipInBrowser2" ), QString() ) ); if ( index == -1 ) index = 1; cmbScanZipInBrowser->setCurrentIndex( index ); mCheckMonitorDirectories->setChecked( mSettings->value( QStringLiteral( "/qgis/monitorDirectoriesInBrowser" ), true ).toBool() ); // log rendering events, for userspace debugging mLogCanvasRefreshChkBx->setChecked( QgsMapRendererJob::settingsLogCanvasRefreshEvent.value() ); //set the default projection behavior radio buttons const QgsOptions::UnknownLayerCrsBehavior mode = QgsSettings().enumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::NoAction, QgsSettings::App ); switch ( mode ) { case NoAction: radCrsNoAction->setChecked( true ); break; case PromptUserForCrs: radPromptForProjection->setChecked( true ); break; case UseProjectCrs: radUseProjectProjection->setChecked( true ); break; case UseDefaultCrs: radUseGlobalProjection->setChecked( true ); break; } QString myLayerDefaultCrs = mSettings->value( QStringLiteral( "/Projections/layerDefaultCrs" ), geoEpsgCrsAuthId() ).toString(); mLayerDefaultCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( myLayerDefaultCrs ); leLayerGlobalCrs->setCrs( mLayerDefaultCrs ); const QString defaultProjectCrs = mSettings->value( QStringLiteral( "/projections/defaultProjectCrs" ), geoEpsgCrsAuthId(), QgsSettings::App ).toString(); leProjectGlobalCrs->setOptionVisible( QgsProjectionSelectionWidget::DefaultCrs, false ); leProjectGlobalCrs->setOptionVisible( QgsProjectionSelectionWidget::CrsNotSet, true ); leProjectGlobalCrs->setNotSetText( tr( "No projection (or unknown/non-Earth projection)" ) ); leProjectGlobalCrs->setCrs( QgsCoordinateReferenceSystem( defaultProjectCrs ) ); leProjectGlobalCrs->setMessage( tr( "<h1>Default projection for new projects</h1>" "Select a projection that should be used for new projects that are created in QGIS." ) ); const QgsGui::ProjectCrsBehavior projectCrsBehavior = mSettings->enumValue( QStringLiteral( "/projections/newProjectCrsBehavior" ), QgsGui::UseCrsOfFirstLayerAdded, QgsSettings::App ); switch ( projectCrsBehavior ) { case QgsGui::UseCrsOfFirstLayerAdded: radProjectUseCrsOfFirstLayer->setChecked( true ); break; case QgsGui::UsePresetCrs: radProjectUseDefaultCrs->setChecked( true ); break; } const double crsAccuracyWarningThreshold = mSettings->value( QStringLiteral( "/projections/crsAccuracyWarningThreshold" ), 0.0, QgsSettings::App ).toDouble(); mCrsAccuracySpin->setMinimumWidth( QFontMetrics( font() ).horizontalAdvance( '0' ) * 20 ); mCrsAccuracySpin->setClearValue( 0.0, tr( "Always show" ) ); mCrsAccuracySpin->setValue( crsAccuracyWarningThreshold ); const bool crsAccuracyIndicator = mSettings->value( QStringLiteral( "/projections/crsAccuracyIndicator" ), false, QgsSettings::App ).toBool(); mCrsAccuracyIndicatorCheck->setChecked( crsAccuracyIndicator ); mShowDatumTransformDialogCheckBox->setChecked( mSettings->value( QStringLiteral( "/projections/promptWhenMultipleTransformsExist" ), false, QgsSettings::App ).toBool() ); // Datum transforms QgsCoordinateTransformContext context; context.readSettings(); mDefaultDatumTransformTableWidget->setTransformContext( context ); // Set the units for measuring mDistanceUnitsComboBox->addItem( tr( "Meters" ), QgsUnitTypes::DistanceMeters ); mDistanceUnitsComboBox->addItem( tr( "Kilometers" ), QgsUnitTypes::DistanceKilometers ); mDistanceUnitsComboBox->addItem( tr( "Feet" ), QgsUnitTypes::DistanceFeet ); mDistanceUnitsComboBox->addItem( tr( "Yards" ), QgsUnitTypes::DistanceYards ); mDistanceUnitsComboBox->addItem( tr( "Miles" ), QgsUnitTypes::DistanceMiles ); mDistanceUnitsComboBox->addItem( tr( "Nautical Miles" ), QgsUnitTypes::DistanceNauticalMiles ); mDistanceUnitsComboBox->addItem( tr( "Centimeters" ), QgsUnitTypes::DistanceCentimeters ); mDistanceUnitsComboBox->addItem( tr( "Millimeters" ), QgsUnitTypes::DistanceMillimeters ); mDistanceUnitsComboBox->addItem( tr( "Degrees" ), QgsUnitTypes::DistanceDegrees ); mDistanceUnitsComboBox->addItem( tr( "Map Units" ), QgsUnitTypes::DistanceUnknownUnit ); bool ok = false; QgsUnitTypes::DistanceUnit distanceUnits = QgsUnitTypes::decodeDistanceUnit( mSettings->value( QStringLiteral( "/qgis/measure/displayunits" ) ).toString(), &ok ); if ( !ok ) distanceUnits = QgsUnitTypes::DistanceMeters; mDistanceUnitsComboBox->setCurrentIndex( mDistanceUnitsComboBox->findData( distanceUnits ) ); mAreaUnitsComboBox->addItem( tr( "Square Meters" ), QgsUnitTypes::AreaSquareMeters ); mAreaUnitsComboBox->addItem( tr( "Square Kilometers" ), QgsUnitTypes::AreaSquareKilometers ); mAreaUnitsComboBox->addItem( tr( "Square Feet" ), QgsUnitTypes::AreaSquareFeet ); mAreaUnitsComboBox->addItem( tr( "Square Yards" ), QgsUnitTypes::AreaSquareYards ); mAreaUnitsComboBox->addItem( tr( "Square Miles" ), QgsUnitTypes::AreaSquareMiles ); mAreaUnitsComboBox->addItem( tr( "Hectares" ), QgsUnitTypes::AreaHectares ); mAreaUnitsComboBox->addItem( tr( "Acres" ), QgsUnitTypes::AreaAcres ); mAreaUnitsComboBox->addItem( tr( "Square Nautical Miles" ), QgsUnitTypes::AreaSquareNauticalMiles ); mAreaUnitsComboBox->addItem( tr( "Square Centimeters" ), QgsUnitTypes::AreaSquareCentimeters ); mAreaUnitsComboBox->addItem( tr( "Square Millimeters" ), QgsUnitTypes::AreaSquareMillimeters ); mAreaUnitsComboBox->addItem( tr( "Square Degrees" ), QgsUnitTypes::AreaSquareDegrees ); mAreaUnitsComboBox->addItem( tr( "Map Units" ), QgsUnitTypes::AreaUnknownUnit ); QgsUnitTypes::AreaUnit areaUnits = QgsUnitTypes::decodeAreaUnit( mSettings->value( QStringLiteral( "/qgis/measure/areaunits" ) ).toString(), &ok ); if ( !ok ) areaUnits = QgsUnitTypes::AreaSquareMeters; mAreaUnitsComboBox->setCurrentIndex( mAreaUnitsComboBox->findData( areaUnits ) ); mAngleUnitsComboBox->addItem( tr( "Degrees" ), QgsUnitTypes::AngleDegrees ); mAngleUnitsComboBox->addItem( tr( "Radians" ), QgsUnitTypes::AngleRadians ); mAngleUnitsComboBox->addItem( tr( "Gon/gradians" ), QgsUnitTypes::AngleGon ); mAngleUnitsComboBox->addItem( tr( "Minutes of Arc" ), QgsUnitTypes::AngleMinutesOfArc ); mAngleUnitsComboBox->addItem( tr( "Seconds of Arc" ), QgsUnitTypes::AngleSecondsOfArc ); mAngleUnitsComboBox->addItem( tr( "Turns/revolutions" ), QgsUnitTypes::AngleTurn ); mAngleUnitsComboBox->addItem( tr( "Milliradians (SI Definition)" ), QgsUnitTypes::AngleMilliradiansSI ); mAngleUnitsComboBox->addItem( tr( "Mil (NATO/military Definition)" ), QgsUnitTypes::AngleMilNATO ); QgsUnitTypes::AngleUnit unit = QgsUnitTypes::decodeAngleUnit( mSettings->value( QStringLiteral( "/qgis/measure/angleunits" ), QgsUnitTypes::encodeUnit( QgsUnitTypes::AngleDegrees ) ).toString() ); mAngleUnitsComboBox->setCurrentIndex( mAngleUnitsComboBox->findData( unit ) ); // set decimal places of the measure tool int decimalPlaces = mSettings->value( QStringLiteral( "/qgis/measure/decimalplaces" ), 3 ).toInt(); mDecimalPlacesSpinBox->setClearValue( 3 ); mDecimalPlacesSpinBox->setRange( 0, 12 ); mDecimalPlacesSpinBox->setValue( decimalPlaces ); // set if base unit of measure tool should be changed bool baseUnit = mSettings->value( QStringLiteral( "qgis/measure/keepbaseunit" ), true ).toBool(); if ( baseUnit ) { mKeepBaseUnitCheckBox->setChecked( true ); } else { mKeepBaseUnitCheckBox->setChecked( false ); } mPlanimetricMeasurementsComboBox->setChecked( mSettings->value( QStringLiteral( "measure/planimetric" ), false, QgsSettings::Core ).toBool() ); cmbIconSize->setCurrentIndex( cmbIconSize->findText( mSettings->value( QStringLiteral( "qgis/iconSize" ), QGIS_ICON_SIZE ).toString() ) ); // set font size and family spinFontSize->blockSignals( true ); mFontFamilyRadioQt->blockSignals( true ); mFontFamilyRadioCustom->blockSignals( true ); mFontFamilyComboBox->blockSignals( true ); spinFontSize->setValue( mStyleSheetOldOpts.value( QStringLiteral( "fontPointSize" ) ).toInt() ); QString fontFamily = mStyleSheetOldOpts.value( QStringLiteral( "fontFamily" ) ).toString(); bool isQtDefault = ( fontFamily == mStyleSheetBuilder->defaultFont().family() ); mFontFamilyRadioQt->setChecked( isQtDefault ); mFontFamilyRadioCustom->setChecked( !isQtDefault ); mFontFamilyComboBox->setEnabled( !isQtDefault ); if ( !isQtDefault ) { QFont *tempFont = new QFont( fontFamily ); // is exact family match returned from system? if ( tempFont->family() == fontFamily ) { mFontFamilyComboBox->setCurrentFont( *tempFont ); } delete tempFont; } spinFontSize->blockSignals( false ); mFontFamilyRadioQt->blockSignals( false ); mFontFamilyRadioCustom->blockSignals( false ); mFontFamilyComboBox->blockSignals( false ); mMessageTimeoutSpnBx->setValue( mSettings->value( QStringLiteral( "/qgis/messageTimeout" ), 5 ).toInt() ); mMessageTimeoutSpnBx->setClearValue( 5 ); QString name = mSettings->value( QStringLiteral( "/qgis/style" ) ).toString(); whileBlocking( cmbStyle )->setCurrentIndex( cmbStyle->findText( name, Qt::MatchFixedString ) ); QString theme = mSettings->value( QStringLiteral( "UI/UITheme" ), QStringLiteral( "default" ) ).toString(); if ( !QgsApplication::uiThemes().contains( theme ) ) { theme = QStringLiteral( "default" ); } whileBlocking( cmbUITheme )->setCurrentIndex( cmbUITheme->findText( theme, Qt::MatchFixedString ) ); mNativeColorDialogsChkBx->setChecked( mSettings->value( QStringLiteral( "/qgis/native_color_dialogs" ), false ).toBool() ); //set the state of the checkboxes //Changed to default to true as of QGIS 1.7 chkAntiAliasing->setChecked( mSettings->value( QStringLiteral( "/qgis/enable_anti_aliasing" ), true ).toBool() ); chkUseRenderCaching->setChecked( mSettings->value( QStringLiteral( "/qgis/enable_render_caching" ), true ).toBool() ); chkParallelRendering->setChecked( mSettings->value( QStringLiteral( "/qgis/parallel_rendering" ), true ).toBool() ); spinMapUpdateInterval->setValue( mSettings->value( QStringLiteral( "/qgis/map_update_interval" ), 250 ).toInt() ); spinMapUpdateInterval->setClearValue( 250 ); chkMaxThreads->setChecked( QgsApplication::maxThreads() != -1 ); spinMaxThreads->setEnabled( chkMaxThreads->isChecked() ); spinMaxThreads->setRange( 1, QThread::idealThreadCount() ); spinMaxThreads->setValue( QgsApplication::maxThreads() ); // Default simplify drawing configuration mSimplifyDrawingGroupBox->setChecked( mSettings->enumValue( QStringLiteral( "/qgis/simplifyDrawingHints" ), QgsVectorSimplifyMethod::GeometrySimplification ) != QgsVectorSimplifyMethod::NoSimplification ); mSimplifyDrawingSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/simplifyDrawingTol" ), Qgis::DEFAULT_MAPTOPIXEL_THRESHOLD ).toFloat() ); mSimplifyDrawingAtProvider->setChecked( !mSettings->value( QStringLiteral( "/qgis/simplifyLocal" ), true ).toBool() ); //segmentation tolerance type mToleranceTypeComboBox->addItem( tr( "Maximum Angle" ), QgsAbstractGeometry::MaximumAngle ); mToleranceTypeComboBox->addItem( tr( "Maximum Difference" ), QgsAbstractGeometry::MaximumDifference ); QgsAbstractGeometry::SegmentationToleranceType toleranceType = mSettings->enumValue( QStringLiteral( "/qgis/segmentationToleranceType" ), QgsAbstractGeometry::MaximumAngle ); int toleranceTypeIndex = mToleranceTypeComboBox->findData( toleranceType ); if ( toleranceTypeIndex != -1 ) { mToleranceTypeComboBox->setCurrentIndex( toleranceTypeIndex ); } double tolerance = mSettings->value( QStringLiteral( "/qgis/segmentationTolerance" ), "0.01745" ).toDouble(); if ( toleranceType == QgsAbstractGeometry::MaximumAngle ) { tolerance = tolerance * 180.0 / M_PI; //value shown to the user is degree, not rad } mSegmentationToleranceSpinBox->setValue( tolerance ); mSegmentationToleranceSpinBox->setClearValue( 1.0 ); QStringList myScalesList = Qgis::defaultProjectScales().split( ',' ); myScalesList.append( QStringLiteral( "1:1" ) ); mSimplifyMaximumScaleComboBox->updateScales( myScalesList ); mSimplifyMaximumScaleComboBox->setScale( mSettings->value( QStringLiteral( "/qgis/simplifyMaxScale" ), 1 ).toFloat() ); // Magnifier double magnifierMin = 100 * QgsGuiUtils::CANVAS_MAGNIFICATION_MIN; double magnifierMax = 100 * QgsGuiUtils::CANVAS_MAGNIFICATION_MAX; double magnifierVal = 100 * mSettings->value( QStringLiteral( "/qgis/magnifier_factor_default" ), 1.0 ).toDouble(); doubleSpinBoxMagnifierDefault->setRange( magnifierMin, magnifierMax ); doubleSpinBoxMagnifierDefault->setSingleStep( 50 ); doubleSpinBoxMagnifierDefault->setDecimals( 0 ); doubleSpinBoxMagnifierDefault->setSuffix( QStringLiteral( "%" ) ); doubleSpinBoxMagnifierDefault->setValue( magnifierVal ); doubleSpinBoxMagnifierDefault->setClearValue( 100 ); // Default local simplification algorithm mSimplifyAlgorithmComboBox->addItem( tr( "Distance" ), static_cast<int>( QgsVectorSimplifyMethod::Distance ) ); mSimplifyAlgorithmComboBox->addItem( tr( "SnapToGrid" ), static_cast<int>( QgsVectorSimplifyMethod::SnapToGrid ) ); mSimplifyAlgorithmComboBox->addItem( tr( "Visvalingam" ), static_cast<int>( QgsVectorSimplifyMethod::Visvalingam ) ); mSimplifyAlgorithmComboBox->setCurrentIndex( mSimplifyAlgorithmComboBox->findData( mSettings->enumValue( QStringLiteral( "/qgis/simplifyAlgorithm" ), QgsVectorSimplifyMethod::NoSimplification ) ) ); // Slightly awkward here at the settings value is true to use QImage, // but the checkbox is true to use QPixmap chkAddedVisibility->setChecked( mSettings->value( QStringLiteral( "/qgis/new_layers_visible" ), true ).toBool() ); cbxLegendClassifiers->setChecked( mSettings->value( QStringLiteral( "/qgis/showLegendClassifiers" ), false ).toBool() ); cbxHideSplash->setChecked( mSettings->value( QStringLiteral( "/qgis/hideSplash" ), false ).toBool() ); cbxShowNews->setChecked( !mSettings->value( QStringLiteral( "%1/disabled" ).arg( QgsNewsFeedParser::keyForFeed( QgsWelcomePage::newsFeedUrl() ) ), false, QgsSettings::Core ).toBool() ); mDataSourceManagerNonModal->setChecked( mSettings->value( QStringLiteral( "/qgis/dataSourceManagerNonModal" ), false ).toBool() ); cbxCheckVersion->setChecked( mSettings->value( QStringLiteral( "/qgis/checkVersion" ), true ).toBool() ); cbxCheckVersion->setVisible( mSettings->value( QStringLiteral( "/qgis/allowVersionCheck" ), true ).toBool() ); cbxAttributeTableDocked->setChecked( mSettings->value( QStringLiteral( "/qgis/dockAttributeTable" ), false ).toBool() ); mComboCopyFeatureFormat->addItem( tr( "Plain Text, No Geometry" ), QgsClipboard::AttributesOnly ); mComboCopyFeatureFormat->addItem( tr( "Plain Text, WKT Geometry" ), QgsClipboard::AttributesWithWKT ); mComboCopyFeatureFormat->addItem( tr( "GeoJSON" ), QgsClipboard::GeoJSON ); mComboCopyFeatureFormat->setCurrentIndex( mComboCopyFeatureFormat->findData( mSettings->enumValue( QStringLiteral( "/qgis/copyFeatureFormat" ), QgsClipboard::AttributesWithWKT ) ) ); leNullValue->setText( QgsApplication::nullRepresentation() ); cmbLegendDoubleClickAction->setCurrentIndex( mSettings->value( QStringLiteral( "/qgis/legendDoubleClickAction" ), 0 ).toInt() ); // Legend symbol minimum / maximum values mLegendSymbolMinimumSizeSpinBox->setClearValue( 0.0, tr( "none" ) ); mLegendSymbolMaximumSizeSpinBox->setClearValue( 0.0, tr( "none" ) ); mLegendSymbolMinimumSizeSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/legendsymbolMinimumSize" ), 0.1 ).toDouble() ); mLegendSymbolMaximumSizeSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/legendsymbolMaximumSize" ), 20.0 ).toDouble() ); // WMS getLegendGraphic setting mLegendGraphicResolutionSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/defaultLegendGraphicResolution" ), 0 ).toInt() ); // Map Tips delay mMapTipsDelaySpinBox->setValue( mSettings->value( QStringLiteral( "qgis/mapTipsDelay" ), 850 ).toInt() ); mMapTipsDelaySpinBox->setClearValue( 850 ); mRespectScreenDpiCheckBox->setChecked( QgsSettingsRegistryGui::settingsRespectScreenDPI.value() ); // // Raster properties // spnRed->setValue( mSettings->value( QStringLiteral( "/Raster/defaultRedBand" ), 1 ).toInt() ); spnRed->setClearValue( 1 ); spnGreen->setValue( mSettings->value( QStringLiteral( "/Raster/defaultGreenBand" ), 2 ).toInt() ); spnGreen->setClearValue( 2 ); spnBlue->setValue( mSettings->value( QStringLiteral( "/Raster/defaultBlueBand" ), 3 ).toInt() ); spnBlue->setClearValue( 3 ); mZoomedInResamplingComboBox->insertItem( 0, tr( "Nearest neighbour" ), QStringLiteral( "nearest neighbour" ) ); mZoomedInResamplingComboBox->insertItem( 1, tr( "Bilinear" ), QStringLiteral( "bilinear" ) ); mZoomedInResamplingComboBox->insertItem( 2, tr( "Cubic" ), QStringLiteral( "cubic" ) ); mZoomedOutResamplingComboBox->insertItem( 0, tr( "Nearest neighbour" ), QStringLiteral( "nearest neighbour" ) ); mZoomedOutResamplingComboBox->insertItem( 1, tr( "Bilinear" ), QStringLiteral( "bilinear" ) ); mZoomedOutResamplingComboBox->insertItem( 2, tr( "Cubic" ), QStringLiteral( "cubic" ) ); QString zoomedInResampling = mSettings->value( QStringLiteral( "/Raster/defaultZoomedInResampling" ), QStringLiteral( "nearest neighbour" ) ).toString(); mZoomedInResamplingComboBox->setCurrentIndex( mZoomedInResamplingComboBox->findData( zoomedInResampling ) ); QString zoomedOutResampling = mSettings->value( QStringLiteral( "/Raster/defaultZoomedOutResampling" ), QStringLiteral( "nearest neighbour" ) ).toString(); mZoomedOutResamplingComboBox->setCurrentIndex( mZoomedOutResamplingComboBox->findData( zoomedOutResampling ) ); spnOversampling->setValue( mSettings->value( QStringLiteral( "/Raster/defaultOversampling" ), 2.0 ).toDouble() ); spnOversampling->setClearValue( 2.0 ); mCbEarlyResampling->setChecked( mSettings->value( QStringLiteral( "/Raster/defaultEarlyResampling" ), false ).toBool() ); initContrastEnhancement( cboxContrastEnhancementAlgorithmSingleBand, QStringLiteral( "singleBand" ), QgsContrastEnhancement::contrastEnhancementAlgorithmString( QgsRasterLayer::SINGLE_BAND_ENHANCEMENT_ALGORITHM ) ); initContrastEnhancement( cboxContrastEnhancementAlgorithmMultiBandSingleByte, QStringLiteral( "multiBandSingleByte" ), QgsContrastEnhancement::contrastEnhancementAlgorithmString( QgsRasterLayer::MULTIPLE_BAND_SINGLE_BYTE_ENHANCEMENT_ALGORITHM ) ); initContrastEnhancement( cboxContrastEnhancementAlgorithmMultiBandMultiByte, QStringLiteral( "multiBandMultiByte" ), QgsContrastEnhancement::contrastEnhancementAlgorithmString( QgsRasterLayer::MULTIPLE_BAND_MULTI_BYTE_ENHANCEMENT_ALGORITHM ) ); initMinMaxLimits( cboxContrastEnhancementLimitsSingleBand, QStringLiteral( "singleBand" ), QgsRasterMinMaxOrigin::limitsString( QgsRasterLayer::SINGLE_BAND_MIN_MAX_LIMITS ) ); initMinMaxLimits( cboxContrastEnhancementLimitsMultiBandSingleByte, QStringLiteral( "multiBandSingleByte" ), QgsRasterMinMaxOrigin::limitsString( QgsRasterLayer::MULTIPLE_BAND_SINGLE_BYTE_MIN_MAX_LIMITS ) ); initMinMaxLimits( cboxContrastEnhancementLimitsMultiBandMultiByte, QStringLiteral( "multiBandMultiByte" ), QgsRasterMinMaxOrigin::limitsString( QgsRasterLayer::MULTIPLE_BAND_MULTI_BYTE_MIN_MAX_LIMITS ) ); spnThreeBandStdDev->setValue( mSettings->value( QStringLiteral( "/Raster/defaultStandardDeviation" ), QgsRasterMinMaxOrigin::DEFAULT_STDDEV_FACTOR ).toDouble() ); spnThreeBandStdDev->setClearValue( QgsRasterMinMaxOrigin::DEFAULT_STDDEV_FACTOR ); mRasterCumulativeCutLowerDoubleSpinBox->setValue( 100.0 * mSettings->value( QStringLiteral( "/Raster/cumulativeCutLower" ), QString::number( QgsRasterMinMaxOrigin::CUMULATIVE_CUT_LOWER ) ).toDouble() ); mRasterCumulativeCutUpperDoubleSpinBox->setValue( 100.0 * mSettings->value( QStringLiteral( "/Raster/cumulativeCutUpper" ), QString::number( QgsRasterMinMaxOrigin::CUMULATIVE_CUT_UPPER ) ).toDouble() ); //set the color for selections int red = mSettings->value( QStringLiteral( "/qgis/default_selection_color_red" ), 255 ).toInt(); int green = mSettings->value( QStringLiteral( "/qgis/default_selection_color_green" ), 255 ).toInt(); int blue = mSettings->value( QStringLiteral( "/qgis/default_selection_color_blue" ), 0 ).toInt(); int alpha = mSettings->value( QStringLiteral( "/qgis/default_selection_color_alpha" ), 255 ).toInt(); pbnSelectionColor->setColor( QColor( red, green, blue, alpha ) ); pbnSelectionColor->setColorDialogTitle( tr( "Set Selection Color" ) ); pbnSelectionColor->setAllowOpacity( true ); pbnSelectionColor->setContext( QStringLiteral( "gui" ) ); pbnSelectionColor->setDefaultColor( QColor( 255, 255, 0, 255 ) ); //set the default color for canvas background red = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_red" ), 255 ).toInt(); green = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_green" ), 255 ).toInt(); blue = mSettings->value( QStringLiteral( "/qgis/default_canvas_color_blue" ), 255 ).toInt(); pbnCanvasColor->setColor( QColor( red, green, blue ) ); pbnCanvasColor->setColorDialogTitle( tr( "Set Canvas Color" ) ); pbnCanvasColor->setContext( QStringLiteral( "gui" ) ); pbnCanvasColor->setDefaultColor( Qt::white ); // set the default color for the measure tool red = mSettings->value( QStringLiteral( "/qgis/default_measure_color_red" ), 222 ).toInt(); green = mSettings->value( QStringLiteral( "/qgis/default_measure_color_green" ), 155 ).toInt(); blue = mSettings->value( QStringLiteral( "/qgis/default_measure_color_blue" ), 67 ).toInt(); pbnMeasureColor->setColor( QColor( red, green, blue ) ); pbnMeasureColor->setColorDialogTitle( tr( "Set Measuring Tool Color" ) ); pbnMeasureColor->setContext( QStringLiteral( "gui" ) ); pbnMeasureColor->setDefaultColor( QColor( 222, 155, 67 ) ); int projOpen = mSettings->value( QStringLiteral( "/qgis/projOpenAtLaunch" ), 0 ).toInt(); mProjectOnLaunchCmbBx->setCurrentIndex( projOpen ); mProjectOnLaunchLineEdit->setText( mSettings->value( QStringLiteral( "/qgis/projOpenAtLaunchPath" ) ).toString() ); mProjectOnLaunchLineEdit->setEnabled( projOpen == 2 ); mProjectOnLaunchPushBtn->setEnabled( projOpen == 2 ); connect( mProjectOnLaunchPushBtn, &QAbstractButton::pressed, this, &QgsOptions::selectProjectOnLaunch ); chbAskToSaveProjectChanges->setChecked( mSettings->value( QStringLiteral( "qgis/askToSaveProjectChanges" ), QVariant( true ) ).toBool() ); mLayerDeleteConfirmationChkBx->setChecked( mSettings->value( QStringLiteral( "qgis/askToDeleteLayers" ), true ).toBool() ); chbWarnOldProjectVersion->setChecked( mSettings->value( QStringLiteral( "/qgis/warnOldProjectVersion" ), QVariant( true ) ).toBool() ); Qgis::PythonMacroMode pyMacroMode = mSettings->enumValue( QStringLiteral( "/qgis/enableMacros" ), Qgis::PythonMacroMode::Ask ); mEnableMacrosComboBox->setCurrentIndex( mEnableMacrosComboBox->findData( QVariant::fromValue( pyMacroMode ) ) ); mDefaultPathsComboBox->addItem( tr( "Absolute" ), static_cast< int >( Qgis::FilePathType::Absolute ) ); mDefaultPathsComboBox->addItem( tr( "Relative" ), static_cast< int >( Qgis::FilePathType::Relative ) ); mDefaultPathsComboBox->setCurrentIndex( mDefaultPathsComboBox->findData( static_cast< int >( mSettings->value( QStringLiteral( "/qgis/defaultProjectPathsRelative" ), QVariant( true ) ).toBool() ? Qgis::FilePathType::Relative : Qgis::FilePathType::Absolute ) ) ); QgsProject::FileFormat defaultProjectFileFormat = mSettings->enumValue( QStringLiteral( "/qgis/defaultProjectFileFormat" ), QgsProject::FileFormat::Qgz ); mFileFormatQgzButton->setChecked( defaultProjectFileFormat == QgsProject::FileFormat::Qgz ); mFileFormatQgsButton->setChecked( defaultProjectFileFormat == QgsProject::FileFormat::Qgs ); // templates cbxProjectDefaultNew->setChecked( mSettings->value( QStringLiteral( "/qgis/newProjectDefault" ), QVariant( false ) ).toBool() ); QString templateDirName = mSettings->value( QStringLiteral( "/qgis/projectTemplateDir" ), QString( QgsApplication::qgisSettingsDirPath() + "project_templates" ) ).toString(); // make dir if it doesn't exist - should just be called once QDir templateDir; if ( ! templateDir.exists( templateDirName ) ) { templateDir.mkdir( templateDirName ); } leTemplateFolder->setText( templateDirName ); connect( pbnProjectDefaultSetCurrent, &QAbstractButton::clicked, this, &QgsOptions::setCurrentProjectDefault ); connect( pbnProjectDefaultReset, &QAbstractButton::clicked, this, &QgsOptions::resetProjectDefault ); connect( pbnTemplateFolderBrowse, &QAbstractButton::pressed, this, &QgsOptions::browseTemplateFolder ); connect( pbnTemplateFolderReset, &QAbstractButton::pressed, this, &QgsOptions::resetTemplateFolder ); setZoomFactorValue(); spinZoomFactor->setClearValue( 200 ); // predefined scales for scale combobox QString scalePaths = mSettings->value( QStringLiteral( "Map/scales" ), Qgis::defaultProjectScales() ).toString(); if ( !scalePaths.isEmpty() ) { const QStringList scalesList = scalePaths.split( ',' ); for ( const QString &scale : scalesList ) { addScaleToScaleList( scale ); } } connect( mListGlobalScales, &QListWidget::itemChanged, this, &QgsOptions::scaleItemChanged ); connect( pbnAddScale, &QAbstractButton::clicked, this, &QgsOptions::addScale ); connect( pbnRemoveScale, &QAbstractButton::clicked, this, &QgsOptions::removeScale ); connect( pbnExportScales, &QAbstractButton::clicked, this, &QgsOptions::exportScales ); connect( pbnImportScales, &QAbstractButton::clicked, this, &QgsOptions::importScales ); connect( pbnDefaultScaleValues, &QAbstractButton::clicked, this, &QgsOptions::restoreDefaultScaleValues ); // // Color palette // connect( mButtonAddColor, &QAbstractButton::clicked, this, &QgsOptions::addColor ); connect( mButtonRemoveColor, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::removeSelection ); connect( mButtonCopyColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::copyColors ); connect( mButtonPasteColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::pasteColors ); connect( mButtonImportColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::showImportColorsDialog ); connect( mButtonExportColors, &QAbstractButton::clicked, mTreeCustomColors, &QgsColorSchemeList::showExportColorsDialog ); connect( mActionImportPalette, &QAction::triggered, this, [ = ] { if ( QgsCompoundColorWidget::importUserPaletteFromFile( this ) ) { //refresh combobox refreshSchemeComboBox(); mColorSchemesComboBox->setCurrentIndex( mColorSchemesComboBox->count() - 1 ); } } ); connect( mActionRemovePalette, &QAction::triggered, this, [ = ] { //get current scheme QList<QgsColorScheme *> schemeList = QgsApplication::colorSchemeRegistry()->schemes(); int prevIndex = mColorSchemesComboBox->currentIndex(); if ( prevIndex >= schemeList.length() ) { return; } //make user scheme is a user removable scheme QgsUserColorScheme *userScheme = dynamic_cast<QgsUserColorScheme *>( schemeList.at( prevIndex ) ); if ( !userScheme ) { return; } if ( QgsCompoundColorWidget::removeUserPalette( userScheme, this ) ) { refreshSchemeComboBox(); prevIndex = std::max( std::min( prevIndex, mColorSchemesComboBox->count() - 1 ), 0 ); mColorSchemesComboBox->setCurrentIndex( prevIndex ); } } ); connect( mActionNewPalette, &QAction::triggered, this, [ = ] { if ( QgsCompoundColorWidget::createNewUserPalette( this ) ) { //refresh combobox refreshSchemeComboBox(); mColorSchemesComboBox->setCurrentIndex( mColorSchemesComboBox->count() - 1 ); } } ); connect( mActionShowInButtons, &QAction::toggled, this, [ = ]( bool state ) { QgsUserColorScheme *scheme = dynamic_cast< QgsUserColorScheme * >( mTreeCustomColors->scheme() ); if ( scheme ) { scheme->setShowSchemeInMenu( state ); } } ); QMenu *schemeMenu = new QMenu( mSchemeToolButton ); schemeMenu->addAction( mActionNewPalette ); schemeMenu->addAction( mActionImportPalette ); schemeMenu->addAction( mActionRemovePalette ); schemeMenu->addSeparator(); schemeMenu->addAction( mActionShowInButtons ); mSchemeToolButton->setMenu( schemeMenu ); //find custom color scheme from registry refreshSchemeComboBox(); QList<QgsCustomColorScheme *> customSchemes; QgsApplication::colorSchemeRegistry()->schemes( customSchemes ); if ( customSchemes.length() > 0 ) { mTreeCustomColors->setScheme( customSchemes.at( 0 ) ); mColorSchemesComboBox->setCurrentIndex( mColorSchemesComboBox->findText( customSchemes.at( 0 )->schemeName() ) ); updateActionsForCurrentColorScheme( customSchemes.at( 0 ) ); } connect( mColorSchemesComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, [ = ]( int index ) { //save changes to scheme if ( mTreeCustomColors->isDirty() ) { mTreeCustomColors->saveColorsToScheme(); } QgsColorScheme *scheme = QgsApplication::colorSchemeRegistry()->schemes().value( index ); if ( scheme ) { mTreeCustomColors->setScheme( scheme ); updateActionsForCurrentColorScheme( scheme ); } } ); // // Layout settings // //default layout font mComposerFontComboBox->blockSignals( true ); QString layoutFontFamily = mSettings->value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString(); QFont tempLayoutFont( layoutFontFamily ); // is exact family match returned from system? if ( tempLayoutFont.family() == layoutFontFamily ) { mComposerFontComboBox->setCurrentFont( tempLayoutFont ); } mComposerFontComboBox->blockSignals( false ); //default layout grid color int gridRed, gridGreen, gridBlue, gridAlpha; gridRed = mSettings->value( QStringLiteral( "LayoutDesigner/gridRed" ), 190, QgsSettings::Gui ).toInt(); gridGreen = mSettings->value( QStringLiteral( "LayoutDesigner/gridGreen" ), 190, QgsSettings::Gui ).toInt(); gridBlue = mSettings->value( QStringLiteral( "LayoutDesigner/gridBlue" ), 190, QgsSettings::Gui ).toInt(); gridAlpha = mSettings->value( QStringLiteral( "LayoutDesigner/gridAlpha" ), 100, QgsSettings::Gui ).toInt(); QColor gridColor = QColor( gridRed, gridGreen, gridBlue, gridAlpha ); mGridColorButton->setColor( gridColor ); mGridColorButton->setColorDialogTitle( tr( "Select Grid Color" ) ); mGridColorButton->setAllowOpacity( true ); mGridColorButton->setContext( QStringLiteral( "gui" ) ); mGridColorButton->setDefaultColor( QColor( 190, 190, 190, 100 ) ); //default layout grid style QString gridStyleString; gridStyleString = mSettings->value( QStringLiteral( "LayoutDesigner/gridStyle" ), "Dots", QgsSettings::Gui ).toString(); mGridStyleComboBox->insertItem( 0, tr( "Solid" ) ); mGridStyleComboBox->insertItem( 1, tr( "Dots" ) ); mGridStyleComboBox->insertItem( 2, tr( "Crosses" ) ); if ( gridStyleString == QLatin1String( "Solid" ) ) { mGridStyleComboBox->setCurrentIndex( 0 ); } else if ( gridStyleString == QLatin1String( "Crosses" ) ) { mGridStyleComboBox->setCurrentIndex( 2 ); } else { //default grid is dots mGridStyleComboBox->setCurrentIndex( 1 ); } //grid and guide defaults mGridResolutionSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapGridResolution" ), 10.0, QgsSettings::Gui ).toDouble() ); mGridResolutionSpinBox->setClearValue( 10.0 ); mSnapToleranceSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapTolerancePixels" ), 5, QgsSettings::Gui ).toInt() ); mSnapToleranceSpinBox->setClearValue( 5 ); mOffsetXSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetX" ), 0, QgsSettings::Gui ).toDouble() ); mOffsetYSpinBox->setValue( mSettings->value( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetY" ), 0, QgsSettings::Gui ).toDouble() ); // // Translation and locale settings // QString currentLocale = QLocale().name(); lblSystemLocale->setText( tr( "Detected active locale on your system: %1" ).arg( currentLocale ) ); QString userLocale = QgsApplication::settingsLocaleUserLocale.value(); bool showGroupSeparator = QgsApplication::settingsLocaleShowGroupSeparator.value(); QString globalLocale = QgsApplication::settingsLocaleGlobalLocale.value(); const QStringList language18nList( i18nList() ); for ( const auto &l : language18nList ) { // QTBUG-57802: eo locale is improperly handled QString displayName = l.startsWith( QLatin1String( "eo" ) ) ? QLocale::languageToString( QLocale::Esperanto ) : l.startsWith( QLatin1String( "sc" ) ) ? QStringLiteral( "sardu" ) : QLocale( l ).nativeLanguageName(); cboTranslation->addItem( QIcon( QString( ":/images/flags/%1.svg" ).arg( l ) ), displayName, l ); } const QList<QLocale> allLocales = QLocale::matchingLocales( QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry ); QSet<QString> addedLocales; for ( const auto &l : allLocales ) { // Do not add duplicates (like en_US) if ( ! addedLocales.contains( l.name() ) ) { cboGlobalLocale->addItem( QStringLiteral( "%1 %2 (%3)" ).arg( QLocale::languageToString( l.language() ), QLocale::countryToString( l.country() ), l.name() ), l.name() ); addedLocales.insert( l.name() ); } } cboTranslation->setCurrentIndex( cboTranslation->findData( userLocale ) ); cboGlobalLocale->setCurrentIndex( cboGlobalLocale->findData( globalLocale ) ); grpLocale->setChecked( QgsApplication::settingsLocaleOverrideFlag.value() ); cbShowGroupSeparator->setChecked( showGroupSeparator ); //set elements in digitizing tab mLineWidthSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingLineWidth.value() ); mLineColorToolButton->setColor( QColor( QgsSettingsRegistryCore::settingsDigitizingLineColorRed.value(), QgsSettingsRegistryCore::settingsDigitizingLineColorGreen.value(), QgsSettingsRegistryCore::settingsDigitizingLineColorBlue.value(), QgsSettingsRegistryCore::settingsDigitizingLineColorAlpha.value() ) ); mLineColorToolButton->setAllowOpacity( true ); mLineColorToolButton->setContext( QStringLiteral( "gui" ) ); mLineColorToolButton->setDefaultColor( QColor( 255, 0, 0, 200 ) ); mFillColorToolButton->setColor( QColor( QgsSettingsRegistryCore::settingsDigitizingFillColorRed.value(), QgsSettingsRegistryCore::settingsDigitizingFillColorGreen.value(), QgsSettingsRegistryCore::settingsDigitizingFillColorBlue.value(), QgsSettingsRegistryCore::settingsDigitizingFillColorAlpha.value() ) ); mFillColorToolButton->setAllowOpacity( true ); mFillColorToolButton->setContext( QStringLiteral( "gui" ) ); mFillColorToolButton->setDefaultColor( QColor( 255, 0, 0, 30 ) ); mLineGhostCheckBox->setChecked( QgsSettingsRegistryCore::settingsDigitizingLineGhost.value() ); mDefaultZValueSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingDefaultZValue.value() ); mDefaultZValueSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingDefaultZValue.defaultValue() ); mDefaultMValueSpinBox->setValue( mSettings->value( QStringLiteral( "/qgis/digitizing/default_m_value" ), Qgis::DEFAULT_M_COORDINATE ).toDouble() ); mDefaultMValueSpinBox->setClearValue( Qgis::DEFAULT_M_COORDINATE ); //default snap mode mSnappingEnabledDefault->setChecked( QgsSettingsRegistryCore::settingsDigitizingDefaultSnapEnabled.value() ); for ( QgsSnappingConfig::SnappingTypes type : { QgsSnappingConfig::NoSnapFlag, QgsSnappingConfig::VertexFlag, QgsSnappingConfig::SegmentFlag, QgsSnappingConfig::CentroidFlag, QgsSnappingConfig::MiddleOfSegmentFlag, QgsSnappingConfig::LineEndpointFlag, QgsSnappingConfig::AreaFlag, } ) { mDefaultSnapModeComboBox->addItem( QgsSnappingConfig::snappingTypeFlagToIcon( type ), QgsSnappingConfig::snappingTypeFlagToString( type ), type ); } QgsSnappingConfig::SnappingTypeFlag defaultSnapMode = QgsSettingsRegistryCore::settingsDigitizingDefaultSnapType.value(); mDefaultSnapModeComboBox->setCurrentIndex( mDefaultSnapModeComboBox->findData( static_cast<int>( defaultSnapMode ) ) ); mDefaultSnappingToleranceSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.value() ); mDefaultSnappingToleranceSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.defaultValue() ); mSearchRadiusVertexEditSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.value() ); mSearchRadiusVertexEditSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.defaultValue() ); QgsTolerance::UnitType defSnapUnits = QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit.value(); if ( defSnapUnits == QgsTolerance::ProjectUnits || defSnapUnits == QgsTolerance::LayerUnits ) { index = mDefaultSnappingToleranceComboBox->findText( tr( "map units" ) ); } else { index = mDefaultSnappingToleranceComboBox->findText( tr( "pixels" ) ); } mDefaultSnappingToleranceComboBox->setCurrentIndex( index ); QgsTolerance::UnitType defRadiusUnits = QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEditUnit.value(); if ( defRadiusUnits == QgsTolerance::ProjectUnits || defRadiusUnits == QgsTolerance::LayerUnits ) { index = mSearchRadiusVertexEditComboBox->findText( tr( "map units" ) ); } else { index = mSearchRadiusVertexEditComboBox->findText( tr( "pixels" ) ); } mSearchRadiusVertexEditComboBox->setCurrentIndex( index ); mSnappingMarkerColorButton->setColor( QgsSettingsRegistryCore::settingsDigitizingSnapColor.value() ); mSnappingTooltipsCheckbox->setChecked( QgsSettingsRegistryCore::settingsDigitizingSnapTooltip.value() ); mEnableSnappingOnInvisibleFeatureCheckbox->setChecked( QgsSettingsRegistryCore::settingsDigitizingSnapInvisibleFeature.value() ); //vertex marker mMarkersOnlyForSelectedCheckBox->setChecked( QgsSettingsRegistryCore::settingsDigitizingMarkerOnlyForSelected.value() ); mMarkerStyleComboBox->addItem( tr( "Semi Transparent Circle" ) ); mMarkerStyleComboBox->addItem( tr( "Cross" ) ); mMarkerStyleComboBox->addItem( tr( "None" ) ); mValidateGeometries->clear(); mValidateGeometries->addItem( tr( "Off" ) ); mValidateGeometries->addItem( tr( "QGIS" ) ); mValidateGeometries->addItem( tr( "GEOS" ) ); QString markerStyle = QgsSettingsRegistryCore::settingsDigitizingMarkerStyle.value(); if ( markerStyle == QLatin1String( "SemiTransparentCircle" ) ) { mMarkerStyleComboBox->setCurrentIndex( mMarkerStyleComboBox->findText( tr( "Semi Transparent Circle" ) ) ); } else if ( markerStyle == QLatin1String( "Cross" ) ) { mMarkerStyleComboBox->setCurrentIndex( mMarkerStyleComboBox->findText( tr( "Cross" ) ) ); } else if ( markerStyle == QLatin1String( "None" ) ) { mMarkerStyleComboBox->setCurrentIndex( mMarkerStyleComboBox->findText( tr( "None" ) ) ); } mMarkerSizeSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingMarkerSizeMm.value() ); mMarkerSizeSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingMarkerSizeMm.defaultValue() ); chkReuseLastValues->setChecked( QgsSettingsRegistryCore::settingsDigitizingReuseLastValues.value() ); chkDisableAttributeValuesDlg->setChecked( QgsSettingsRegistryCore::settingsDigitizingDisableEnterAttributeValuesDialog.value() ); mValidateGeometries->setCurrentIndex( QgsSettingsRegistryCore::settingsDigitizingValidateGeometries.value() ); mSnappingMainDialogComboBox->clear(); mSnappingMainDialogComboBox->addItem( tr( "Dialog" ), "dialog" ); mSnappingMainDialogComboBox->addItem( tr( "Dock" ), "dock" ); mSnappingMainDialogComboBox->setCurrentIndex( mSnappingMainDialogComboBox->findData( mSettings->value( QStringLiteral( "/qgis/mainSnappingWidgetMode" ), "dialog" ).toString() ) ); mOffsetJoinStyleComboBox->addItem( tr( "Round" ), static_cast< int >( Qgis::JoinStyle::Round ) ); mOffsetJoinStyleComboBox->addItem( tr( "Miter" ), static_cast< int >( Qgis::JoinStyle::Miter ) ); mOffsetJoinStyleComboBox->addItem( tr( "Bevel" ), static_cast< int >( Qgis::JoinStyle::Bevel ) ); Qgis::JoinStyle joinStyleSetting = QgsSettingsRegistryCore::settingsDigitizingOffsetJoinStyle.value(); mOffsetJoinStyleComboBox->setCurrentIndex( mOffsetJoinStyleComboBox->findData( static_cast< int >( joinStyleSetting ) ) ); mOffsetQuadSegSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingOffsetQuadSeg.value() ); mOffsetQuadSegSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingOffsetQuadSeg.defaultValue() ); mCurveOffsetMiterLimitComboBox->setValue( QgsSettingsRegistryCore::settingsDigitizingOffsetMiterLimit.value() ); mCurveOffsetMiterLimitComboBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingOffsetMiterLimit.defaultValue() ); mTracingConvertToCurveCheckBox->setChecked( QgsSettingsRegistryCore::settingsDigitizingConvertToCurve.value() ); mTracingCustomAngleToleranceSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingConvertToCurveAngleTolerance.value() ); mTracingCustomAngleToleranceSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingConvertToCurveAngleTolerance.defaultValue() ); mTracingCustomDistanceToleranceSpinBox->setValue( QgsSettingsRegistryCore::settingsDigitizingConvertToCurveDistanceTolerance.value() ); mTracingCustomDistanceToleranceSpinBox->setClearValue( QgsSettingsRegistryCore::settingsDigitizingConvertToCurveDistanceTolerance.defaultValue() ); // load gdal driver list only when gdal tab is first opened mLoadedGdalDriverList = false; mVariableEditor->context()->appendScope( QgsExpressionContextUtils::globalScope() ); mVariableEditor->reloadContext(); mVariableEditor->setEditableScopeIndex( 0 ); connect( mAddCustomVarBtn, &QAbstractButton::clicked, this, &QgsOptions::addCustomVariable ); connect( mRemoveCustomVarBtn, &QAbstractButton::clicked, this, &QgsOptions::removeCustomVariable ); // locator mLocatorOptionsWidget = new QgsLocatorOptionsWidget( QgisApp::instance()->locatorWidget(), this ); QVBoxLayout *locatorLayout = new QVBoxLayout(); locatorLayout->addWidget( mLocatorOptionsWidget ); mOptionsLocatorGroupBox->setLayout( locatorLayout ); QList< QgsOptionsWidgetFactory *> factories = optionsFactories; // ensure advanced factory is always last QgsAdvancedSettingsOptionsFactory advancedFactory; factories << &advancedFactory; for ( QgsOptionsWidgetFactory *factory : std::as_const( factories ) ) { QgsOptionsPageWidget *page = factory->createWidget( this ); if ( !page ) continue; mAdditionalOptionWidgets << page; const QString beforePage = factory->pagePositionHint(); if ( beforePage.isEmpty() ) addPage( factory->title(), factory->title(), factory->icon(), page, factory->path() ); else insertPage( factory->title(), factory->title(), factory->icon(), page, beforePage, factory->path() ); if ( QgsAdvancedSettingsWidget *advancedPage = qobject_cast< QgsAdvancedSettingsWidget * >( page ) ) { advancedPage->settingsTree()->setSettingsObject( mSettings ); } } #ifdef HAVE_OPENCL // Setup OpenCL Acceleration widget connect( mGPUEnableCheckBox, &QCheckBox::toggled, this, [ = ]( bool checked ) { if ( checked ) { // Since this may crash and lock users out of the settings, let's disable opencl setting before entering // and restore after available was successfully called const bool openClStatus { QgsOpenClUtils::enabled() }; QgsOpenClUtils::setEnabled( false ); if ( QgsOpenClUtils::available( ) ) { QgsOpenClUtils::setEnabled( openClStatus ); mOpenClContainerWidget->setEnabled( true ); mOpenClDevicesCombo->clear(); for ( const auto &dev : QgsOpenClUtils::devices( ) ) { mOpenClDevicesCombo->addItem( QgsOpenClUtils::deviceInfo( QgsOpenClUtils::Info::Name, dev ), QgsOpenClUtils::deviceId( dev ) ); } // Info updater std::function<void( int )> infoUpdater = [ = ]( int ) { mGPUInfoTextBrowser->setText( QgsOpenClUtils::deviceDescription( mOpenClDevicesCombo->currentData().toString() ) ); }; connect( mOpenClDevicesCombo, qOverload< int >( &QComboBox::currentIndexChanged ), infoUpdater ); mOpenClDevicesCombo->setCurrentIndex( mOpenClDevicesCombo->findData( QgsOpenClUtils::deviceId( QgsOpenClUtils::activeDevice() ) ) ); infoUpdater( -1 ); mOpenClContainerWidget->show(); } else { mGPUInfoTextBrowser->setText( tr( "No OpenCL compatible devices were found on your system.<br>" "You may need to install additional libraries in order to enable OpenCL.<br>" "Please check your logs for further details." ) ); mOpenClContainerWidget->setEnabled( false ); mGPUEnableCheckBox->setChecked( false ); } } else { mOpenClContainerWidget->setEnabled( false ); } } ); mOpenClContainerWidget->setEnabled( false ); mGPUEnableCheckBox->setChecked( QgsOpenClUtils::enabled( ) ); #else mGPUEnableCheckBox->setChecked( false ); for ( int idx = 0; idx < mOptionsPageAccelerationLayout->count(); ++idx ) { QWidget *item = mOptionsPageAccelerationLayout->itemAt( idx )->widget(); if ( item ) { item->setEnabled( false ); } } QLabel *noOpenCL = new QLabel( tr( "QGIS is compiled without OpenCL support. " "GPU acceleration is not available." ), this ); mOptionsPageAccelerationLayout->insertWidget( 0, noOpenCL ); #endif connect( pbnEditCreateOptions, &QAbstractButton::pressed, this, &QgsOptions::editCreateOptions ); connect( pbnEditPyramidsOptions, &QAbstractButton::pressed, this, &QgsOptions::editPyramidsOptions ); // restore window and widget geometry/state connect( mRestoreDefaultWindowStateBtn, &QAbstractButton::clicked, this, &QgsOptions::restoreDefaultWindowState ); mBearingFormat.reset( QgsLocalDefaultSettings::bearingFormat() ); connect( mCustomizeBearingFormatButton, &QPushButton::clicked, this, &QgsOptions::customizeBearingFormat ); restoreOptionsBaseUi(); #ifdef QGISDEBUG checkPageWidgetNameMap(); #endif } QgsOptions::~QgsOptions() { delete mSettings; } void QgsOptions::checkPageWidgetNameMap() { const QMap< QString, QString > pageNames = QgisApp::instance()->optionsPagesMap(); std::function<void( const QModelIndex & )> traverseModel; // traverse through the model, collecting all entries which correspond to pages QStringList pageTitles; traverseModel = [&]( const QModelIndex & parent ) { for ( int row = 0; row < mTreeModel->rowCount( parent ); ++row ) { const QModelIndex currentIndex = mTreeModel->index( row, 0, parent ); if ( mTreeModel->itemFromIndex( currentIndex )->isSelectable() ) pageTitles << currentIndex.data().toString(); traverseModel( currentIndex ); } }; traverseModel( QModelIndex() ); Q_ASSERT_X( pageNames.count() == pageTitles.count(), "QgsOptions::checkPageWidgetNameMap()", "QgisApp::optionsPagesMap() is outdated, contains too many entries" ); int page = 0; for ( const QString &pageTitle : std::as_const( pageTitles ) ) { QWidget *currentPage = mOptionsStackedWidget->widget( page ); Q_ASSERT_X( pageNames.contains( pageTitle ), "QgsOptions::checkPageWidgetNameMap()", QStringLiteral( "QgisApp::optionsPagesMap() is outdated, please update. Missing %1" ).arg( pageTitle ).toLocal8Bit().constData() ); Q_ASSERT_X( pageNames.value( pageTitle ) == currentPage->objectName() || pageNames.value( pageTitle ) == pageTitle, "QgsOptions::checkPageWidgetNameMap()", QStringLiteral( "QgisApp::optionsPagesMap() is outdated, please update. %1 should be %2 or %1 not %3" ).arg( pageTitle ).arg( currentPage->objectName() ).arg( pageNames.value( pageTitle ) ).toLocal8Bit().constData() ); page++; } } void QgsOptions::setCurrentPage( const QString &pageWidgetName ) { //find the page with a matching widget name for ( int page = 0; page < mOptionsStackedWidget->count(); ++page ) { QWidget *currentPage = mOptionsStackedWidget->widget( page ); if ( currentPage->objectName() == pageWidgetName ) { //found the page, set it as current mOptionsStackedWidget->setCurrentIndex( page ); return; } else if ( mTreeProxyModel ) { const QModelIndex sourceIndex = mTreeProxyModel->pageNumberToSourceIndex( page ); if ( sourceIndex.data().toString() == pageWidgetName || sourceIndex.data( Qt::UserRole + 1 ).toString() == pageWidgetName ) { mOptionsStackedWidget->setCurrentIndex( page ); return; } } } } void QgsOptions::setCurrentPage( const int pageNumber ) { if ( pageNumber >= 0 && pageNumber < mOptionsStackedWidget->count() ) mOptionsStackedWidget->setCurrentIndex( pageNumber ); } void QgsOptions::mProxyTypeComboBox_currentIndexChanged( int idx ) { frameManualProxy->setEnabled( idx != 0 ); } void QgsOptions::cbxProjectDefaultNew_toggled( bool checked ) { if ( checked ) { QString fileName = QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_default.qgs" ); if ( ! QFile::exists( fileName ) ) { QMessageBox::information( nullptr, tr( "Save Default Project" ), tr( "You must set a default project" ) ); cbxProjectDefaultNew->setChecked( false ); } } } void QgsOptions::setCurrentProjectDefault() { QString fileName = QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_default.qgs" ); if ( QgsProject::instance()->write( fileName ) ) { QMessageBox::information( nullptr, tr( "Save Default Project" ), tr( "Current project saved as default" ) ); } else { QMessageBox::critical( nullptr, tr( "Save Default Project" ), tr( "Error saving current project as default" ) ); } } void QgsOptions::resetProjectDefault() { QString fileName = QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_default.qgs" ); if ( QFile::exists( fileName ) ) { QFile::remove( fileName ); } cbxProjectDefaultNew->setChecked( false ); } void QgsOptions::browseTemplateFolder() { QString newDir = QFileDialog::getExistingDirectory( nullptr, tr( "Choose a directory to store project template files" ), leTemplateFolder->text() ); if ( ! newDir.isNull() ) { leTemplateFolder->setText( newDir ); } } void QgsOptions::resetTemplateFolder() { leTemplateFolder->setText( QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_templates" ) ); } void QgsOptions::iconSizeChanged( const QString &iconSize ) { QgisApp::instance()->setIconSizes( iconSize.toInt() ); } void QgsOptions::uiThemeChanged( const QString &theme ) { if ( theme == QgsApplication::themeName() ) return; QgisApp::instance()->setTheme( theme ); } void QgsOptions::mProjectOnLaunchCmbBx_currentIndexChanged( int indx ) { bool specific = ( indx == 2 ); mProjectOnLaunchLineEdit->setEnabled( specific ); mProjectOnLaunchPushBtn->setEnabled( specific ); } void QgsOptions::selectProjectOnLaunch() { // Retrieve last used project dir from persistent settings QgsSettings settings; QString lastUsedDir = mSettings->value( QStringLiteral( "/UI/lastProjectDir" ), QDir::homePath() ).toString(); QString projPath = QFileDialog::getOpenFileName( this, tr( "Choose project file to open at launch" ), lastUsedDir, tr( "QGIS files" ) + " (*.qgs *.qgz *.QGS *.QGZ)" ); if ( !projPath.isNull() ) { mProjectOnLaunchLineEdit->setText( projPath ); } } void QgsOptions::saveOptions() { for ( QgsOptionsPageWidget *widget : std::as_const( mAdditionalOptionWidgets ) ) { if ( !widget->isValid() ) { setCurrentPage( widget->objectName() ); return; } } QgsSettings settings; mSettings->setValue( QStringLiteral( "UI/UITheme" ), cmbUITheme->currentText() ); // custom environment variables mSettings->setValue( QStringLiteral( "qgis/customEnvVarsUse" ), QVariant( mCustomVariablesChkBx->isChecked() ) ); QStringList customVars; for ( int i = 0; i < mCustomVariablesTable->rowCount(); ++i ) { if ( mCustomVariablesTable->item( i, 1 )->text().isEmpty() ) continue; QComboBox *varApplyCmbBx = qobject_cast<QComboBox *>( mCustomVariablesTable->cellWidget( i, 0 ) ); QString customVar = varApplyCmbBx->currentData().toString(); customVar += '|'; customVar += mCustomVariablesTable->item( i, 1 )->text(); customVar += '='; customVar += mCustomVariablesTable->item( i, 2 )->text(); customVars << customVar; } mSettings->setValue( QStringLiteral( "qgis/customEnvVars" ), QVariant( customVars ) ); //search directories for user plugins QStringList pathsList; for ( int i = 0; i < mListPluginPaths->count(); ++i ) { pathsList << mListPluginPaths->item( i )->text(); } mSettings->setValue( QStringLiteral( "plugins/searchPathsForPlugins" ), pathsList ); //search directories for svgs pathsList.clear(); for ( int i = 0; i < mListSVGPaths->count(); ++i ) { pathsList << mListSVGPaths->item( i )->text(); } QgsApplication::setSvgPaths( pathsList ); pathsList.clear(); for ( int i = 0; i < mListComposerTemplatePaths->count(); ++i ) { pathsList << mListComposerTemplatePaths->item( i )->text(); } QgsLayout::settingsSearchPathForTemplates.setValue( pathsList ); pathsList.clear(); for ( int r = 0; r < mLocalizedDataPathListWidget->count(); r++ ) pathsList << mLocalizedDataPathListWidget->item( r )->text(); QgsApplication::localizedDataPathRegistry()->setPaths( pathsList ); pathsList.clear(); for ( int i = 0; i < mListHiddenBrowserPaths->count(); ++i ) { pathsList << mListHiddenBrowserPaths->item( i )->text(); } mSettings->setValue( QStringLiteral( "/browser/hiddenPaths" ), pathsList ); //QGIS help locations QStringList helpPaths; for ( int i = 0; i < mHelpPathTreeWidget->topLevelItemCount(); ++i ) { if ( QTreeWidgetItem *item = mHelpPathTreeWidget->topLevelItem( i ) ) { helpPaths << item->text( 0 ); } } mSettings->setValue( QStringLiteral( "help/helpSearchPath" ), helpPaths ); //Network timeout QgsNetworkAccessManager::setTimeout( mNetworkTimeoutSpinBox->value() ); mSettings->setValue( QStringLiteral( "/qgis/networkAndProxy/userAgent" ), leUserAgent->text() ); // WMS capabiltiies expiry time mSettings->setValue( QStringLiteral( "/qgis/defaultCapabilitiesExpiry" ), mDefaultCapabilitiesExpirySpinBox->value() ); // WMS/WMS-C tile expiry time mSettings->setValue( QStringLiteral( "/qgis/defaultTileExpiry" ), mDefaultTileExpirySpinBox->value() ); // WMS/WMS-C default max retry in case of tile request errors mSettings->setValue( QStringLiteral( "/qgis/defaultTileMaxRetry" ), mDefaultTileMaxRetrySpinBox->value() ); // Proxy stored authentication configurations mSettings->setValue( QStringLiteral( "proxy/authcfg" ), mAuthSettings->configId( ) ); //Web proxy settings mSettings->setValue( QStringLiteral( "proxy/proxyEnabled" ), grpProxy->isChecked() ); mSettings->setValue( QStringLiteral( "proxy/proxyHost" ), leProxyHost->text() ); mSettings->setValue( QStringLiteral( "proxy/proxyPort" ), leProxyPort->text() ); mSettings->setValue( QStringLiteral( "proxy/proxyUser" ), mAuthSettings->username() ); mSettings->setValue( QStringLiteral( "proxy/proxyPassword" ), mAuthSettings->password() ); mSettings->setValue( QStringLiteral( "proxy/proxyType" ), mProxyTypeComboBox->currentText() ); if ( !mCacheDirectory->text().isEmpty() ) mSettings->setValue( QStringLiteral( "cache/directory" ), mCacheDirectory->text() ); else mSettings->remove( QStringLiteral( "cache/directory" ) ); mSettings->setValue( QStringLiteral( "cache/size" ), QVariant::fromValue( mCacheSize->value() * 1024L ) ); //url with no proxy at all QStringList noProxyUrls; noProxyUrls.reserve( mNoProxyUrlListWidget->count() ); for ( int i = 0; i < mNoProxyUrlListWidget->count(); ++i ) { const QString host = mNoProxyUrlListWidget->item( i )->text(); if ( !host.trimmed().isEmpty() ) noProxyUrls << host; } mSettings->setValue( QStringLiteral( "proxy/noProxyUrls" ), noProxyUrls ); QgisApp::instance()->namUpdate(); //general settings mSettings->setValue( QStringLiteral( "/Map/searchRadiusMM" ), spinBoxIdentifyValue->value() ); mSettings->setValue( QStringLiteral( "/Map/highlight/color" ), mIdentifyHighlightColorButton->color().name() ); mSettings->setValue( QStringLiteral( "/Map/highlight/colorAlpha" ), mIdentifyHighlightColorButton->color().alpha() ); mSettings->setValue( QStringLiteral( "/Map/highlight/buffer" ), mIdentifyHighlightBufferSpinBox->value() ); mSettings->setValue( QStringLiteral( "/Map/highlight/minWidth" ), mIdentifyHighlightMinWidthSpinBox->value() ); bool showLegendClassifiers = mSettings->value( QStringLiteral( "/qgis/showLegendClassifiers" ), false ).toBool(); mSettings->setValue( QStringLiteral( "/qgis/showLegendClassifiers" ), cbxLegendClassifiers->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/hideSplash" ), cbxHideSplash->isChecked() ); mSettings->setValue( QStringLiteral( "%1/disabled" ).arg( QgsNewsFeedParser::keyForFeed( QgsWelcomePage::newsFeedUrl() ) ), !cbxShowNews->isChecked(), QgsSettings::Core ); mSettings->setValue( QStringLiteral( "/qgis/dataSourceManagerNonModal" ), mDataSourceManagerNonModal->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/checkVersion" ), cbxCheckVersion->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/dockAttributeTable" ), cbxAttributeTableDocked->isChecked() ); mSettings->setEnumValue( QStringLiteral( "/qgis/attributeTableBehavior" ), ( QgsAttributeTableFilterModel::FilterMode )cmbAttrTableBehavior->currentData().toInt() ); mSettings->setValue( QStringLiteral( "/qgis/attributeTableView" ), mAttrTableViewComboBox->currentData() ); mSettings->setValue( QStringLiteral( "/qgis/attributeTableRowCache" ), spinBoxAttrTableRowCache->value() ); mSettings->setEnumValue( QStringLiteral( "/qgis/promptForSublayers" ), static_cast< Qgis::SublayerPromptMode >( cmbPromptSublayers->currentData().toInt() ) ); mSettings->setValue( QStringLiteral( "/qgis/scanItemsInBrowser2" ), cmbScanItemsInBrowser->currentData().toString() ); mSettings->setValue( QStringLiteral( "/qgis/scanZipInBrowser2" ), cmbScanZipInBrowser->currentData().toString() ); mSettings->setValue( QStringLiteral( "/qgis/monitorDirectoriesInBrowser" ), mCheckMonitorDirectories->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/mainSnappingWidgetMode" ), mSnappingMainDialogComboBox->currentData() ); mSettings->setValue( QStringLiteral( "/qgis/legendsymbolMinimumSize" ), mLegendSymbolMinimumSizeSpinBox->value() ); mSettings->setValue( QStringLiteral( "/qgis/legendsymbolMaximumSize" ), mLegendSymbolMaximumSizeSpinBox->value() ); QgsSymbolLegendNode::MINIMUM_SIZE = mLegendSymbolMinimumSizeSpinBox->value(); QgsSymbolLegendNode::MAXIMUM_SIZE = mLegendSymbolMaximumSizeSpinBox->value(); mSettings->setValue( QStringLiteral( "/qgis/defaultLegendGraphicResolution" ), mLegendGraphicResolutionSpinBox->value() ); mSettings->setValue( QStringLiteral( "/qgis/mapTipsDelay" ), mMapTipsDelaySpinBox->value() ); QgsSettingsRegistryGui::settingsRespectScreenDPI.setValue( mRespectScreenDpiCheckBox->isChecked() ); mSettings->setEnumValue( QStringLiteral( "/qgis/copyFeatureFormat" ), ( QgsClipboard::CopyFormat )mComboCopyFeatureFormat->currentData().toInt() ); QgisApp::instance()->setMapTipsDelay( mMapTipsDelaySpinBox->value() ); mSettings->setValue( QStringLiteral( "/qgis/new_layers_visible" ), chkAddedVisibility->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/enable_anti_aliasing" ), chkAntiAliasing->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/enable_render_caching" ), chkUseRenderCaching->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/parallel_rendering" ), chkParallelRendering->isChecked() ); int maxThreads = chkMaxThreads->isChecked() ? spinMaxThreads->value() : -1; QgsApplication::setMaxThreads( maxThreads ); mSettings->setValue( QStringLiteral( "/qgis/max_threads" ), maxThreads ); mSettings->setValue( QStringLiteral( "/qgis/map_update_interval" ), spinMapUpdateInterval->value() ); mSettings->setValue( QStringLiteral( "/qgis/legendDoubleClickAction" ), cmbLegendDoubleClickAction->currentIndex() ); // Default simplify drawing configuration QgsVectorSimplifyMethod::SimplifyHints simplifyHints = QgsVectorSimplifyMethod::NoSimplification; if ( mSimplifyDrawingGroupBox->isChecked() ) { simplifyHints |= QgsVectorSimplifyMethod::GeometrySimplification; if ( mSimplifyDrawingSpinBox->value() > 1 ) simplifyHints |= QgsVectorSimplifyMethod::AntialiasingSimplification; } mSettings->setEnumValue( QStringLiteral( "/qgis/simplifyDrawingHints" ), simplifyHints ); mSettings->setEnumValue( QStringLiteral( "/qgis/simplifyAlgorithm" ), ( QgsVectorSimplifyMethod::SimplifyHints )mSimplifyAlgorithmComboBox->currentData().toInt() ); mSettings->setValue( QStringLiteral( "/qgis/simplifyDrawingTol" ), mSimplifyDrawingSpinBox->value() ); mSettings->setValue( QStringLiteral( "/qgis/simplifyLocal" ), !mSimplifyDrawingAtProvider->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/simplifyMaxScale" ), mSimplifyMaximumScaleComboBox->scale() ); // magnification mSettings->setValue( QStringLiteral( "/qgis/magnifier_factor_default" ), doubleSpinBoxMagnifierDefault->value() / 100 ); //curve segmentation QgsAbstractGeometry::SegmentationToleranceType segmentationType = ( QgsAbstractGeometry::SegmentationToleranceType )mToleranceTypeComboBox->currentData().toInt(); mSettings->setEnumValue( QStringLiteral( "/qgis/segmentationToleranceType" ), segmentationType ); double segmentationTolerance = mSegmentationToleranceSpinBox->value(); if ( segmentationType == QgsAbstractGeometry::MaximumAngle ) { segmentationTolerance = segmentationTolerance / 180.0 * M_PI; //user sets angle tolerance in degrees, internal classes need value in rad } mSettings->setValue( QStringLiteral( "/qgis/segmentationTolerance" ), segmentationTolerance ); // project mSettings->setValue( QStringLiteral( "/qgis/projOpenAtLaunch" ), mProjectOnLaunchCmbBx->currentIndex() ); mSettings->setValue( QStringLiteral( "/qgis/projOpenAtLaunchPath" ), mProjectOnLaunchLineEdit->text() ); mSettings->setValue( QStringLiteral( "/qgis/askToSaveProjectChanges" ), chbAskToSaveProjectChanges->isChecked() ); mSettings->setValue( QStringLiteral( "qgis/askToDeleteLayers" ), mLayerDeleteConfirmationChkBx->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/warnOldProjectVersion" ), chbWarnOldProjectVersion->isChecked() ); if ( ( mSettings->value( QStringLiteral( "/qgis/projectTemplateDir" ) ).toString() != leTemplateFolder->text() ) || ( mSettings->value( QStringLiteral( "/qgis/newProjectDefault" ) ).toBool() != cbxProjectDefaultNew->isChecked() ) ) { mSettings->setValue( QStringLiteral( "/qgis/newProjectDefault" ), cbxProjectDefaultNew->isChecked() ); mSettings->setValue( QStringLiteral( "/qgis/projectTemplateDir" ), leTemplateFolder->text() ); QgisApp::instance()->updateProjectFromTemplates(); } mSettings->setEnumValue( QStringLiteral( "/qgis/enableMacros" ), mEnableMacrosComboBox->currentData().value<Qgis::PythonMacroMode>() ); mSettings->setValue( QStringLiteral( "/qgis/defaultProjectPathsRelative" ), static_cast< Qgis::FilePathType >( mDefaultPathsComboBox->currentData().toInt() ) == Qgis::FilePathType::Relative ); mSettings->setEnumValue( QStringLiteral( "/qgis/defaultProjectFileFormat" ), mFileFormatQgsButton->isChecked() ? QgsProject::FileFormat::Qgs : QgsProject::FileFormat::Qgz ); QgsApplication::setNullRepresentation( leNullValue->text() ); mSettings->setValue( QStringLiteral( "/qgis/style" ), cmbStyle->currentText() ); mSettings->setValue( QStringLiteral( "/qgis/iconSize" ), cmbIconSize->currentText() ); mSettings->setValue( QStringLiteral( "/qgis/messageTimeout" ), mMessageTimeoutSpnBx->value() ); mSettings->setValue( QStringLiteral( "/qgis/native_color_dialogs" ), mNativeColorDialogsChkBx->isChecked() ); // rasters settings mSettings->setValue( QStringLiteral( "/Raster/defaultRedBand" ), spnRed->value() ); mSettings->setValue( QStringLiteral( "/Raster/defaultGreenBand" ), spnGreen->value() ); mSettings->setValue( QStringLiteral( "/Raster/defaultBlueBand" ), spnBlue->value() ); mSettings->setValue( QStringLiteral( "/Raster/defaultZoomedInResampling" ), mZoomedInResamplingComboBox->currentData().toString() ); mSettings->setValue( QStringLiteral( "/Raster/defaultZoomedOutResampling" ), mZoomedOutResamplingComboBox->currentData().toString() ); mSettings->setValue( QStringLiteral( "/Raster/defaultOversampling" ), spnOversampling->value() ); mSettings->setValue( QStringLiteral( "/Raster/defaultEarlyResampling" ), mCbEarlyResampling->isChecked() ); saveContrastEnhancement( cboxContrastEnhancementAlgorithmSingleBand, QStringLiteral( "singleBand" ) ); saveContrastEnhancement( cboxContrastEnhancementAlgorithmMultiBandSingleByte, QStringLiteral( "multiBandSingleByte" ) ); saveContrastEnhancement( cboxContrastEnhancementAlgorithmMultiBandMultiByte, QStringLiteral( "multiBandMultiByte" ) ); saveMinMaxLimits( cboxContrastEnhancementLimitsSingleBand, QStringLiteral( "singleBand" ) ); saveMinMaxLimits( cboxContrastEnhancementLimitsMultiBandSingleByte, QStringLiteral( "multiBandSingleByte" ) ); saveMinMaxLimits( cboxContrastEnhancementLimitsMultiBandMultiByte, QStringLiteral( "multiBandMultiByte" ) ); mSettings->setValue( QStringLiteral( "/Raster/defaultStandardDeviation" ), spnThreeBandStdDev->value() ); mSettings->setValue( QStringLiteral( "/Raster/cumulativeCutLower" ), mRasterCumulativeCutLowerDoubleSpinBox->value() / 100.0 ); mSettings->setValue( QStringLiteral( "/Raster/cumulativeCutUpper" ), mRasterCumulativeCutUpperDoubleSpinBox->value() / 100.0 ); // log rendering events, for userspace debugging QgsMapRendererJob::settingsLogCanvasRefreshEvent.setValue( mLogCanvasRefreshChkBx->isChecked() ); //check behavior so default projection when new layer is added with no //projection defined... if ( radPromptForProjection->isChecked() ) { mSettings->setEnumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::PromptUserForCrs, QgsSettings::App ); } else if ( radUseProjectProjection->isChecked() ) { mSettings->setEnumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::UseProjectCrs, QgsSettings::App ); } else if ( radCrsNoAction->isChecked() ) { mSettings->setEnumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::NoAction, QgsSettings::App ); } else { mSettings->setEnumValue( QStringLiteral( "/projections/unknownCrsBehavior" ), QgsOptions::UnknownLayerCrsBehavior::UseDefaultCrs, QgsSettings::App ); } mSettings->setValue( QStringLiteral( "/Projections/layerDefaultCrs" ), mLayerDefaultCrs.authid() ); mSettings->setValue( QStringLiteral( "/projections/defaultProjectCrs" ), leProjectGlobalCrs->crs().authid(), QgsSettings::App ); mSettings->setEnumValue( QStringLiteral( "/projections/newProjectCrsBehavior" ), radProjectUseCrsOfFirstLayer->isChecked() ? QgsGui::UseCrsOfFirstLayerAdded : QgsGui::UsePresetCrs, QgsSettings::App ); mSettings->setValue( QStringLiteral( "/projections/promptWhenMultipleTransformsExist" ), mShowDatumTransformDialogCheckBox->isChecked(), QgsSettings::App ); mSettings->setValue( QStringLiteral( "/projections/crsAccuracyWarningThreshold" ), mCrsAccuracySpin->value(), QgsSettings::App ); mSettings->setValue( QStringLiteral( "/projections/crsAccuracyIndicator" ), mCrsAccuracyIndicatorCheck->isChecked(), QgsSettings::App ); //measurement settings mSettings->setValue( QStringLiteral( "measure/planimetric" ), mPlanimetricMeasurementsComboBox->isChecked(), QgsSettings::Core ); QgsUnitTypes::DistanceUnit distanceUnit = static_cast< QgsUnitTypes::DistanceUnit >( mDistanceUnitsComboBox->currentData().toInt() ); mSettings->setValue( QStringLiteral( "/qgis/measure/displayunits" ), QgsUnitTypes::encodeUnit( distanceUnit ) ); QgsUnitTypes::AreaUnit areaUnit = static_cast< QgsUnitTypes::AreaUnit >( mAreaUnitsComboBox->currentData().toInt() ); mSettings->setValue( QStringLiteral( "/qgis/measure/areaunits" ), QgsUnitTypes::encodeUnit( areaUnit ) ); QgsUnitTypes::AngleUnit angleUnit = static_cast< QgsUnitTypes::AngleUnit >( mAngleUnitsComboBox->currentData().toInt() ); mSettings->setValue( QStringLiteral( "/qgis/measure/angleunits" ), QgsUnitTypes::encodeUnit( angleUnit ) ); int decimalPlaces = mDecimalPlacesSpinBox->value(); mSettings->setValue( QStringLiteral( "/qgis/measure/decimalplaces" ), decimalPlaces ); bool baseUnit = mKeepBaseUnitCheckBox->isChecked(); mSettings->setValue( QStringLiteral( "/qgis/measure/keepbaseunit" ), baseUnit ); //set the color for selections QColor myColor = pbnSelectionColor->color(); mSettings->setValue( QStringLiteral( "/qgis/default_selection_color_red" ), myColor.red() ); mSettings->setValue( QStringLiteral( "/qgis/default_selection_color_green" ), myColor.green() ); mSettings->setValue( QStringLiteral( "/qgis/default_selection_color_blue" ), myColor.blue() ); mSettings->setValue( QStringLiteral( "/qgis/default_selection_color_alpha" ), myColor.alpha() ); //set the default color for canvas background myColor = pbnCanvasColor->color(); mSettings->setValue( QStringLiteral( "/qgis/default_canvas_color_red" ), myColor.red() ); mSettings->setValue( QStringLiteral( "/qgis/default_canvas_color_green" ), myColor.green() ); mSettings->setValue( QStringLiteral( "/qgis/default_canvas_color_blue" ), myColor.blue() ); //set the default color for the measure tool myColor = pbnMeasureColor->color(); mSettings->setValue( QStringLiteral( "/qgis/default_measure_color_red" ), myColor.red() ); mSettings->setValue( QStringLiteral( "/qgis/default_measure_color_green" ), myColor.green() ); mSettings->setValue( QStringLiteral( "/qgis/default_measure_color_blue" ), myColor.blue() ); mSettings->setValue( QStringLiteral( "/qgis/zoom_factor" ), zoomFactorValue() ); //digitizing QgsSettingsRegistryCore::settingsDigitizingLineWidth.setValue( mLineWidthSpinBox->value() ); QColor digitizingColor = mLineColorToolButton->color(); QgsSettingsRegistryCore::settingsDigitizingLineColorRed.setValue( digitizingColor.red() ); QgsSettingsRegistryCore::settingsDigitizingLineColorGreen.setValue( digitizingColor.green() ); QgsSettingsRegistryCore::settingsDigitizingLineColorBlue.setValue( digitizingColor.blue() ); QgsSettingsRegistryCore::settingsDigitizingLineColorAlpha.setValue( digitizingColor.alpha() ); digitizingColor = mFillColorToolButton->color(); QgsSettingsRegistryCore::settingsDigitizingFillColorRed.setValue( digitizingColor.red() ); QgsSettingsRegistryCore::settingsDigitizingFillColorGreen.setValue( digitizingColor.green() ); QgsSettingsRegistryCore::settingsDigitizingFillColorBlue.setValue( digitizingColor.blue() ); QgsSettingsRegistryCore::settingsDigitizingFillColorAlpha.setValue( digitizingColor.alpha() ); QgsSettingsRegistryCore::settingsDigitizingLineGhost.setValue( mLineGhostCheckBox->isChecked() ); QgsSettingsRegistryCore::settingsDigitizingDefaultZValue.setValue( mDefaultZValueSpinBox->value() ); QgsSettingsRegistryCore::settingsDigitizingDefaultMValue.setValue( mDefaultMValueSpinBox->value() ); //default snap mode QgsSettingsRegistryCore::settingsDigitizingDefaultSnapEnabled.setValue( mSnappingEnabledDefault->isChecked() ); QgsSettingsRegistryCore::settingsDigitizingDefaultSnapType.setValue( static_cast<QgsSnappingConfig::SnappingTypes>( mDefaultSnapModeComboBox->currentData().toInt() ) ); QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingTolerance.setValue( mDefaultSnappingToleranceSpinBox->value() ); QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEdit.setValue( mSearchRadiusVertexEditSpinBox->value() ); QgsSettingsRegistryCore::settingsDigitizingDefaultSnappingToleranceUnit.setValue( ( mDefaultSnappingToleranceComboBox->currentIndex() == 0 ? QgsTolerance::ProjectUnits : QgsTolerance::Pixels ) ); QgsSettingsRegistryCore::settingsDigitizingSearchRadiusVertexEditUnit.setValue( ( mSearchRadiusVertexEditComboBox->currentIndex() == 0 ? QgsTolerance::ProjectUnits : QgsTolerance::Pixels ) ); QgsSettingsRegistryCore::settingsDigitizingSnapColor.setValue( mSnappingMarkerColorButton->color() ); QgsSettingsRegistryCore::settingsDigitizingSnapTooltip.setValue( mSnappingTooltipsCheckbox->isChecked() ); QgsSettingsRegistryCore::settingsDigitizingSnapInvisibleFeature.setValue( mEnableSnappingOnInvisibleFeatureCheckbox->isChecked() ); QgsSettingsRegistryCore::settingsDigitizingMarkerOnlyForSelected.setValue( mMarkersOnlyForSelectedCheckBox->isChecked() ); QString markerComboText = mMarkerStyleComboBox->currentText(); if ( markerComboText == tr( "Semi Transparent Circle" ) ) { QgsSettingsRegistryCore::settingsDigitizingMarkerStyle.setValue( QStringLiteral( "SemiTransparentCircle" ) ); } else if ( markerComboText == tr( "Cross" ) ) { QgsSettingsRegistryCore::settingsDigitizingMarkerStyle.setValue( QStringLiteral( "Cross" ) ); } else if ( markerComboText == tr( "None" ) ) { QgsSettingsRegistryCore::settingsDigitizingMarkerStyle.setValue( QStringLiteral( "None" ) ); } QgsSettingsRegistryCore::settingsDigitizingMarkerSizeMm.setValue( mMarkerSizeSpinBox->value() ); QgsSettingsRegistryCore::settingsDigitizingReuseLastValues.setValue( chkReuseLastValues->isChecked() ); QgsSettingsRegistryCore::settingsDigitizingDisableEnterAttributeValuesDialog.setValue( chkDisableAttributeValuesDlg->isChecked() ); QgsSettingsRegistryCore::settingsDigitizingValidateGeometries.setValue( mValidateGeometries->currentIndex() ); QgsSettingsRegistryCore::settingsDigitizingOffsetJoinStyle.setValue( mOffsetJoinStyleComboBox->currentData().value<Qgis::JoinStyle>() ); QgsSettingsRegistryCore::settingsDigitizingOffsetQuadSeg.setValue( mOffsetQuadSegSpinBox->value() ); QgsSettingsRegistryCore::settingsDigitizingOffsetMiterLimit.setValue( mCurveOffsetMiterLimitComboBox->value() ); QgsSettingsRegistryCore::settingsDigitizingConvertToCurve.setValue( mTracingConvertToCurveCheckBox->isChecked() ); QgsSettingsRegistryCore::settingsDigitizingConvertToCurveAngleTolerance.setValue( mTracingCustomAngleToleranceSpinBox->value() ); QgsSettingsRegistryCore::settingsDigitizingConvertToCurveDistanceTolerance.setValue( mTracingCustomDistanceToleranceSpinBox->value() ); // default scale list QString myPaths; for ( int i = 0; i < mListGlobalScales->count(); ++i ) { if ( i != 0 ) { myPaths += ','; } myPaths += mListGlobalScales->item( i )->text(); } mSettings->setValue( QStringLiteral( "Map/scales" ), myPaths ); // // Color palette // if ( mTreeCustomColors->isDirty() ) { mTreeCustomColors->saveColorsToScheme(); } // // Layout settings // //default font QString layoutFont = mComposerFontComboBox->currentFont().family(); mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultFont" ), layoutFont, QgsSettings::Gui ); //grid color mSettings->setValue( QStringLiteral( "LayoutDesigner/gridRed" ), mGridColorButton->color().red(), QgsSettings::Gui ); mSettings->setValue( QStringLiteral( "LayoutDesigner/gridGreen" ), mGridColorButton->color().green(), QgsSettings::Gui ); mSettings->setValue( QStringLiteral( "LayoutDesigner/gridBlue" ), mGridColorButton->color().blue(), QgsSettings::Gui ); mSettings->setValue( QStringLiteral( "LayoutDesigner/gridAlpha" ), mGridColorButton->color().alpha(), QgsSettings::Gui ); //grid style if ( mGridStyleComboBox->currentText() == tr( "Solid" ) ) { mSettings->setValue( QStringLiteral( "LayoutDesigner/gridStyle" ), "Solid", QgsSettings::Gui ); } else if ( mGridStyleComboBox->currentText() == tr( "Dots" ) ) { mSettings->setValue( QStringLiteral( "LayoutDesigner/gridStyle" ), "Dots", QgsSettings::Gui ); } else if ( mGridStyleComboBox->currentText() == tr( "Crosses" ) ) { mSettings->setValue( QStringLiteral( "LayoutDesigner/gridStyle" ), "Crosses", QgsSettings::Gui ); } //grid and guide defaults mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapGridResolution" ), mGridResolutionSpinBox->value(), QgsSettings::Gui ); mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapTolerancePixels" ), mSnapToleranceSpinBox->value(), QgsSettings::Gui ); mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetX" ), mOffsetXSpinBox->value(), QgsSettings::Gui ); mSettings->setValue( QStringLiteral( "LayoutDesigner/defaultSnapGridOffsetY" ), mOffsetYSpinBox->value(), QgsSettings::Gui ); // // Locale settings // QgsApplication::settingsLocaleUserLocale.setValue( cboTranslation->currentData().toString() ); QgsApplication::settingsLocaleOverrideFlag.setValue( grpLocale->isChecked() ); QgsApplication::settingsLocaleGlobalLocale.setValue( cboGlobalLocale->currentData( ).toString() ); // Number settings QgsApplication::settingsLocaleShowGroupSeparator.setValue( cbShowGroupSeparator->isChecked( ) ); QgsLocalDefaultSettings::setBearingFormat( mBearingFormat.get() ); #ifdef HAVE_OPENCL // OpenCL settings QgsOpenClUtils::setEnabled( mGPUEnableCheckBox->isChecked() ); QString preferredDevice( mOpenClDevicesCombo->currentData().toString() ); QgsOpenClUtils::storePreferredDevice( preferredDevice ); #endif // Gdal skip driver list if ( mLoadedGdalDriverList ) saveGdalDriverList(); // refresh symbology for any legend items, only if needed if ( showLegendClassifiers != cbxLegendClassifiers->isChecked() ) { // TODO[MD] QgisApp::instance()->legend()->updateLegendItemSymbologies(); } //save variables QgsExpressionContextUtils::setGlobalVariables( mVariableEditor->variablesInActiveScope() ); // save app stylesheet last (in case reset becomes necessary) if ( mStyleSheetNewOpts != mStyleSheetOldOpts ) { mStyleSheetBuilder->saveToSettings( mStyleSheetNewOpts ); // trigger an extra style sheet build to propagate saved settings mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts ); } mDefaultDatumTransformTableWidget->transformContext().writeSettings(); mLocatorOptionsWidget->commitChanges(); for ( QgsOptionsPageWidget *widget : std::as_const( mAdditionalOptionWidgets ) ) { widget->apply(); } QgsGui::instance()->emitOptionsChanged(); } void QgsOptions::rejectOptions() { // don't reset stylesheet if we don't have to if ( mStyleSheetNewOpts != mStyleSheetOldOpts ) { mStyleSheetBuilder->buildStyleSheet( mStyleSheetOldOpts ); } } void QgsOptions::spinFontSize_valueChanged( int fontSize ) { mStyleSheetNewOpts.insert( QStringLiteral( "fontPointSize" ), QVariant( fontSize ) ); mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts ); } void QgsOptions::mFontFamilyRadioQt_released() { if ( mStyleSheetNewOpts.value( QStringLiteral( "fontFamily" ) ).toString() != mStyleSheetBuilder->defaultFont().family() ) { mStyleSheetNewOpts.insert( QStringLiteral( "fontFamily" ), QVariant( mStyleSheetBuilder->defaultFont().family() ) ); mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts ); } } void QgsOptions::mFontFamilyRadioCustom_released() { if ( mFontFamilyComboBox->currentFont().family() != mStyleSheetBuilder->defaultFont().family() ) { mStyleSheetNewOpts.insert( QStringLiteral( "fontFamily" ), QVariant( mFontFamilyComboBox->currentFont().family() ) ); mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts ); } } void QgsOptions::mFontFamilyComboBox_currentFontChanged( const QFont &font ) { if ( mFontFamilyRadioCustom->isChecked() && mStyleSheetNewOpts.value( QStringLiteral( "fontFamily" ) ).toString() != font.family() ) { mStyleSheetNewOpts.insert( QStringLiteral( "fontFamily" ), QVariant( font.family() ) ); mStyleSheetBuilder->buildStyleSheet( mStyleSheetNewOpts ); } } void QgsOptions::leLayerGlobalCrs_crsChanged( const QgsCoordinateReferenceSystem &crs ) { mLayerDefaultCrs = crs; } void QgsOptions::lstRasterDrivers_itemDoubleClicked( QTreeWidgetItem *item, int column ) { Q_UNUSED( column ) // edit driver if driver supports write if ( item && ( cmbEditCreateOptions->findText( item->text( 0 ) ) != -1 ) ) { editGdalDriver( item->text( 0 ) ); } } void QgsOptions::editCreateOptions() { editGdalDriver( cmbEditCreateOptions->currentText() ); } void QgsOptions::editPyramidsOptions() { editGdalDriver( QStringLiteral( "_pyramids" ) ); } void QgsOptions::editGdalDriver( const QString &driverName ) { if ( driverName.isEmpty() ) return; QgsDialog dlg( this, Qt::WindowFlags(), QDialogButtonBox::Ok | QDialogButtonBox::Cancel ); QVBoxLayout *layout = dlg.layout(); QString title = tr( "Create Options - %1 Driver" ).arg( driverName ); if ( driverName == QLatin1String( "_pyramids" ) ) title = tr( "Create Options - pyramids" ); dlg.setWindowTitle( title ); if ( driverName == QLatin1String( "_pyramids" ) ) { QgsRasterPyramidsOptionsWidget *optionsWidget = new QgsRasterPyramidsOptionsWidget( &dlg, QStringLiteral( "gdal" ) ); layout->addWidget( optionsWidget ); dlg.resize( 400, 400 ); if ( dlg.exec() == QDialog::Accepted ) optionsWidget->apply(); } else { QgsRasterFormatSaveOptionsWidget *optionsWidget = new QgsRasterFormatSaveOptionsWidget( &dlg, driverName, QgsRasterFormatSaveOptionsWidget::Full, QStringLiteral( "gdal" ) ); layout->addWidget( optionsWidget ); if ( dlg.exec() == QDialog::Accepted ) optionsWidget->apply(); } } // Return state of the visibility flag for newly added layers. If bool QgsOptions::newVisible() { return chkAddedVisibility->isChecked(); } QStringList QgsOptions::i18nList() { QStringList myList; myList << QStringLiteral( "en_US" ); //there is no qm file for this so we add it manually QString myI18nPath = QgsApplication::i18nPath(); QDir myDir( myI18nPath, QStringLiteral( "qgis*.qm" ) ); QStringList myFileList = myDir.entryList(); QStringListIterator myIterator( myFileList ); while ( myIterator.hasNext() ) { QString myFileName = myIterator.next(); // Ignore the 'en' translation file, already added as 'en_US'. if ( myFileName.compare( QLatin1String( "qgis_en.qm" ) ) == 0 ) continue; myList << myFileName.remove( QStringLiteral( "qgis_" ) ).remove( QStringLiteral( ".qm" ) ); } return myList; } void QgsOptions::restoreDefaultWindowState() { // richard if ( QMessageBox::warning( this, tr( "Restore UI Defaults" ), tr( "Are you sure to reset the UI to default (needs restart)?" ), QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Cancel ) return; mSettings->setValue( QStringLiteral( "/qgis/restoreDefaultWindowState" ), true ); } void QgsOptions::mCustomVariablesChkBx_toggled( bool chkd ) { mAddCustomVarBtn->setEnabled( chkd ); mRemoveCustomVarBtn->setEnabled( chkd ); mCustomVariablesTable->setEnabled( chkd ); } void QgsOptions::addCustomEnvVarRow( const QString &varName, const QString &varVal, const QString &varApply ) { int rowCnt = mCustomVariablesTable->rowCount(); mCustomVariablesTable->insertRow( rowCnt ); QComboBox *varApplyCmbBx = new QComboBox( this ); varApplyCmbBx->addItem( tr( "Overwrite" ), QVariant( "overwrite" ) ); varApplyCmbBx->addItem( tr( "If Undefined" ), QVariant( "undefined" ) ); varApplyCmbBx->addItem( tr( "Unset" ), QVariant( "unset" ) ); varApplyCmbBx->addItem( tr( "Prepend" ), QVariant( "prepend" ) ); varApplyCmbBx->addItem( tr( "Append" ), QVariant( "append" ) ); varApplyCmbBx->addItem( tr( "Skip" ), QVariant( "skip" ) ); varApplyCmbBx->setCurrentIndex( varApply.isEmpty() ? 0 : varApplyCmbBx->findData( QVariant( varApply ) ) ); QFont cbf = varApplyCmbBx->font(); QFontMetrics cbfm = QFontMetrics( cbf ); cbf.setPointSize( cbf.pointSize() - 2 ); varApplyCmbBx->setFont( cbf ); mCustomVariablesTable->setCellWidget( rowCnt, 0, varApplyCmbBx ); Qt::ItemFlags itmFlags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDropEnabled; QTableWidgetItem *varNameItm = new QTableWidgetItem( varName ); varNameItm->setFlags( itmFlags ); mCustomVariablesTable->setItem( rowCnt, 1, varNameItm ); QTableWidgetItem *varValueItm = new QTableWidgetItem( varVal ); varNameItm->setFlags( itmFlags ); mCustomVariablesTable->setItem( rowCnt, 2, varValueItm ); mCustomVariablesTable->setRowHeight( rowCnt, cbfm.height() + 8 ); } void QgsOptions::addCustomVariable() { addCustomEnvVarRow( QString(), QString() ); mCustomVariablesTable->setFocus(); mCustomVariablesTable->setCurrentCell( mCustomVariablesTable->rowCount() - 1, 1 ); mCustomVariablesTable->edit( mCustomVariablesTable->currentIndex() ); } void QgsOptions::removeCustomVariable() { mCustomVariablesTable->removeRow( mCustomVariablesTable->currentRow() ); } void QgsOptions::mCurrentVariablesQGISChxBx_toggled( bool qgisSpecific ) { for ( int i = mCurrentVariablesTable->rowCount() - 1; i >= 0; --i ) { if ( qgisSpecific ) { QString itmTxt = mCurrentVariablesTable->item( i, 0 )->text(); if ( !itmTxt.startsWith( QLatin1String( "QGIS" ), Qt::CaseInsensitive ) ) mCurrentVariablesTable->hideRow( i ); } else { mCurrentVariablesTable->showRow( i ); } } if ( mCurrentVariablesTable->rowCount() > 0 ) { mCurrentVariablesTable->sortByColumn( 0, Qt::AscendingOrder ); mCurrentVariablesTable->resizeColumnToContents( 0 ); } } void QgsOptions::addPluginPath() { QString myDir = QFileDialog::getExistingDirectory( this, tr( "Choose a directory" ), QDir::toNativeSeparators( QDir::homePath() ), QFileDialog::ShowDirsOnly ); if ( ! myDir.isEmpty() ) { QListWidgetItem *newItem = new QListWidgetItem( mListPluginPaths ); newItem->setText( myDir ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mListPluginPaths->addItem( newItem ); mListPluginPaths->setCurrentItem( newItem ); } } void QgsOptions::removePluginPath() { int currentRow = mListPluginPaths->currentRow(); QListWidgetItem *itemToRemove = mListPluginPaths->takeItem( currentRow ); delete itemToRemove; } void QgsOptions::addHelpPath() { QTreeWidgetItem *item = new QTreeWidgetItem(); item->setText( 0, QStringLiteral( "HELP_LOCATION" ) ); item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable ); mHelpPathTreeWidget->addTopLevelItem( item ); mHelpPathTreeWidget->setCurrentItem( item ); } void QgsOptions::removeHelpPath() { QList<QTreeWidgetItem *> items = mHelpPathTreeWidget->selectedItems(); for ( int i = 0; i < items.size(); ++i ) { int idx = mHelpPathTreeWidget->indexOfTopLevelItem( items.at( i ) ); if ( idx >= 0 ) { delete mHelpPathTreeWidget->takeTopLevelItem( idx ); } } } void QgsOptions::moveHelpPathUp() { QList<QTreeWidgetItem *> selectedItems = mHelpPathTreeWidget->selectedItems(); QList<QTreeWidgetItem *>::iterator itemIt = selectedItems.begin(); for ( ; itemIt != selectedItems.end(); ++itemIt ) { int currentIndex = mHelpPathTreeWidget->indexOfTopLevelItem( *itemIt ); if ( currentIndex > 0 ) { mHelpPathTreeWidget->takeTopLevelItem( currentIndex ); mHelpPathTreeWidget->insertTopLevelItem( currentIndex - 1, *itemIt ); mHelpPathTreeWidget->setCurrentItem( *itemIt ); } } } void QgsOptions::moveHelpPathDown() { QList<QTreeWidgetItem *> selectedItems = mHelpPathTreeWidget->selectedItems(); QList<QTreeWidgetItem *>::iterator itemIt = selectedItems.begin(); for ( ; itemIt != selectedItems.end(); ++itemIt ) { int currentIndex = mHelpPathTreeWidget->indexOfTopLevelItem( *itemIt ); if ( currentIndex < mHelpPathTreeWidget->topLevelItemCount() - 1 ) { mHelpPathTreeWidget->takeTopLevelItem( currentIndex ); mHelpPathTreeWidget->insertTopLevelItem( currentIndex + 1, *itemIt ); mHelpPathTreeWidget->setCurrentItem( *itemIt ); } } } void QgsOptions::addTemplatePath() { QString myDir = QFileDialog::getExistingDirectory( this, tr( "Choose a directory" ), QDir::toNativeSeparators( QDir::homePath() ), QFileDialog::ShowDirsOnly ); if ( ! myDir.isEmpty() ) { QListWidgetItem *newItem = new QListWidgetItem( mListComposerTemplatePaths ); newItem->setText( myDir ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mListComposerTemplatePaths->addItem( newItem ); mListComposerTemplatePaths->setCurrentItem( newItem ); } } void QgsOptions::removeTemplatePath() { int currentRow = mListComposerTemplatePaths->currentRow(); QListWidgetItem *itemToRemove = mListComposerTemplatePaths->takeItem( currentRow ); delete itemToRemove; } void QgsOptions::addSVGPath() { QString myDir = QFileDialog::getExistingDirectory( this, tr( "Choose a directory" ), QDir::toNativeSeparators( QDir::homePath() ), QFileDialog::ShowDirsOnly ); if ( ! myDir.isEmpty() ) { QListWidgetItem *newItem = new QListWidgetItem( mListSVGPaths ); newItem->setText( myDir ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mListSVGPaths->addItem( newItem ); mListSVGPaths->setCurrentItem( newItem ); } } void QgsOptions::removeHiddenPath() { int currentRow = mListHiddenBrowserPaths->currentRow(); QListWidgetItem *itemToRemove = mListHiddenBrowserPaths->takeItem( currentRow ); delete itemToRemove; } void QgsOptions::removeSVGPath() { int currentRow = mListSVGPaths->currentRow(); QListWidgetItem *itemToRemove = mListSVGPaths->takeItem( currentRow ); delete itemToRemove; } void QgsOptions::addNoProxyUrl() { QListWidgetItem *newItem = new QListWidgetItem( mNoProxyUrlListWidget ); newItem->setText( QStringLiteral( "URL" ) ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mNoProxyUrlListWidget->addItem( newItem ); mNoProxyUrlListWidget->setCurrentItem( newItem ); } void QgsOptions::removeNoProxyUrl() { int currentRow = mNoProxyUrlListWidget->currentRow(); QListWidgetItem *itemToRemove = mNoProxyUrlListWidget->takeItem( currentRow ); delete itemToRemove; } void QgsOptions::browseCacheDirectory() { QString myDir = QFileDialog::getExistingDirectory( this, tr( "Choose a directory" ), QDir::toNativeSeparators( mCacheDirectory->text() ), QFileDialog::ShowDirsOnly ); if ( !myDir.isEmpty() ) { mCacheDirectory->setText( QDir::toNativeSeparators( myDir ) ); } } void QgsOptions::clearCache() { QgsNetworkAccessManager::instance()->cache()->clear(); QMessageBox::information( this, tr( "Clear Cache" ), tr( "Content cache has been cleared." ) ); } void QgsOptions::clearAccessCache() { QgsNetworkAccessManager::instance()->clearAccessCache(); QMessageBox::information( this, tr( "Clear Cache" ), tr( "Connection authentication cache has been cleared." ) ); } void QgsOptions::optionsStackedWidget_CurrentChanged( int index ) { QgsOptionsDialogBase::optionsStackedWidget_CurrentChanged( index ); Q_UNUSED( index ) // load gdal driver list when gdal tab is first opened if ( mOptionsStackedWidget->currentWidget()->objectName() == QLatin1String( "mOptionsPageGDAL" ) && ! mLoadedGdalDriverList ) { loadGdalDriverList(); } } void QgsOptions::loadGdalDriverList() { QgsApplication::registerGdalDriversFromSettings(); const QStringList mySkippedDrivers = QgsApplication::skippedGdalDrivers(); GDALDriverH myGdalDriver; // current driver QString myGdalDriverDescription; QStringList myDrivers; QStringList myGdalWriteDrivers; QMap<QString, QString> myDriversFlags, myDriversExt, myDriversLongName; QMap<QString, QgsMapLayerType> driversType; // make sure we save list when accept() mLoadedGdalDriverList = true; // allow retrieving metadata from all drivers, they will be skipped again when saving CPLSetConfigOption( "GDAL_SKIP", "" ); GDALAllRegister(); int myGdalDriverCount = GDALGetDriverCount(); for ( int i = 0; i < myGdalDriverCount; ++i ) { myGdalDriver = GDALGetDriver( i ); Q_CHECK_PTR( myGdalDriver ); if ( !myGdalDriver ) { QgsLogger::warning( "unable to get driver " + QString::number( i ) ); continue; } // in GDAL 2.0 both vector and raster drivers are returned by GDALGetDriver myGdalDriverDescription = GDALGetDescription( myGdalDriver ); myDrivers << myGdalDriverDescription; if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, nullptr ) ) == QLatin1String( "YES" ) ) { driversType[myGdalDriverDescription] = QgsMapLayerType::RasterLayer; } else if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_VECTOR, nullptr ) ) == QLatin1String( "YES" ) ) { driversType[myGdalDriverDescription] = QgsMapLayerType::VectorLayer; } QgsDebugMsgLevel( QStringLiteral( "driver #%1 - %2" ).arg( i ).arg( myGdalDriverDescription ), 2 ); // get driver R/W flags, adopted from GDALGeneralCmdLineProcessor() QString driverFlags = ""; if ( driversType[myGdalDriverDescription] == QgsMapLayerType::RasterLayer ) { if ( QgsGdalUtils::supportsRasterCreate( myGdalDriver ) ) { myGdalWriteDrivers << myGdalDriverDescription; driverFlags = "rw+"; } else if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_CREATECOPY, nullptr ) ) driverFlags = "rw"; else driverFlags = "ro"; } else { if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_OPEN, nullptr ) ) driverFlags = "r"; if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_CREATE, nullptr ) ) driverFlags += "w+"; else if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_CREATECOPY, nullptr ) ) driverFlags += "w"; else driverFlags += "o"; } if ( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_VIRTUALIO, nullptr ) ) driverFlags += "v"; myDriversFlags[myGdalDriverDescription] = driverFlags; // get driver extensions and long name // the gdal provider can override/add extensions but there is no interface to query this // aside from parsing QgsRasterLayer::buildSupportedRasterFileFilter() myDriversExt[myGdalDriverDescription] = QString( GDALGetMetadataItem( myGdalDriver, "DMD_EXTENSION", "" ) ).toLower(); myDriversLongName[myGdalDriverDescription] = QString( GDALGetMetadataItem( myGdalDriver, "DMD_LONGNAME", "" ) ); } // restore active drivers QgsApplication::applyGdalSkippedDrivers(); myDrivers.removeDuplicates(); // myDrivers.sort(); // sort list case insensitive - no existing function for this! QMap<QString, QString> strMap; for ( const QString &str : std::as_const( myDrivers ) ) strMap.insert( str.toLower(), str ); myDrivers = strMap.values(); for ( const QString &myName : std::as_const( myDrivers ) ) { QTreeWidgetItem *mypItem = new QTreeWidgetItem( QStringList( myName ) ); if ( mySkippedDrivers.contains( myName ) ) { mypItem->setCheckState( 0, Qt::Unchecked ); } else { mypItem->setCheckState( 0, Qt::Checked ); } // add driver metadata mypItem->setText( 1, myDriversExt[myName] ); QString myFlags = myDriversFlags[myName]; mypItem->setText( 2, myFlags ); mypItem->setText( 3, myDriversLongName[myName] ); if ( driversType[myName] == QgsMapLayerType::RasterLayer ) { lstRasterDrivers->addTopLevelItem( mypItem ); } else { lstVectorDrivers->addTopLevelItem( mypItem ); } } // adjust column width for ( int i = 0; i < 4; i++ ) { lstRasterDrivers->resizeColumnToContents( i ); lstRasterDrivers->setColumnWidth( i, lstRasterDrivers->columnWidth( i ) + 5 ); lstVectorDrivers->resizeColumnToContents( i ); lstVectorDrivers->setColumnWidth( i, lstVectorDrivers->columnWidth( i ) + 5 ); } // populate cmbEditCreateOptions with gdal write drivers - sorted, GTiff first strMap.clear(); for ( const QString &str : std::as_const( myGdalWriteDrivers ) ) strMap.insert( str.toLower(), str ); myGdalWriteDrivers = strMap.values(); myGdalWriteDrivers.removeAll( QStringLiteral( "Gtiff" ) ); myGdalWriteDrivers.prepend( QStringLiteral( "GTiff" ) ); cmbEditCreateOptions->clear(); for ( const QString &myName : std::as_const( myGdalWriteDrivers ) ) { cmbEditCreateOptions->addItem( myName ); } } void QgsOptions::saveGdalDriverList() { bool driverUnregisterNeeded = false; const auto oldSkippedGdalDrivers = QgsApplication::skippedGdalDrivers(); auto deferredSkippedGdalDrivers = QgsApplication::deferredSkippedGdalDrivers(); QStringList skippedGdalDrivers; auto checkDriver = [ & ]( QTreeWidgetItem * item ) { const auto &driverName( item->text( 0 ) ); if ( item->checkState( 0 ) == Qt::Unchecked ) { skippedGdalDrivers << driverName; if ( !deferredSkippedGdalDrivers.contains( driverName ) && !oldSkippedGdalDrivers.contains( driverName ) ) { deferredSkippedGdalDrivers << driverName; driverUnregisterNeeded = true; } } else { if ( deferredSkippedGdalDrivers.contains( driverName ) ) { deferredSkippedGdalDrivers.removeAll( driverName ); } } }; // raster drivers for ( int i = 0; i < lstRasterDrivers->topLevelItemCount(); i++ ) { checkDriver( lstRasterDrivers->topLevelItem( i ) ); } // vector drivers for ( int i = 0; i < lstVectorDrivers->topLevelItemCount(); i++ ) { checkDriver( lstVectorDrivers->topLevelItem( i ) ); } if ( driverUnregisterNeeded ) { QMessageBox::information( this, tr( "Drivers Disabled" ), tr( "One or more drivers have been disabled. This will only take effect after QGIS is restarted." ) ); } QgsApplication::setSkippedGdalDrivers( skippedGdalDrivers, deferredSkippedGdalDrivers ); } void QgsOptions::addScale() { int myScale = QInputDialog::getInt( this, tr( "Enter scale" ), tr( "Scale denominator" ), -1, 1 ); if ( myScale != -1 ) { QListWidgetItem *newItem = addScaleToScaleList( QStringLiteral( "1:%1" ).arg( myScale ) ); mListGlobalScales->setCurrentItem( newItem ); } } void QgsOptions::removeScale() { int currentRow = mListGlobalScales->currentRow(); QListWidgetItem *itemToRemove = mListGlobalScales->takeItem( currentRow ); delete itemToRemove; } void QgsOptions::restoreDefaultScaleValues() { mListGlobalScales->clear(); QStringList myScalesList = Qgis::defaultProjectScales().split( ',' ); const auto constMyScalesList = myScalesList; for ( const QString &scale : constMyScalesList ) { addScaleToScaleList( scale ); } } void QgsOptions::importScales() { QString fileName = QFileDialog::getOpenFileName( this, tr( "Load scales" ), QDir::homePath(), tr( "XML files (*.xml *.XML)" ) ); if ( fileName.isEmpty() ) { return; } QString msg; QStringList myScales; if ( !QgsScaleUtils::loadScaleList( fileName, myScales, msg ) ) { QgsDebugMsg( msg ); } const auto constMyScales = myScales; for ( const QString &scale : constMyScales ) { addScaleToScaleList( scale ); } } void QgsOptions::exportScales() { QString fileName = QFileDialog::getSaveFileName( this, tr( "Save scales" ), QDir::homePath(), tr( "XML files (*.xml *.XML)" ) ); if ( fileName.isEmpty() ) { return; } // ensure the user never omitted the extension from the file name if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) ) { fileName += QLatin1String( ".xml" ); } QStringList myScales; myScales.reserve( mListGlobalScales->count() ); for ( int i = 0; i < mListGlobalScales->count(); ++i ) { myScales.append( mListGlobalScales->item( i )->text() ); } QString msg; if ( !QgsScaleUtils::saveScaleList( fileName, myScales, msg ) ) { QgsDebugMsg( msg ); } } void QgsOptions::initContrastEnhancement( QComboBox *cbox, const QString &name, const QString &defaultVal ) { QgsSettings settings; //add items to the color enhanceContrast combo boxes cbox->addItem( tr( "No Stretch" ), QgsContrastEnhancement::contrastEnhancementAlgorithmString( QgsContrastEnhancement::NoEnhancement ) ); cbox->addItem( tr( "Stretch to MinMax" ), QgsContrastEnhancement::contrastEnhancementAlgorithmString( QgsContrastEnhancement::StretchToMinimumMaximum ) ); cbox->addItem( tr( "Stretch and Clip to MinMax" ), QgsContrastEnhancement::contrastEnhancementAlgorithmString( QgsContrastEnhancement::StretchAndClipToMinimumMaximum ) ); cbox->addItem( tr( "Clip to MinMax" ), QgsContrastEnhancement::contrastEnhancementAlgorithmString( QgsContrastEnhancement::ClipToMinimumMaximum ) ); QString contrastEnhancement = mSettings->value( "/Raster/defaultContrastEnhancementAlgorithm/" + name, defaultVal ).toString(); cbox->setCurrentIndex( cbox->findData( contrastEnhancement ) ); } void QgsOptions::saveContrastEnhancement( QComboBox *cbox, const QString &name ) { QgsSettings settings; QString value = cbox->currentData().toString(); mSettings->setValue( "/Raster/defaultContrastEnhancementAlgorithm/" + name, value ); } void QgsOptions::initMinMaxLimits( QComboBox *cbox, const QString &name, const QString &defaultVal ) { QgsSettings settings; //add items to the color limitsContrast combo boxes cbox->addItem( tr( "Cumulative Pixel Count Cut" ), QgsRasterMinMaxOrigin::limitsString( QgsRasterMinMaxOrigin::CumulativeCut ) ); cbox->addItem( tr( "Minimum / Maximum" ), QgsRasterMinMaxOrigin::limitsString( QgsRasterMinMaxOrigin::MinMax ) ); cbox->addItem( tr( "Mean +/- Standard Deviation" ), QgsRasterMinMaxOrigin::limitsString( QgsRasterMinMaxOrigin::StdDev ) ); QString contrastLimits = mSettings->value( "/Raster/defaultContrastEnhancementLimits/" + name, defaultVal ).toString(); cbox->setCurrentIndex( cbox->findData( contrastLimits ) ); } void QgsOptions::saveMinMaxLimits( QComboBox *cbox, const QString &name ) { QgsSettings settings; QString value = cbox->currentData().toString(); mSettings->setValue( "/Raster/defaultContrastEnhancementLimits/" + name, value ); } void QgsOptions::addColor() { QColor newColor = QgsColorDialog::getColor( QColor(), this->parentWidget(), tr( "Select color" ), true ); if ( !newColor.isValid() ) { return; } activateWindow(); mTreeCustomColors->addColor( newColor, QgsSymbolLayerUtils::colorToName( newColor ) ); } void QgsOptions::removeLocalizedDataPath() { qDeleteAll( mLocalizedDataPathListWidget->selectedItems() ); } void QgsOptions::addLocalizedDataPath() { QString myDir = QFileDialog::getExistingDirectory( this, tr( "Choose a Directory" ), QDir::homePath(), QFileDialog::ShowDirsOnly ); if ( ! myDir.isEmpty() ) { QListWidgetItem *newItem = new QListWidgetItem( mLocalizedDataPathListWidget ); newItem->setText( myDir ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mLocalizedDataPathListWidget->addItem( newItem ); mLocalizedDataPathListWidget->setCurrentItem( newItem ); } } void QgsOptions::moveLocalizedDataPathUp() { QList<QListWidgetItem *> selectedItems = mLocalizedDataPathListWidget->selectedItems(); QList<QListWidgetItem *>::iterator itemIt = selectedItems.begin(); for ( ; itemIt != selectedItems.end(); ++itemIt ) { int row = mLocalizedDataPathListWidget->row( *itemIt ); mLocalizedDataPathListWidget->takeItem( row ); mLocalizedDataPathListWidget->insertItem( row - 1, *itemIt ); } } void QgsOptions::moveLocalizedDataPathDown() { QList<QListWidgetItem *> selectedItems = mLocalizedDataPathListWidget->selectedItems(); QList<QListWidgetItem *>::iterator itemIt = selectedItems.begin(); for ( ; itemIt != selectedItems.end(); ++itemIt ) { int row = mLocalizedDataPathListWidget->row( *itemIt ); mLocalizedDataPathListWidget->takeItem( row ); mLocalizedDataPathListWidget->insertItem( row + 1, *itemIt ); } } QListWidgetItem *QgsOptions::addScaleToScaleList( const QString &newScale ) { QListWidgetItem *newItem = new QListWidgetItem( newScale ); addScaleToScaleList( newItem ); return newItem; } void QgsOptions::addScaleToScaleList( QListWidgetItem *newItem ) { // If the new scale already exists, delete it. QListWidgetItem *duplicateItem = mListGlobalScales->findItems( newItem->text(), Qt::MatchExactly ).value( 0 ); delete duplicateItem; int newDenominator = newItem->text().split( ':' ).value( 1 ).toInt(); int i; for ( i = 0; i < mListGlobalScales->count(); i++ ) { int denominator = mListGlobalScales->item( i )->text().split( ':' ).value( 1 ).toInt(); if ( newDenominator > denominator ) break; } newItem->setData( Qt::UserRole, newItem->text() ); newItem->setFlags( Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable ); mListGlobalScales->insertItem( i, newItem ); } void QgsOptions::refreshSchemeComboBox() { mColorSchemesComboBox->blockSignals( true ); mColorSchemesComboBox->clear(); QList<QgsColorScheme *> schemeList = QgsApplication::colorSchemeRegistry()->schemes(); QList<QgsColorScheme *>::const_iterator schemeIt = schemeList.constBegin(); for ( ; schemeIt != schemeList.constEnd(); ++schemeIt ) { mColorSchemesComboBox->addItem( ( *schemeIt )->schemeName() ); } mColorSchemesComboBox->blockSignals( false ); } void QgsOptions::updateSampleLocaleText() { QLocale locale( cboGlobalLocale->currentData( ).toString() ); if ( cbShowGroupSeparator->isChecked( ) ) { locale.setNumberOptions( locale.numberOptions() &= ~QLocale::NumberOption::OmitGroupSeparator ); } else { locale.setNumberOptions( locale.numberOptions() |= QLocale::NumberOption::OmitGroupSeparator ); } lblLocaleSample->setText( tr( "Sample date: %1 money: %2 int: %3 float: %4" ).arg( QDate::currentDate().toString( locale.dateFormat( QLocale::FormatType::ShortFormat ) ), locale.toCurrencyString( 1000.00 ), locale.toString( 1000 ), locale.toString( 1000.00, 'f', 2 ) ) ); } void QgsOptions::updateActionsForCurrentColorScheme( QgsColorScheme *scheme ) { if ( !scheme ) return; mButtonImportColors->setEnabled( scheme->isEditable() ); mButtonPasteColors->setEnabled( scheme->isEditable() ); mButtonAddColor->setEnabled( scheme->isEditable() ); mButtonRemoveColor->setEnabled( scheme->isEditable() ); QgsUserColorScheme *userScheme = dynamic_cast<QgsUserColorScheme *>( scheme ); mActionRemovePalette->setEnabled( static_cast< bool >( userScheme ) && userScheme->isEditable() ); if ( userScheme ) { mActionShowInButtons->setEnabled( true ); whileBlocking( mActionShowInButtons )->setChecked( userScheme->flags() & QgsColorScheme::ShowInColorButtonMenu ); } else { whileBlocking( mActionShowInButtons )->setChecked( false ); mActionShowInButtons->setEnabled( false ); } } void QgsOptions::scaleItemChanged( QListWidgetItem *changedScaleItem ) { // Check if the new value is valid, restore the old value if not. QRegExp regExp( "1:0*[1-9]\\d*" ); if ( regExp.exactMatch( changedScaleItem->text() ) ) { //Remove leading zeroes from the denominator regExp.setPattern( QStringLiteral( "1:0*" ) ); changedScaleItem->setText( changedScaleItem->text().replace( regExp, QStringLiteral( "1:" ) ) ); } else { QMessageBox::warning( this, tr( "Set Scale" ), tr( "The text you entered is not a valid scale." ) ); changedScaleItem->setText( changedScaleItem->data( Qt::UserRole ).toString() ); } // Take the changed item out of the list and re-add it. This keeps things ordered and creates correct meta-data for the changed item. int row = mListGlobalScales->row( changedScaleItem ); mListGlobalScales->takeItem( row ); addScaleToScaleList( changedScaleItem ); mListGlobalScales->setCurrentItem( changedScaleItem ); } double QgsOptions::zoomFactorValue() { // Get the decimal value for zoom factor. This function is needed because the zoom factor spin box is shown as a percent value. // The minimum zoom factor value is 1.01 if ( spinZoomFactor->value() == spinZoomFactor->minimum() ) return 1.01; else return spinZoomFactor->value() / 100.0; } void QgsOptions::setZoomFactorValue() { // Set the percent value for zoom factor spin box. This function is for converting the decimal zoom factor value in the qgis setting to the percent zoom factor value. if ( mSettings->value( QStringLiteral( "/qgis/zoom_factor" ), 2 ).toDouble() <= 1.01 ) { spinZoomFactor->setValue( spinZoomFactor->minimum() ); } else { int percentValue = mSettings->value( QStringLiteral( "/qgis/zoom_factor" ), 2 ).toDouble() * 100; spinZoomFactor->setValue( percentValue ); } } void QgsOptions::showHelp() { QWidget *activeTab = mOptionsStackedWidget->currentWidget(); QString link; // give first priority to created pages which have specified a help key for ( const QgsOptionsPageWidget *widget : std::as_const( mAdditionalOptionWidgets ) ) { if ( widget == activeTab ) { link = widget->helpKey(); break; } } if ( link.isEmpty() ) { link = QStringLiteral( "introduction/qgis_configuration.html" ); if ( activeTab == mOptionsPageAuth ) { link = QStringLiteral( "auth_system/index.html" ); } else if ( activeTab == mOptionsPageVariables ) { link = QStringLiteral( "introduction/general_tools.html#variables" ); } else if ( activeTab == mOptionsPageCRS ) { link = QStringLiteral( "working_with_projections/working_with_projections.html" ); } } QgsHelp::openHelp( link ); } void QgsOptions::customizeBearingFormat() { QgsBearingNumericFormatDialog dlg( mBearingFormat.get(), this ); dlg.setWindowTitle( tr( "Bearing Format" ) ); if ( dlg.exec() ) { mBearingFormat.reset( dlg.format() ); } }
kalxas/QGIS
src/app/options/qgsoptions.cpp
C++
gpl-2.0
142,532
package edu.ku.brc.specify.tasks.subpane.wb; class SgrHeading implements GridTableHeader { private final Short viewOrder; public SgrHeading(short viewOrder) { this.viewOrder = viewOrder; } @Override public int compareTo(GridTableHeader o) { return this.getViewOrder() - o.getViewOrder(); } @Override public Short getViewOrder() { return viewOrder; } @Override public String getTableName() { return "N/A"; } @Override public String getFieldName() { return "N/A"; } @Override public Class<?> getDataType() { return Float.class; } @Override public Short getDataFieldLength() { return 10; } @Override public String getCaption() { return "SGR Score"; } }
specify/specify6
src/edu/ku/brc/specify/tasks/subpane/wb/SgrHeading.java
Java
gpl-2.0
712
# templater.py - template expansion for output # # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2, incorporated herein by reference. from i18n import _ import re, sys, os import util, config, templatefilters path = ['templates', '../templates'] stringify = templatefilters.stringify def parsestring(s, quoted=True): '''parse a string using simple c-like syntax. string must be in quotes if quoted is True.''' if quoted: if len(s) < 2 or s[0] != s[-1]: raise SyntaxError(_('unmatched quotes')) return s[1:-1].decode('string_escape') return s.decode('string_escape') class engine(object): '''template expansion engine. template expansion works like this. a map file contains key=value pairs. if value is quoted, it is treated as string. otherwise, it is treated as name of template file. templater is asked to expand a key in map. it looks up key, and looks for strings like this: {foo}. it expands {foo} by looking up foo in map, and substituting it. expansion is recursive: it stops when there is no more {foo} to replace. expansion also allows formatting and filtering. format uses key to expand each item in list. syntax is {key%format}. filter uses function to transform value. syntax is {key|filter1|filter2|...}.''' template_re = re.compile(r'{([\w\|%]+)}|#([\w\|%]+)#') def __init__(self, loader, filters={}, defaults={}): self.loader = loader self.filters = filters self.defaults = defaults self.cache = {} def process(self, t, map): '''Perform expansion. t is name of map element to expand. map contains added elements for use during expansion. Is a generator.''' tmpl = self.loader(t) iters = [self._process(tmpl, map)] while iters: try: item = iters[0].next() except StopIteration: iters.pop(0) continue if isinstance(item, str): yield item elif item is None: yield '' elif hasattr(item, '__iter__'): iters.insert(0, iter(item)) else: yield str(item) def _format(self, expr, get, map): key, format = expr.split('%') v = get(key) if not hasattr(v, '__iter__'): raise SyntaxError(_("error expanding '%s%%%s'") % (key, format)) lm = map.copy() for i in v: lm.update(i) yield self.process(format, lm) def _filter(self, expr, get, map): if expr not in self.cache: parts = expr.split('|') val = parts[0] try: filters = [self.filters[f] for f in parts[1:]] except KeyError, i: raise SyntaxError(_("unknown filter '%s'") % i[0]) def apply(get): x = get(val) for f in filters: x = f(x) return x self.cache[expr] = apply return self.cache[expr](get) def _process(self, tmpl, map): '''Render a template. Returns a generator.''' def get(key): v = map.get(key) if v is None: v = self.defaults.get(key, '') if hasattr(v, '__call__'): v = v(**map) return v while tmpl: m = self.template_re.search(tmpl) if not m: yield tmpl break start, end = m.span(0) variants = m.groups() expr = variants[0] or variants[1] if start: yield tmpl[:start] tmpl = tmpl[end:] if '%' in expr: yield self._format(expr, get, map) elif '|' in expr: yield self._filter(expr, get, map) else: yield get(expr) engines = {'default': engine} class templater(object): def __init__(self, mapfile, filters={}, defaults={}, cache={}, minchunk=1024, maxchunk=65536): '''set up template engine. mapfile is name of file to read map definitions from. filters is dict of functions. each transforms a value into another. defaults is dict of default map definitions.''' self.mapfile = mapfile or 'template' self.cache = cache.copy() self.map = {} self.base = (mapfile and os.path.dirname(mapfile)) or '' self.filters = templatefilters.filters.copy() self.filters.update(filters) self.defaults = defaults self.minchunk, self.maxchunk = minchunk, maxchunk self.engines = {} if not mapfile: return if not os.path.exists(mapfile): raise util.Abort(_('style not found: %s') % mapfile) conf = config.config() conf.read(mapfile) for key, val in conf[''].items(): if val[0] in "'\"": try: self.cache[key] = parsestring(val) except SyntaxError, inst: raise SyntaxError('%s: %s' % (conf.source('', key), inst.args[0])) else: val = 'default', val if ':' in val[1]: val = val[1].split(':', 1) self.map[key] = val[0], os.path.join(self.base, val[1]) def __contains__(self, key): return key in self.cache or key in self.map def load(self, t): '''Get the template for the given template name. Use a local cache.''' if not t in self.cache: try: self.cache[t] = open(self.map[t][1]).read() except IOError, inst: raise IOError(inst.args[0], _('template file %s: %s') % (self.map[t][1], inst.args[1])) return self.cache[t] def __call__(self, t, **map): ttype = t in self.map and self.map[t][0] or 'default' proc = self.engines.get(ttype) if proc is None: proc = engines[ttype](self.load, self.filters, self.defaults) self.engines[ttype] = proc stream = proc.process(t, map) if self.minchunk: stream = util.increasingchunks(stream, min=self.minchunk, max=self.maxchunk) return stream def templatepath(name=None): '''return location of template file or directory (if no name). returns None if not found.''' normpaths = [] # executable version (py2exe) doesn't support __file__ if hasattr(sys, 'frozen'): module = sys.executable else: module = __file__ for f in path: if f.startswith('/'): p = f else: fl = f.split('/') p = os.path.join(os.path.dirname(module), *fl) if name: p = os.path.join(p, name) if name and os.path.exists(p): return os.path.normpath(p) elif os.path.isdir(p): normpaths.append(os.path.normpath(p)) return normpaths def stylemap(style, paths=None): """Return path to mapfile for a given style. Searches mapfile in the following locations: 1. templatepath/style/map 2. templatepath/map-style 3. templatepath/map """ if paths is None: paths = templatepath() elif isinstance(paths, str): paths = [paths] locations = style and [os.path.join(style, "map"), "map-" + style] or [] locations.append("map") for path in paths: for location in locations: mapfile = os.path.join(path, location) if os.path.isfile(mapfile): return mapfile raise RuntimeError("No hgweb templates found in %r" % paths)
dkrisman/Traipse
mercurial/templater.py
Python
gpl-2.0
7,996
<?php namespace SSOPress\Core; if(!defined('ABSPATH')) die(); class URLRewriter{ public function init(){ $this->add_rewrite_tags(); $this->add_rewrite_rules(); } private function add_rewrite_tags(){ add_rewrite_tag('%ssopress%', '([^&]+)'); add_rewrite_tag('%ssopress_action%', '([^&]+)'); } private function add_rewrite_rules(){ add_rewrite_rule( '^ssopress/jwt/login/?$', 'index.php?ssopress=true&ssopress_action=jwt_login', 'top' ); add_rewrite_rule( '^ssopress/error/?$', 'index.php?ssopress=true&ssopress_action=login_error', 'top' ); } }
justinoue/SSOPress
core/url_rewriter.php
PHP
gpl-2.0
680
/** * ClarescoExperienceAPI * Copyright * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * Please contact Claresco, www.claresco.com, if you have any questions. **/ package com.claresco.tinman.lrs; import java.util.HashMap; import java.util.Set; import java.util.Map; import org.apache.jena.riot.web.*; /** * XapiLanguageMap.java * * * * * * @author rheza * on Jan 16, 2014 * */ public class XapiLanguageMap { private HashMap<String, String> myLanguageMapping; public XapiLanguageMap(){ this.myLanguageMapping = new HashMap<String, String>(); } public void registerLanguage(String theLanguage, String theWord){ this.myLanguageMapping.put(theLanguage, theWord); } public boolean isEmpty(){ return myLanguageMapping == null || myLanguageMapping.isEmpty(); } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return this.myLanguageMapping.toString(); } public String[][] getLanguageMapAsArray(){ Set<Map.Entry<String,String>> myEntrySet = this.myLanguageMapping.entrySet(); String[][] myArray = new String[myEntrySet.size()][2]; int j = 0; for (Map.Entry<String, String> i : this.myLanguageMapping.entrySet()){ myArray[j][0] = i.getKey(); myArray[j][1] = i.getValue(); j++; } return myArray; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if(obj instanceof XapiLanguageMap){ XapiLanguageMap theLmap = (XapiLanguageMap) obj; if(myLanguageMapping.equals(theLmap.myLanguageMapping)){ return true; } } return false; } public static void main(String[] args) { XapiLanguageMap lmap = new XapiLanguageMap(); XapiLanguageMap lmap2 = new XapiLanguageMap(); lmap.registerLanguage("a", "b"); lmap2.registerLanguage("a", "b"); System.out.println(lmap2.equals(lmap)); } }
claresco/Tinman
src/com/claresco/tinman/lrs/XapiLanguageMap.java
Java
gpl-2.0
2,099
using System; public class Seven { static void Main() { int a = 2; int b = 0; int c = 10001; while (b <= c) { if (Prime(a)) b++; if (b < c) a++; } Console.WriteLine("{0}", a); } // Test for primality up to n. static bool Prime(int n) { if (n % 2 == 0) return false for (int i = 3; i <= Math.Sqrt(n); i += 2) if (n % i == 0) return false; return true; } }
bhalash/Project-Euler
csharp/07.cs
C#
gpl-2.0
449
# Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2011 Nick Hall # Copyright (C) 2011 Tim G L Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # #------------------------------------------------------------------------- # # Gtk modules # #------------------------------------------------------------------------- from gi.repository import Gtk #------------------------------------------------------------------------- # # Gramps modules # #------------------------------------------------------------------------- from gramps.gui.listmodel import ListModel from gramps.gen.utils.db import navigation_label from gramps.gen.plug import Gramplet from gramps.gui.utils import edit_object from gramps.gen.const import GRAMPS_LOCALE as glocale from gramps.gen.datehandler import displayer _ = glocale.translation.gettext class Backlinks(Gramplet): """ Displays the back references for an object. """ def init(self): self.date_column = None self.evts = False self.gui.WIDGET = self.build_gui() self.gui.get_container_widget().remove(self.gui.textview) self.gui.get_container_widget().add(self.gui.WIDGET) self.gui.WIDGET.show() def build_gui(self): """ Build the GUI interface. """ self.top = Gtk.TreeView() titles = [(_('Type'), 1, 100), (_('Name'), 2, 100), (_('Date'), 4, 200), ('sd', 4, 120), # sorted date column ('', 5, 1), #hidden column for the handle ('', 6, 1), #hidden column for non-localized object type ] self.model = ListModel(self.top, titles, event_func=self.cb_double_click) self.date_column = self.top.get_column(2) self.sdate = self.top.get_column(3) self.top.get_column(1).set_expand(True) # The name use the max # possible size return self.top def display_backlinks(self, active_handle): """ Display the back references for an object. """ self.evts = False sdcolumn = None for classname, handle in \ self.dbstate.db.find_backlink_handles(active_handle): name = navigation_label(self.dbstate.db, classname, handle)[0] sdcolumn = self.top.get_column(3) dcolumn = self.top.get_column(2) if classname == "Event": obj = self.dbstate.db.get_event_from_handle(handle) o_date = obj.get_date_object() date = displayer.display(o_date) sdate = "%09d" % o_date.get_sort_value() sdcolumn.set_sort_column_id(3) dcolumn.set_sort_column_id(3) self.evts = True else: sdcolumn.set_sort_column_id(1) date = sdate = "" self.model.add((_(classname), name, date, sdate, handle, classname)) if self.evts: self.date_column.set_visible(True) sdcolumn.set_visible(False) else: self.date_column.set_visible(False) if sdcolumn: sdcolumn.set_visible(False) self.set_has_data(self.model.count > 0) def get_has_data(self, active_handle): """ Return True if the gramplet has data, else return False. """ if not active_handle: return False for handle in self.dbstate.db.find_backlink_handles(active_handle): return True return False def cb_double_click(self, treeview): """ Handle double click on treeview. """ (model, iter_) = treeview.get_selection().get_selected() if not iter_: return (objclass, handle) = (model.get_value(iter_, 5), model.get_value(iter_, 4)) edit_object(self.dbstate, self.uistate, objclass, handle) class PersonBacklinks(Backlinks): """ Displays the back references for a person. """ def db_changed(self): self.connect(self.dbstate.db, 'person-update', self.update) def active_changed(self, handle): self.update() def update_has_data(self): active_handle = self.get_active('Person') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Person') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class EventBacklinks(Backlinks): """ Displays the back references for an event. """ def db_changed(self): self.connect(self.dbstate.db, 'event-update', self.update) self.connect_signal('Event', self.update) def update_has_data(self): active_handle = self.get_active('Event') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Event') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class FamilyBacklinks(Backlinks): """ Displays the back references for a family. """ def db_changed(self): self.connect(self.dbstate.db, 'family-update', self.update) self.connect_signal('Family', self.update) def update_has_data(self): active_handle = self.get_active('Family') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Family') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class PlaceBacklinks(Backlinks): """ Displays the back references for a place. """ def db_changed(self): self.connect(self.dbstate.db, 'place-update', self.update) self.connect_signal('Place', self.update) def update_has_data(self): active_handle = self.get_active('Place') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Place') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class SourceBacklinks(Backlinks): """ Displays the back references for a source,. """ def db_changed(self): self.connect(self.dbstate.db, 'source-update', self.update) self.connect_signal('Source', self.update) def update_has_data(self): active_handle = self.get_active('Source') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Source') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class CitationBacklinks(Backlinks): """ Displays the back references for a Citation,. """ def db_changed(self): self.connect(self.dbstate.db, 'citation-update', self.update) self.connect_signal('Citation', self.update) def update_has_data(self): active_handle = self.get_active('Citation') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Citation') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class RepositoryBacklinks(Backlinks): """ Displays the back references for a repository. """ def db_changed(self): self.connect(self.dbstate.db, 'repository-update', self.update) self.connect_signal('Repository', self.update) def update_has_data(self): active_handle = self.get_active('Repository') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Repository') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class MediaBacklinks(Backlinks): """ Displays the back references for a media object. """ def db_changed(self): self.connect(self.dbstate.db, 'media-update', self.update) self.connect_signal('Media', self.update) def update_has_data(self): active_handle = self.get_active('Media') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Media') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False) class NoteBacklinks(Backlinks): """ Displays the back references for a note. """ def db_changed(self): self.connect(self.dbstate.db, 'note-update', self.update) self.connect_signal('Note', self.update) def update_has_data(self): active_handle = self.get_active('Note') self.set_has_data(self.get_has_data(active_handle)) def main(self): active_handle = self.get_active('Note') self.model.clear() if active_handle: self.display_backlinks(active_handle) else: self.set_has_data(False)
Nick-Hall/gramps
gramps/plugins/gramplet/backlinks.py
Python
gpl-2.0
10,199
# -*-python-*- # GemRB - Infinity Engine Emulator # Copyright (C) 2003-2005 The GemRB Project # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # GUISTORE.py - script to open the store/inn/temple windows ################################################### import GemRB import GUICommon import GUICommonWindows from GUIDefines import * from ie_stats import * from ie_slots import * StoreWindow = None MessageWindow = None ActionWindow = None PortraitWindow = None StoreShoppingWindow = None StoreIdentifyWindow = None StoreStealWindow = None StoreDonateWindow = None StoreHealWindow = None StoreRumourWindow = None StoreRentWindow = None OldPortraitWindow = None RentConfirmWindow = None LeftButton = None RightButton = None ITEM_PC = 0 ITEM_STORE = 1 Inventory = None RentIndex = -1 Store = None Buttons = [-1,-1,-1,-1] inventory_slots = () total_price = 0 total_income = 0 if GUICommon.GameIsIWD2(): ItemButtonCount = 6 else: ItemButtonCount = 4 RepModTable = None PreviousPC = 0 BarteringPC = 0 # 0 - Store # 1 - Tavern # 2 - Inn # 3 - Temple # 4 - Container # 5 - Container # 0 - buy/sell # 1 - identify # 2 - steal # 3 - heal # 4 - donate # 5 - drink # 6 - rent if GUICommon.GameIsIWD1(): # no bam for bags storebams = ("STORSTOR","STORTVRN","STORINN","STORTMPL","STORSTOR","STORSTOR") else: storebams = ("STORSTOR","STORTVRN","STORINN","STORTMPL","STORBAG","STORBAG") storetips = (14288,14292,14291,12138,15013,14289,14287) roomtypes = (17389,17517,17521,17519) store_funcs = None def CloseWindows (): global StoreShoppingWindow, StoreIdentifyWindow, StoreStealWindow global StoreHealWindow, StoreDonateWindow, StoreRumourWindow, StoreRentWindow for win in StoreShoppingWindow, StoreIdentifyWindow, StoreStealWindow, StoreHealWindow, StoreDonateWindow, StoreRumourWindow, StoreRentWindow: if win: win.Unload () StoreShoppingWindow = StoreIdentifyWindow = StoreStealWindow = StoreHealWindow = StoreDonateWindow = StoreRumourWindow = StoreRentWindow = None return def CloseStoreWindow (): import GUIINV global StoreWindow, ActionWindow, PortraitWindow global OldPortraitWindow GemRB.SetVar ("Inventory", 0) CloseWindows () if StoreWindow: StoreWindow.Unload () if ActionWindow: ActionWindow.Unload () if not GUICommon.GameIsBG1(): if PortraitWindow: PortraitWindow.Unload () StoreWindow = None GemRB.LeaveStore () if not GUICommon.GameIsBG1(): GUICommonWindows.PortraitWindow = OldPortraitWindow if Inventory: GUIINV.OpenInventoryWindow () else: GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE) #enabling the game control screen GemRB.UnhideGUI () #enabling the other windows GUICommonWindows.SetSelectionChangeHandler( None ) return def OpenStoreWindow (): global Store global StoreWindow, ActionWindow, PortraitWindow global OldPortraitWindow global store_funcs global Inventory, RepModTable, BarteringPC #these are function pointers, not strings #can't put this in global init, doh! store_funcs = (OpenStoreShoppingWindow, OpenStoreIdentifyWindow,OpenStoreStealWindow, OpenStoreHealWindow, OpenStoreDonateWindow, OpenStoreRumourWindow,OpenStoreRentWindow ) RepModTable = GemRB.LoadTable ("repmodst") GemRB.HideGUI () GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE) #removing the game control screen if GemRB.GetVar ("Inventory"): Inventory = 1 else: Inventory = None GemRB.SetVar ("Action", 0) if GUICommon.GameIsIWD2(): GemRB.LoadWindowPack ("GUISTORE", 800, 600) else: GemRB.LoadWindowPack ("GUISTORE", 640, 480) StoreWindow = Window = GemRB.LoadWindow (3) #saving the original portrait window OldPortraitWindow = GUICommonWindows.PortraitWindow if GUICommon.GameIsIWD2() or GUICommon.GameIsBG1(): #PortraitWindow = GUICommonWindows.OpenPortraitWindow () pass else: PortraitWindow = GUICommonWindows.OpenPortraitWindow (0) ActionWindow = GemRB.LoadWindow (0) #this window is static and grey, but good to stick the frame onto ActionWindow.SetFrame () Store = GemRB.GetStore () BarteringPC = GemRB.GameGetFirstSelectedPC () # Done Button = Window.GetControl (0) Button.SetText (11973) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, CloseStoreWindow) #Store type icon if not GUICommon.GameIsIWD2(): Button = Window.GetControl (5) Button.SetSprites (storebams[Store['StoreType']],0,0,0,0,0) #based on shop type, these buttons will change store_type = Store['StoreType'] store_buttons = Store['StoreButtons'] for i in range (4): Buttons[i] = Button = Window.GetControl (i+1) Action = store_buttons[i] Button.SetVarAssoc ("Action", i) if Action>=0: Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR) if GUICommon.GameIsIWD1() or GUICommon.GameIsIWD2(): Button.SetSprites ("GUISTBBC", Action, 1,2,0,0) else: Button.SetSprites ("GUISTBBC", Action, 0,1,2,0) Button.SetTooltip (storetips[Action]) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, store_funcs[Action]) Button.SetState (IE_GUI_BUTTON_ENABLED) else: Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_OR) Button.SetTooltip ("") Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, None) Button.SetState (IE_GUI_BUTTON_DISABLED) ActionWindow.SetVisible (WINDOW_VISIBLE) Window.SetVisible (WINDOW_VISIBLE) store_funcs[store_buttons[0]] () if not GUICommon.GameIsIWD2(): if GUICommon.GameIsBG1(): GUICommonWindows.PortraitWindow.SetVisible (WINDOW_VISIBLE) else: PortraitWindow.SetVisible (WINDOW_VISIBLE) return def OpenStoreShoppingWindow (): global StoreShoppingWindow global LeftButton, RightButton CloseWindows() StoreShoppingWindow = Window = GemRB.LoadWindow (2) # left scrollbar ScrollBarLeft = Window.GetControl (11) ScrollBarLeft.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreShoppingWindow) # right scrollbar ScrollBarRight = Window.GetControl (12) ScrollBarRight.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreShoppingWindow) if Inventory: # Title Label = Window.GetControl (0xfffffff) if GUICommon.GameIsIWD1() or GUICommon.GameIsIWD2(): Label.SetText (26291) elif GUICommon.GameIsBG2(): Label.SetText (51881) else: Label.SetText ("") # buy price ... Label = Window.GetControl (0x1000002b) Label.SetText ("") # sell price ... Label = Window.GetControl (0x1000002c) Label.SetText ("") # buy price ... Label = Window.GetControl (0x1000002f) Label.SetText ("") # sell price ... Label = Window.GetControl (0x10000030) Label.SetText ("") else: # buy price ... Label = Window.GetControl (0x1000002b) Label.SetText ("0") # sell price ... Label = Window.GetControl (0x1000002c) Label.SetText ("0") for i in range (ItemButtonCount): Button = Window.GetControl (i+5) if GUICommon.GameIsBG2(): Button.SetBorder (0,0,0,0,0,0,0,128,160,0,1) else: Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SelectBuy) Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoLeftWindow) Button.AttachScrollBar (ScrollBarLeft) Button = Window.GetControl (i+13) if GUICommon.GameIsBG2(): Button.SetBorder (0,0,0,0,0,0,0,128,160,0,1) Button.SetSprites ("GUIBTBUT", 0, 0,1,2,5) else: Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1) if Store['StoreType'] != 3: # can't sell to temples Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SelectSell) Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoRightWindow) Button.AttachScrollBar (ScrollBarRight) # Buy LeftButton = Button = Window.GetControl (2) if Inventory: if GUICommon.GameIsIWD2(): Button.SetText (26287) elif GUICommon.GameIsIWD1(): Button.SetText (26288) elif GUICommon.GameIsBG2(): Button.SetText (51882) else: Button.SetText ("") Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ToBackpackPressed) else: Button.SetText (13703) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, BuyPressed) # Sell RightButton = Button = Window.GetControl (3) if Inventory: if GUICommon.GameIsIWD1() or GUICommon.GameIsIWD2(): Button.SetText (26288) elif GUICommon.GameIsBG2(): Button.SetText (51883) else: Button.SetText ("") Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ToBagPressed) else: Button.SetText (13704) if Store['StoreType'] != 3: # can't sell to temples Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SellPressed) # inactive button if GUICommon.GameIsBG2(): Button = Window.GetControl (50) Button.SetState (IE_GUI_BUTTON_LOCKED) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET) #backpack Button = Window.GetControl (44) Button.SetState (IE_GUI_BUTTON_LOCKED) # encumbrance Label = Window.CreateLabel (0x10000043, 15,325,60,15,"NUMBER","0:",IE_FONT_ALIGN_LEFT|IE_FONT_ALIGN_TOP) Label = Window.CreateLabel (0x10000044, 15,365,80,15,"NUMBER","0:",IE_FONT_ALIGN_RIGHT|IE_FONT_ALIGN_TOP) GUICommonWindows.SetSelectionChangeHandler( UpdateStoreShoppingWindow ) UpdateStoreShoppingWindow () Window.SetVisible (WINDOW_VISIBLE) return def OpenStoreIdentifyWindow (): global StoreIdentifyWindow global LeftButton GemRB.SetVar ("Index", -1) GemRB.SetVar ("TopIndex", 0) CloseWindows() StoreIdentifyWindow = Window = GemRB.LoadWindow (4) ScrollBar = Window.GetControl (7) ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreIdentifyWindow) TextArea = Window.GetControl (23) TextArea.SetFlags (IE_GUI_TEXTAREA_AUTOSCROLL) # Identify LeftButton = Button = Window.GetControl (5) Button.SetText (14133) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, IdentifyPressed) Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoIdentifyWindow) # price ... Label = Window.GetControl (0x10000003) Label.SetText ("0") # 8-11 item slots, 0x1000000c-f labels for i in range (ItemButtonCount): Button = Window.GetControl (i+8) Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR) if GUICommon.GameIsIWD1() or GUICommon.GameIsIWD2(): Button.SetSprites ("GUISTMSC", 0, 1,2,0,3) Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1) elif GUICommon.GameIsBG1(): Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1) else: Button.SetBorder (0,0,0,0,0,0,0,128,160,0,1) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SelectID) Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoIdentifyWindow) Button.AttachScrollBar (ScrollBar) GUICommonWindows.SetSelectionChangeHandler( UpdateStoreIdentifyWindow ) UpdateStoreIdentifyWindow () Window.SetVisible (WINDOW_VISIBLE) return def OpenStoreStealWindow (): global StoreStealWindow global LeftButton GemRB.SetVar ("RightIndex", 0) GemRB.SetVar ("LeftIndex", 0) GemRB.SetVar ("RightTopIndex", 0) GemRB.SetVar ("LeftTopIndex", 0) CloseWindows() StoreStealWindow = Window = GemRB.LoadWindow (6) # left scrollbar ScrollBarLeft = Window.GetControl (9) ScrollBarLeft.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreStealWindow) # right scrollbar ScrollBarRight = Window.GetControl (10) ScrollBarRight.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, RedrawStoreStealWindow) for i in range (ItemButtonCount): Button = Window.GetControl (i+4) if GUICommon.GameIsBG2(): Button.SetBorder (0,0,0,0,0,0,0,128,160,0,1) else: Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RedrawStoreStealWindow) Button.AttachScrollBar (ScrollBarLeft) Button = Window.GetControl (i+11) if GUICommon.GameIsBG2(): Button.SetBorder (0,0,0,0,0,0,0,128,160,0,1) else: Button.SetBorder (0,0,0,0,0,32,32,192,128,0,1) Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoRightWindow) Button.AttachScrollBar (ScrollBarRight) # Steal LeftButton = Button = Window.GetControl (1) Button.SetText (14179) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, StealPressed) Button = Window.GetControl (37) Button.SetState (IE_GUI_BUTTON_LOCKED) # encumbrance Label = Window.CreateLabel (0x10000043, 15,325,60,15,"NUMBER","0:",IE_FONT_ALIGN_LEFT|IE_FONT_ALIGN_TOP) Label = Window.CreateLabel (0x10000044, 15,365,80,15,"NUMBER","0:",IE_FONT_ALIGN_RIGHT|IE_FONT_ALIGN_TOP) GUICommonWindows.SetSelectionChangeHandler( UpdateStoreStealWindow ) UpdateStoreStealWindow () Window.SetVisible (WINDOW_VISIBLE) return def OpenStoreDonateWindow (): global StoreDonateWindow CloseWindows () StoreDonateWindow = Window = GemRB.LoadWindow (9) # graphics Button = Window.GetControl (10) Button.SetFlags (IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_ANIMATED|IE_GUI_BUTTON_PLAYONCE, OP_OR) Button.SetState (IE_GUI_BUTTON_LOCKED) # Donate Button = Window.GetControl (3) Button.SetText (15101) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, DonateGold) Button.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR) # Entry Field = Window.GetControl (5) Field.SetText ("0") Field.SetEvent (IE_GUI_EDIT_ON_CHANGE, UpdateStoreDonateWindow) Field.SetStatus (IE_GUI_EDIT_NUMBER|IE_GUI_CONTROL_FOCUSED) # + Button = Window.GetControl (6) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, IncrementDonation) # - Button = Window.GetControl (7) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, DecrementDonation) GUICommonWindows.SetSelectionChangeHandler( UpdateStoreDonateWindow ) UpdateStoreDonateWindow () Window.SetVisible (WINDOW_VISIBLE) return def OpenStoreHealWindow (): global StoreHealWindow GemRB.SetVar ("Index", -1) GemRB.SetVar ("TopIndex", 0) CloseWindows() StoreHealWindow = Window = GemRB.LoadWindow (5) ScrollBar = Window.GetControl (7) ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, UpdateStoreHealWindow) #spell buttons for i in range (ItemButtonCount): Button = Window.GetControl (i+8) Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateStoreHealWindow) Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, InfoHealWindow) #Button.AttachScrollBar (ScrollBar) # price tag Label = Window.GetControl (0x10000003) Label.SetText ("0") # Heal Button = Window.GetControl (5) Button.SetText (13703) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, BuyHeal) Button.SetState (IE_GUI_BUTTON_DISABLED) Count = Store['StoreCureCount'] if Count>4: Count = Count-4 else: Count = 0 ScrollBar.SetVarAssoc ("TopIndex", Count+1) UpdateStoreHealWindow () Window.SetVisible (WINDOW_VISIBLE) return def OpenStoreRumourWindow (): global StoreRumourWindow GemRB.SetVar ("TopIndex", 0) CloseWindows() StoreRumourWindow = Window = GemRB.LoadWindow (8) #removing those pesky labels for i in range (5): Window.DeleteControl (0x10000005+i) TextArea = Window.GetControl (11) TextArea.SetText (14144) #tavern quality image if GUICommon.GameIsBG1() or GUICommon.GameIsBG2(): BAM = "TVRNQUL%d"% ((Store['StoreFlags']>>9)&3) Button = Window.GetControl (12) Button.SetSprites (BAM, 0, 0, 0, 0, 0) Button.SetState (IE_GUI_BUTTON_LOCKED) ScrollBar = Window.GetControl (5) ScrollBar.SetEvent (IE_GUI_SCROLLBAR_ON_CHANGE, UpdateStoreRumourWindow) Count = Store['StoreDrinkCount'] if Count>4: Count = Count-4 else: Count = 0 ScrollBar.SetVarAssoc ("TopIndex", Count+1) UpdateStoreRumourWindow () Window.SetVisible (WINDOW_VISIBLE) return def OpenStoreRentWindow (): global StoreRentWindow, RentIndex CloseWindows() StoreRentWindow = Window = GemRB.LoadWindow (7) # room types RentIndex = -1 for i in range (4): ok = Store['StoreRoomPrices'][i] Button = Window.GetControl (i) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateStoreRentWindow) if ok<0: Button.SetState (IE_GUI_BUTTON_DISABLED) #disabled room icons are selected, not disabled else: Button.SetVarAssoc ("RentIndex", i) if RentIndex==-1: RentIndex = i Button = Window.GetControl (i+4) Button.SetText (14294+i) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateStoreRentWindow) Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR) Button.SetVarAssoc ("RentIndex", i) if GUICommon.GameIsBG1(): #these bioware guys screw up everything possible #remove this line if you fixed guistore Button.SetSprites ("GUISTROC",0, 1,2,0,3) if ok<0: Button.SetState (IE_GUI_BUTTON_DISABLED) # Rent Button = Window.GetControl (11) Button.SetText (14293) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RentRoom) GemRB.SetVar ("RentIndex", RentIndex) UpdateStoreRentWindow () Window.SetVisible (WINDOW_VISIBLE) return def UpdateStoreCommon (Window, title, name, gold): Label = Window.GetControl (title) Label.SetText (Store['StoreName']) if name: pc = GemRB.GameGetSelectedPCSingle () Label = Window.GetControl (name) Label.SetText (GemRB.GetPlayerName (pc, 0) ) Label = Window.GetControl (gold) Label.SetText (str(GemRB.GameGetPartyGold ())) return def GetPC(): global PreviousPC if PreviousPC: pc = GemRB.GameGetSelectedPCSingle () if PreviousPC != pc: PreviousPC = pc # reset the store indices, to prevent overscrolling GemRB.SetVar ("RightIndex", 0) GemRB.SetVar ("LeftIndex", 0) GemRB.SetVar ("RightTopIndex", 0) GemRB.SetVar ("LeftTopIndex", 0) GemRB.SetVar ("Index", 0) GemRB.SetVar ("TopIndex", 0) else: PreviousPC = GemRB.GameGetSelectedPCSingle () pc = PreviousPC return pc def UpdateStoreShoppingWindow (): global Store, inventory_slots Window = StoreShoppingWindow #reget store in case of a change Store = GemRB.GetStore () pc = GetPC() LeftCount = Store['StoreItemCount'] - ItemButtonCount + 1 if LeftCount<0: LeftCount=0 ScrollBar = Window.GetControl (11) ScrollBar.SetVarAssoc ("LeftTopIndex", LeftCount) LeftTopIndex = GemRB.GetVar ("LeftTopIndex") if LeftTopIndex>LeftCount: GemRB.SetVar ("LeftTopIndex", LeftCount) pc = GemRB.GameGetSelectedPCSingle () inventory_slots = GemRB.GetSlots (pc, SLOT_INVENTORY) RightCount = len(inventory_slots) - ItemButtonCount + 1 if RightCount<0: RightCount=0 ScrollBar = Window.GetControl (12) ScrollBar.SetVarAssoc ("RightTopIndex", RightCount) RightTopIndex = GemRB.GetVar ("RightTopIndex") if RightTopIndex>RightCount: GemRB.SetVar ("RightTopIndex", RightCount) RedrawStoreShoppingWindow () return def SelectID (): pc = GemRB.GameGetSelectedPCSingle () Index = GemRB.GetVar ("Index") GemRB.ChangeStoreItem (pc, inventory_slots[Index], SHOP_ID|SHOP_SELECT) RedrawStoreIdentifyWindow () return def SelectBuy (): Window = StoreShoppingWindow pc = GemRB.GameGetSelectedPCSingle () LeftIndex = GemRB.GetVar ("LeftIndex") GemRB.ChangeStoreItem (pc, LeftIndex, SHOP_BUY|SHOP_SELECT) RedrawStoreShoppingWindow () return def ToBackpackPressed (): Window = StoreShoppingWindow pc = GemRB.GameGetSelectedPCSingle () LeftCount = Store['StoreItemCount'] #going backwards because removed items shift the slots for i in range (LeftCount, 0, -1): Flags = GemRB.IsValidStoreItem (pc, i-1, ITEM_STORE)&SHOP_SELECT if Flags: GemRB.ChangeStoreItem (pc, i-1, SHOP_BUY) UpdateStoreShoppingWindow () return def BuyPressed (): Window = StoreShoppingWindow if (BuySum>GemRB.GameGetPartyGold ()): ErrorWindow (11047) return pc = GemRB.GameGetSelectedPCSingle () LeftCount = Store['StoreItemCount'] #going backwards because removed items shift the slots for i in range (LeftCount, 0, -1): Flags = GemRB.IsValidStoreItem (pc, i-1, ITEM_STORE)&SHOP_SELECT if Flags: Slot = GemRB.GetStoreItem (i-1) Item = GemRB.GetItem (Slot['ItemResRef']) Price = GetRealPrice (pc, "sell", Item, Slot) if Price <= 0: Price = 1 if GemRB.ChangeStoreItem (pc, i-1, SHOP_BUY): GemRB.GameSetPartyGold (GemRB.GameGetPartyGold ()-Price) UpdateStoreShoppingWindow () return def SelectSell (): Window = StoreShoppingWindow pc = GemRB.GameGetSelectedPCSingle () RightIndex = GemRB.GetVar ("RightIndex") GemRB.ChangeStoreItem (pc, inventory_slots[RightIndex], SHOP_SELL|SHOP_SELECT) RedrawStoreShoppingWindow () return def ToBagPressed (): Window = StoreShoppingWindow pc = GemRB.GameGetSelectedPCSingle () RightCount = len (inventory_slots) #no need to go reverse for Slot in range (RightCount): Flags = GemRB.IsValidStoreItem (pc, inventory_slots[Slot], ITEM_PC) if Flags & SHOP_SELECT: GemRB.ChangeStoreItem (pc, inventory_slots[Slot], SHOP_SELL) UpdateStoreShoppingWindow () return def SellPressed (): Window = StoreShoppingWindow pc = GemRB.GameGetSelectedPCSingle () RightCount = len (inventory_slots) #no need to go reverse for Slot in range (RightCount): Flags = GemRB.IsValidStoreItem (pc, inventory_slots[Slot], ITEM_PC) & SHOP_SELECT if Flags: GemRB.ChangeStoreItem (pc, inventory_slots[Slot], SHOP_SELL) GemRB.GameSetPartyGold (GemRB.GameGetPartyGold ()+SellSum) UpdateStoreShoppingWindow () return def RedrawStoreShoppingWindow (): global BuySum, SellSum Window = StoreShoppingWindow UpdateStoreCommon (Window, 0x10000003, 0x1000002e, 0x1000002a) pc = GemRB.GameGetSelectedPCSingle () LeftTopIndex = GemRB.GetVar ("LeftTopIndex") LeftIndex = GemRB.GetVar ("LeftIndex") RightTopIndex = GemRB.GetVar ("RightTopIndex") RightIndex = GemRB.GetVar ("RightIndex") idx = [ LeftTopIndex, RightTopIndex, LeftIndex, RightIndex ] LeftCount = Store['StoreItemCount'] BuySum = 0 for i in range (LeftCount): if GemRB.IsValidStoreItem (pc, i, ITEM_STORE) & SHOP_SELECT: Slot = GemRB.GetStoreItem (i) Item = GemRB.GetItem (Slot['ItemResRef']) if Inventory: Price = 1 else: Price = GetRealPrice (pc, "sell", Item, Slot) if Price <= 0: Price = 1 BuySum = BuySum + Price RightCount = len(inventory_slots) SellSum = 0 for i in range (RightCount): Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i], ITEM_PC) if Flags & SHOP_SELECT: Slot = GemRB.GetSlotItem (pc, inventory_slots[i]) Item = GemRB.GetItem (Slot['ItemResRef']) if Inventory: Price = 1 else: Price = GetRealPrice (pc, "buy", Item, Slot) if Flags & SHOP_ID: Price = 1 SellSum = SellSum + Price Label = Window.GetControl (0x1000002b) if Inventory: Label.SetText ("") else: Label.SetText (str(BuySum) ) if BuySum: LeftButton.SetState (IE_GUI_BUTTON_ENABLED) else: LeftButton.SetState (IE_GUI_BUTTON_DISABLED) Label = Window.GetControl (0x1000002c) if Inventory: Label.SetText ("") else: Label.SetText (str(SellSum) ) if SellSum: RightButton.SetState (IE_GUI_BUTTON_ENABLED) else: RightButton.SetState (IE_GUI_BUTTON_DISABLED) for i in range (ItemButtonCount): if i+LeftTopIndex<LeftCount: Slot = GemRB.GetStoreItem (i+LeftTopIndex) else: Slot = None Button = Window.GetControl (i+5) Label = Window.GetControl (0x10000012+i) Button.SetVarAssoc ("LeftIndex", LeftTopIndex+i) SetupItems (pc, Slot, Button, Label, i, ITEM_STORE, idx) if i+RightTopIndex<RightCount: Slot = GemRB.GetSlotItem (pc, inventory_slots[i+RightTopIndex]) else: Slot = None Button = Window.GetControl (i+13) Label = Window.GetControl (0x1000001e+i) Button.SetVarAssoc ("RightIndex", RightTopIndex+i) SetupItems (pc, Slot, Button, Label, i, ITEM_PC, idx) return def UpdateStoreIdentifyWindow (): global inventory_slots Window = StoreIdentifyWindow pc = GetPC() inventory_slots = GemRB.GetSlots (pc, SLOT_INVENTORY) Count = len(inventory_slots) ScrollBar = Window.GetControl (7) ScrollBar.SetVarAssoc ("TopIndex", Count-ItemButtonCount+1) GemRB.SetVar ("Index", -1) RedrawStoreIdentifyWindow () return def RedrawStoreIdentifyWindow (): Window = StoreIdentifyWindow UpdateStoreCommon (Window, 0x10000000, 0x10000005, 0x10000001) TopIndex = GemRB.GetVar ("TopIndex") Index = GemRB.GetVar ("Index") pc = GemRB.GameGetSelectedPCSingle () Count = len(inventory_slots) IDPrice = Store['IDPrice'] Selected = 0 for Slot in range (0, Count): flags = GemRB.IsValidStoreItem (pc, inventory_slots[Slot], ITEM_PC) if flags & SHOP_ID and flags & SHOP_SELECT: Selected += 1 for i in range (ItemButtonCount): if TopIndex+i<Count: Slot = GemRB.GetSlotItem (pc, inventory_slots[TopIndex+i]) else: Slot = None Button = Window.GetControl (i+8) # TODO: recheck they really differ if GUICommon.GameIsIWD2(): Label = Window.GetControl (0x1000000d+i) else: Label = Window.GetControl (0x1000000c+i) Button.SetVarAssoc ("Index", TopIndex+i) if Slot: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[TopIndex+i], ITEM_PC) Item = GemRB.GetItem (Slot['ItemResRef']) Button.SetItemIcon (Slot['ItemResRef'], 0) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND) Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_OR) if Flags & SHOP_ID: if Flags & SHOP_SELECT: Button.SetState (IE_GUI_BUTTON_SELECTED) else: Button.SetState (IE_GUI_BUTTON_ENABLED) GemRB.SetToken ("ITEMNAME", GemRB.GetString (Item['ItemName'])) GemRB.SetToken ("ITEMCOST", str(IDPrice) ) Button.EnableBorder (0, 1) else: Button.SetState (IE_GUI_BUTTON_DISABLED) GemRB.SetToken ("ITEMNAME", GemRB.GetString (Item['ItemNameIdentified'])) GemRB.SetToken ("ITEMCOST", str(0) ) Button.EnableBorder (0, 0) Label.SetText (10162) else: Button.SetState (IE_GUI_BUTTON_DISABLED) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_OR) Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_NAND) Label.SetText ("") Button = Window.GetControl (5) Label = Window.GetControl (0x10000003) if Selected: Button.SetState (IE_GUI_BUTTON_ENABLED) Label.SetText (str(IDPrice * Selected) ) else: Button.SetState (IE_GUI_BUTTON_DISABLED) Label.SetText (str(0) ) return def IdentifyPressed (): pc = GemRB.GameGetSelectedPCSingle () Count = len(inventory_slots) # get all the selected items toID = [] for Slot in range (0, Count): Flags = GemRB.IsValidStoreItem (pc, inventory_slots[Slot], ITEM_PC) if Flags & SHOP_SELECT and Flags & SHOP_ID: toID.append(Slot) # enough gold? EndGold = GemRB.GameGetPartyGold () - Store['IDPrice'] * len(toID) if EndGold < 0: return # identify Window = StoreIdentifyWindow TextArea = Window.GetControl (23) for i in toID: GemRB.ChangeStoreItem (pc, inventory_slots[i], SHOP_ID) Slot = GemRB.GetSlotItem (pc, inventory_slots[i]) Item = GemRB.GetItem (Slot['ItemResRef']) # FIXME: some items have the title, some don't - figure it out TextArea.Append(Item['ItemNameIdentified']) TextArea.Append("\n\n") TextArea.Append(Item['ItemDescIdentified']) TextArea.Append("\n\n\n") GemRB.GameSetPartyGold (EndGold) UpdateStoreIdentifyWindow () return def InfoIdentifyWindow (): Index = GemRB.GetVar ("Index") pc = GemRB.GameGetSelectedPCSingle () Count = len(inventory_slots) if Index >= Count: return Slot = GemRB.GetSlotItem (pc, inventory_slots[Index]) Item = GemRB.GetItem (Slot['ItemResRef']) InfoWindow (Slot, Item) return def InfoLeftWindow (): Index = GemRB.GetVar ("LeftIndex") Slot = GemRB.GetStoreItem (Index) Item = GemRB.GetItem (Slot['ItemResRef']) InfoWindow (Slot, Item) return def InfoRightWindow (): Index = GemRB.GetVar ("RightIndex") pc = GemRB.GameGetSelectedPCSingle () Count = len(inventory_slots) if Index >= Count: return Slot = GemRB.GetSlotItem (pc, inventory_slots[Index]) Item = GemRB.GetItem (Slot['ItemResRef']) InfoWindow (Slot, Item) return def InfoWindow (Slot, Item): global MessageWindow Identify = Slot['Flags'] & IE_INV_ITEM_IDENTIFIED MessageWindow = Window = GemRB.LoadWindow (12) #fake label Label = Window.GetControl (0x10000000) Label.SetText ("") #description bam if GUICommon.GameIsBG1() or GUICommon.GameIsBG2(): Button = Window.GetControl (7) Button.SetItemIcon (Slot['ItemResRef'], 2) #slot bam Button = Window.GetControl (2) Button.SetItemIcon (Slot['ItemResRef'], 0) Label = Window.GetControl (0x10000007) TextArea = Window.GetControl (5) if Identify: Label.SetText (Item['ItemNameIdentified']) TextArea.SetText (Item['ItemDescIdentified']) else: Label.SetText (Item['ItemName']) TextArea.SetText (Item['ItemDesc']) #Done Button = Window.GetControl (4) Button.SetText (11973) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ErrorDone) # hide the empty button if GUICommon.GameIsBG2() or GUICommon.GameIsIWD2(): Window.DeleteControl (9) Window.ShowModal (MODAL_SHADOW_GRAY) return def UpdateStoreStealWindow (): global Store, inventory_slots Window = StoreStealWindow #reget store in case of a change Store = GemRB.GetStore () LeftCount = Store['StoreItemCount'] ScrollBar = Window.GetControl (9) ScrollBar.SetVarAssoc ("LeftTopIndex", LeftCount-ItemButtonCount+1) pc = GetPC() inventory_slots = GemRB.GetSlots (pc, SLOT_INVENTORY) RightCount = len(inventory_slots) ScrollBar = Window.GetControl (10) ScrollBar.SetVarAssoc ("RightTopIndex", RightCount-ItemButtonCount+1) GemRB.SetVar ("LeftIndex", -1) LeftButton.SetState (IE_GUI_BUTTON_DISABLED) RedrawStoreStealWindow () return def StealPressed (): Window = StoreShoppingWindow LeftIndex = GemRB.GetVar ("LeftIndex") pc = GemRB.GameGetSelectedPCSingle () #percentage skill check, if fails, trigger StealFailed #if difficulty = 0 and skill=100, automatic success #if difficulty = 0 and skill=50, 50% success #if difficulty = 50 and skill=50, 0% success #if skill>random(100)+difficulty - success if GUICommon.CheckStat100 (pc, IE_PICKPOCKET, Store['StealFailure']): GemRB.ChangeStoreItem (pc, LeftIndex, SHOP_STEAL) UpdateStoreStealWindow () else: GemRB.StealFailed () CloseStoreWindow () return def RedrawStoreStealWindow (): Window = StoreStealWindow UpdateStoreCommon (Window, 0x10000002, 0x10000027, 0x10000023) LeftTopIndex = GemRB.GetVar ("LeftTopIndex") LeftIndex = GemRB.GetVar ("LeftIndex") RightTopIndex = GemRB.GetVar ("RightTopIndex") RightIndex = GemRB.GetVar ("RightIndex") idx = [ LeftTopIndex, RightTopIndex, LeftIndex, RightIndex ] LeftCount = Store['StoreItemCount'] pc = GemRB.GameGetSelectedPCSingle () RightCount = len(inventory_slots) for i in range (ItemButtonCount): Slot = GemRB.GetStoreItem (i+LeftTopIndex) Button = Window.GetControl (i+4) Label = Window.GetControl (0x1000000f+i) Button.SetVarAssoc ("LeftIndex", LeftTopIndex+i) SetupItems (pc, Slot, Button, Label, i, ITEM_STORE, idx, 1) if i+RightTopIndex<RightCount: Slot = GemRB.GetSlotItem (pc, inventory_slots[i+RightTopIndex]) else: Slot = None Button = Window.GetControl (i+11) Label = Window.GetControl (0x10000019+i) Button.SetVarAssoc ("RightIndex", RightTopIndex+i) SetupItems (pc, Slot, Button, Label, i, ITEM_PC, idx, 1) if LeftIndex>=0: LeftButton.SetState (IE_GUI_BUTTON_ENABLED) else: LeftButton.SetState (IE_GUI_BUTTON_DISABLED) return def SetupItems (pc, Slot, Button, Label, i, type, idx, steal=0): if Slot == None: Button.SetState (IE_GUI_BUTTON_DISABLED) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_OR) Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_NAND) Label.SetText ("") else: LeftTopIndex = idx[0] RightTopIndex = idx[1] LeftIndex = idx[2] Item = GemRB.GetItem (Slot['ItemResRef']) Button.SetItemIcon (Slot['ItemResRef'], 0) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND) Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_OR) if type == ITEM_STORE: Price = GetRealPrice (pc, "buy", Item, Slot) Flags = GemRB.IsValidStoreItem (pc, i+LeftTopIndex, type) if steal: Button.SetState (IE_GUI_BUTTON_ENABLED) else: if Flags & SHOP_BUY: if Flags & SHOP_SELECT: Button.SetState (IE_GUI_BUTTON_SELECTED) else: Button.SetState (IE_GUI_BUTTON_ENABLED) else: Button.SetState (IE_GUI_BUTTON_DISABLED) if not Inventory: Price = GetRealPrice (pc, "sell", Item, Slot) if Price <= 0: Price = 1 else: Flags = GemRB.IsValidStoreItem (pc, inventory_slots[i+RightTopIndex], type) if Flags & SHOP_STEAL: if LeftIndex == LeftTopIndex + i: Button.SetState (IE_GUI_BUTTON_SELECTED) else: Button.SetState (IE_GUI_BUTTON_ENABLED) else: Button.SetState (IE_GUI_BUTTON_DISABLED) if steal: Price = Slot['Price'] else: if Inventory: Price = 1 else: Price = GetRealPrice (pc, "buy", Item, Slot) if (Price>0) and (Flags & SHOP_SELL): if Flags & SHOP_SELECT: Button.SetState (IE_GUI_BUTTON_SELECTED) else: Button.SetState (IE_GUI_BUTTON_ENABLED) else: Button.SetState (IE_GUI_BUTTON_DISABLED) if Flags & SHOP_ID: GemRB.SetToken ("ITEMNAME", GemRB.GetString (Item['ItemName'])) Button.EnableBorder (0, 1) if not steal and type == ITEM_PC: Price = 1 else: GemRB.SetToken ("ITEMNAME", GemRB.GetString (Item['ItemNameIdentified'])) Button.EnableBorder (0, 0) if Inventory: if GUICommon.GameIsIWD1() or GUICommon.GameIsIWD2(): Label.SetText (24890) elif GUICommon.GameIsBG2(): Label.SetText (28337) else: Label.SetText ("") else: GemRB.SetToken ("ITEMCOST", str(Price) ) Label.SetText (10162) def GetRealPrice (pc, mode, Item, Slot): # get the base from the item price = Item['Price'] # modifier from store properties (in percent) if mode == "buy": mod = Store['BuyMarkup'] else: mod = Store['SellMarkup'] # depreciation works like this: # - if you sell the item the first time, SellMarkup is used; # - if you sell the item the second time, SellMarkup-DepreciationRate is used; # - if you sell the item any more times, SellMarkup-2*DepreciationRate is used. # If the storekeep has an infinite amount of the item, only SellMarkup is used. # The amount of items sold at the same time doesn't matter! Selling three bows # separately will produce less gold then selling them at the same time. # We don't care who is the seller, so if the store already has 2 items, there'll be no gain if mode == "buy": count = GemRB.FindStoreItem (Slot["ItemResRef"]) if count: oc = count if count > 2: count = 2 mod -= count * Store['Depreciation'] # charisma modifier (in percent) mod += GemRB.GetAbilityBonus (IE_CHR, GemRB.GetPlayerStat (BarteringPC, IE_CHR) - 1, 0) # reputation modifier (in percent, but absolute) mod = mod * RepModTable.GetValue (0, GemRB.GameGetReputation()/10 - 1) / 100 return price * mod / 100 def UpdateStoreDonateWindow (): Window = StoreDonateWindow UpdateStoreCommon (Window, 0x10000007, 0, 0x10000008) Field = Window.GetControl (5) donation = int("0"+Field.QueryText ()) gold = GemRB.GameGetPartyGold () if donation>gold: donation = gold Field.SetText (str(gold) ) Button = Window.GetControl (3) if donation: Button.SetState (IE_GUI_BUTTON_ENABLED) else: Button.SetState (IE_GUI_BUTTON_DISABLED) return def IncrementDonation (): Window = StoreDonateWindow Field = Window.GetControl (5) donation = int("0"+Field.QueryText ()) if donation<GemRB.GameGetPartyGold (): Field.SetText (str(donation+1) ) else: Field.SetText (str(GemRB.GameGetPartyGold ()) ) UpdateStoreDonateWindow () return def DecrementDonation (): Window = StoreDonateWindow Field = Window.GetControl (5) donation = int("0"+Field.QueryText ()) if donation>0: Field.SetText (str(donation-1) ) else: Field.SetText (str(0) ) UpdateStoreDonateWindow () return def DonateGold (): Window = StoreDonateWindow TextArea = Window.GetControl (0) TextArea.SetFlags (IE_GUI_TEXTAREA_AUTOSCROLL) Button = Window.GetControl (10) Button.SetAnimation ("DONATE") Field = Window.GetControl (5) donation = int("0"+Field.QueryText ()) GemRB.GameSetPartyGold (GemRB.GameGetPartyGold ()-donation) if GemRB.IncreaseReputation (donation): TextArea.Append (10468, -1) GemRB.PlaySound ("act_03") UpdateStoreDonateWindow () return TextArea.Append (10469, -1) GemRB.PlaySound ("act_03e") UpdateStoreDonateWindow () return def UpdateStoreHealWindow (): Window = StoreHealWindow UpdateStoreCommon (Window, 0x10000000, 0, 0x10000001) TopIndex = GemRB.GetVar ("TopIndex") Index = GemRB.GetVar ("Index") pc = GemRB.GameGetSelectedPCSingle () for i in range (ItemButtonCount): Cure = GemRB.GetStoreCure (TopIndex+i) Button = Window.GetControl (i+8) Label = Window.GetControl (0x1000000c+i) Button.SetVarAssoc ("Index", TopIndex+i) if Cure: Spell = GemRB.GetSpell (Cure['CureResRef']) Button.SetSpellIcon (Cure['CureResRef'], 1) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND) Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_OR) dead = GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD # toggle raise dead/resurrect based on state # unfortunately the flags are not set properly in iwd print "UpdateStoreHealWindow", dead, Cure['CureResRef'], Spell["SpellTargetType"] if (dead and Spell["SpellTargetType"] != 3) or \ (not dead and Spell["SpellTargetType"] == 3): # 3 - non-living # locked and shaded Button.SetState (IE_GUI_BUTTON_DISABLED) Button.SetBorder (0, 0,0, 0,0, 200,0,0,100, 1,1) else: Button.SetState (IE_GUI_BUTTON_ENABLED) Button.SetBorder (0, 0,0, 0,0, 0,0,0,0, 0,0) GemRB.SetToken ("ITEMNAME", GemRB.GetString (Spell['SpellName'])) GemRB.SetToken ("ITEMCOST", str(Cure['Price']) ) Label.SetText (10162) else: Button.SetState (IE_GUI_BUTTON_DISABLED) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_OR) Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_NAND) Button.SetBorder (0, 0,0, 0,0, 0,0,0,0, 0,0) Label.SetText ("") if TopIndex+i==Index: TextArea = Window.GetControl (23) TextArea.SetText (Cure['Description']) Label = Window.GetControl (0x10000003) Label.SetText (str(Cure['Price']) ) Button = Window.GetControl (5) Button.SetState (IE_GUI_BUTTON_ENABLED) return def InfoHealWindow (): global MessageWindow UpdateStoreHealWindow () Index = GemRB.GetVar ("Index") Cure = GemRB.GetStoreCure (Index) Spell = GemRB.GetSpell (Cure['CureResRef']) MessageWindow = Window = GemRB.LoadWindow (14) Label = Window.GetControl (0x10000000) Label.SetText (Spell['SpellName']) Button = Window.GetControl (2) Button.SetSpellIcon (Cure['CureResRef'], 1) TextArea = Window.GetControl (3) TextArea.SetText (Spell['SpellDesc']) #Done Button = Window.GetControl (5) Button.SetText (11973) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ErrorDone) Window.ShowModal (MODAL_SHADOW_GRAY) return def BuyHeal (): Index = GemRB.GetVar ("Index") Cure = GemRB.GetStoreCure (Index) gold = GemRB.GameGetPartyGold () if gold < Cure['Price']: ErrorWindow (11048) return GemRB.GameSetPartyGold (gold-Cure['Price']) pc = GemRB.GameGetSelectedPCSingle () GemRB.ApplySpell (pc, Cure['CureResRef']) UpdateStoreHealWindow () return def UpdateStoreRumourWindow (): Window = StoreRumourWindow UpdateStoreCommon (Window, 0x10000011, 0, 0x10000012) TopIndex = GemRB.GetVar ("TopIndex") for i in range (5): Drink = GemRB.GetStoreDrink (TopIndex+i) Button = Window.GetControl (i) Button.SetVarAssoc ("Index", i) if Drink: GemRB.SetToken ("ITEMNAME", GemRB.GetString (Drink['DrinkName'])) GemRB.SetToken ("ITEMCOST", str(Drink['Price']) ) Button.SetText (10162) Button.SetState (IE_GUI_BUTTON_ENABLED) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, GulpDrink) else: Button.SetText ("") Button.SetState (IE_GUI_BUTTON_DISABLED) return def GulpDrink (): Window = StoreRumourWindow TextArea = Window.GetControl (13) TextArea.SetFlags (IE_GUI_TEXTAREA_AUTOSCROLL) pc = GemRB.GameGetSelectedPCSingle () intox = GemRB.GetPlayerStat (pc, IE_INTOXICATION) intox = 0 if intox > 80: TextArea.Append (10832, -1) return gold = GemRB.GameGetPartyGold () Index = GemRB.GetVar ("TopIndex")+GemRB.GetVar ("Index") Drink = GemRB.GetStoreDrink (Index) if gold < Drink['Price']: ErrorWindow (11049) return GemRB.GameSetPartyGold (gold-Drink['Price']) GemRB.SetPlayerStat (pc, IE_INTOXICATION, intox+Drink['Strength']) text = GemRB.GetRumour (Drink['Strength'], Store['TavernRumour']) TextArea.Append (text, -1) GemRB.PlaySound ("gam_07") UpdateStoreRumourWindow () return def UpdateStoreRentWindow (): global RentIndex Window = StoreRentWindow UpdateStoreCommon (Window, 0x10000008, 0, 0x10000009) RentIndex = GemRB.GetVar ("RentIndex") Button = Window.GetControl (11) Label = Window.GetControl (0x1000000d) if RentIndex>=0: TextArea = Window.GetControl (12) TextArea.SetText (roomtypes[RentIndex] ) price = Store['StoreRoomPrices'][RentIndex] Label.SetText (str(price) ) Button.SetState (IE_GUI_BUTTON_ENABLED) else: Label.SetText ("0" ) Button.SetState (IE_GUI_BUTTON_DISABLED) return def RentConfirm (): RentIndex = GemRB.GetVar ("RentIndex") price = Store['StoreRoomPrices'][RentIndex] Gold = GemRB.GameGetPartyGold () GemRB.GameSetPartyGold (Gold-price) GemRB.RestParty (13, 1, RentIndex+1) if RentConfirmWindow: RentConfirmWindow.Unload () Window = StoreRentWindow TextArea = Window.GetControl (12) #is there any way to change this??? GemRB.SetToken ("HOUR", "8") GemRB.SetToken ("HP", "%d"%(RentIndex+1)) TextArea.SetText (16476) GemRB.SetVar ("RentIndex", -1) Button = Window.GetControl (RentIndex+4) Button.SetState (IE_GUI_BUTTON_ENABLED) UpdateStoreRentWindow () return def RentDeny () : if RentConfirmWindow: RentConfirmWindow.Unload () UpdateStoreRentWindow () return def RentRoom (): global RentIndex, RentConfirmWindow RentIndex = GemRB.GetVar ("RentIndex") price = Store['StoreRoomPrices'][RentIndex] Gold = GemRB.GameGetPartyGold () if Gold<price: ErrorWindow (11051) return RentConfirmWindow = Window = GemRB.LoadWindow (11) #confirm Button = Window.GetControl (0) Button.SetText (17199) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RentConfirm) Button.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR) #deny Button = Window.GetControl (1) Button.SetText (13727) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RentDeny) Button.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR) #textarea TextArea = Window.GetControl (3) TextArea.SetText (15358) Window.ShowModal (MODAL_SHADOW_GRAY) return def ErrorWindow (strref): global MessageWindow MessageWindow = Window = GemRB.LoadWindow (10) TextArea = Window.GetControl (3) TextArea.SetText (strref) #done Button = Window.GetControl (0) Button.SetText (11973) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ErrorDone) Window.ShowModal (MODAL_SHADOW_GRAY) return def ErrorDone (): if MessageWindow: MessageWindow.Unload () return ################################################### # End of file GUISTORE.py
NickDaly/GemRB-FixConfig-Branch
gemrb/GUIScripts/GUISTORE.py
Python
gpl-2.0
42,696
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package test; import java.io.StringReader; import unalcol.io.Read; import unalcol.io.ShortTermMemoryReader; import unalcol.io.Write; import unalcol.random.raw.RawGenerator; import unalcol.random.rngpack.RanMT; import unalcol.types.real.array.DoubleArray; import unalcol.types.real.array.DoubleArrayPlainRead; import unalcol.types.real.array.DoubleArrayPlainWrite; /** * * @author Jonatan */ public class DoubleArrayTest { public static double[] sort(){ RawGenerator g = new RanMT(); int N = 1000; double[] x = g.raw(N); return sort(x); } public static double[] sort( double[] x ){ System.out.println("Sorted array..."); DoubleArray.merge(x); System.out.println(Write.toString(x)); return x; } public static double[] persistency(){ // Registering the PlainRead service (reading double arrays as plain text, // notice that an instance of the Plain read service is provided. Read.set(double[].class, new DoubleArrayPlainRead()); // The first value is the number of real values, followed by the values // to be stored in the double array StringReader r = new StringReader(" 3 -1234.4555e-123 345.6789 23.456"); ShortTermMemoryReader reader = new ShortTermMemoryReader(r); double[] x = new double[0]; try{ // Reading the array from the provided buffer (reader) x = (double[])Read.apply(double[].class, reader); // Printing the array using a regular for loop for( int i=0; i<x.length; i++ ){ System.out.println(x[i]); } // Using a service for printing the array. Here we register the plain text // writing service for double arrays and use it by default Write.set(double[].class, new DoubleArrayPlainWrite()); // Printing to a String System.out.println(Write.toString(x)); return x; }catch(Exception e ){ e.printStackTrace(); } return null; } public static void main( String[] args ){ double[] x = persistency(); x = sort(x); } }
BIORIMP/biorimp
BIO-RIMP/HAEAsrc/test/DoubleArrayTest.java
Java
gpl-2.0
2,482
<?php /*-----------------------------------------------------------------------------------*/ /* This theme supports WooCommerce, woo! */ /*-----------------------------------------------------------------------------------*/ add_action( 'after_setup_theme', 'woocommerce_support' ); function woocommerce_support() { add_theme_support( 'woocommerce' ); } /*-----------------------------------------------------------------------------------*/ /* Any WooCommerce overrides and functions can be found here /*-----------------------------------------------------------------------------------*/ // Add html5 shim add_action('wp_head', 'wootique_html5_shim'); function wootique_html5_shim() { ?> <!-- Load Google HTML5 shim to provide support for <IE9 --> <!--[if lt IE 9]> <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <?php } // Disable WooCommerce styles if ( version_compare( WOOCOMMERCE_VERSION, "2.1" ) >= 0 ) { // WooCommerce 2.1 or above is active add_filter( 'woocommerce_enqueue_styles', '__return_false' ); } else { // WooCommerce is less than 2.1 define( 'WOOCOMMERCE_USE_CSS', false ); } /*-----------------------------------------------------------------------------------*/ /* Header /*-----------------------------------------------------------------------------------*/ // Hook in the search add_action('woo_nav_before', 'wootique_header_search'); function wootique_header_search() { ?> <div id="search-top"> <form role="search" method="get" id="searchform" class="searchform" action="<?php echo home_url(); ?>"> <label class="screen-reader-text" for="s"><?php _e('Wyniki dla:', 'woothemes'); ?></label> <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" class="field s" placeholder="<?php _e('Szukaj przedmiotów', 'woothemes'); ?>" /> <input type="image" class="submit btn" name="submit" value="<?php _e('Search', 'woothemes'); ?>" src="<?php echo get_template_directory_uri(); ?>/images/ico-search.png"> <?php if ( wootique_get_woo_option( 'woo_header_search_scope' ) == 'products' ) { echo '<input type="hidden" name="post_type" value="product" />'; } else { echo '<input type="hidden" name="post_type" value="post" />'; } ?> </form> <div class="fix"></div> </div><!-- /.search-top --> <?php } // Remove WC sidebar remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10); // Adjust markup on all WooCommerce pages remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); add_action('woocommerce_before_main_content', 'woostore_before_content', 10); add_action('woocommerce_after_main_content', 'woostore_after_content', 20); // Fix the layout etc function woostore_before_content() { ?> <!-- #content Starts --> <?php woo_content_before(); ?> <div id="content" class="col-full"> <!-- #main Starts --> <?php woo_main_before(); ?> <div id="main" class="col-left"> <?php } function woostore_after_content() { ?> <?php if ( is_search() && is_post_type_archive() ) { add_filter( 'woo_pagination_args', 'woocommerceframework_add_search_fragment', 10 ); } ?> <?php woo_pagenav(); ?> </div><!-- /#main --> <?php woo_main_after(); ?> </div><!-- /#content --> <?php woo_content_after(); ?> <?php } function woocommerceframework_add_search_fragment ( $settings ) { $settings['add_fragment'] = '&post_type=product'; return $settings; } // End woocommerceframework_add_search_fragment() // Add the WC sidebar in the right place add_action( 'woo_main_after', 'woocommerce_get_sidebar', 10); // Remove breadcrumb (we're using the WooFramework default breadcrumb) remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0); add_action( 'woocommerce_before_main_content', 'woostore_breadcrumb', 01, 0); function woostore_breadcrumb() { if ( wootique_get_woo_option( 'woo_breadcrumbs_show' ) == 'true' ) { woo_breadcrumbs(); } } // Remove pagination (we're using the WooFramework default pagination) remove_action( 'woocommerce_pagination', 'woocommerce_pagination', 10 ); // <2.0 remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 ); // 2.0+ // Adjust the star rating in the sidebar add_filter('woocommerce_star_rating_size_sidebar', 'woostore_star_sidebar'); function woostore_star_sidebar() { return 12; } // Adjust the star rating in the recent reviews add_filter('woocommerce_star_rating_size_recent_reviews', 'woostore_star_reviews'); function woostore_star_reviews() { return 12; } // Change columns in product loop to 3 add_filter('loop_shop_columns', 'woostore_loop_columns'); function woostore_loop_columns() { return 3; } // Change columns in related products output to 3 remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20); add_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20); if ( ! function_exists('woocommerce_output_related_products') && version_compare( WOOCOMMERCE_VERSION, "2.1" ) < 0 ) { function woocommerce_output_related_products() { woocommerce_related_products( 3,3 ); } } add_filter( 'woocommerce_output_related_products_args', 'wootique_related_products' ); function wootique_related_products() { $args = array( 'posts_per_page' => 3, 'columns' => 3, ); return $args; } if ( ! function_exists( 'woo_upsell_display' ) ) { function woo_upsell_display() { // Display up sells in correct layout. woocommerce_upsell_display( -1, 3 ); } } remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_upsell_display', 15 ); add_action( 'woocommerce_after_single_product_summary', 'woo_upsell_display', 15 ); // If theme lightbox is enabled, disable the WooCommerce lightbox and make product images prettyPhoto galleries /*add_action( 'wp_footer', 'woocommerce_prettyphoto' ); function woocommerce_prettyphoto() { if ( wootique_get_woo_option( 'woo_enable_lightbox' ) == "true" ) { update_option( 'woocommerce_enable_lightbox', false ); ?> <script> jQuery(document).ready(function(){ jQuery('.images a').attr('rel', 'prettyPhoto[product-gallery]'); }); </script> <?php } }*/ // Move the price below the excerpt on the single product page remove_action( 'woocommerce_template_single_summary', 'woocommerce_template_single_price', 10, 2); add_action( 'woocommerce_template_single_summary', 'woocommerce_template_single_price', 25, 2); // Display 12 products per page add_filter('loop_shop_per_page', create_function('$cols', 'return 12;')); add_action('woo_nav_after', 'woocommerce_cart_link', 10); add_action('woo_nav_after', 'wootique_checkout_button', 10); function woocommerce_cart_link() { global $woocommerce; ?> <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" title="'<?php _e( 'View your shopping cart', 'woothemes' ); ?>'" class="cart-button"> <span><?php echo sprintf(_n( '%d przedmiot &ndash; ', '%d przedmiotów &ndash; ', $woocommerce->cart->get_cart_contents_count(), 'woothemes'), $woocommerce->cart->get_cart_contents_count()) . $woocommerce->cart->get_cart_total(); ?></span> </a> <?php } function wootique_checkout_button() { global $woocommerce; ?> <?php if (sizeof($woocommerce->cart->cart_contents)>0) : echo '<a href="'.$woocommerce->cart->get_checkout_url().'" class="checkout-link">'.__('Checkout','woothemes').'</a>'; endif; ?> <?php } add_filter('add_to_cart_fragments', 'header_add_to_cart_fragment'); function header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); woocommerce_cart_link(); $fragments['.cart-button'] = ob_get_clean(); return $fragments; }
Recongt/www-ecommerce-
wp-content/themes/wootique/includes/theme-woocommerce.php
PHP
gpl-2.0
7,839
/* * File: ximaraw.cpp * Purpose: Platform Independent RAW Image Class Loader * 16/Dec/2007 Davide Pizzolato - www.xdp.it * CxImage version 7.0.2 07/Feb/2011 * * CxImageRAW (c) May/2006 pdw63 * * based on dcraw.c -- Dave Coffin's raw photo decoder * Copyright 1997-2007 by Dave Coffin, dcoffin a cybercom o net */ #include "ximaraw.h" #if CXIMAGE_SUPPORT_RAW //////////////////////////////////////////////////////////////////////////////// #if CXIMAGE_SUPPORT_DECODE //////////////////////////////////////////////////////////////////////////////// bool CxImageRAW::Decode(CxFile *hFile) { if (hFile==NULL) return false; DCRAW dcr; cx_try { // initialization dcr_init_dcraw(&dcr); dcr.opt.user_qual = GetCodecOption(CXIMAGE_FORMAT_RAW) & 0x03; // setup variables for debugging char szClass[] = "CxImageRAW"; dcr.ifname = szClass; dcr.sz_error = info.szLastError; // setup library options, see dcr_print_manual for the available switches // call dcr_parse_command_line_options(&dcr,0,0,0) to set default options // if (dcr_parse_command_line_options(&dcr,argc,argv,&arg)) if (dcr_parse_command_line_options(&dcr,0,0,0)){ cx_throw("CxImageRAW: unknown option"); } // set return point for error handling if (setjmp (dcr.failure)) { cx_throw(""); } // install file manager CxFileRaw src(hFile,&dcr); // check file header dcr_identify(&dcr); if(!dcr.is_raw){ cx_throw("CxImageRAW: not a raw image"); } if (dcr.load_raw == NULL) { cx_throw("CxImageRAW: missing raw decoder"); } // verify special case if (dcr.load_raw == dcr_kodak_ycbcr_load_raw) { dcr.height += dcr.height & 1; dcr.width += dcr.width & 1; } if (info.nEscape == -1){ head.biWidth = dcr.width; head.biHeight= dcr.height; info.dwType = CXIMAGE_FORMAT_RAW; cx_throw("output dimensions returned"); } // shrinked decoding available and requested? dcr.shrink = dcr.filters && (dcr.opt.half_size || dcr.opt.threshold || dcr.opt.aber[0] != 1 || dcr.opt.aber[2] != 1); dcr.iheight = (dcr.height + dcr.shrink) >> dcr.shrink; dcr.iwidth = (dcr.width + dcr.shrink) >> dcr.shrink; // install custom camera matrix if (dcr.opt.use_camera_matrix && dcr.cmatrix[0][0] > 0.25) { memcpy (dcr.rgb_cam, dcr.cmatrix, sizeof dcr.cmatrix); dcr.raw_color = 0; } else { dcr.opt.use_camera_wb = 1; } // allocate memory for the image dcr.image = (ushort (*)[4]) calloc (dcr.iheight*dcr.iwidth, sizeof *dcr.image); dcr_merror (&dcr, dcr.image, szClass); if (dcr.meta_length) { dcr.meta_data = (char *) malloc (dcr.meta_length); dcr_merror (&dcr, dcr.meta_data, szClass); } // start image decoder hFile->Seek(dcr.data_offset, SEEK_SET); (*dcr.load_raw)(&dcr); // post processing if (dcr.zero_is_bad) dcr_remove_zeroes(&dcr); dcr_bad_pixels(&dcr,dcr.opt.bpfile); if (dcr.opt.dark_frame) dcr_subtract (&dcr,dcr.opt.dark_frame); dcr.quality = 2 + !dcr.fuji_width; if (dcr.opt.user_qual >= 0) dcr.quality = dcr.opt.user_qual; if (dcr.opt.user_black >= 0) dcr.black = dcr.opt.user_black; if (dcr.opt.user_sat >= 0) dcr.maximum = dcr.opt.user_sat; #ifdef COLORCHECK dcr_colorcheck(&dcr); #endif #if RESTRICTED if (dcr.is_foveon && !dcr.opt.document_mode) dcr_foveon_interpolate(&dcr); #endif if (!dcr.is_foveon && dcr.opt.document_mode < 2) dcr_scale_colors(&dcr); // pixel interpolation and filters dcr_pre_interpolate(&dcr); if (dcr.filters && !dcr.opt.document_mode) { if (dcr.quality == 0) dcr_lin_interpolate(&dcr); else if (dcr.quality == 1 || dcr.colors > 3) dcr_vng_interpolate(&dcr); else if (dcr.quality == 2) dcr_ppg_interpolate(&dcr); else dcr_ahd_interpolate(&dcr); } if (dcr.mix_green) { int32_t i; for (dcr.colors=3, i=0; i < dcr.height*dcr.width; i++) { dcr.image[i][1] = (dcr.image[i][1] + dcr.image[i][3]) >> 1; } } if (!dcr.is_foveon && dcr.colors == 3) dcr_median_filter(&dcr); if (!dcr.is_foveon && dcr.opt.highlight == 2) dcr_blend_highlights(&dcr); if (!dcr.is_foveon && dcr.opt.highlight > 2) dcr_recover_highlights(&dcr); if (dcr.opt.use_fuji_rotate) dcr_fuji_rotate(&dcr); #ifndef NO_LCMS if (dcr.opt.cam_profile) dcr_apply_profile (dcr.opt.cam_profile, dcr.opt.out_profile); #endif // final conversion dcr_convert_to_rgb(&dcr); if (dcr.opt.use_fuji_rotate) dcr_stretch(&dcr); dcr.iheight = dcr.height; dcr.iwidth = dcr.width; if (dcr.flip & 4) SWAP(dcr.height,dcr.width); // ready to transfer data from dcr.image if (!Create(dcr.width,dcr.height,24,CXIMAGE_FORMAT_RAW)){ cx_throw(""); } uchar *ppm = (uchar *) calloc (dcr.width, dcr.colors*dcr.opt.output_bps/8); ushort *ppm2 = (ushort *) ppm; dcr_merror (&dcr, ppm, szClass); uchar lut[0x10000]; if (dcr.opt.output_bps == 8) dcr_gamma_lut (&dcr, lut); int32_t c, row, col, soff, rstep, cstep; soff = dcr_flip_index (&dcr, 0, 0); cstep = dcr_flip_index (&dcr, 0, 1) - soff; rstep = dcr_flip_index (&dcr, 1, 0) - dcr_flip_index (&dcr, 0, dcr.width); for (row=0; row < dcr.height; row++, soff += rstep) { for (col=0; col < dcr.width; col++, soff += cstep) { if (dcr.opt.output_bps == 8) for (c=0; c < dcr.colors; c++) ppm [col*dcr.colors+c] = lut[dcr.image[soff][c]]; else for (c=0; c < dcr.colors; c++) ppm2[col*dcr.colors+c] = dcr.image[soff][c]; } if (dcr.opt.output_bps == 16 && !dcr.opt.output_tiff && htons(0x55aa) != 0x55aa) #if defined(_LINUX) || defined(__APPLE__) swab ((char*)ppm2, (char*)ppm2, dcr.width*dcr.colors*2); #else _swab ((char*)ppm2, (char*)ppm2, dcr.width*dcr.colors*2); #endif uint32_t size = dcr.width * (dcr.colors*dcr.opt.output_bps/8); RGBtoBGR(ppm,size); memcpy(GetBits(dcr.height - 1 - row), ppm, min(size,GetEffWidth())); } free (ppm); dcr_cleanup_dcraw(&dcr); } cx_catch { dcr_cleanup_dcraw(&dcr); if (strcmp(message,"")) strncpy(info.szLastError,message,255); if (info.nEscape == -1 && info.dwType == CXIMAGE_FORMAT_RAW) return true; return false; } /* that's it */ return true; } #if CXIMAGE_SUPPORT_EXIF bool CxImageRAW::GetExifThumbnail(const TCHAR *filename, const TCHAR *outname, int32_t type) { DCRAW dcr; CxIOFile file; if (!file.Open(filename, _T("rb"))) return false; cx_try { // initialization dcr_init_dcraw(&dcr); dcr.opt.user_qual = GetCodecOption(CXIMAGE_FORMAT_RAW) & 0x03; // setup variables for debugging char szClass[] = "CxImageRAW"; dcr.ifname = szClass; dcr.sz_error = info.szLastError; // setup library options, see dcr_print_manual for the available switches // call dcr_parse_command_line_options(&dcr,0,0,0) to set default options // if (dcr_parse_command_line_options(&dcr,argc,argv,&arg)) if (dcr_parse_command_line_options(&dcr,0,0,0)){ cx_throw("CxImageRAW: unknown option"); } // set return point for error handling if (setjmp (dcr.failure)) { cx_throw(""); } // install file manager CxFileRaw src(&file,&dcr); // check file header dcr_identify(&dcr); if(!dcr.is_raw){ cx_throw("CxImageRAW: not a raw image"); } if (dcr.load_raw == NULL) { cx_throw("CxImageRAW: missing raw decoder"); } // THUMB. if (dcr.thumb_offset != 0) { FILE* file = _tfopen(outname, _T("wb")); DCRAW* p = &dcr; dcr_fseek(dcr.obj_, dcr.thumb_offset, SEEK_SET); dcr.write_thumb(&dcr, file); fclose(file); // Read in the thumbnail to resize and rotate. CxImage image(outname, CXIMAGE_FORMAT_UNKNOWN); if (image.IsValid()) { #if CXIMAGE_SUPPORT_TRANSFORMATION // Resizing. if (image.GetWidth() > 256 || image.GetHeight() > 256) { float amount = 256.0f / max(image.GetWidth(), image.GetHeight()); image.Resample((int32_t)(image.GetWidth() * amount), (int32_t)(image.GetHeight() * amount), 0); } // Rotation. if (p->flip != 0) image.RotateExif(p->flip); #endif #if CXIMAGE_SUPPORT_ENCODE && CXIMAGE_SUPPORT_JPG return image.Save(outname, CXIMAGE_FORMAT_JPG); #endif } } else { cx_throw("No thumbnail!"); } dcr_cleanup_dcraw(&dcr); } cx_catch { dcr_cleanup_dcraw(&dcr); if (strcmp(message,"")) strncpy(info.szLastError,message,255); if (info.nEscape == -1 && info.dwType == CXIMAGE_FORMAT_RAW) return true; return false; } /* that's it */ return true; } #endif //CXIMAGE_SUPPORT_EXIF //////////////////////////////////////////////////////////////////////////////// #endif //CXIMAGE_SUPPORT_DECODE //////////////////////////////////////////////////////////////////////////////// #if CXIMAGE_SUPPORT_ENCODE //////////////////////////////////////////////////////////////////////////////// bool CxImageRAW::Encode(CxFile * hFile) { if (hFile == NULL) return false; strcpy(info.szLastError, "Save RAW not supported"); return false; } //////////////////////////////////////////////////////////////////////////////// #endif // CXIMAGE_SUPPORT_ENCODE //////////////////////////////////////////////////////////////////////////////// #endif // CXIMAGE_SUPPORT_RAW
csxiaomiao/SGF2GIF
3rdpart/CxImage/ximaraw.cpp
C++
gpl-2.0
8,919
<div id="sidebar_default"> <div id="sidebar"> <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar Widgets')) : else : ?> <!-- All this stuff in here only shows up if you DON'T have any widgets active in this zone --> <div class="sidebar-widget-style"> <h2 class="sidebar-widget-title"><?php esc_html_e( 'Subscribe', 'droidpress' ); ?></h2> <ul> <li><a href="<?php bloginfo('rss2_url'); ?>"><?php esc_html_e( 'Entries (RSS)', 'droidpress' ); ?></a></li> <li><a href="<?php bloginfo('comments_rss2_url'); ?>"><?php esc_html_e( 'Comments (RSS)', 'droidpress' ); ?></a></li> </ul> </div> <div class="sidebar-widget-style"> <h2 class="sidebar-widget-title"><?php esc_html_e( 'Pages', 'droidpress' ); ?></h2> <ul> <?php wp_list_pages('title_li=' ); ?> </ul> </div> <div class="sidebar-widget-style"> <h2 class="sidebar-widget-title"><?php esc_html_e( 'Archives', 'droidpress' ); ?></h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </div> <div class="sidebar-widget-style"> <h2 class="sidebar-widget-title"><?php esc_html_e( 'Categories', 'droidpress' ); ?></h2> <ul> <?php wp_list_categories('show_count=1&title_li='); ?> </ul> </div> <div class="sidebar-widget-style"> <h2 class="sidebar-widget-title"><?php esc_html_e( 'WordPress', 'droidpress' ); ?></h2> <ul> <?php wp_register(); ?> <li><?php wp_loginout(); ?></li> <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform."><?php esc_html_e( 'WordPress', 'droidpress' ); ?></a></li> <?php wp_meta(); ?> </ul> </div> <div class="sidebar-widget-style"> <h2 class="sidebar-widget-title"><?php esc_html_e( 'Subscribe', 'droidpress' ); ?></h2> <ul> <li><a href="<?php bloginfo('rss2_url'); ?>"><?php esc_html_e( 'Entries (RSS)', 'droidpress' ); ?></a></li> <li><a href="<?php bloginfo('comments_rss2_url'); ?>"><?php esc_html_e( 'Comments (RSS)', 'droidpress' ); ?></a></li> </ul> </div> <?php endif; ?> </div><!--end sidebar--> </div><!--end sidebar_default-->
cyberchimps/DroidPress
sidebar.php
PHP
gpl-2.0
2,243
<?php /** * Internationalisation file for extension OggPlayer. * * @file * @ingroup Extensions */ $messages = array(); $messages['en'] = array( 'ogg-desc' => 'Handler for Ogg Theora and Vorbis files, with JavaScript player', 'ogg-short-audio' => 'Ogg $1 sound file, $2', 'ogg-short-video' => 'Ogg $1 video file, $2', 'ogg-short-general' => 'Ogg $1 media file, $2', 'ogg-long-audio' => 'Ogg $1 sound file, length $2, $3', 'ogg-long-video' => 'Ogg $1 video file, length $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Ogg multiplexed audio/video file, $1, length $2, $4×$5 pixels, $3 overall', 'ogg-long-general' => 'Ogg media file, length $2, $3', 'ogg-long-error' => 'Invalid Ogg file: $1', 'ogg-play' => 'Play', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Play video', 'ogg-play-sound' => 'Play sound', 'ogg-no-player' => 'Sorry, your system does not appear to have any supported player software. Please <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">download a player</a>.', 'ogg-no-xiphqt' => 'You do not appear to have the XiphQT component for QuickTime. QuickTime cannot play Ogg files without this component. Please <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">download XiphQT</a> or choose another player.', 'ogg-player-videoElement' => 'Native browser support', 'ogg-player-oggPlugin' => 'Browser plugin', 'ogg-player-cortado' => 'Cortado (Java)', # only translate this message to other languages if you have to change it 'ogg-player-vlc-mozilla' => 'VLC', # only translate this message to other languages if you have to change it 'ogg-player-vlc-activex' => 'VLC (ActiveX)', # only translate this message to other languages if you have to change it 'ogg-player-quicktime-mozilla' => 'QuickTime', # only translate this message to other languages if you have to change it 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', # only translate this message to other languages if you have to change it 'ogg-player-totem' => 'Totem', # only translate this message to other languages if you have to change it 'ogg-player-kmplayer' => 'KMPlayer', # only translate this message to other languages if you have to change it 'ogg-player-kaffeine' => 'Kaffeine', # only translate this message to other languages if you have to change it 'ogg-player-mplayerplug-in' => 'mplayerplug-in', # only translate this message to other languages if you have to change it 'ogg-player-thumbnail' => 'Still image only', 'ogg-player-soundthumb' => 'No player', 'ogg-player-selected' => '(selected)', 'ogg-use-player' => 'Use player:', 'ogg-more' => 'More…', 'ogg-dismiss' => 'Close', 'ogg-download' => 'Download file', 'ogg-desc-link' => 'About this file', 'ogg-oggThumb-version' => 'OggHandler requires oggThumb version $1 or later.', 'ogg-oggThumb-failed' => 'oggThumb failed to create the thumbnail.', ); /** Message documentation (Message documentation) * @author Aotake * @author BrokenArrow * @author EugeneZelenko * @author Fryed-peach * @author Jon Harald Søby * @author Lloffiwr * @author Meno25 * @author Minh Nguyen * @author Mormegil * @author Purodha * @author Shirayuki * @author Siebrand * @author Umherirrender */ $messages['qqq'] = array( 'ogg-desc' => '{{desc|name=Ogg Handler|url=http://www.mediawiki.org/wiki/Extension:OggHandler}}', 'ogg-short-audio' => 'File details for Ogg sound (audio) files, short version. Parameters: * $1 - stream type name. Any one of the following: Vorbis, Speex, FLAC * $2 - duration of the sound/audio (localized) - e.g. 1m34s {{Related|Ogg-short}}', 'ogg-short-video' => 'File details for Ogg video files, short version. Parameters: * $1 - stream type name: Theora * $2 - duration of the video (localized) - e.g. 1m34s {{Related|Ogg-short}}', 'ogg-short-general' => 'File details for generic (non-audio, non-video) Ogg files, short version. Parameters: * $1 - stream type name * $2 - duration of the media (localized) - e.g. 1m34s {{Related|Ogg-short}}', 'ogg-long-audio' => 'File details for Ogg sound (audio) files, long version. Shown after the filename in the image description page. Parameters: * $1 - stream type name. Any one of the following: Vorbis, Speex, FLAC * $2 - duration of the sound (localized) - e.g. 1m34s * $3 - bit-rate of the sound (localized) - e.g. 97kbps {{Related|Ogg-long}}', 'ogg-long-video' => 'File details for Ogg video files, long version. Shown after the filename in the image description page. Parameters: * $1 - stream type name: Theora * $2 - duration of the video (localized) - e.g. 1m34s * $3 - bit-rate of the video (localized) - e.g. 97kbps * $4 - width of the video (in pixels) * $5 - height of the video (in pixels) {{Related|Ogg-long}}', 'ogg-long-multiplexed' => '{{doc-important|Start with a lowercase letter, unless the first word is "Ogg".}} File details for Ogg multiplexed audio/video files, long version. Shown after the filename in the image description page. Parameters: * $1 - stream type names, slash-separated - e.g. Theora/Vorbis * $2 - duration (localized) - e.g. 1m34s * $3 - bit-rate (localized) - e.g. 97kbps * $4 - width of the video (in pixels) * $5 - height of the video (in pixels) {{Related|Ogg-long}}', 'ogg-long-general' => 'File details for Ogg generic (non-video, non-audio) files, long version. Shown after the filename in the image description page. Parameters: * $1 - (Unused) * $2 - duration (localized) - e.g. 1m34s * $3 - bit-rate (localized) - e.g. 97kbps {{Related|Ogg-long}}', 'ogg-long-error' => 'Used as error message. Parameters: * $1 - error message. e.g. File not found, invalid stream, etc.', 'ogg-play' => '{{Identical|Play}}', 'ogg-pause' => 'Used as button text. {{Identical|Pause}}', 'ogg-stop' => '{{Identical|Stop}}', 'ogg-play-video' => 'Used as HTML <code><nowiki><button></nowiki></code> title and HTML <code><nowiki><img></nowiki></code> alt. If sound, the message {{msg-mw|Ogg-play-sound}} is used instead.', 'ogg-play-sound' => 'Used as HTML <code><nowiki><button></nowiki></code> title and HTML <code><nowiki><img></nowiki></code> alt. If video, the message {{msg-mw|Ogg-play-video}} is used instead.', 'ogg-no-player' => 'Used as error message in JavaScript code.', 'ogg-no-xiphqt' => 'Used as error message in JavaScript code.', 'ogg-player-videoElement' => 'Message used in JavaScript. For definition of "native support" see [http://en.wiktionary.org/wiki/native_support Wiktionary]. {{Related|Ogg-player}}', 'ogg-player-oggPlugin' => '{{Related|Ogg-player}}', 'ogg-player-cortado' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-vlc-mozilla' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-vlc-activex' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-quicktime-mozilla' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-quicktime-activex' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-totem' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-kmplayer' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-kaffeine' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-mplayerplug-in' => '{{optional}} {{Related|Ogg-player}}', 'ogg-player-thumbnail' => '{{Related|Ogg-player}}', 'ogg-player-soundthumb' => '{{Related|Ogg-player}}', 'ogg-player-selected' => 'This message follows the following Player messages: {{Related|Ogg-player}}', 'ogg-use-player' => 'Used as caption for Player selector. This message is followed by a list of the players. "Use player:" means about "Select a player to use:".', 'ogg-more' => '{{Identical|More...}}', 'ogg-dismiss' => '{{Identical|Close}}', 'ogg-download' => '{{Identical|Download}}', 'ogg-desc-link' => 'Used as link text in JavaScript code. The link points to Description page for this file.', 'ogg-oggThumb-version' => 'Parameters: * $1 - version number, 0.9 (hard-coded) See also: * {{msg-mw|ogg-oggThumb-failed}}', 'ogg-oggThumb-failed' => 'See also: * {{msg-mw|ogg-oggThumb-version}}', ); /** Afrikaans (Afrikaans) * @author AVRS * @author Naudefj * @author SPQRobin * @author පසිඳු කාවින්ද */ $messages['af'] = array( 'ogg-desc' => "Hanteer Ogg Theora- en Vorbis-lêers met 'n JavaScript-mediaspeler", 'ogg-short-audio' => 'Ogg $1 klanklêer, $2', 'ogg-short-video' => 'Ogg $1 video lêer, $2', 'ogg-short-general' => 'Ogg $1 medialêer, $2', 'ogg-long-audio' => '(Ogg $1 klanklêer, lengte $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 videolêer, lengte $2, $4×$5 pixels, $3', 'ogg-long-general' => '(Ogg medialêer, lengte $2, $3)', # Fuzzy 'ogg-long-error' => '(Ongeldige ogg-lêer: $1)', # Fuzzy 'ogg-play' => 'Speel', 'ogg-pause' => 'Wag', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Speel video', 'ogg-play-sound' => 'Speel geluid', 'ogg-player-videoElement' => 'Standaardondersteuning in webblaaier', 'ogg-player-oggPlugin' => 'Webblaaier-plugin', 'ogg-player-thumbnail' => 'Still image net', 'ogg-player-soundthumb' => 'Geen mediaspeler', 'ogg-player-selected' => '(geselekteer)', 'ogg-use-player' => 'Gebruik speler:', 'ogg-more' => 'Meer…', 'ogg-dismiss' => 'Sluit', 'ogg-download' => 'Laai lêer af', 'ogg-desc-link' => 'Aangaande die lêer', ); /** Albaamo innaaɬiilka (Albaamo innaaɬiilka) * @author Ulohnanne */ $messages['akz'] = array( 'ogg-more' => 'Maatàasasi...', ); /** Gheg Albanian (Gegë) * @author AVRS * @author Mdupont */ $messages['aln'] = array( 'ogg-desc' => 'Mbajtës për Ogg Vorbis Theora dhe fotografi, me JavaScript lojtar', 'ogg-short-audio' => 'Ogg tingull $1 fotografi, $2', 'ogg-short-video' => 'video file Ogg $1, $2', 'ogg-short-general' => 'Ogg $1 media file, $2', 'ogg-long-audio' => '(ZQM file $1 shëndoshë, gjatë $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 video file, gjatë $2, $4 × $5 pixels, $3', 'ogg-long-multiplexed' => '(ZQM multiplexed audio / video file, 1 $, gjatë $2, $4 × $5 pixels, $3 e përgjithshme)', # Fuzzy 'ogg-long-general' => '(Ogg media file, gjatë $2, $3)', # Fuzzy 'ogg-long-error' => '(Invalid ogg file: $1)', # Fuzzy 'ogg-play' => 'Luaj', 'ogg-pause' => 'Pushim', 'ogg-stop' => 'Ndalo', 'ogg-play-video' => 'video Play', 'ogg-play-sound' => 'Tingull', 'ogg-no-player' => 'Na vjen keq, sistemi juaj nuk duket të ketë ndonjë lojtar software mbështetur. Ju lutemi <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">të shkarkoni një lojtar</a> .', 'ogg-no-xiphqt' => 'Ju nuk duket të ketë komponent XiphQT për QuickTime. QuickTime nuk mund të luajnë Ogg files pa këtë element. Ju lutem <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">shkarkoni XiphQT</a> ose zgjidhni një tjetër lojtar.', 'ogg-player-videoElement' => 'mbështetje Gjuha shfletuesin', 'ogg-player-oggPlugin' => 'Browser plugin', 'ogg-player-thumbnail' => 'Ende image vetëm', 'ogg-player-soundthumb' => 'Nuk ka lojtar', 'ogg-player-selected' => '(Zgjedhur)', ); /** Aragonese (aragonés) * @author AVRS * @author Juanpabl */ $messages['an'] = array( 'ogg-desc' => 'Maneyador ta fichers Ogg Theora and Vorbis, con un reproductor JavaScript', 'ogg-short-audio' => 'Fichero de son ogg $1, $2', 'ogg-short-video' => 'Fichero de vidio ogg $1, $2', 'ogg-short-general' => 'Fichero multimedia ogg $1, $2', 'ogg-long-audio' => '(Fichero de son ogg $1, durada $2, $3)', # Fuzzy 'ogg-long-video' => 'Fichero de vidio ogg $1, durada $2, $4×$5 píxels, $3', 'ogg-long-multiplexed' => '(fichero ogg multiplexato audio/vidio, $1, durada $2, $4×$5 píxels, $3 total)', # Fuzzy 'ogg-long-general' => '(fichero ogg multimedia durada $2, $3)', # Fuzzy 'ogg-long-error' => '(Fichero ogg no conforme: $1)', # Fuzzy 'ogg-play' => 'Reproducir', 'ogg-pause' => 'Pausa', 'ogg-stop' => 'Aturar', 'ogg-play-video' => 'Reproducir vidio', 'ogg-play-sound' => 'Reproducir son', 'ogg-no-player' => 'No puedo trobar garra software reproductor suportato. Habría d\'<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">escargar un reproductor</a>.', 'ogg-no-xiphqt' => 'No puedo trobar o component XiphQT ta QuickTime. QuickTime no puede reproducir ficheros ogg sin este component. Puede <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">escargar XiphQT</a> u trigar un atro reproductor.', 'ogg-player-videoElement' => "Soporte nativo d'o navegador", 'ogg-player-oggPlugin' => "Plugin d'o navegador", 'ogg-player-thumbnail' => 'Nomás imachen fixa', 'ogg-player-soundthumb' => 'Garra reproductor', 'ogg-player-selected' => '(trigato)', 'ogg-use-player' => 'Fer servir o reproductor:', 'ogg-more' => 'Más…', 'ogg-dismiss' => 'Zarrar', 'ogg-download' => 'Escargar fichero', 'ogg-desc-link' => 'Información sobre este fichero', 'ogg-oggThumb-version' => 'OggHandler requiere una versión oggThumb $1 u posterior.', 'ogg-oggThumb-failed' => 'oggThumb no podió creyar a imachen miniatura.', ); /** Arabic (العربية) * @author Aiman titi * @author Alnokta * @author Majid Al-Dharrab * @author Meno25 * @author OsamaK */ $messages['ar'] = array( 'ogg-desc' => 'متحكم لملفات Ogg Theora وVorbis، مع لاعب جافاسكريت', 'ogg-short-audio' => 'Ogg $1 ملف صوت، $2', 'ogg-short-video' => 'Ogg $1 ملف فيديو، $2', 'ogg-short-general' => 'Ogg $1 ملف ميديا، $2', 'ogg-long-audio' => 'Ogg $1 ملف صوت، الطول $2، $3', 'ogg-long-video' => 'Ogg $1 ملف فيديو، الطول $2، $4×$5 بكسل، $3', 'ogg-long-multiplexed' => 'ملف Ogg مالتي بليكسد أوديو/فيديو، $1، الطول $2، $4×$5 بكسل، $3 إجمالي', 'ogg-long-general' => 'ملف ميديا Ogg، الطول $2، $3', 'ogg-long-error' => 'ملف Ogg غير صحيح: $1', 'ogg-play' => 'شغّل', 'ogg-pause' => 'ألبث', 'ogg-stop' => 'أوقف', 'ogg-play-video' => 'شغّل الفيديو', 'ogg-play-sound' => 'شغّل الصوت', 'ogg-no-player' => 'معذرة ولكن يبدو أنه لا يوجد لديك برنامج عرض مدعوم. من فضلك ثبت <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">الجافا</a>.', 'ogg-no-xiphqt' => 'لا يبدو أنك تملك مكون XiphQT لكويك تايم. كويك تايم لا يمكنه عرض ملفات Ogg بدون هذا المكون. من فضلك <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">حمل XiphQT</a> أو اختر برنامجا آخر.', 'ogg-player-videoElement' => 'دعم متصفح مدمج', 'ogg-player-oggPlugin' => 'إضافة متصفح', 'ogg-player-cortado' => 'كورتادو (جافا)', 'ogg-player-vlc-mozilla' => 'في إل سي', 'ogg-player-vlc-activex' => 'في إل سي (أكتيف إكس)', 'ogg-player-quicktime-mozilla' => 'كويك تايم', 'ogg-player-quicktime-activex' => 'كويك تايم (أكتيف إكس)', 'ogg-player-totem' => 'توتيم', 'ogg-player-kmplayer' => 'كيه إم بلاير', 'ogg-player-kaffeine' => 'كافيين', 'ogg-player-mplayerplug-in' => 'إضافة إم بلاير', 'ogg-player-thumbnail' => 'ما زال صورة فقط', 'ogg-player-soundthumb' => 'لا يوجد مشغل', 'ogg-player-selected' => '(مختار)', 'ogg-use-player' => 'استخدم البرنامج:', 'ogg-more' => 'المزيد...', 'ogg-dismiss' => 'أغلق', 'ogg-download' => 'نزّل الملف', 'ogg-desc-link' => 'عن هذا الملف', 'ogg-oggThumb-version' => 'OggHandler يتطلب الإصدار oggThumb $1 أو في وقت لاحق.', 'ogg-oggThumb-failed' => 'فشل في إنشاء المصغرات', ); /** Aramaic (ܐܪܡܝܐ) * @author Basharh */ $messages['arc'] = array( 'ogg-player-soundthumb' => 'ܠܝܬ ܛܐܠܢܐ', 'ogg-more' => 'ܝܬܝܪ…', 'ogg-download' => 'ܐܚܬ ܠܦܦܐ', ); /** Egyptian Spoken Arabic (مصرى) * @author AVRS * @author Ghaly * @author Meno25 * @author Ramsis II */ $messages['arz'] = array( 'ogg-desc' => 'متحكم لملفات أو جى جى ثيورا و فوربيس، مع بلاير جافاسكريبت', 'ogg-short-audio' => 'Ogg $1 ملف صوت، $2', 'ogg-short-video' => 'Ogg $1 ملف فيديو, $2', 'ogg-short-general' => 'Ogg $1 ملف ميديا، $2', 'ogg-long-audio' => '(Ogg $1 ملف صوت، الطول $2، $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 ملف فيديو، الطول $2، $4×$5 بكسل، $3', 'ogg-long-multiplexed' => '(ملف Ogg مالتى بليكسد أوديو/فيديو، $1، الطول $2، $4×$5 بكسل، $3 إجمالي)', # Fuzzy 'ogg-long-general' => '(ملف ميديا Ogg، الطول $2، $3)', # Fuzzy 'ogg-long-error' => '(ملف ogg مش صحيح: $1)', # Fuzzy 'ogg-play' => 'شغل', 'ogg-pause' => ' توقيف مؤقت', 'ogg-stop' => 'توقيف', 'ogg-play-video' => 'شغل الفيديو', 'ogg-play-sound' => 'شغل الصوت', 'ogg-no-player' => 'متاسفين الظاهر أنه ماعندكش برنامج عرض مدعوم. لو سمحت تنزل < a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">الجافا</a>.', 'ogg-no-xiphqt' => 'الظاهر انه ماعندكش مكون الـ XiphQT لكويك تايم. كويك تايم مش ممكن يعرض ملفات Ogg من غير المكون دا. لو سمحت <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">تنزل XiphQT</a> أو تختار برنامج تانى.', 'ogg-player-videoElement' => 'دعم البراوزر الاصلي', 'ogg-player-oggPlugin' => 'اضافة براوزر', 'ogg-player-cortado' => 'كورتادو (جافا)', 'ogg-player-vlc-mozilla' => 'فى إل سي', 'ogg-player-vlc-activex' => 'فى إل سى (أكتيف إكس)', 'ogg-player-quicktime-mozilla' => 'كويك تايم', 'ogg-player-quicktime-activex' => 'كويك تايم (أكتيف إكس)', 'ogg-player-totem' => 'توتيم', 'ogg-player-kmplayer' => 'كيه إم بلاير', 'ogg-player-kaffeine' => 'كافيين', 'ogg-player-mplayerplug-in' => 'إضافة إم بلاير', 'ogg-player-thumbnail' => 'صورة ثابتة بس', 'ogg-player-soundthumb' => 'ما فيش برنامج', 'ogg-player-selected' => '(مختار)', 'ogg-use-player' => 'استخدم البرنامج:', 'ogg-more' => 'أكتر...', 'ogg-dismiss' => 'اقفل', 'ogg-download' => 'نزل الملف', 'ogg-desc-link' => 'عن الملف دا', ); /** Assamese (অসমীয়া) * @author Bishnu Saikia * @author Chaipau * @author Gitartha.bordoloi */ $messages['as'] = array( 'ogg-desc' => 'জাভাস্ক্ৰিপ্ট প্লেয়াৰৰ সৈতে Ogg Theora আৰু Vorbis ফাইলৰ হেণ্ডলাৰ', 'ogg-short-audio' => 'অগ $1 শব্দ ফাইল, $2', 'ogg-short-video' => 'অগ $1 ভিডিঅ’ ফাইল, $2', 'ogg-short-general' => 'অগ $1 মিডিয়া ফাইল, $2', 'ogg-long-audio' => 'অগ $1 শব্দ ফাইল, দৈৰ্ঘ্য $2, $3', 'ogg-long-video' => 'অগ $1 ভিডিঅ’ ফাইল, দৈৰ্ঘ্য $2, $4×$5 পিক্সেল, $3', 'ogg-long-multiplexed' => 'অগ মাল্টিপ্লেক্সকৃত অডিঅ’/ভিডিঅ’ ফাইল, $1, দৈৰ্ঘ্য $2, $4×$5 পিক্সেল, $3 সামগ্ৰিক', 'ogg-long-general' => 'অগ মিডিয়া ফাইল, দৈৰ্ঘ্য $2, $3', 'ogg-long-error' => 'অবৈধ ogg ফাইল: $1', 'ogg-play' => 'প্লে কৰক', 'ogg-pause' => 'বিৰতি', 'ogg-stop' => 'বন্ধ', 'ogg-play-video' => 'ভিডিঅ’ প্লে কৰক', 'ogg-play-sound' => 'শ্ৰাব্য ক্লিপ শুনক', 'ogg-no-player' => 'দুঃখিত, আপোনাৰ কম্পিউটাৰত ফাইলটো চলোৱাৰ বাবে প্ৰয়োজনীয় ছফটৱেৰ নাই। অনুগ্ৰহ কৰি <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ছফটৱেৰটো ডাউনলোড কৰক</a>।', 'ogg-no-xiphqt' => 'আপোনাৰ কুইক্‌টাইম ছফ্টৱেৰটোত XiphQT উপাদানটো নাই। এই উপাদানটো নোহোৱাকৈ কুইক্‌টাইমে Ogg ফাইল চলাব নোৱাৰে। অনুগ্ৰহ কৰি <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT ডাউনল\'ড কৰক</a> বা আন এটা প্লে\'য়াৰ ব্যৱহাৰ কৰক।', 'ogg-player-videoElement' => 'স্থানীয় ব্ৰাউজাৰ চাপোৰ্ট', 'ogg-player-oggPlugin' => 'ব্ৰাউজাৰ প্লাগ-ইন', 'ogg-player-vlc-mozilla' => 'ভিএলচি', 'ogg-player-vlc-activex' => 'ভিএলচি (এক্টিভ-এক্স)', 'ogg-player-totem' => 'টোটেম', 'ogg-player-thumbnail' => 'কেৱলমাত্ৰ স্থিৰ চিত্ৰ', 'ogg-player-soundthumb' => 'কোনো প্লেয়াৰ নাই', 'ogg-player-selected' => '(নিৰ্বাচিত)', 'ogg-use-player' => 'প্লেয়াৰ ব্যৱহাৰ কৰক:', 'ogg-more' => 'অধিক...', 'ogg-dismiss' => 'বন্ধ কৰক', 'ogg-download' => 'ফাইল ডাউনলোড কৰক', 'ogg-desc-link' => 'এই ফাইলৰ বৃত্তান্ত', 'ogg-oggThumb-version' => 'OggHandler-ক oggThumb সংস্কৰণ $1 বা পিছৰবোৰৰ প্ৰয়োজন।', 'ogg-oggThumb-failed' => 'oggThumb-এ ক্ষুদ্ৰ প্ৰতিকৃতি সৃষ্টি কৰাত ব্যৰ্থ হৈছে।', ); /** Asturian (asturianu) * @author AVRS * @author Esbardu * @author Xuacu */ $messages['ast'] = array( 'ogg-desc' => "Remanador d'archivos Ogg Theora y Vorbis, con un reproductor JavaScript", 'ogg-short-audio' => 'Archivu de soníu ogg $1, $2', 'ogg-short-video' => 'Ficheru de videu ogg $1, $2', 'ogg-short-general' => 'Archivu multimedia ogg $1, $2', 'ogg-long-audio' => 'Ficheru de soníu ogg $1, llonxitú $2, $3', 'ogg-long-video' => 'Archivu de videu ogg $1, llonxitú $2, $4×$5 píxeles, $3', 'ogg-long-multiplexed' => 'Ficheru de soníu/videu ogg multiplexáu, $1, llonxitú $2, $4×$5 píxeles, $3 en total', 'ogg-long-general' => 'Ficheru multimedia ogg, llonxitú $2, $3', 'ogg-long-error' => 'Ficheru ogg inválidu: $1', 'ogg-play' => 'Reproducir', 'ogg-pause' => 'Pausar', 'ogg-stop' => 'Aparar', 'ogg-play-video' => 'Reproducir videu', 'ogg-play-sound' => 'Reproducir soníu', 'ogg-no-player' => 'Sentímoslo, el to sistema nun paez tener nengún de los reproductores soportaos. Por favor <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">descarga un reproductor</a>.', 'ogg-no-xiphqt' => 'Paez que nun tienes el componente XiphQT pa QuickTime. QuickTime nun pue reproducr archivos ogg ensin esti componente. Por favor <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">descarga XiphQT</a> o escueyi otru reproductor.', 'ogg-player-videoElement' => 'Soporte nativu del navegador', 'ogg-player-oggPlugin' => 'Plugin del navegador', 'ogg-player-thumbnail' => 'Namái imaxe en pausa', 'ogg-player-soundthumb' => 'Nun hai reproductor', 'ogg-player-selected' => '(seleicionáu)', 'ogg-use-player' => 'Utilizar el reproductor:', 'ogg-more' => 'Más...', 'ogg-dismiss' => 'Zarrar', 'ogg-download' => 'Descargar archivu', 'ogg-desc-link' => 'Tocante a esti archivu', 'ogg-oggThumb-version' => 'OggHandler requier oggThumb version $1 o mayor.', 'ogg-oggThumb-failed' => 'oggThumb nun pudo crear la miniatura.', ); /** Kotava (Kotava) * @author Sab */ $messages['avk'] = array( 'ogg-download' => 'Iyeltakkalvajara', 'ogg-desc-link' => 'Icde bat iyeltak', ); /** Azerbaijani (azərbaycanca) * @author Cekli829 * @author Vago * @author Vugar 1981 */ $messages['az'] = array( 'ogg-play' => 'Başla', 'ogg-pause' => 'Fasilə', 'ogg-stop' => 'Dur', 'ogg-play-video' => 'Videonu başla', 'ogg-play-sound' => 'Səsi başla', 'ogg-player-cortado' => 'Cortado (Java)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (ActiveX)', 'ogg-player-quicktime-mozilla' => 'QuickTime', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kaffeine', 'ogg-player-mplayerplug-in' => 'mplayerplug-in', 'ogg-player-selected' => '(seçildi)', 'ogg-more' => 'Çox…', 'ogg-dismiss' => 'Bağla', 'ogg-download' => 'Fayl yüklə', ); /** South Azerbaijani (تورکجه) * @author Amir a57 */ $messages['azb'] = array( 'ogg-long-error' => 'اعتبارسیز آگ فایل: $1', 'ogg-play' => 'پخش', 'ogg-pause' => 'فاصیله', 'ogg-stop' => 'دایان', 'ogg-play-video' => 'ویدیو پخشی', 'ogg-play-sound' => 'سس پخشی', 'ogg-player-selected' => '(سئچیلدی)', 'ogg-more' => 'چوخ...', 'ogg-dismiss' => 'باغلا', 'ogg-download' => 'فایل یوکله', 'ogg-desc-link' => 'بو فایلا گوره', ); /** Bashkir (башҡортса) * @author Haqmar * @author Roustammr * @author Рустам Нурыев * @author ҒатаУлла */ $messages['ba'] = array( 'ogg-desc' => 'Ogg Theora һәм Vorbis файлдарын JavaScript-уйнатыусы ҡулланған эшкәртеүсе', 'ogg-short-audio' => 'Тауыш файлы Ogg $1, $2', 'ogg-short-video' => 'Видео-файл Ogg $1, $2', 'ogg-short-general' => 'Медиа-файл Ogg $1, $2', 'ogg-long-audio' => 'Ogg $1 тауыш файлы , оҙонлоҡ $2, $3', 'ogg-long-video' => 'видео-файл Ogg $1, оҙонлоҡ $2, $4×$5 {{PLURAL:$5|пиксель}}, $3', 'ogg-long-multiplexed' => 'мультиплекс аудио/видео-файл Ogg, $1, оҙонлоҡ $2, $4×$5 {{PLURAL:$5|пиксель}}, барыһы $3', 'ogg-long-general' => 'Ogg медиа-файл , оҙонлоҡ $2, $3', 'ogg-long-error' => 'яңылыш ogg-файл: $1', 'ogg-play' => 'Уйнатырға', 'ogg-pause' => 'Туҡтатып тору', 'ogg-stop' => 'Туҡтатыу', 'ogg-play-video' => 'Видеояҙманы ҡарау', 'ogg-play-sound' => 'Көйҙе тыңлау', 'ogg-no-player' => 'Ғәфү итегеҙ, ләкин һеҙнең системағыҙ был файлдар төрен аса алмай, зинһар кәрәк булған программаларҙы <ahref="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">үҙегеҙгә күсереп алыгыҙ</a>.', 'ogg-player-oggPlugin' => 'Ogg модуль', 'ogg-player-thumbnail' => 'Хәрәкәтһеҙ рәсем генә', 'ogg-player-soundthumb' => 'Уйнатыусы юҡ', 'ogg-player-selected' => '(һайланған)', 'ogg-use-player' => 'Ҡулланыласаҡ уйнатыусы:', 'ogg-more' => 'Тағы...', 'ogg-dismiss' => 'Ябырға', 'ogg-desc-link' => 'Был файл тураһында', 'ogg-oggThumb-failed' => 'oggThumb нигеҙендә рәсемде яһап булманы.', ); /** Southern Balochi (بلوچی مکرانی) * @author Mostafadaneshvar */ $messages['bcc'] = array( 'ogg-desc' => 'دسگیره په فایلان Ogg Theora و Vorbis, گون پخش کنوک جاوا اسکرسیپت', 'ogg-short-audio' => 'فایل صوتی Ogg $1، $2', 'ogg-short-video' => 'فایل تصویری Ogg $1، $2', 'ogg-short-general' => 'فایل مدیا Ogg $1، $2', 'ogg-long-audio' => '(اوجی جی $1 فایل صوتی, طول $2, $3)', # Fuzzy 'ogg-long-video' => 'اوجی جی $1 فایل ویدیو, طول $2, $4×$5 پیکسل, $3', 'ogg-long-multiplexed' => '(اوجی جی چند دابی فایل صوت/تصویر, $1, طول $2, $4×$5 پیکسل, $3 کل)', # Fuzzy 'ogg-long-general' => '(اوجی جی فایل مدیا, طول $2, $3)', # Fuzzy 'ogg-long-error' => '(نامعتبرین فایل اوجی جی: $1)', # Fuzzy 'ogg-play' => 'پخش', 'ogg-pause' => 'توقف', 'ogg-stop' => 'بند', 'ogg-play-video' => 'پخش ویدیو', 'ogg-play-sound' => 'پخش توار', 'ogg-no-player' => 'شرمنده،شمی سیستم جاه کیت که هچ برنامه حمایتی پخش کنوک نیست. لطفا <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download"> یک پخش کنوکی ای گیزیت</a>.', 'ogg-no-xiphqt' => 'چوش جاه کیت که شما را جز XiphQTپه کویک تایم نیست. کویک تایم بی ای جز نه تونیت فایلان اوجی جی بوانیت. لطف <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ایرگیزیت XiphQT</a> یا دگه وانوکی انتخاب کنیت.', 'ogg-player-videoElement' => '<video> جزء', # Fuzzy 'ogg-player-oggPlugin' => ' پلاگین اوجی جی', # Fuzzy 'ogg-player-cortado' => 'کارتادو(جاوا)', 'ogg-player-vlc-mozilla' => 'وی ال سی', 'ogg-player-vlc-activex' => 'VLC (ActiveX)وی ال سی', 'ogg-player-quicktime-mozilla' => 'کویک تایم', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX) کویک تایم', 'ogg-player-thumbnail' => 'هنگت فقط عکس', 'ogg-player-soundthumb' => 'هچ پخش کنوک', 'ogg-player-selected' => '(انتخابی)', 'ogg-use-player' => 'استفاده کن پخش کنوک', 'ogg-more' => 'گیشتر...', 'ogg-dismiss' => 'بندگ', 'ogg-download' => 'ایرگیزگ فایل', 'ogg-desc-link' => 'ای فایل باره', ); /** Bikol Central (Bikol Central) * @author Filipinayzd */ $messages['bcl'] = array( 'ogg-more' => 'Dakol pa..', 'ogg-dismiss' => 'Isara', ); /** Belarusian (беларуская) * @author Тест */ $messages['be'] = array( 'ogg-dismiss' => 'Закрыць', ); /** Belarusian (Taraškievica orthography) (беларуская (тарашкевіца)‎) * @author AVRS * @author EugeneZelenko * @author Jim-by * @author Red Winged Duck * @author Wizardist */ $messages['be-tarask'] = array( 'ogg-desc' => 'Апрацоўшчык файлаў Ogg Theora і Vorbis з прайгравальнікам JavaScript', 'ogg-short-audio' => 'Аўдыё-файл Ogg $1, $2', 'ogg-short-video' => 'Відэа-файл у фармаце Ogg $1, $2', 'ogg-short-general' => 'Мэдыяфайл Ogg $1, $2', 'ogg-long-audio' => 'аўдыё-файл Ogg $1, даўжыня $2, $3', 'ogg-long-video' => 'відэа-файл Ogg $1, даўжыня $2, $4×$5 піксэляў, $3', 'ogg-long-multiplexed' => 'мультыплексны аўдыё/відэа-файл Ogg, $1, даўжыня $2, $4×$5 піксэляў, усяго $3', 'ogg-long-general' => 'мэдыяфайл Ogg, даўжыня $2, $3', 'ogg-long-error' => 'Няслушны файл у фармаце Ogg: $1', 'ogg-play' => 'Прайграць', 'ogg-pause' => 'Паўза', 'ogg-stop' => 'Спыніць', 'ogg-play-video' => 'Прайграць відэа', 'ogg-play-sound' => 'Прайграць аўдыё', 'ogg-no-player' => 'Прабачце, Ваша сыстэма ня мае неабходнага праграмнага забесьпячэньня для прайграваньня файлаў. Калі ласка, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">загрузіце прайгравальнік</a>.', 'ogg-no-xiphqt' => 'Адсутнічае кампанэнт XiphQT для QuickTime. QuickTime ня можа прайграваць файлы ў фармаце Ogg бяз гэтага кампанэнта. Калі ласка, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">загрузіце XiphQT</a> альбо выберыце іншы прайгравальнік.', 'ogg-player-videoElement' => 'Убудаваная падтрымка браўзэра', 'ogg-player-oggPlugin' => 'Плагін для браўзэра', 'ogg-player-thumbnail' => 'Толькі нерухомая выява', 'ogg-player-soundthumb' => 'Няма прайгравальніка', 'ogg-player-selected' => '(выбраны)', 'ogg-use-player' => 'Выкарыстоўваць прайгравальнік:', 'ogg-more' => 'Болей…', 'ogg-dismiss' => 'Зачыніць', 'ogg-download' => 'Загрузіць файл', 'ogg-desc-link' => 'Інфармацыя пра гэты файл', 'ogg-oggThumb-version' => 'OggHandler патрабуе oggThumb вэрсіі $1 ці больш позьняй.', 'ogg-oggThumb-failed' => 'oggThumb не атрымалася стварыць мініятуру.', ); /** Bulgarian (български) * @author AVRS * @author Borislav * @author DCLXVI * @author Spiritia */ $messages['bg'] = array( 'ogg-desc' => 'Приложение за файлове тип Ogg Theora и Vorbis, с плейър на JavaScript', 'ogg-short-audio' => 'Ogg $1 звуков файл, $2', 'ogg-short-video' => 'Ogg $1 видео файл, $2', 'ogg-long-audio' => '(Ogg $1 звуков файл, продължителност $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 видео файл, продължителност $2, $4×$5 пиксела, $3', 'ogg-long-general' => '(Мултимедиен файл в ogg формат с дължина $2, $3)', # Fuzzy 'ogg-long-error' => '(Невалиден ogg файл: $1)', # Fuzzy 'ogg-play' => 'Пускане', 'ogg-pause' => 'Пауза', 'ogg-stop' => 'Спиране', 'ogg-play-video' => 'Пускане на видео', 'ogg-play-sound' => 'Пускане на звук', 'ogg-no-player' => 'Съжаляваме, но на вашия компютър изглежда няма някой от поддържаните плейъри. Моля <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">изтеглете си плейър</a>.', 'ogg-no-xiphqt' => 'Изглежда нямате инсталиран компонента XiphQT за QuickTime. Без този компонент, QuickTime не може да пуска файлове във формат Ogg. Моля, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">свалете си XiphQT</a> или изберете друго приложение.', 'ogg-player-videoElement' => 'Локална поддръжка от браузъра', 'ogg-player-oggPlugin' => 'Плъгин към браузъра', 'ogg-player-thumbnail' => 'Само неподвижни изображения', 'ogg-player-soundthumb' => 'Няма плеър', 'ogg-player-selected' => '(избран)', 'ogg-use-player' => 'Ползване на плеър:', 'ogg-more' => 'Повече...', 'ogg-dismiss' => 'Затваряне', 'ogg-download' => 'Изтегляне на файла', 'ogg-desc-link' => 'Информация за файла', ); /** Bengali (বাংলা) * @author AVRS * @author Bellayet * @author Nasir8891 * @author Zaheen */ $messages['bn'] = array( 'ogg-short-audio' => 'অগ $1 সাউন্ড ফাইল, $2', 'ogg-short-video' => 'অগ $1 ভিডিও ফাইল, $2', 'ogg-short-general' => 'অগ $1 মিডিয়া ফাইল, $2', 'ogg-long-audio' => 'অগ $1 সাউন্ড ফাইল, দৈর্ঘ্য $2, $3', 'ogg-long-video' => 'অগ $1 ভিডিও ফাইল, দৈর্ঘ্য $2, $4×$5 পিক্সেল, $3', 'ogg-long-multiplexed' => 'অগ মাল্টিপ্লেক্সকৃত অডিও/ভিডিও ফাইল, $1, দৈর্ঘ্য $2, $4×$5 পিক্সেল, $3 সামগ্রিক', 'ogg-long-general' => 'অগ মিডিয়া ফাইল, দৈর্ঘ্য $2, $3', 'ogg-long-error' => 'অবৈধ অগ ফাইল: $1', 'ogg-play' => 'চালানো হোক', 'ogg-pause' => 'বিরতি', 'ogg-stop' => 'বন্ধ', 'ogg-play-video' => 'ভিডিও চালানো হোক', 'ogg-play-sound' => 'অডিও চালানো হোক', 'ogg-no-player' => 'দুঃখিত, আপনার কম্পিউটারে ফাইলটি চালনার জন্য কোন সফটওয়্যার নেই। অনুগ্রহ করে <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">চালনাকারী সফটওয়্যার ডাউনলোড করুন</a>।', 'ogg-no-xiphqt' => 'আপনার কুইকটাইম সফটওয়্যারটিতে XiphQT উপাদানটি নেই। এই উপাদানটি ছাড়া কুইকটাইম অগ ফাইল চালাতে পারবে না। অনুগ্রহ করে <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT ডাউনলোড করুন</a> অথবা অন্য একটি চালনাকারী সফটওয়্যার ব্যবহার করুন।', 'ogg-player-videoElement' => 'স্থানীয় ব্রাউজার সাপোর্ট', 'ogg-player-oggPlugin' => 'ব্রাউজার প্লাগ-ইন', 'ogg-player-thumbnail' => 'শুধুমাত্র স্থির চিত্র', 'ogg-player-soundthumb' => 'কোন চালনাকারী সফটওয়্যার নেই', 'ogg-player-selected' => '(নির্বাচিত)', 'ogg-use-player' => 'এই চালনাকারী সফটওয়্যার ব্যবহার করুন:', 'ogg-more' => 'আরও...', 'ogg-dismiss' => 'বন্ধ', 'ogg-download' => 'ফাইল ডাউনলোড করুন', 'ogg-desc-link' => 'এই ফাইলের বৃত্তান্ত', 'ogg-oggThumb-failed' => 'oggThumb থাম্বনেইল তৈরী করতে পারেনি।', ); /** Breton (brezhoneg) * @author AVRS * @author Fohanno * @author Fulup * @author Y-M D */ $messages['br'] = array( 'ogg-desc' => 'Skor evit ar restroù Ogg Theora ha Vorbis, gant ul lenner JavaScript', 'ogg-short-audio' => 'Restr son Ogg $1, $2', 'ogg-short-video' => 'Restr video Ogg $1, $2', 'ogg-short-general' => 'Restr media Ogg $1, $2', 'ogg-long-audio' => '(Restr son Ogg $1, pad $2, $3)', 'ogg-long-video' => 'Restr video Ogg $1, pad $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => '(Restr Ogg klevet/video liesplezhet $1, pad $2, $4×$5 piksel, $3 hollad)', 'ogg-long-general' => '(Restr media Ogg, pad $2, $3)', 'ogg-long-error' => '(Restr ogg direizh : $1)', 'ogg-play' => 'Lenn', 'ogg-pause' => 'Ehan', 'ogg-stop' => 'Paouez', 'ogg-play-video' => 'Lenn ar video', 'ogg-play-sound' => 'Lenn ar son', 'ogg-no-player' => 'Evit doare n\'eus gant ho reizhiad hini ebet eus al lennerioù skoret. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Pellgargit ul lenner skoret</a> mar plij.', 'ogg-no-xiphqt' => 'Evit doare e vank deoc\'h ar parzh XiphQT evit QuickTime. N\'hall ket QuickTime lenn ar restroù Ogg files hep ar parzh-se. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Pellgargit XiphQT</a> pe dibabit ul lenner all.', 'ogg-player-videoElement' => 'Skor ar merdeer orin', 'ogg-player-oggPlugin' => 'Adveziant ar merdeer', 'ogg-player-thumbnail' => 'Skeudenn statek hepken', 'ogg-player-soundthumb' => 'Lenner ebet', 'ogg-player-selected' => '(diuzet)', 'ogg-use-player' => 'Ober gant al lenner :', 'ogg-more' => "Muioc'h...", 'ogg-dismiss' => 'Serriñ', 'ogg-download' => 'Pellgargañ ar restr', 'ogg-desc-link' => 'Diwar-benn ar restr-mañ', 'ogg-oggThumb-version' => "Rekis eo stumm $1 oggThumb, pe nevesoc'h, evit implijout OggHandler.", 'ogg-oggThumb-failed' => "N'eo ket deuet a-benn oggThumb da grouiñ ar munud.", ); /** Bosnian (bosanski) * @author AVRS * @author CERminator */ $messages['bs'] = array( 'ogg-desc' => 'Upravljač za Ogg Theora i Vorbis datotekem sa JavaScript preglednikom', 'ogg-short-audio' => 'Ogg $1 zvučna datoteka, $2', 'ogg-short-video' => 'Ogg $1 video datoteka, $2', 'ogg-short-general' => 'Ogg $1 medijalna datoteka, $2', 'ogg-long-audio' => '(Ogg $1 zvučna datoteka, dužina $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 video datoteka, dužina $2, $4×$5 piksela, $3', 'ogg-long-multiplexed' => '(Ogg multipleksna zvučna/video datoteka, $1, dužina $2, $4×$5 piksela, $3 sveukupno)', # Fuzzy 'ogg-long-general' => '(Ogg medijalna datoteka, dužina $2, $3)', # Fuzzy 'ogg-long-error' => '(Nevaljana ogg datoteka: $1)', # Fuzzy 'ogg-play' => 'Pokreni', 'ogg-pause' => 'Pauza', 'ogg-stop' => 'Zaustavi', 'ogg-play-video' => 'Pokreni video', 'ogg-play-sound' => 'Sviraj zvuk', 'ogg-no-player' => 'Žao nam je, Vaš sistem izgleda da nema nikakvog podržanog softvera za pregled. Molimo Vas <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">da skinete preglednik</a>.', 'ogg-no-xiphqt' => 'Izgleda da nemate XiphQT komponentu za program QuickTime. QuickTime ne može reproducirati Ogg datoteke bez ove komponente. Molimo Vas da <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">skinete XiphQT</a> ili da odaberete drugi preglednik.', 'ogg-player-videoElement' => 'Prirodna podrška preglednika', 'ogg-player-oggPlugin' => 'Dodatak pregledniku', 'ogg-player-thumbnail' => 'Samo mirne slike', 'ogg-player-soundthumb' => 'Nema preglednika', 'ogg-player-selected' => '(odabrano)', 'ogg-use-player' => 'Koristi svirač:', 'ogg-more' => 'Više...', 'ogg-dismiss' => 'Zatvori', 'ogg-download' => 'Učitaj datoteku', 'ogg-desc-link' => 'O ovoj datoteci', 'ogg-oggThumb-version' => 'OggHandler zahtijeva oggThumb verziju $1 ili kasniju.', 'ogg-oggThumb-failed' => 'oggThumb nije uspio napraviti smanjeni pregled.', ); /** Catalan (català) * @author AVRS * @author Aleator * @author Arnaugir * @author Paucabot * @author SMP * @author Toniher * @author Vriullop */ $messages['ca'] = array( 'ogg-desc' => 'Gestor de fitxers Ogg Theora i Vorbis, amb reproductor de Javascript', 'ogg-short-audio' => "Fitxer OGG d'àudio $1, $2", 'ogg-short-video' => 'Fitxer OGG de vídeo $1, $2', 'ogg-short-general' => 'Fitxer multimèdia OGG $1, $2', 'ogg-long-audio' => 'Fitxer de so Ogg $1, llargada $2, $3', 'ogg-long-video' => 'Fitxer OGG de vídeo $1, llargada $2, $4×$5 píxels, $3', 'ogg-long-multiplexed' => "Arxiu d'àudio/vídeo Ogg multiplex, $1, llargada $2, $4×$5 píxels, $3 general", 'ogg-long-general' => 'Fitxer multimèdia Ogg, llargada $2, $3', 'ogg-long-error' => 'Fitxer Ogg invàlid: $1', 'ogg-play' => 'Reprodueix', 'ogg-pause' => 'Pausa', 'ogg-stop' => 'Atura', 'ogg-play-video' => 'Reprodueix vídeo', 'ogg-play-sound' => 'Reprodueix so', 'ogg-no-player' => 'No teniu instaŀlat cap reproductor acceptat. Podeu <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">descarregar-ne</a> un.', 'ogg-no-xiphqt' => 'No disposeu del component XiphQT al vostre QuickTime. Aquest component és imprescindible per a que el QuickTime pugui reproduir fitxers OGG. Podeu <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">descarregar-lo</a> o escollir un altre reproductor.', 'ogg-player-videoElement' => 'Suport natiu del navegador', 'ogg-player-oggPlugin' => 'Connector del navegador', 'ogg-player-thumbnail' => 'Només un fotograma', 'ogg-player-soundthumb' => 'Cap reproductor', 'ogg-player-selected' => '(seleccionat)', 'ogg-use-player' => 'Usa el reproductor:', 'ogg-more' => 'Més...', 'ogg-dismiss' => 'Tanca', 'ogg-download' => 'Descarrega el fitxer', 'ogg-desc-link' => 'Informació del fitxer', 'ogg-oggThumb-version' => "L'OggHandler necessita l'oggThumb versió $1 o posterior.", 'ogg-oggThumb-failed' => "L'oggThumb no ha pogut crear una miniatura.", ); /** Chechen (нохчийн) * @author Sasan700 * @author Умар */ $messages['ce'] = array( 'ogg-dismiss' => 'Къайлайаккха', 'ogg-download' => 'Файл чуяккхар', ); /** Sorani Kurdish (کوردی) * @author Asoxor */ $messages['ckb'] = array( 'ogg-more' => 'زیاتر', 'ogg-dismiss' => 'بەستن', ); /** Czech (česky) * @author AVRS * @author Li-sung * @author Matěj Grabovský * @author Mormegil */ $messages['cs'] = array( 'ogg-desc' => 'Obsluha souborů Ogg Theora a Vorbis s JavaScriptovým přehrávačem', 'ogg-short-audio' => 'Zvukový soubor ogg $1, $2', 'ogg-short-video' => 'Videosoubor ogg $1, $2', 'ogg-short-general' => 'Soubor média ogg $1, $2', 'ogg-long-audio' => 'Zvukový soubor Ogg $1, délka $2, $3', 'ogg-long-video' => 'Videosoubor $1, délka $2, $4×$5 pixelů, $3', 'ogg-long-multiplexed' => 'multiplexovaný audio/video soubor Ogg, $1, délka $2, $4×$5 pixelů, celkem $3', 'ogg-long-general' => 'Soubor média Ogg, délka $2, $3', 'ogg-long-error' => 'Chybný soubor Ogg: $1', 'ogg-play' => 'Přehrát', 'ogg-pause' => 'Pozastavit', 'ogg-stop' => 'Zastavit', 'ogg-play-video' => 'Přehrát video', 'ogg-play-sound' => 'Přehrát zvuk', 'ogg-no-player' => 'Váš systém zřejmě neobsahuje žádný podporovaný přehrávač. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Váš systém zřejmě neobsahuje žádný podporovaný přehrávač. </a>.', 'ogg-no-xiphqt' => 'Nemáte rozšíření XiphQT pro QuickTime. QuickTime nemůže přehrávat soubory ogg bez tohoto rozšíření. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Stáhněte XiphQT</a> nebo vyberte jiný přehrávač.', 'ogg-player-videoElement' => 'Vestavěná podpora v prohlížeči', 'ogg-player-oggPlugin' => 'Zásuvný modul do prohlížeče', 'ogg-player-thumbnail' => 'Pouze snímek náhledu', 'ogg-player-soundthumb' => 'Žádný přehrávač', 'ogg-player-selected' => '(zvoleno)', 'ogg-use-player' => 'Vyberte přehrávač:', 'ogg-more' => 'Více...', 'ogg-dismiss' => 'Zavřít', 'ogg-download' => 'Stáhnout soubor', 'ogg-desc-link' => 'O tomto souboru', 'ogg-oggThumb-version' => 'OggHandler vyžaduje oggThumb verze $1 nebo novější.', 'ogg-oggThumb-failed' => 'oggThumb nedokázal vytvořit náhled.', ); /** Welsh (Cymraeg) * @author AVRS * @author Lloffiwr */ $messages['cy'] = array( 'ogg-desc' => 'Trinydd ffeiliau Ogg Theora a Vorbis, gyda chwaraewr JavaScript', 'ogg-short-audio' => 'Ffeil sain Ogg $1, $2', 'ogg-short-video' => 'Ffeil fideo Ogg $1, $2', 'ogg-short-general' => 'Ffeil gyfrwng Ogg $1, $2', 'ogg-long-audio' => 'Ffeil sain Ogg $1, o hyd $2, $3', 'ogg-long-video' => 'Ffeil fideo Ogg $1, o hyd $2, $4×$5 picsel, $3', 'ogg-long-multiplexed' => 'Ffeil sain/fideo amlbleth Ogg, $1, o hyd $2, $4×$5 picsel, $3 o ben i ben', 'ogg-long-general' => 'Ffeil gyfrwng Ogg, o hyd $2, $3', 'ogg-long-error' => 'Ffeil OGG annilys: $1', 'ogg-play' => 'Chwarae', 'ogg-pause' => 'Oedi', 'ogg-stop' => 'Aros', 'ogg-play-video' => "Chwarae'r fideo", 'ogg-play-sound' => 'Gwrando', 'ogg-no-player' => 'Mae\'n ddrwg gennym, mae\'n debyg nad oes unrhyw feddalwedd chwaraewr a gefnogir ar eich system. Byddwch gystal à <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">lawrlwytho chwaraewr</a>.', 'ogg-no-xiphqt' => 'Ymddengys nad yw\'r gydran XiphQT ar gyfer QuickTime gennych. Ni all QuickTime chwarae ffeiliau Ogg heb y gydran hon. Os gwelwch yn dda, a wnewch chi <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">lawrlwytho XiphQT</a> neu ddewis chwaraewr arall.', 'ogg-player-videoElement' => 'Cynhaliad porwr ar gael yn barod', 'ogg-player-oggPlugin' => 'Ategyn porwr', 'ogg-player-thumbnail' => 'Llun llonydd yn unig', 'ogg-player-soundthumb' => 'Dim chwaraewr', 'ogg-player-selected' => '(dethol)', 'ogg-use-player' => 'Dewis chwaraewr:', 'ogg-more' => 'Mwy...', 'ogg-dismiss' => 'Cau', 'ogg-download' => 'Islwytho ffeil', 'ogg-desc-link' => "Ynglŷn â'r ffeil hon", 'ogg-oggThumb-version' => 'Mae ar OggHandler angen fersiwn $1 o oggThumb (neu fersiwn diweddarach).', 'ogg-oggThumb-failed' => "Methodd oggThumb â chynhyrchu'r mân-lun.", ); /** Danish (dansk) * @author AVRS * @author Byrial * @author Jon Harald Søby * @author Peter Alberti */ $messages['da'] = array( 'ogg-desc' => 'Understøtter Ogg Theora- og Vorbis-filer med en JavaScript-afspiller.', 'ogg-short-audio' => 'Ogg $1 lydfil, $2', 'ogg-short-video' => 'Ogg $1 videofil, $2', 'ogg-short-general' => 'Ogg $1 mediafil, $2', 'ogg-long-audio' => 'Ogg $1-lydfil, længde $2, $3', 'ogg-long-video' => 'Ogg $1 videofil, længde $2, $4×$5 pixel, $3', 'ogg-long-multiplexed' => 'Sammensat ogg-lyd- og -videofil, $1, længde $2, $4×$5 pixel, $3 samlet', 'ogg-long-general' => 'Ogg mediefil, længde $2, $3', 'ogg-long-error' => 'Ugyldig ogg-fil: $1', 'ogg-play' => 'Afspil', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Afspil video', 'ogg-play-sound' => 'Afspil lyd', 'ogg-no-player' => 'Desværre ser det ud til at dit system har nogen understøttede medieafspillere. <a href="http://mediawiki.org/wiki/Extension:OggHandler/Client_download">Download venligst en afspiller</a>.', 'ogg-no-xiphqt' => 'Det ser ud til at du ikke har XiphQT-komponenten til QuickTime. QuickTime kan ikke afspille Ogg-file uden denne komponent. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Download venligst XiphQT</a> eller vælg en anden afspiller.', 'ogg-player-videoElement' => 'Indbygget browserunderstøttelse', 'ogg-player-oggPlugin' => 'Browsertilføjelse', 'ogg-player-thumbnail' => 'Kun stillbilleder', 'ogg-player-soundthumb' => 'Ingen afspiller', 'ogg-player-selected' => '(valgt)', 'ogg-use-player' => 'Brug afspiller:', 'ogg-more' => 'Mere...', 'ogg-dismiss' => 'Luk', 'ogg-download' => 'Download fil', 'ogg-desc-link' => 'Om denne fil', 'ogg-oggThumb-version' => 'OggHandler kræver oggThumb version $1 eller nyere.', 'ogg-oggThumb-failed' => 'oggThumb kunne ikke oprette et miniaturebillede.', ); /** German (Deutsch) * @author AVRS * @author Kghbln * @author Leithian * @author Metalhead64 * @author MichaelFrey * @author Raimond Spekking * @author Umherirrender */ $messages['de'] = array( 'ogg-desc' => 'Stellt ein Steuerungsprogramm, einschließlich einer JavaScript-gestützten Abspielsoftware, für Ogg Theora- und Ogg Vorbis-Dateien bereit', 'ogg-short-audio' => 'Ogg-$1-Audiodatei, $2', 'ogg-short-video' => 'Ogg-$1-Videodatei, $2', 'ogg-short-general' => 'Ogg-$1-Mediadatei, $2', 'ogg-long-audio' => 'Ogg-$1-Audiodatei, Länge: $2, $3', 'ogg-long-video' => 'Ogg-$1-Videodatei, Länge: $2, $4×$5 Pixel, $3', 'ogg-long-multiplexed' => 'Gebündelte Ogg-Audio-/Ogg-Video-Datei, $1, Länge: $2, $4×$5 Pixel, $3 insgesamt', 'ogg-long-general' => 'Ogg-Mediadatei, Länge: $2, $3', 'ogg-long-error' => 'Ungültige Ogg-Datei: $1', 'ogg-play' => 'Start', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Stopp', 'ogg-play-video' => 'Video abspielen', 'ogg-play-sound' => 'Audio abspielen', 'ogg-no-player' => 'Das System scheint über keine Abspielsoftware zu verfügen. Bitte <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">eine Abspielsoftware</a> installieren.', 'ogg-no-xiphqt' => 'Das System scheint nicht über die XiphQT-Komponente für QuickTime zu verfügen. QuickTime kann ohne diese Komponente keine Ogg-Dateien abspielen. Bitte <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT</a> installieren oder eine andere Abspielsoftware wählen.', 'ogg-player-videoElement' => 'Vorhandene Browserunterstützung', 'ogg-player-oggPlugin' => 'Browser-Plugin', 'ogg-player-thumbnail' => 'nur Vorschaubild', 'ogg-player-soundthumb' => 'Kein Player', 'ogg-player-selected' => '(ausgewählt)', 'ogg-use-player' => 'Abspielsoftware:', 'ogg-more' => 'Optionen …', 'ogg-dismiss' => 'Schließen', 'ogg-download' => 'Datei speichern', 'ogg-desc-link' => 'Über diese Datei', 'ogg-oggThumb-version' => 'OggHandler erfordert oggThumb in der Version $1 oder höher.', 'ogg-oggThumb-failed' => 'oggThumb konnte kein Miniaturbild erstellen.', ); /** Swiss High German (Schweizer Hochdeutsch) * @author Geitost */ $messages['de-ch'] = array( 'ogg-desc' => 'Stellt ein Steuerungsprogramm, einschliesslich einer JavaScript-gestützten Abspielsoftware, für Ogg Theora- und Ogg Vorbis-Dateien bereit.', 'ogg-dismiss' => 'Schliessen', ); /** Zazaki (Zazaki) * @author AVRS * @author Aspar * @author Erdemaslancan * @author Xoser */ $messages['diq'] = array( 'ogg-desc' => 'Qe dosyayanê Ogg Theora u Vorbisî pê JavaScriptî qulp', 'ogg-short-audio' => 'Ogg $1 dosyaya vengi, $2', 'ogg-short-video' => 'Ogg $1 dosyaya filmi, $2', 'ogg-short-general' => 'Ogg $1 dosyaya medyayi, $2', 'ogg-long-audio' => 'Ogg $1 dosyaya vengi, dergey $2, $3', 'ogg-long-video' => 'Ogg $1 dosyaya filmi, mudde $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => 'Ogg dosyaya filmi/vengi yo tewr sewiyede, $1, dergey $2, $4×$5 piksel, Şareyey $3', 'ogg-long-general' => 'Ogg dosyaya medyay, dergey $2, $3 ya', 'ogg-long-error' => 'dosyaya oggi yo nemeqbul: $1', 'ogg-play' => 'Bıcın', 'ogg-pause' => 'Vındarnê', 'ogg-stop' => 'vındarn', 'ogg-play-video' => "video bıd' kaykerdış", 'ogg-play-sound' => "veng bıd' kaykerdış", 'ogg-no-player' => 'ma meluli, wina aseno ke sistemê şıma wayirê softwareyi yo player niyo. kerem kerê <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">yew player biyare war</a>.', 'ogg-no-xiphqt' => 'qey QuickTimeyi wina aseno ke şıma wayirê parçeyê XiphQTi niyê. heta ke parçeyê QuickTimeyi çinibi dosyayê Oggyi nêxebıtiyeni. kerem kerê<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT\'i biyar war</a> ya zi yewna player bıvıcinê.', 'ogg-player-videoElement' => 'destekê cıgêrayoxê mehelliyi', 'ogg-player-oggPlugin' => 'Zeylê rovıteri', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (ActiveX)', 'ogg-player-quicktime-mozilla' => 'QuickTime', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kaffeine', 'ogg-player-mplayerplug-in' => 'mplayerplug-in', 'ogg-player-thumbnail' => 'hema têna resm o.', 'ogg-player-soundthumb' => 'player çino', 'ogg-player-selected' => '(vıciyaye)', 'ogg-use-player' => 'player bışuxuln:', 'ogg-more' => 'hema....', 'ogg-dismiss' => 'Racnê', 'ogg-download' => 'dosya biyar war', 'ogg-desc-link' => 'derheqê dosyayi de', 'ogg-oggThumb-version' => 'OggHandler rê oggThumb versiyon $1 ya zi newiyer lazim o.', 'ogg-oggThumb-failed' => 'oggThumb nieskene thumbnail biviraze.', ); /** Lower Sorbian (dolnoserbski) * @author AVRS * @author Michawiki */ $messages['dsb'] = array( 'ogg-desc' => 'Wóźeński program za dataje Ogg Theora a Vprbis z JavaScriptowym wótegrawakom', 'ogg-short-audio' => 'Ogg $1 awdiodataja, $2', 'ogg-short-video' => 'Ogg $1 wideodataja, $2', 'ogg-short-general' => 'Ogg $1 medijowa dataja, $2', 'ogg-long-audio' => 'Ogg $1 awdiodataja, dłujkosć $2, $3', 'ogg-long-video' => 'Ogg $1 wideodataja, dłujkosć $2, $4×$5 pikselow, $3', 'ogg-long-multiplexed' => 'ogg multipleksowa awdio-/wideodataja, $1, dłujkosć $2, $4×$5 pikselow, $3 dogromady', 'ogg-long-general' => 'Ogg medijowa dataja, dłujkosć $2, $3', 'ogg-long-error' => 'Njepłaśiwa ogg-dataja: $1', 'ogg-play' => 'Wótegraś', 'ogg-pause' => 'Pśestank', 'ogg-stop' => 'Stoj', 'ogg-play-video' => 'Wideo wótegraś', 'ogg-play-sound' => 'Zuk wótegraś', 'ogg-no-player' => 'Wódaj, twój system njezda se pódpěrany wótegrawak měś. Pšosym <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ześěgni wótegrawak</a>.', 'ogg-no-xiphqt' => 'Zda se, až njamaš komponentu XiphQT za QuickTime. QuickTime njamóžo ogg-dataje bźez toś teje komponenty wótegraś. Pšosym <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Cient_download">ześěgni XiphQT</a> abo wubjeŕ drugi wótegrawak.', 'ogg-player-videoElement' => 'Zatwarjona pódpěra pśez wobglědowak', 'ogg-player-oggPlugin' => 'Tykac za wobglědowak', 'ogg-player-thumbnail' => 'Jano njegibny wobraz', 'ogg-player-soundthumb' => 'Žeden wótegrawak', 'ogg-player-selected' => '(wubrany)', 'ogg-use-player' => 'Wubjeŕ wótgrawak:', 'ogg-more' => 'Wěcej...', 'ogg-dismiss' => 'Zacyniś', 'ogg-download' => 'Dataju ześěgnuś', 'ogg-desc-link' => 'Wó toś tej dataji', 'ogg-oggThumb-version' => 'OggHandler trjeba wersiju $1 oggThumb abo nowšu.', 'ogg-oggThumb-failed' => 'oggThumb njejo mógł wobrazk napóraś.', ); /** Greek (Ελληνικά) * @author AVRS * @author Consta * @author Dead3y3 * @author Glavkos * @author Omnipaedista * @author ZaDiak */ $messages['el'] = array( 'ogg-desc' => 'Χειριστής για αρχεία Ogg Theora και Vorbis, με αναπαραγωγέα JavaScript', 'ogg-short-audio' => 'Αρχείο ήχου Ogg $1, $2', 'ogg-short-video' => 'Αρχείο βίντεο Ogg $1, $2', 'ogg-short-general' => 'Αρχείο μέσων Ogg $1, $2', 'ogg-long-audio' => 'Αρχείο ήχου Ogg $1, διάρκεια $2, $3', 'ogg-long-video' => 'Αρχείο βίντεο Ogg $1, διάρκεια $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Αρχείο πολυπλεκτικού ήχου/βίντεο Ogg, $1, διάρκεια $2, $4×$5 pixels, $3 ολικά', 'ogg-long-general' => 'Αρχείο ήχου Ogg, διάρκεια $2, $3', 'ogg-long-error' => 'Μη έγκυρο αρχείο ogg: $1', 'ogg-play' => 'Αναπαραγωγή', 'ogg-pause' => 'Παύση', 'ogg-stop' => 'Διακοπή', 'ogg-play-video' => 'Αναπαραγωγή βίντεο', 'ogg-play-sound' => 'Αναπαραγωγή ήχου', 'ogg-no-player' => 'Συγγνώμη, το σύστημά σας δεν φαίνεται να έχει κάποιο υποστηριζόμενο λογισμικό αναπαραγωγής.<br /> Παρακαλώ <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">κατεβάστε ένα πρόγραμμα αναπαραγωγής</a>.', 'ogg-no-xiphqt' => 'Δεν φαίνεται να έχετε το στοιχείο XiphQT για το πρόγραμμα QuickTime.<br /> Το πρόγραμμα QuickTime δεν μπορεί να αναπαράγει αρχεία Ogg χωρίς αυτό το στοιχείο.<br /> Παρακαλώ <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">κατεβάστε το XiphQT</a> ή επιλέξτε ένα άλλο πρόγραμμα αναπαραγωγής.', 'ogg-player-videoElement' => 'Τοπική υποστήριξη φυλλομετρητή', 'ogg-player-oggPlugin' => 'Πρόσθετο φυλλομετρητή', 'ogg-player-thumbnail' => 'Ακίνητη εικόνα μόνο', 'ogg-player-soundthumb' => 'Κανένας αναπαραγωγέας', 'ogg-player-selected' => '(επιλέχθηκε)', 'ogg-use-player' => 'Χρησιμοποίησε αναπαραγωγέα:', 'ogg-more' => 'Περισσότερα...', 'ogg-dismiss' => 'Κλείσιμο', 'ogg-download' => 'Κατεβάστε το αρχείο', 'ogg-desc-link' => 'Σχετικά με αυτό το αρχείο', 'ogg-oggThumb-version' => 'Ο OggHandler απαιτεί την έκδοση oggThumb $1 ή μεταγενέστερη', 'ogg-oggThumb-failed' => 'το oggThumb απέτυχε να δημιουργήσει τη μικρογραφία.', ); /** Esperanto (Esperanto) * @author AVRS * @author Amikeco * @author ArnoLagrange * @author Yekrats */ $messages['eo'] = array( 'ogg-desc' => 'Traktilo por dosieroj Ogg Theora kaj Vobis kun Ĵavaskripta legilo.', 'ogg-short-audio' => 'Ogg $1 sondosiero, $2', 'ogg-short-video' => 'Ogg $1 videodosiero, $2', 'ogg-short-general' => 'Media ogg-dosiero $1, $2', 'ogg-long-audio' => 'Aŭda ogg-dosiero $1, longeco $2, $3', 'ogg-long-video' => 'Video ogg-dosiero $1, longeco $2, $4×$5 pikseloj, $3 entute', 'ogg-long-multiplexed' => 'Kunigita aŭdio/video ogg-dosiero, $1, longeco $2, $4×$5 pikseloj, $3 entute', 'ogg-long-general' => 'Ogg-mediodosiero, longeco $2, $3', 'ogg-long-error' => 'Malvalida ogg-dosiero: $1', 'ogg-play' => 'Legi', 'ogg-pause' => 'Paŭzi', 'ogg-stop' => 'Halti', 'ogg-play-video' => 'Montri videon', 'ogg-play-sound' => 'Aŭdigi sonon', 'ogg-no-player' => 'Ŝajnas ke via sistemo malhavas ian medilegilan programon por legi tian dosieron. Bonvolu <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">elŝuti iun</a>.', 'ogg-no-xiphqt' => 'Ŝajnas ke vi malhavas la XiphQT-komponaĵon por QuickTime. QuickTime ne kapablas aŭdigi sondosierojn sentiu komponaĵo. Bonvolu <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">elŝuti XiphQT</a> aux elektu alian legilon.', 'ogg-player-videoElement' => 'Fundamenta subteno per retumilo', 'ogg-player-oggPlugin' => 'Retumila kromprogramo', 'ogg-player-thumbnail' => 'Nur senmova bildo', 'ogg-player-soundthumb' => 'Neniu legilo', 'ogg-player-selected' => '(elektita)', 'ogg-use-player' => 'Uzi legilon:', 'ogg-more' => 'Pli...', 'ogg-dismiss' => 'Fermi', 'ogg-download' => 'Alŝuti dosieron', 'ogg-desc-link' => 'Pri ĉi tiu dosiero', 'ogg-oggThumb-version' => 'OggHandler bezonas oggThumb version $1 aŭ postan.', 'ogg-oggThumb-failed' => 'oggThumb malsukcis krei etan version.', ); /** Spanish (español) * @author AVRS * @author Aleator * @author Armando-Martin * @author Crazymadlover * @author Fitoschido * @author Muro de Aguas * @author Remember the dot * @author Sanbec * @author Spacebirdy */ $messages['es'] = array( 'ogg-desc' => 'Manejador de archivos de Ogg Thedora y Vorbis, con reproductor de JavaScript', 'ogg-short-audio' => 'Archivo de sonido Ogg $1, $2', 'ogg-short-video' => 'Archivo de video Ogg $1, $2', 'ogg-short-general' => 'Archivo Ogg $1, $2', 'ogg-long-audio' => 'Archivo de sonido Ogg $1, duración $2, $3', 'ogg-long-video' => 'Archivo de video Ogg $1, tamaño $2, $4×$5 píxeles, $3', 'ogg-long-multiplexed' => 'Archivo Ogg de audio/video multiplexado, $1, duración $2, $4×$5 píxeles, $3 total', 'ogg-long-general' => 'Archivo Ogg, duración $2, $3', 'ogg-long-error' => 'Archivo ogg no válido: $1', 'ogg-play' => 'Reproducir', 'ogg-pause' => 'Pausar', 'ogg-stop' => 'Detener', 'ogg-play-video' => 'Reproducir vídeo', 'ogg-play-sound' => 'Reproducir sonido', 'ogg-no-player' => 'Lo sentimos, su sistema parece no tener disponible un programa para reproducción de archivos multimedia. Por favor <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">descargue un reproductor</a>.', 'ogg-no-xiphqt' => 'Parece que Ud. no tiene el componente XiphQT de QuickTime. QuckTime no puede reproducir archivos en formato Ogg sin este componente. Por favor <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">descargue XiphQT</a> o elija otro reproductor de archivos multimedia.', 'ogg-player-videoElement' => 'Apoyo nativo de navegador', 'ogg-player-oggPlugin' => 'Complemento de navegador', 'ogg-player-thumbnail' => 'Únicamente imagen', 'ogg-player-soundthumb' => 'Ningún reproductor', 'ogg-player-selected' => '(seleccionado)', 'ogg-use-player' => 'Usar reproductor:', 'ogg-more' => 'Opciones...', 'ogg-dismiss' => 'Cerrar', 'ogg-download' => 'Descargar archivo', 'ogg-desc-link' => 'Sobre este archivo', 'ogg-oggThumb-version' => 'OggHandler requiere una versión oggThumb $1 o posterior.', 'ogg-oggThumb-failed' => 'oggThumb no pudo crear la imagen miniatura.', ); /** Estonian (eesti) * @author Avjoska * @author Pikne * @author Silvar */ $messages['et'] = array( 'ogg-desc' => 'Theora- ja Vorbis-tüüpi Ogg-faildie käsitseja JavaScript-esitajaga', 'ogg-short-audio' => '$1-tüüpi Ogg-helifail, $2', 'ogg-short-video' => '$1-tüüpi Ogg-videofail, $2', 'ogg-short-general' => '$1-tüüpi Ogg-fail, $2', 'ogg-long-audio' => '$1-tüüpi Ogg-helifail, kestus: $2, $3', 'ogg-long-video' => '$1-tüüpi Ogg-videofail, kestus: $2, $4×$5 pikslit, $3', 'ogg-long-multiplexed' => 'Ogg-liitfail (heli ja video), $1, kestus: $2, $4×$5 pikslit, üldbitikiirus: $3', 'ogg-long-general' => 'Ogg-fail, kestus: $2, $3', 'ogg-long-error' => 'Vigane Ogg-fail: $1', 'ogg-play' => 'Esita', 'ogg-pause' => 'Paus', 'ogg-stop' => 'Peata', 'ogg-play-video' => 'Esita video', 'ogg-play-sound' => 'Esita heli', 'ogg-no-player' => 'Kahjuks ei paista su süsteemis olevat ühtki ühilduvat esitustarkvara. Palun <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">laadi tarkvara alla</a>.', 'ogg-no-xiphqt' => 'Paistab, et sul pole QuickTime\'i komponenti XiphQT. Selleta ei saa QuickTime Ogg-faile esitada. Palun <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">laadi XiphQT alla</a> või vali teine esitaja.', 'ogg-player-videoElement' => 'Võrgulehitseja omatugi', 'ogg-player-oggPlugin' => 'Võrgulehitseja lisa', 'ogg-player-thumbnail' => 'Liikumatu pilt', 'ogg-player-soundthumb' => 'Mängijat ei ole', 'ogg-player-selected' => '(valitud)', 'ogg-use-player' => 'Kasuta mängijat:', 'ogg-more' => 'Lisa...', 'ogg-dismiss' => 'Sule', 'ogg-download' => 'Laadi fail alla', 'ogg-desc-link' => 'Info faili kohta', 'ogg-oggThumb-version' => 'OggHandler vajab oggThumbi versiooni $1 või hilisemat.', 'ogg-oggThumb-failed' => 'oggThumbil ei õnnestunud pisipildi loomine.', ); /** Basque (euskara) * @author An13sa * @author Joxemai * @author Theklan */ $messages['eu'] = array( 'ogg-desc' => 'Ogg Theora eta Vorbis fitxategientzako edukiontzia, JavaScript playerrarekin', 'ogg-short-audio' => 'Ogg $1 soinu fitxategia, $2', 'ogg-short-video' => 'Ogg $1 bideo fitxategia, $2', 'ogg-short-general' => 'Ogg $1 media fitxategia, $2', 'ogg-long-audio' => 'Ogg $1 soinu fitxategia, $2 iraupena, $3', 'ogg-long-error' => 'ogg fitxategi okerra: $1', 'ogg-play' => 'Hasi', 'ogg-pause' => 'Eten', 'ogg-stop' => 'Gelditu', 'ogg-play-video' => 'Bideoa hasi', 'ogg-play-sound' => 'Soinua hasi', 'ogg-player-soundthumb' => 'Erreproduktorerik ez', 'ogg-player-selected' => '(aukeratua)', 'ogg-use-player' => 'Erabili erreproduktore hau:', 'ogg-more' => 'Gehiago...', 'ogg-dismiss' => 'Itxi', 'ogg-download' => 'Fitxategia jaitsi', 'ogg-desc-link' => 'Fitxategi honen inguruan', ); /** Persian (فارسی) * @author Ebraminio * @author Huji * @author Sahim * @author Wayiran */ $messages['fa'] = array( 'ogg-desc' => 'به دست گیرندهٔ پرونده‌های Ogg Theora و Vorbis، با پخش‌کنندهٔ مبتنی بر JavaScript', 'ogg-short-audio' => 'پرونده صوتی Ogg $1، $2', 'ogg-short-video' => 'پرونده تصویری Ogg $1، $2', 'ogg-short-general' => 'پرونده Ogg $1، $2', 'ogg-long-audio' => 'پروندهٔ صوتی آگ $1، مدت $2، $3', 'ogg-long-video' => 'پروندهٔ تصویری آگ $1، مدت $2 ، $4×$5 پیکسل، $3', 'ogg-long-multiplexed' => 'پروندهٔ صوتی/تصویری پیچیدهٔ آگ، $1، مدت $2، $4×$5 پیکسل، $3 در مجموع', 'ogg-long-general' => 'پروندهٔ رسانه‌ای آگ، مدت $2، $3', 'ogg-long-error' => 'پروندهٔ نامعتبر آگ: $1', 'ogg-play' => 'پخش', 'ogg-pause' => 'مکث', 'ogg-stop' => 'ایست', 'ogg-play-video' => 'پخش ویدئو', 'ogg-play-sound' => 'پخش صدا', 'ogg-no-player' => 'متاسفانه دستگاه شما نرم‌افزار پخش‌کنندهٔ مناسب ندارد. لطفاً <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">یک برنامهٔ پخش‌کننده بارگیری کنید</a>.', 'ogg-no-xiphqt' => 'به نظر نمی‌سرد که شما جزء XiphQT از برنامهٔ QuickTime را داشته باشید. برنامهٔ QuickTime بدون این جزء توان پخش پرونده‌های Ogg را ندارد. لطفاً <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT را بارگیری کنید</a> یا از یک پخش‌کنندهٔ دیگر استفاده کنید.', 'ogg-player-videoElement' => 'پشتیبانی ذاتی مرورگر', 'ogg-player-oggPlugin' => 'افزایهٔ مرورگر', 'ogg-player-thumbnail' => 'فقط تصاویر ثابت', 'ogg-player-soundthumb' => 'فاقد پخش‌کننده', 'ogg-player-selected' => '(انتخاب شده)', 'ogg-use-player' => 'این پخش‌کننده را به کارگیر:', 'ogg-more' => 'بیشتر...', 'ogg-dismiss' => 'بستن', 'ogg-download' => 'بارگیری پرونده', 'ogg-desc-link' => 'پیرامون این پرونده', 'ogg-oggThumb-version' => 'OggHandler به oggThumb نسخهٔ $1 یا بعدتر از آن نیاز دارد.', 'ogg-oggThumb-failed' => 'oggThumb موفق به ایجاد بندانگشتی نشد.', ); /** Finnish (suomi) * @author AVRS * @author Agony * @author Crt * @author Linnea * @author Nike * @author Str4nd */ $messages['fi'] = array( 'ogg-desc' => 'Käsittelijä Ogg Theora ja Vorbis -tiedostoille ja JavaScript-soitin.', 'ogg-short-audio' => 'Ogg $1 -äänitiedosto, $2', 'ogg-short-video' => 'Ogg $1 -videotiedosto, $2', 'ogg-short-general' => 'Ogg $1 -mediatiedosto, $2', 'ogg-long-audio' => 'Ogg $1 -äänitiedosto, $2, $3', 'ogg-long-video' => 'Ogg $1 -videotiedosto, $2, $4×$5, $3', 'ogg-long-multiplexed' => 'Ogg-tiedosto (limitetty kuva ja ääni), $1, $2, $4×$5, $3', 'ogg-long-general' => 'Ogg-tiedosto, $2, $3', 'ogg-long-error' => 'Kelvoton Ogg-tiedosto: $1', 'ogg-play' => 'Soita', 'ogg-pause' => 'Tauko', 'ogg-stop' => 'Pysäytä', 'ogg-play-video' => 'Toista video', 'ogg-play-sound' => 'Soita ääni', 'ogg-no-player' => 'Järjestelmästäsi ei löytynyt mitään tuetuista soitinohjelmista. Voit ladata sopivan <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">soitinohjelman</a>.', 'ogg-no-xiphqt' => 'Tarvittavaa QuickTimen XiphQT-komponenttia ei löytynyt. QuickTime ei voi toistaa Ogg-tiedostoja ilman tätä komponenttia. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Lataa XiphQT</a> tai valitse toinen soitin.', 'ogg-player-videoElement' => 'Luontainen selaintuki', 'ogg-player-oggPlugin' => 'Selainlaajennos', 'ogg-player-thumbnail' => 'Pysäytyskuva', 'ogg-player-soundthumb' => 'Ei soitinta', 'ogg-player-selected' => '(valittu)', 'ogg-use-player' => 'Soitin:', 'ogg-more' => 'Lisää…', 'ogg-dismiss' => 'Sulje', 'ogg-download' => 'Lataa', 'ogg-desc-link' => 'Tiedoston tiedot', 'ogg-oggThumb-version' => 'OggHandler vaatii oggThumbin version $1 tai uudemman.', 'ogg-oggThumb-failed' => 'oggThumb ei onnistunut luomaan pienoiskuvaa.', ); /** Faroese (føroyskt) * @author EileenSanda * @author Spacebirdy */ $messages['fo'] = array( 'ogg-short-audio' => 'Ogg $1 ljóð fíla, $2', 'ogg-short-video' => 'Ogg $1 video fíla, $2', 'ogg-play' => 'Play', 'ogg-pause' => 'Pausa', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Spæl video', 'ogg-play-sound' => 'Spæl ljóð', 'ogg-player-videoElement' => 'Innbygdur brovsara stuðul', 'ogg-player-soundthumb' => 'Ongin avspælari', 'ogg-use-player' => 'Brúka avspælara:', 'ogg-more' => 'Meira...', 'ogg-dismiss' => 'Lat aftur', 'ogg-download' => 'Tak niður fílu', 'ogg-desc-link' => 'Um hesa fílu', ); /** French (français) * @author AVRS * @author Crochet.david * @author DavidL * @author Gomoko * @author Grondin * @author Jean-Frédéric * @author Peter17 * @author Seb35 * @author Sherbrooke * @author Urhixidur * @author Verdy p */ $messages['fr'] = array( 'ogg-desc' => 'Support pour les fichiers Ogg Theora et Vorbis, avec un lecteur Javascript', 'ogg-short-audio' => 'Fichier son Ogg $1, $2', 'ogg-short-video' => 'Fichier vidéo Ogg $1, $2', 'ogg-short-general' => 'Fichier média Ogg $1, $2', 'ogg-long-audio' => 'Fichier son Ogg $1, durée $2, $3', 'ogg-long-video' => 'Fichier vidéo Ogg $1, durée $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Fichier multiplexé audio/vidéo Ogg, $1, durée $2, $4×$5 pixels, $3', 'ogg-long-general' => 'Fichier média Ogg, durée $2, $3', 'ogg-long-error' => 'Fichier Ogg invalide : $1', 'ogg-play' => 'Lecture', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Arrêt', 'ogg-play-video' => 'Lire la vidéo', 'ogg-play-sound' => 'Lire le son', 'ogg-no-player' => 'Désolé, votre système ne possède apparemment aucun des lecteurs supportés. Veuillez installer <a href="//www.mediawiki.org/wiki/Extension:OggHandler/Client_download/fr">un des lecteurs supportés</a>.', 'ogg-no-xiphqt' => 'Vous n’avez apparemment pas le composant XiphQT pour Quicktime. Quicktime ne peut pas lire les fichiers Ogg sans ce composant. Veuillez <a href="//www.mediawiki.org/wiki/Extension:OggHandler/Client_download/fr">télécharger XiphQT</a> ou choisir un autre lecteur.', 'ogg-player-videoElement' => 'Support du navigateur natif', 'ogg-player-oggPlugin' => 'Module complémentaire du navigateur', 'ogg-player-thumbnail' => 'Image statique seulement', 'ogg-player-soundthumb' => 'Aucun lecteur', 'ogg-player-selected' => '(sélectionné)', 'ogg-use-player' => 'Utiliser le lecteur :', 'ogg-more' => 'Plus…', 'ogg-dismiss' => 'Fermer', 'ogg-download' => 'Télécharger le fichier', 'ogg-desc-link' => 'À propos de ce fichier', 'ogg-oggThumb-version' => 'OggHandler nécessite oggThumb, version $1 ou supérieure.', 'ogg-oggThumb-failed' => 'oggThumb n’a pas réussi à créer la miniature.', ); /** Franco-Provençal (arpetan) * @author AVRS * @author ChrisPtDe */ $messages['frp'] = array( 'ogg-desc' => 'Assistance por los fichiérs Ogg Theora et Vorbis, avouéc un liésor JavaScript.', 'ogg-short-audio' => 'fichiér son Ogg $1, $2', 'ogg-short-video' => 'Fichiér vidèô Ogg $1, $2', 'ogg-short-general' => 'Fichiér mèdia Ogg $1, $2', 'ogg-long-audio' => 'Fichiér son Ogg $1, durâ $2, $3', 'ogg-long-video' => 'fichiér vidèô Ogg $1, temps $2, $4×$5 pixèls, $3', 'ogg-long-multiplexed' => 'Fichiér multiplèxo ôdiô / vidèô Ogg, $1, durâ $2, $4×$5 pixèls, en tot $3', 'ogg-long-general' => 'Fichiér mèdia Ogg, durâ $2, $3', 'ogg-long-error' => 'Fichiér Ogg envalido : $1', 'ogg-play' => 'Liére', 'ogg-pause' => 'Pousa', 'ogg-stop' => 'Arrét', 'ogg-play-video' => 'Liére la vidèô', 'ogg-play-sound' => 'Liére lo son', 'ogg-no-player' => 'Dèsolâ, aparament voutron sistèmo at gins de liésor recognu. Volyéd enstalar <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/fr">yon des liésors recognus</a>.', 'ogg-no-xiphqt' => 'Aparament vos avéd pas lo composent XiphQT por QuickTime. QuickTime pôt pas liére los fichiérs Ogg sen cél composent. Volyéd <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/fr">tèlèchargiér XiphQT</a> ou ben chouèsir un ôtro liésor.', 'ogg-player-videoElement' => 'Assistance du navigator nativa', 'ogg-player-oggPlugin' => 'Modulo d’èxtension du navigator', 'ogg-player-thumbnail' => 'Solament l’émâge fixa', 'ogg-player-soundthumb' => 'Gins de liésor', 'ogg-player-selected' => '(chouèsi)', 'ogg-use-player' => 'Utilisar lo liésor :', 'ogg-more' => 'De ples...', 'ogg-dismiss' => 'Cllôre', 'ogg-download' => 'Tèlèchargiér lo fichiér', 'ogg-desc-link' => 'Sur ceti fichiér', 'ogg-oggThumb-version' => 'OggHandler at fôta d’oggThumb, vèrsion $1 ou ben ples novèla.', 'ogg-oggThumb-failed' => 'oggThumb at pas reussi a fâre la figura.', ); /** Friulian (furlan) * @author AVRS * @author Klenje */ $messages['fur'] = array( 'ogg-desc' => 'Gjestôr pai files Ogg Theora e Vorbis, cuntun riprodutôr JavaScript', 'ogg-short-audio' => 'File audio Ogg $1, $2', 'ogg-short-video' => 'File video Ogg $1, $2', 'ogg-short-general' => 'File multimediâl Ogg $1, $2', 'ogg-long-audio' => 'File audio Ogg $1, durade $2, $3', 'ogg-long-video' => 'File video Ogg $1, durade $2, dimensions $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'File audio/video multiplexed Ogg $1, lungjece $2, dimensions $4×$5 pixels, in dut $3', 'ogg-long-general' => 'File multimediâl Ogg, durade $2, $3', 'ogg-long-error' => 'File Ogg no valit: $1', 'ogg-play' => 'Riprodûs', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Ferme', 'ogg-play-video' => 'Riprodûs il video', 'ogg-play-sound' => 'Riprodûs il file audio', 'ogg-no-player' => 'Nus displâs ma il to sisteme nol à riprodutôrs software supuartâts. Par plasê <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">discjame un riprodutôr</a>.', 'ogg-no-xiphqt' => 'Al samee che no tu vedis il component XiphQT par QuickTime. QuickTime nol pues riprodusi i files Ogg cence di chest component. Par plasê <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">discjame XiphQT</a> o sielç un altri letôr.', 'ogg-player-videoElement' => 'Supuart sgarfadôr natîf', 'ogg-player-oggPlugin' => 'Plugin sgarfadôr', 'ogg-player-thumbnail' => 'Dome figure fisse', 'ogg-player-soundthumb' => 'Nissun riprodutôr', 'ogg-player-selected' => '(selezionât)', 'ogg-use-player' => 'Dopre il riprodutôr:', 'ogg-more' => 'Altri...', 'ogg-dismiss' => 'Siere', 'ogg-download' => 'Discjame il file', 'ogg-desc-link' => 'Informazions su chest file', 'ogg-oggThumb-version' => 'A OggHandler i covente oggThumb version $1 o sucessive.', 'ogg-oggThumb-failed' => 'oggThumb nol è rivât a creâ la miniature.', ); /** Irish (Gaeilge) * @author Spacebirdy */ $messages['ga'] = array( 'ogg-dismiss' => 'Dún', ); /** Galician (galego) * @author AVRS * @author Toliño * @author Xosé */ $messages['gl'] = array( 'ogg-desc' => 'Manipulador dos ficheiros Ogg Theora e mais dos ficheiros Vorbis co reprodutor JavaScript', 'ogg-short-audio' => 'Ficheiro de son Ogg $1, $2', 'ogg-short-video' => 'Ficheiro de vídeo Ogg $1, $2', 'ogg-short-general' => 'Ficheiro multimedia Ogg $1, $2', 'ogg-long-audio' => 'ficheiro de son Ogg $1, duración: $2, $3', 'ogg-long-video' => 'ficheiro de vídeo Ogg $1, duración: $2, $4×$5 píxeles, $3', 'ogg-long-multiplexed' => 'ficheiro de son/vídeo Ogg multiplex, $1, duración: $2, $4×$5 píxeles, $3 total', 'ogg-long-general' => 'ficheiro multimedia Ogg, duración: $2, $3', 'ogg-long-error' => 'Ficheiro Ogg non válido: $1', 'ogg-play' => 'Reproducir', 'ogg-pause' => 'Pausar', 'ogg-stop' => 'Deter', 'ogg-play-video' => 'Reproducir o vídeo', 'ogg-play-sound' => 'Reproducir o son', 'ogg-no-player' => 'Parece que o seu sistema non dispón do software de reprodución axeitado. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Instale un reprodutor</a>.', 'ogg-no-xiphqt' => 'Parece que non dispón do compoñente XiphQT para QuickTime. QuickTime non pode reproducir ficheiros Ogg sen este componente. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Instale XiphQT</a> ou escolla outro reprodutor.', 'ogg-player-videoElement' => 'Soporte nativo do navegador', 'ogg-player-oggPlugin' => 'Complemento do navegador', 'ogg-player-thumbnail' => 'Só instantánea', 'ogg-player-soundthumb' => 'Ningún reprodutor', 'ogg-player-selected' => '(seleccionado)', 'ogg-use-player' => 'Usar o reprodutor:', 'ogg-more' => 'Máis...', 'ogg-dismiss' => 'Pechar', 'ogg-download' => 'Descargar o ficheiro', 'ogg-desc-link' => 'Acerca deste ficheiro', 'ogg-oggThumb-version' => 'O OggHandler necesita a versión $1 ou unha posterior do oggThumb.', 'ogg-oggThumb-failed' => 'Houbo un erro por parte do oggThumb ao crear a miniatura.', ); /** Ancient Greek (Ἀρχαία ἑλληνικὴ) * @author Crazymadlover * @author Flyax * @author Omnipaedista */ $messages['grc'] = array( 'ogg-long-error' => '(Ἄκυρα ἀρχεῖα ogg: $1)', # Fuzzy 'ogg-play' => 'Ἀναπαράγειν', 'ogg-player-selected' => '(επιλεγμένη)', 'ogg-more' => 'πλέον...', 'ogg-dismiss' => 'Κλῄειν', ); /** Swiss German (Alemannisch) * @author AVRS * @author Als-Chlämens * @author Als-Holder * @author Melancholie */ $messages['gsw'] = array( 'ogg-desc' => 'Styyrigsprogramm fir Ogg Theora- un Vorbis-Dateie, mit ere JavaScript-Abspiilsoftware', 'ogg-short-audio' => 'Ogg-$1-Audiodatei, $2', 'ogg-short-video' => 'Ogg-$1-Videodatei, $2', 'ogg-short-general' => 'Ogg-$1-Mediadatei, $2', 'ogg-long-audio' => 'Ogg-$1-Audiodatei, Längi: $2, $3', 'ogg-long-video' => 'Ogg-$1-Videodatei, Längi: $2, $4×$5 Pixel, $3', 'ogg-long-multiplexed' => 'Gebündelti Ogg-Audio-/Ogg-Video-Datei, $1, Längi: $2, $4×$5 Pixel, $3 insgesamt', 'ogg-long-general' => 'Ogg-Mediadatei, Längi: $2, $3', 'ogg-long-error' => 'Ungültigi Ogg-Datei: $1', 'ogg-play' => 'Start', 'ogg-pause' => 'Paus', 'ogg-stop' => 'Stopp', 'ogg-play-video' => 'Video abspiile', 'ogg-play-sound' => 'Audio abspiile', 'ogg-no-player' => 'Dyy Syschtem het schyyns kei Abspiilsoftware. Bitte installier <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">e Abspiilsoftware</a>.', 'ogg-no-xiphqt' => 'Dyy Syschtem het schyyns d XiphQT-Komponent fir QuickTime nit. QuickTime cha ohni die Komponent kei Ogg-Dateie abspiile. Bitte <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">lad XiphQT</a> oder wehl e anderi Abspiilsoftware.', 'ogg-player-videoElement' => 'Vorhandeni Browserunterstitzig', 'ogg-player-oggPlugin' => 'Browser-Plugin', 'ogg-player-thumbnail' => 'Zeig Vorschaubild', 'ogg-player-soundthumb' => 'Kei Player', 'ogg-player-selected' => '(usgwehlt)', 'ogg-use-player' => 'Abspiilsoftware:', 'ogg-more' => 'Meh …', 'ogg-dismiss' => 'Zuemache', 'ogg-download' => 'Datei spychere', 'ogg-desc-link' => 'Iber die Datei', 'ogg-oggThumb-version' => 'OggHandler brucht oggThumb in dr Version $1 oder hecher.', 'ogg-oggThumb-failed' => 'oggThumb het kei Miniaturbild chenne aalege.', ); /** Gujarati (ગુજરાતી) * @author KartikMistry * @author Sushant savla */ $messages['gu'] = array( 'ogg-desc' => 'JavaScript પ્લેયર સાથે Ogg Theora and Vorbis ફાઈલ માટેનો હેંડલર,', 'ogg-short-audio' => 'Ogg $1 ધ્વનિ ફાઈલ, $2', 'ogg-short-video' => 'Ogg $1 વિડીઓ ફાઈલ, $2', 'ogg-short-general' => 'Ogg $1 મિડીઆ ફાઈલ, $2', 'ogg-long-audio' => 'Ogg $1 ધ્વનિ ફાઈલ, લંબાઈ $2, $3', 'ogg-long-video' => 'Ogg $1 વિડીઓ ફાઈલ, લંબાઈ $2, $4×$5 પિક્સેલ્સ, $3', 'ogg-long-multiplexed' => 'Ogg multiplexed શ્રવ્ય/ચલચિત્ર ફાઈલ, $1, લંબાઈ $2, $4×$5 પીક્સેલ્સ, $3 પૂર્ણતઃ', 'ogg-long-general' => 'Ogg મિડીઆ ફાઈલ, લંબાઈ $2, $3', 'ogg-long-error' => 'અજ્ઞાત ogg ફાઇલ : $1', 'ogg-play' => 'ચાલુ કરો', 'ogg-pause' => 'ઊભું રાખો', 'ogg-stop' => 'બંધ કરો', 'ogg-play-video' => 'વિડીઓ ચલાવો', 'ogg-play-sound' => 'ધ્વનિ ચલાવો', 'ogg-no-player' => 'ખેદ છે, તમારી કોમ્પ્યુટર પ્રણાલીમાં કોઈ માન્ય પ્લેયર સોફ્ટવેર નથી. મહેરબાની કરી <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">download a player</a>.', 'ogg-no-xiphqt' => 'લાગે છે તમારી પાસે QuickTime માટેનો XiphQT ભાગ નથી. આ ભાગ વગર QuickTime; Ogg ફાઈલો નહીં ચલાવી શકે.. કૃપા કરી <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT ડાઉનલોડ કરો </a> અથવા અન્ય પ્લેયર પસંદ કરો.', 'ogg-player-videoElement' => 'મૂળભૂત બ્રાઉઝર આધાર', 'ogg-player-oggPlugin' => 'બ્રાઉઝર પ્લગઈન', 'ogg-player-thumbnail' => 'માત્ર સ્થિત ચિત્ર જ', 'ogg-player-soundthumb' => 'કોઈ પ્લેયર નહી', 'ogg-player-selected' => '(પસંદ કરેલ)', 'ogg-use-player' => 'પ્લેયર વાપરો:', 'ogg-more' => 'વધુ...', 'ogg-dismiss' => 'બંધ કરો', 'ogg-download' => 'ફાઈલ ડાઉનલોડ કરો', 'ogg-desc-link' => 'આ ફાઈલ વિષે', 'ogg-oggThumb-version' => 'OggHandler ને oggThumb $1 અથવા પછીની આવૃત્તિ જરુરી છે.', 'ogg-oggThumb-failed' => 'oggThumb લઘુ ચિત્ર (થમ્બ નેલ)રચવામાં નિષ્ફળ.', ); /** Manx (Gaelg) * @author MacTire02 */ $messages['gv'] = array( 'ogg-desc-link' => 'Mychione y choadan shoh', ); /** Hebrew (עברית) * @author Amire80 * @author Rotem Liss * @author Rotemliss * @author YaronSh */ $messages['he'] = array( 'ogg-desc' => 'מציג מדיה לקובצי Ogg Theora ו־Vorbis, עם נגן JavaScript', 'ogg-short-audio' => 'קובץ שמע $1 של Ogg, $2', 'ogg-short-video' => 'קובץ וידאו $1 של Ogg, $2', 'ogg-short-general' => 'קובץ מדיה $1 של Ogg, $2', 'ogg-long-audio' => 'קובץ צליל בתסדיר Ogg $1, באורך $2, $3', 'ogg-long-video' => 'קובץ וידאו $1 של Ogg, באורך $2, $4×$5 פיקסלים, $3', 'ogg-long-multiplexed' => 'קובץ Ogg מרובב של שמע ווידאו, $1 באורך $2, $4×$5 פיקסלים, $3 בסך הכול', 'ogg-long-general' => 'קובץ מדיה של Ogg, באורך $2, $3', 'ogg-long-error' => 'קובץ ogg בלתי־תקין: $1', 'ogg-play' => 'נגן', 'ogg-pause' => 'הפסק', 'ogg-stop' => 'עצור', 'ogg-play-video' => 'נגן וידאו', 'ogg-play-sound' => 'נגן שמע', 'ogg-no-player' => 'מצטערים, נראה שהמערכת שלכם אינה כוללת תוכנת נגן נתמכת. אנא <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">הורידו נגן</a>.', 'ogg-no-xiphqt' => 'נראה שלא התקנתם את רכיב XiphQT של QuickTime, אך QuickTime אינו יכול לנגן קובצי Ogg בלי רכיב זה. אנא <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">הורידו את XiphQT</a> או בחרו נגן אחר.', 'ogg-player-videoElement' => 'תמיכה טבעית של הדפדפן', 'ogg-player-oggPlugin' => 'תוסף לדפדפן', 'ogg-player-thumbnail' => 'עדיין תמונה בלבד', 'ogg-player-soundthumb' => 'אין נגן', 'ogg-player-selected' => '(נבחר)', 'ogg-use-player' => 'שימוש בנגן:', 'ogg-more' => 'עוד…', 'ogg-dismiss' => 'סגירה', 'ogg-download' => 'הורדת הקובץ', 'ogg-desc-link' => 'אודות הקובץ', 'ogg-oggThumb-version' => 'OggHandler דורש את oggThumb בגרסה $1 ומעלה.', 'ogg-oggThumb-failed' => 'oggThumb נכשל ביצירת התמונה הממוזערת.', ); /** Hindi (हिन्दी) * @author AVRS * @author Ansumang * @author Kaustubh * @author Shyam */ $messages['hi'] = array( 'ogg-desc' => 'ऑग थियोरा और वॉर्बिस फ़ाईल्सके लिये चालक, जावास्क्रीप्ट प्लेयर के साथ', 'ogg-short-audio' => 'ऑग $1 ध्वनी फ़ाईल, $2', 'ogg-short-video' => 'ऑग $1 चलतचित्र फ़ाईल, $2', 'ogg-short-general' => 'ऑग $1 मीडिया फ़ाईल, $2', 'ogg-long-audio' => '(ऑग $1 ध्वनी फ़ाईल, लंबाई $2, $3)', # Fuzzy 'ogg-long-video' => 'ऑग $1 चलतचित्र फ़ाईल, लंबाई $2, $4×$5 पीक्सेल्स, $3', 'ogg-long-multiplexed' => '(ऑग ध्वनी/चित्र फ़ाईल, $1, लंबाई $2, $4×$5 पिक्सेल्स, $3 कुल)', # Fuzzy 'ogg-long-general' => '(ऑग मीडिया फ़ाईल, लंबाई $2, $3)', # Fuzzy 'ogg-long-error' => '(गलत ऑग फ़ाईल: $1)', # Fuzzy 'ogg-play' => 'शुरू करें', 'ogg-pause' => 'विराम', 'ogg-stop' => 'रोकें', 'ogg-play-video' => 'विडियो शुरू करें', 'ogg-play-sound' => 'ध्वनी चलायें', 'ogg-no-player' => 'क्षमा करें, आपके तंत्र में कोई प्रमाणिक चालक सॉफ्टवेयर दर्शित नहीं हो रहा है। कृपया <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">एक चालक डाउनलोड करें</a>।', 'ogg-no-xiphqt' => 'आपके पास QuickTime के लिए XiphQT घटक प्रतीत नहीं हो रहा है। QuickTime बिना इस घटक के Ogg files चलने में असमर्थ है। कृपया <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT डाउनलोड करें</a> अथवा अन्य चालक चुनें।', 'ogg-player-videoElement' => 'मूल ब्राउज़र समर्थन', 'ogg-player-oggPlugin' => 'ब्राउज़र प्लगइन', 'ogg-player-thumbnail' => 'सिर्फ स्थिर चित्र', 'ogg-player-soundthumb' => 'प्लेअर नहीं हैं', 'ogg-player-selected' => '(चुने हुए)', 'ogg-use-player' => 'यह प्लेअर इस्तेमाल करें:', 'ogg-more' => 'और...', 'ogg-dismiss' => 'बंद करें', 'ogg-download' => 'फ़ाईल डाउनलोड करें', 'ogg-desc-link' => 'इस फ़ाईलके बारे में', ); /** Fiji Hindi (Latin script) (Fiji Hindi) * @author Karthi.dr */ $messages['hif-latn'] = array( 'ogg-more' => 'Aur...', 'ogg-dismiss' => 'Band karo', ); /** Croatian (hrvatski) * @author AVRS * @author CERminator * @author Dalibor Bosits * @author Ex13 * @author SpeedyGonsales */ $messages['hr'] = array( 'ogg-desc' => 'Poslužitelj za Ogg Theora i Vorbis datoteke, s JavaScript preglednikom', 'ogg-short-audio' => 'Ogg $1 zvučna datoteka, $2', 'ogg-short-video' => 'Ogg $1 video datoteka, $2', 'ogg-short-general' => 'Ogg $1 medijska datoteka, $2', 'ogg-long-audio' => '(Ogg $1 zvučna datoteka, duljine $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 video datoteka, duljine $2, $4x$5 piksela, $3', 'ogg-long-multiplexed' => '(Ogg multipleksirana zvučna/video datoteka, $1, duljine $2, $4×$5 piksela, $3 ukupno)', # Fuzzy 'ogg-long-general' => '(Ogg medijska datoteka, duljine $2, $3)', # Fuzzy 'ogg-long-error' => '(nevaljana ogg datoteka: $1)', # Fuzzy 'ogg-play' => 'Pokreni', 'ogg-pause' => 'Pauziraj', 'ogg-stop' => 'Zaustavi', 'ogg-play-video' => 'Pokreni video', 'ogg-play-sound' => 'Sviraj zvuk', 'ogg-no-player' => "Oprostite, izgleda da Vaš operacijski sustav nema instalirane medijske preglednike. Molimo <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">instalirajte medijski preglednik (''player'')</a>.", 'ogg-no-xiphqt' => "Nemate instaliranu XiphQT komponentu za QuickTime (ili je neispravno instalirana). QuickTime ne može pokretati Ogg datoteke bez ove komponente. Molimo <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">instalirajte XiphQT</a> ili izaberite drugi preglednik (''player'').", 'ogg-player-videoElement' => 'Ugrađena podrška za preglednik', 'ogg-player-oggPlugin' => 'Plugin preglednika', 'ogg-player-vlc-activex' => 'VLC (ActiveX kontrola)', 'ogg-player-thumbnail' => 'Samo (nepokretne) slike', 'ogg-player-soundthumb' => 'Nema preglednika', 'ogg-player-selected' => '(odabran)', 'ogg-use-player' => "Rabi preglednik (''player''):", 'ogg-more' => 'Više...', 'ogg-dismiss' => 'Zatvori', 'ogg-download' => 'Snimi datoteku', 'ogg-desc-link' => 'O ovoj datoteci', 'ogg-oggThumb-version' => 'OggHandler zahtijeva oggThumb inačicu $1 ili noviju.', 'ogg-oggThumb-failed' => 'oggThumb nije uspio stvoriti sličicu.', ); /** Upper Sorbian (hornjoserbsce) * @author AVRS * @author Dundak * @author Michawiki */ $messages['hsb'] = array( 'ogg-desc' => 'Wodźenski program za dataje Ogg Theora a Vorbis, z JavaScriptowym wothrawakom', 'ogg-short-audio' => 'Awdiodataja Ogg $1, $2', 'ogg-short-video' => 'Widejodataja Ogg $1, $2', 'ogg-short-general' => 'Ogg medijowa dataja $1, $2', 'ogg-long-audio' => 'Ogg-awdiodataja $1, dołhosć $2, $3', 'ogg-long-video' => 'Ogg-widejodataja $1, dołhosć: $2, $4×$5 pikselow, $3', 'ogg-long-multiplexed' => 'Ogg multipleksna awdio-/widejodataja, $1, dołhosć $2, $4×$5 pikselow, $3 dohromady', 'ogg-long-general' => 'Ogg medijowa dataja, dołhosć $2, $3', 'ogg-long-error' => 'Njepłaćiwa ogg-dataja: $1', 'ogg-play' => 'Wothrać', 'ogg-pause' => 'Přestawka', 'ogg-stop' => 'Stój', 'ogg-play-video' => 'Widejo wothrać', 'ogg-play-sound' => 'Zynk wothrać', 'ogg-no-player' => 'Bohužel twój system po wšěm zdaću nima wothrawansku software. Prošu <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">sćehń wothrawak</a>.', 'ogg-no-xiphqt' => 'Po wšěm zdaću nimaš komponentu XiphQT za QuickTime. QuickTime njemóže Ogg-dataje bjez tuteje komponenty wothrawać. Prošu <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">sćehń XiphQT</a> abo wubjer druhi wothrawak.', 'ogg-player-videoElement' => 'Eksistowace podpěra wobhladowaka', 'ogg-player-oggPlugin' => 'Tykač wobhladowaka', 'ogg-player-thumbnail' => 'Hišće jenož wobraz', 'ogg-player-soundthumb' => 'Žadyn wothrawak', 'ogg-player-selected' => '(wubrany)', 'ogg-use-player' => 'Wothrawak:', 'ogg-more' => 'Wjace ...', 'ogg-dismiss' => 'Začinić', 'ogg-download' => 'Dataju sćahnyć', 'ogg-desc-link' => 'Wo tutej dataji', 'ogg-oggThumb-version' => 'OggHandler trjeba wersiju $1 oggThumb abo nowšu.', 'ogg-oggThumb-failed' => 'oggThumb njemóžeše wobrazk wutworić.', ); /** Haitian (Kreyòl ayisyen) * @author Masterches */ $messages['ht'] = array( 'ogg-play' => 'Jwe', 'ogg-pause' => 'Poz', 'ogg-stop' => 'Stope', ); /** Hungarian (magyar) * @author AVRS * @author Dani * @author Dj * @author Glanthor Reviol * @author Tgr */ $messages['hu'] = array( 'ogg-desc' => 'JavaScript nyelven írt lejátszó Ogg Theora és Vorbis fájlokhoz', 'ogg-short-audio' => 'Ogg $1 hangfájl, $2', 'ogg-short-video' => 'Ogg $1 videofájl, $2', 'ogg-short-general' => 'Ogg $1 médiafájl, $2', 'ogg-long-audio' => 'Ogg $1 hangfájl, hossza: $2, $3', 'ogg-long-video' => 'Ogg $1 videófájl, hossza $2, $4×$5 képpont, $3', 'ogg-long-multiplexed' => 'Ogg egyesített audió- és videófájl, $1, hossz: $2, $4×$5 képpont, $3 összesen', 'ogg-long-general' => 'Ogg médiafájl, hossza: $2, $3', 'ogg-long-error' => 'Érvénytelen ogg fájl: $1', 'ogg-play' => 'Lejátszás', 'ogg-pause' => 'Szüneteltetés', 'ogg-stop' => 'Állj', 'ogg-play-video' => 'Videó lejátszása', 'ogg-play-sound' => 'Hang lejátszása', 'ogg-no-player' => 'Sajnáljuk, de úgy tűnik, hogy nem rendelkezel a megfelelő lejátszóval. Amennyiben le szeretnéd játszani, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">tölts le egyet</a>.', 'ogg-no-xiphqt' => 'Úgy tűnik, nem rendelkezel a QuickTime-hoz való XiphQT összetevővel. Enélkül a QuickTime nem tudja lejátszani az Ogg fájlokat. A lejátszáshoz tölts le egyet <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">innen</a>, vagy válassz másik lejátszót.', 'ogg-player-videoElement' => 'A böngésző támogatja', 'ogg-player-oggPlugin' => 'Beépülő modul böngészőhöz', 'ogg-player-thumbnail' => 'Csak állókép', 'ogg-player-soundthumb' => 'Nincs lejátszó', 'ogg-player-selected' => '(kiválasztott)', 'ogg-use-player' => 'Lejátszó:', 'ogg-more' => 'Tovább...', 'ogg-dismiss' => 'Bezárás', 'ogg-download' => 'Fájl letöltése', 'ogg-desc-link' => 'Fájlinformációk', 'ogg-oggThumb-version' => 'Az OggHandlerhez $1 vagy későbbi verziójú oggThumb szükséges.', 'ogg-oggThumb-failed' => 'Az oggThumb nem tudta elkészíteni a bélyegképet.', ); /** Interlingua (interlingua) * @author AVRS * @author McDutchie */ $messages['ia'] = array( 'ogg-desc' => 'Gestor pro le files Ogg Theora e Vorbis, con reproductor JavaScript', 'ogg-short-audio' => 'File audio Ogg $1, $2', 'ogg-short-video' => 'File video Ogg $1, $2', 'ogg-short-general' => 'File media Ogg $1, $2', 'ogg-long-audio' => 'File audio Ogg $1, duration $2, $3', 'ogg-long-video' => 'File video Ogg $1, duration $2, $4×$5 pixel, $3', 'ogg-long-multiplexed' => 'File multiplexate audio/video Ogg, $1, duration $2, $4×$5 pixel, $3 in total', 'ogg-long-general' => 'File multimedial Ogg, duration $2, $3', 'ogg-long-error' => 'File Ogg invalide: $1', 'ogg-play' => 'Jocar', 'ogg-pause' => 'Pausar', 'ogg-stop' => 'Stoppar', 'ogg-play-video' => 'Jocar video', 'ogg-play-sound' => 'Sonar audio', 'ogg-no-player' => 'Excusa, ma il pare que non es installate alcun lector compatibile in tu systema. Per favor <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">discarga un lector.</a>', 'ogg-no-xiphqt' => 'Pare que tu non ha le componente XiphQT pro QuickTime. Sin iste componente, QuickTime non sape leger le files Ogg. Per favor <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">discarga XiphQT</a> o selige un altere lector.', 'ogg-player-videoElement' => 'Supporto native in navigator', 'ogg-player-oggPlugin' => 'Plugin pro navigator', 'ogg-player-thumbnail' => 'Imagine static solmente', 'ogg-player-soundthumb' => 'Necun lector', 'ogg-player-selected' => '(seligite)', 'ogg-use-player' => 'Usar lector:', 'ogg-more' => 'Plus…', 'ogg-dismiss' => 'Clauder', 'ogg-download' => 'Discargar file', 'ogg-desc-link' => 'A proposito de iste file', 'ogg-oggThumb-version' => 'OggHandler require oggThumb version $1 o plus recente.', 'ogg-oggThumb-failed' => 'oggThumb ha fallite de crear le miniatura.', ); /** Indonesian (Bahasa Indonesia) * @author AVRS * @author Bennylin * @author Farras * @author Irwangatot * @author IvanLanin * @author Kenrick95 * @author Rex */ $messages['id'] = array( 'ogg-desc' => 'Menangani berkas Ogg Theora dan Vorbis dengan pemutar JavaScript', 'ogg-short-audio' => 'Berkas suara $1 ogg, $2', 'ogg-short-video' => 'Berkas video $1 ogg, $2', 'ogg-short-general' => 'Berkas media $1 ogg, $2', 'ogg-long-audio' => 'Berkas suara $1 ogg, panjang $2, $3', 'ogg-long-video' => 'Berkas video $1 ogg, panjang $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => 'Berkas audio/video multiplexed ogg, $1, panjang $2, $4×$5 piksel, $3 keseluruhan', 'ogg-long-general' => 'Berkas media ogg, panjang $2, $3', 'ogg-long-error' => 'Berkas ogg tak valid: $1', 'ogg-play' => 'Mainkan', 'ogg-pause' => 'Jeda', 'ogg-stop' => 'Berhenti', 'ogg-play-video' => 'Putar video', 'ogg-play-sound' => 'Putar suara', 'ogg-no-player' => 'Maaf, sistem Anda tampaknya tak memiliki satupun perangkat lunak pemutar yang mendukung. Silakan <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">mengunduh salah satu pemutar</a>.', 'ogg-no-xiphqt' => 'Tampaknya Anda tak memiliki komponen XiphQT untuk QuickTime. QuickTime tak dapat memutar berkas Ogg tanpa komponen ini. Silakan <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">mengunduh XiphQT</a> atau pilih pemutar lain.', 'ogg-player-videoElement' => 'elemen <video>', 'ogg-player-oggPlugin' => 'plugin Ogg', 'ogg-player-thumbnail' => 'Hanya gambar statis', 'ogg-player-soundthumb' => 'Tak ada pemutar', 'ogg-player-selected' => '(terpilih)', 'ogg-use-player' => 'Gunakan pemutar:', 'ogg-more' => 'Lainnya...', 'ogg-dismiss' => 'Tutup', 'ogg-download' => 'Unduh berkas', 'ogg-desc-link' => 'Mengenai berkas ini', 'ogg-oggThumb-version' => 'OggHandler membutuhkan oggThumb versi $1 atau terbaru.', 'ogg-oggThumb-failed' => 'oggThumb gagal membuat miniatur gambar.', ); /** Igbo (Igbo) * @author Ukabia */ $messages['ig'] = array( 'ogg-play' => 'Dọ', 'ogg-pause' => "Zùy'íké", 'ogg-stop' => 'Kụ̀shí', 'ogg-more' => 'Ozókwá...', 'ogg-dismiss' => 'Mèchí', ); /** Iloko (Ilokano) * @author Lam-ang */ $messages['ilo'] = array( 'ogg-desc' => 'Agtengngel para dagiti Ogg Theora ken Vorbis a papeles, nga addaan ti JavaScript a pagay-ayam.', 'ogg-short-audio' => 'Ogg $1 mangeg a papeles, $2', 'ogg-short-video' => 'Ogg $1 mabuya a papeles, $2', 'ogg-short-general' => 'Ogg $1 media a papeles, $2', 'ogg-long-audio' => 'Ogg $1 mangeg a papeles, kaatiddog $2, $3', 'ogg-long-video' => 'Ogg $1 mabuya a papeles, lkaatiddog $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Ogg multiplexed a mangeg/mabuya a papeles, $1, kaatiddog $2, $4×$5 pixels, $3 amin-amin', 'ogg-long-general' => 'Ogg media a papeles, kaatiddog $2, $3', 'ogg-long-error' => 'Imbalido nga ogg a papeles: $1', 'ogg-play' => 'Ayayamen', 'ogg-pause' => 'Pasardengan', 'ogg-stop' => 'Isardeng', 'ogg-play-video' => 'Ay-ayamen ti mabuya', 'ogg-play-sound' => 'Ay-ayamen ti mangeg', 'ogg-no-player' => 'Pasensian a, ti sistemam ket kasla awan ti natapayaan na nga agpa-ayayam a software. Pangngaasi a <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">mangipan ti agpa-ayayam</a>.', 'ogg-no-xiphqt' => 'Kasla awanen ka ti XiphQT a banag para iti QuickTime Ti QuickTime ket saan nga agy-ayam iti Ogg a papeles nga awanen daytoy a banag. Pangngaasi a <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">mangipan ti XiphQT</a> wenno agpili iti sabali a pagay-ayam.', 'ogg-player-videoElement' => 'Patneng a pagbasabasa tapayaen', 'ogg-player-oggPlugin' => 'Pagbasabasa a pasullat', 'ogg-player-thumbnail' => 'Saan a nakuti nga imahen laeng', 'ogg-player-soundthumb' => 'Awan ti pagay-ayam', 'ogg-player-selected' => '(napili)', 'ogg-use-player' => 'Usaren ti pagay-ayam:', 'ogg-more' => 'Adu pay...', 'ogg-dismiss' => 'Irikep', 'ogg-download' => 'Mangipan ti papeles', 'ogg-desc-link' => 'Maipanggep daytoy nga imahen', 'ogg-oggThumb-version' => 'Ti OggHandler ket masapul na ti oggThumb a bersion $1 wenno ti naududi.', 'ogg-oggThumb-failed' => 'Napaay ti oggThumb nga agaramid ti imahen.', ); /** Ido (Ido) * @author Malafaya */ $messages['io'] = array( 'ogg-long-error' => '(Ne-valida ogg-arkivo: $1)', # Fuzzy 'ogg-player-selected' => '(selektita)', 'ogg-more' => 'Plus…', 'ogg-dismiss' => 'Klozar', 'ogg-desc-link' => 'Pri ca arkivo', ); /** Icelandic (íslenska) * @author S.Örvarr.S * @author Snævar * @author Spacebirdy */ $messages['is'] = array( 'ogg-short-audio' => 'Ogg $1 hljóðskrá, $2', 'ogg-short-video' => 'Ogg $1 myndbandskrá, $2', 'ogg-short-general' => 'Ogg $1 margmiðlunarskrá, $2', 'ogg-long-audio' => 'Ogg $1 hljóðskrá, lengd $2, $3', 'ogg-long-video' => 'Ogg $1 myndbandskrá, lengd $2, $4×$5 dílar, $3', 'ogg-long-general' => 'Ogg margmiðlunarskrá, lengd $2, $3', 'ogg-play' => 'Spila', 'ogg-pause' => 'gera hlé', 'ogg-stop' => 'Stöðva', 'ogg-play-video' => 'Spila myndband', 'ogg-play-sound' => 'Spila hljóð', 'ogg-no-player' => 'Því miður, virðist talvan þín ekki hafa neitt forrit til að spila Ogg skrár. Vinsamlegast <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">hladdu niður spilara</a>.', 'ogg-no-xiphqt' => 'Þú virðist ekki hafa XiphQT viðbótina fyrir QuickTime. QuickTime getur ekki spilað Ogg skrár án viðbótarinnar. Vinsamlegast <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">hladdu niður XiphQT</a> eða veldu annan spilara.', 'ogg-player-videoElement' => 'Stuðningur í vafra', 'ogg-player-oggPlugin' => 'Vafrara viðbót', 'ogg-player-soundthumb' => 'Enginn spilari', 'ogg-player-selected' => '(valið)', 'ogg-use-player' => 'Nota spilara:', 'ogg-more' => 'Meira...', 'ogg-dismiss' => 'Loka', 'ogg-download' => 'Sækja skrá', 'ogg-desc-link' => 'Um þessa skrá', ); /** Italian (italiano) * @author .anaconda * @author AVRS * @author Beta16 * @author BrokenArrow * @author Darth Kule * @author HalphaZ */ $messages['it'] = array( 'ogg-desc' => 'Gestore per i file Ogg Theora e Vorbis, con programma di riproduzione in JavaScript', 'ogg-short-audio' => 'File audio Ogg $1, $2', 'ogg-short-video' => 'File video Ogg $1, $2', 'ogg-short-general' => 'File multimediale Ogg $1, $2', 'ogg-long-audio' => 'File audio Ogg $1, durata $2, $3', 'ogg-long-video' => 'File video Ogg $1, durata $2, dimensioni $4×$5 pixel, $3', 'ogg-long-multiplexed' => 'File audio/video multiplexed Ogg $1, durata $2, dimensioni $4×$5 pixel, complessivamente $3', 'ogg-long-general' => 'File multimediale Ogg, durata $2, $3', 'ogg-long-error' => 'File Ogg non valido: $1', 'ogg-play' => 'Riproduci', 'ogg-pause' => 'Pausa', 'ogg-stop' => 'Ferma', 'ogg-play-video' => 'Riproduci il filmato', 'ogg-play-sound' => 'Riproduci il file sonoro', 'ogg-no-player' => 'Siamo spiacenti, ma non risulta installato alcun software di riproduzione compatibile. Si prega di <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">scaricare un lettore</a> adatto.', 'ogg-no-xiphqt' => 'Non risulta installato il componente XiphQT di QuickTime. Senza tale componente non è possibile la riproduzione di file Ogg con QuickTime. Si prega di <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">scaricare XiphQT</a> o scegliere un altro lettore.', 'ogg-player-videoElement' => 'Supporto browser nativo', 'ogg-player-oggPlugin' => 'Plugin browser', 'ogg-player-thumbnail' => 'Solo immagini fisse', 'ogg-player-soundthumb' => 'Nessun lettore', 'ogg-player-selected' => '(selezionato)', 'ogg-use-player' => 'Usa il lettore:', 'ogg-more' => 'Altro...', 'ogg-dismiss' => 'Chiudi', 'ogg-download' => 'Scarica il file', 'ogg-desc-link' => 'Informazioni su questo file', 'ogg-oggThumb-version' => 'OggHandler richiede la versione $1 o superiore di oggThumb.', 'ogg-oggThumb-failed' => 'oggThumb non è riuscito a creare la miniatura.', ); /** Japanese (日本語) * @author AVRS * @author Aotake * @author Fryed-peach * @author JtFuruhata * @author Kahusi * @author Shirayuki */ $messages['ja'] = array( 'ogg-desc' => 'Ogg Theora / Vorbis ファイルのハンドラーと JavaScript プレーヤー', 'ogg-short-audio' => 'Ogg $1 音声ファイル、$2', 'ogg-short-video' => 'Ogg $1 動画ファイル、$2', 'ogg-short-general' => 'Ogg $1 メディアファイル、$2', 'ogg-long-audio' => 'Ogg $1 音声ファイル、長さ $2、$3', 'ogg-long-video' => 'Ogg $1 動画ファイル、長さ $2、$4×$5 ピクセル、$3', 'ogg-long-multiplexed' => 'Ogg 多重音声/動画ファイル、$1、長さ $2、$4×$5 ピクセル、全体で$3', 'ogg-long-general' => 'Ogg メディアファイル、長さ $2、$3', 'ogg-long-error' => '無効な Ogg ファイル: $1', 'ogg-play' => '再生', 'ogg-pause' => '一時停止', 'ogg-stop' => '停止', 'ogg-play-video' => '動画を再生', 'ogg-play-sound' => '音声を再生', 'ogg-no-player' => '申し訳ありませんが、あなたのシステムには対応する再生ソフトウェアがインストールされていないようです。<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ここからダウンロードしてください</a>。', 'ogg-no-xiphqt' => 'QuickTime 用 XiphQT コンポーネントがインストールされていないようです。QuickTime で Ogg ファイルを再生するには、このコンポーネントが必要です。<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ここから XiphQT をダウンロードする</a>か、別の再生ソフトをインストールしてください。', 'ogg-player-videoElement' => 'ネイティブブラウザーに対応', 'ogg-player-oggPlugin' => 'ブラウザープラグイン', 'ogg-player-thumbnail' => '静止画像のみ', 'ogg-player-soundthumb' => 'プレーヤーなし', 'ogg-player-selected' => '(選択)', 'ogg-use-player' => '使用するプレーヤー:', 'ogg-more' => 'その他…', 'ogg-dismiss' => '閉じる', 'ogg-download' => 'ファイルをダウンロード', 'ogg-desc-link' => 'ファイルの詳細', 'ogg-oggThumb-version' => 'OggHandler は oggThumb バージョン$1またはそれ以降が必要です。', 'ogg-oggThumb-failed' => 'oggThumb によるサムネイル作成に失敗しました。', ); /** Jutish (jysk) * @author AVRS * @author Huslåke */ $messages['jut'] = array( 'ogg-desc' => 'Håndlær før Ogg Theora og Vorbis filer, ve JavaScript spæler', 'ogg-short-audio' => 'Ogg $1 sond file, $2', 'ogg-short-video' => 'Ogg $1 video file, $2', 'ogg-short-general' => 'Ogg $1 media file, $2', 'ogg-long-audio' => '(Ogg $1 sond file, duråsje $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 video file, duråsje $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => '(Ogg multipleksen audio/video file, $1, duråsje $2, $4×$5 piksler, $3 åverål)', # Fuzzy 'ogg-long-general' => '(Ogg $1 media file, duråsje $2, $3)', # Fuzzy 'ogg-long-error' => '(Ugyldegt ogg file: $2)', # Fuzzy 'ogg-play' => 'Spæl', 'ogg-pause' => 'Pås', 'ogg-stop' => 'Ståp', 'ogg-play-video' => 'Spæl video', 'ogg-play-sound' => 'Spæl sond', 'ogg-no-player' => 'Unskyld, deres sistæm dä ekke appiære til har søm understønenge spæler softwær. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Nærlæĝ en spæler</a>.', 'ogg-no-xiphqt' => 'Du däst ekke appiær til har æ XiphQT kompånent før QuickTime. QuickTime ken ekke spæl Ogg filer veud dette kompånent. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Nærlæĝ XiphQT</a> æller vælg\'en andes spæler.', 'ogg-player-videoElement' => '<video> ælement', # Fuzzy 'ogg-player-oggPlugin' => 'Ogg plugin', # Fuzzy 'ogg-player-thumbnail' => 'Stil billet ålen', 'ogg-player-soundthumb' => 'Ekke spæler', 'ogg-player-selected' => '(sælektærn)', 'ogg-use-player' => 'Brug spæler:', 'ogg-more' => 'Mære...', 'ogg-dismiss' => 'Slut', 'ogg-download' => 'Nærlæĝ billet', 'ogg-desc-link' => 'Åver dette file', ); /** Javanese (Basa Jawa) * @author AVRS * @author Meursault2004 * @author NoiX180 * @author Pras */ $messages['jv'] = array( 'ogg-desc' => 'Sing ngurusi berkas Ogg Theora lan Vorbis mawa pamain JavaScript', 'ogg-short-audio' => 'Berkas swara $1 ogg, $2', 'ogg-short-video' => 'Berkas vidéo $1 ogg, $2', 'ogg-short-general' => 'Berkas média $1 ogg, $2', 'ogg-long-audio' => 'Berkas swara $1 ogg, dawané $2, $3', 'ogg-long-video' => 'Berkas vidéo $1 ogg, dawané $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => 'Berkas odio/pidio multiplèks ogg, $1, dawané $2, $4×$5 piksel, $3 kabéhé', 'ogg-long-general' => 'Berkas média ogg, dawané $2, $3', 'ogg-long-error' => 'Berkas ogg ora sah: $1', 'ogg-play' => 'Main', 'ogg-pause' => 'Lèrèn', 'ogg-stop' => 'Mandeg', 'ogg-play-video' => 'Main vidéo', 'ogg-play-sound' => 'Main swara', 'ogg-no-player' => 'Nuwun sèwu, sistém panjenengan katoné ora ndarbèni siji-sijia piranti empuk sing didukung. Mangga <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ngundhuh salah siji piranti pamain</a>.', 'ogg-no-xiphqt' => 'Katoné panjenengan ora ana komponèn XiphQT kanggo QuickTime. QuickTime ora bisa mainaké berkas-berkas Ogg tanpa komponèn iki. Please <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ngundhuh XiphQT</a> utawa milih piranti pamain liya.', 'ogg-player-videoElement' => 'Dhukungan browser asli', 'ogg-player-oggPlugin' => "''Plugin browser''", 'ogg-player-thumbnail' => 'Namung gambar statis waé', 'ogg-player-soundthumb' => 'Ora ana piranti pamain', 'ogg-player-selected' => '(dipilih)', 'ogg-use-player' => 'Nganggo piranti pamain:', 'ogg-more' => 'Luwih akèh...', 'ogg-dismiss' => 'Tutup', 'ogg-download' => 'Undhuh berkas', 'ogg-desc-link' => 'Prekara berkas iki', 'ogg-oggThumb-version' => 'OggHandler mbutuhaké oggThumb vèrsi $1 utawa sakbanjuré.', 'ogg-oggThumb-failed' => 'oggTumb gagal nggawé gambar mini.', ); /** Georgian (ქართული) * @author BRUTE * @author David1010 * @author Dawid Deutschland * @author ITshnik * @author Malafaya * @author გიორგიმელა */ $messages['ka'] = array( 'ogg-desc' => 'ფაილების დამამუშავებელი Ogg Theora და Vorbis, JavaScript-დამკვრელის გამოყენებით', 'ogg-short-audio' => 'Ogg $1 აუდიო ფაილი, $2', 'ogg-short-video' => 'Ogg $1 ვიდეო ფაილი, $2', 'ogg-short-general' => 'Ogg $1 მედია ფაილი, $2', 'ogg-long-audio' => 'Ogg $1 აუდიო ფაილი, სიგრძე $2, $3', 'ogg-long-video' => 'Ogg $1 ვიდეო ფაილი, სიგრძე $2, $4×$5 პიქსელი, $3', 'ogg-long-multiplexed' => 'Ogg აუდიო/ვიდეო ფაილი, $1, სიგრძე: $2, $4×$5 პიქსელი, $3', 'ogg-long-general' => 'Ogg მედია ფაილი, სიგრძე $2, $3', 'ogg-long-error' => 'არასწორი ogg-ფაილი: $1', 'ogg-play' => 'თამაში', 'ogg-pause' => 'პაუზა', 'ogg-stop' => 'შეჩერება', 'ogg-play-video' => 'ვიდეოს ჩართვა', 'ogg-play-sound' => 'ხმის მოსმენა', 'ogg-no-player' => 'ბოდიშით, თქვენ სისტემას არ გააჩნია ფაილების დამკვრელი საჭირო პროგრამული უზრუნველყოფა. გთხოვთ, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">გადმოწერეთ დამკვრელი</a>.', 'ogg-no-xiphqt' => 'QuickTime-ის კომპონენტი XiphQT არ არის. QuickTime-ს არ შეუძლია Ogg ფაილების დაკვრა ამ კომპონენტის გარეშე. გთხოვთ, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ჩამოტვირთეთ XiphQT</a> ან აირჩიეთ სხვა დამკვრელი.', 'ogg-player-videoElement' => 'მშობლიური ბრაუზერის მხარდაჭერა', 'ogg-player-oggPlugin' => 'ბრაუზერის მოდული', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-thumbnail' => 'მხოლოდ წინასწარი სურათი', 'ogg-player-soundthumb' => 'No player', 'ogg-player-selected' => '(არჩეულია)', 'ogg-use-player' => 'დამკვრელის გამოყენება:', 'ogg-more' => 'მეტი...', 'ogg-dismiss' => 'დახურვა', 'ogg-download' => 'ფაილის ჩამოტვირთვა', 'ogg-desc-link' => 'ამ ფაილის შესახებ', 'ogg-oggThumb-version' => 'OggHandler-ს სჭირდება oggThumb ვერსია $1 ან უფრო გვიანდელი.', 'ogg-oggThumb-failed' => 'oggThumb-მა ვერ მოახერხა მინიატიურის შექმნა.', ); /** Kazakh (Arabic script) (قازاقشا (تٴوتە)‏) * @author AVRS */ $messages['kk-arab'] = array( 'ogg-short-audio' => 'Ogg $1 دىبىس فايلى, $2', 'ogg-short-video' => 'Ogg $1 بەينە فايلى, $2', 'ogg-short-general' => 'Ogg $1 تاسپا فايلى, $2', 'ogg-long-audio' => '(Ogg $1 دىبىس فايلى, ۇزاقتىعى $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 بەينە فايلى, ۇزاقتىعى $2, $4 × $5 پىيكسەل, $3', 'ogg-long-multiplexed' => '(Ogg قۇرامدى دىبىس/بەينە فايلى, $1, ۇزاقتىعى $2, $4 × $5 پىيكسەل, $3 نە بارلىعى)', # Fuzzy 'ogg-long-general' => '(Ogg تاسپا فايلى, ۇزاقتىعى $2, $3)', # Fuzzy 'ogg-long-error' => '(جارامسىز ogg فايلى: $1)', # Fuzzy 'ogg-play' => 'ويناتۋ', 'ogg-pause' => 'ايالداتۋ', 'ogg-stop' => 'توقتاتۋ', 'ogg-play-video' => 'بەينەنى ويناتۋ', 'ogg-play-sound' => 'دىبىستى ويناتۋ', 'ogg-no-player' => 'عافۋ ەتىڭىز, جۇيەڭىزدە ەش سۇيەمەلدەگەن ويناتۋ باعدارلامالىق قامتاماسىزداندىرعىش ورناتىلماعان. <a href="http://www.java.com/en/download/manual.jsp">Java</a> بۋماسىن ورناتىپ شىعىڭىز.', 'ogg-no-xiphqt' => 'QuickTime ويناتقىشىڭىزدىڭ XiphQT دەگەن قۇراشى جوق سىيياقتى. بۇل قۇراشىسىز Ogg فايلدارىن QuickTime ويناتا المايدى. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT قۇراشىن</a> نە باسقا ويناتقىشتى جۇكتەڭىز.', 'ogg-player-videoElement' => '<video> داناسى', 'ogg-player-oggPlugin' => 'Ogg قوسىمشا باعدارلاماسى', 'ogg-player-thumbnail' => 'تەك ستوپ-كادر', 'ogg-player-soundthumb' => 'ويناتقىشسىز', 'ogg-player-selected' => '(بولەكتەلگەن)', 'ogg-use-player' => 'ويناتقىش پايدالانۋى:', 'ogg-more' => 'كوبىرەك...', 'ogg-dismiss' => 'جابۋ', 'ogg-download' => 'فايلدى جۇكتەۋ', 'ogg-desc-link' => 'بۇل فايل تۋرالى', ); /** Kazakh (Cyrillic script) (қазақша (кирил)‎) * @author AVRS */ $messages['kk-cyrl'] = array( 'ogg-short-audio' => 'Ogg $1 дыбыс файлы, $2', 'ogg-short-video' => 'Ogg $1 бейне файлы, $2', 'ogg-short-general' => 'Ogg $1 таспа файлы, $2', 'ogg-long-audio' => '(Ogg $1 дыбыс файлы, ұзақтығы $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 бейне файлы, ұзақтығы $2, $4 × $5 пиксел, $3', 'ogg-long-multiplexed' => '(Ogg құрамды дыбыс/бейне файлы, $1, ұзақтығы $2, $4 × $5 пиксел, $3 не барлығы)', # Fuzzy 'ogg-long-general' => '(Ogg таспа файлы, ұзақтығы $2, $3)', # Fuzzy 'ogg-long-error' => '(Жарамсыз ogg файлы: $1)', # Fuzzy 'ogg-play' => 'Ойнату', 'ogg-pause' => 'Аялдату', 'ogg-stop' => 'Тоқтату', 'ogg-play-video' => 'Бейнені ойнату', 'ogg-play-sound' => 'Дыбысты ойнату', 'ogg-no-player' => 'Ғафу етіңіз, жүйеңізде еш сүйемелдеген ойнату бағдарламалық қамтамасыздандырғыш орнатылмаған. <a href="http://www.java.com/en/download/manual.jsp">Java</a> бумасын орнатып шығыңыз.', 'ogg-no-xiphqt' => 'QuickTime ойнатқышыңыздың XiphQT деген құрашы жоқ сияқты. Бұл құрашысыз Ogg файлдарын QuickTime ойната алмайды. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT құрашын</a> не басқа ойнатқышты жүктеңіз.', 'ogg-player-videoElement' => '<video> данасы', 'ogg-player-oggPlugin' => 'Ogg қосымша бағдарламасы', 'ogg-player-thumbnail' => 'Тек стоп-кадр', 'ogg-player-soundthumb' => 'Ойнатқышсыз', 'ogg-player-selected' => '(бөлектелген)', 'ogg-use-player' => 'Ойнатқыш пайдалануы:', 'ogg-more' => 'Көбірек...', 'ogg-dismiss' => 'Жабу', 'ogg-download' => 'Файлды жүктеу', 'ogg-desc-link' => 'Бұл файл туралы', ); /** Kazakh (Latin script) (qazaqşa (latın)‎) * @author AVRS */ $messages['kk-latn'] = array( 'ogg-short-audio' => 'Ogg $1 dıbıs faýlı, $2', 'ogg-short-video' => 'Ogg $1 beýne faýlı, $2', 'ogg-short-general' => 'Ogg $1 taspa faýlı, $2', 'ogg-long-audio' => '(Ogg $1 dıbıs faýlı, uzaqtığı $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 beýne faýlı, uzaqtığı $2, $4 × $5 pïksel, $3', 'ogg-long-multiplexed' => '(Ogg quramdı dıbıs/beýne faýlı, $1, uzaqtığı $2, $4 × $5 pïksel, $3 ne barlığı)', # Fuzzy 'ogg-long-general' => '(Ogg taspa faýlı, uzaqtığı $2, $3)', # Fuzzy 'ogg-long-error' => '(Jaramsız ogg faýlı: $1)', # Fuzzy 'ogg-play' => 'Oýnatw', 'ogg-pause' => 'Ayaldatw', 'ogg-stop' => 'Toqtatw', 'ogg-play-video' => 'Beýneni oýnatw', 'ogg-play-sound' => 'Dıbıstı oýnatw', 'ogg-no-player' => 'Ğafw etiñiz, jüýeñizde eş süýemeldegen oýnatw bağdarlamalıq qamtamasızdandırğış ornatılmağan. <a href="http://www.java.com/en/download/manual.jsp">Java</a> bwmasın ornatıp şığıñız.', 'ogg-no-xiphqt' => 'QuickTime oýnatqışıñızdıñ XiphQT degen quraşı joq sïyaqtı. Bul quraşısız Ogg faýldarın QuickTime oýnata almaýdı. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT quraşın</a> ne basqa oýnatqıştı jükteñiz.', 'ogg-player-videoElement' => '<video> danası', 'ogg-player-oggPlugin' => 'Ogg qosımşa bağdarlaması', 'ogg-player-thumbnail' => 'Tek stop-kadr', 'ogg-player-soundthumb' => 'Oýnatqışsız', 'ogg-player-selected' => '(bölektelgen)', 'ogg-use-player' => 'Oýnatqış paýdalanwı:', 'ogg-more' => 'Köbirek...', 'ogg-dismiss' => 'Jabw', 'ogg-download' => 'Faýldı jüktew', 'ogg-desc-link' => 'Bul faýl twralı', ); /** Khmer (ភាសាខ្មែរ) * @author AVRS * @author Chhorran * @author Lovekhmer * @author T-Rithy * @author Thearith * @author គីមស៊្រុន */ $messages['km'] = array( 'ogg-desc' => 'គាំទ្រចំពោះ Ogg Theora និង Vorbis files, ជាមួយ ឧបករណ៍អាន JavaScript', 'ogg-short-audio' => 'ឯកសារ សំឡេង Ogg $1, $2', 'ogg-short-video' => 'ឯកសារវីដេអូ Ogg $1, $2', 'ogg-short-general' => 'ឯកសារមេឌាOgg $1, $2', 'ogg-long-audio' => '(ឯកសារសំឡេងប្រភេទOgg $1, រយៈពេល$2 និងទំហំ$3)', # Fuzzy 'ogg-long-video' => 'ឯកសារវីដេអូប្រភេទOgg $1, រយៈពេល$2, $4×$5px, $3', 'ogg-long-multiplexed' => '(ឯកសារអូឌីយ៉ូ/វីដេអូចម្រុះប្រភេទOgg , $1, រយៈពេល$2, $4×$5px, ប្រហែល$3)', # Fuzzy 'ogg-long-general' => '(ឯកសារមេឌាប្រភេទOgg, រយៈពេល$2, $3)', # Fuzzy 'ogg-long-error' => '(ឯកសារ ogg មិនមាន សុពលភាព ៖ $1)', # Fuzzy 'ogg-play' => 'លេង', 'ogg-pause' => 'ផ្អាក', 'ogg-stop' => 'ឈប់', 'ogg-play-video' => 'លេងវីដេអូ', 'ogg-play-sound' => 'បន្លឺសំឡេង', 'ogg-no-player' => 'សូមអភ័យទោស! ប្រព័ន្ធដំណើរការរបស់អ្នក ហាក់បីដូចជាមិនមានកម្មវិធី ណាមួយសម្រាប់លេងទេ។ សូម <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ទាញយកកម្មវិធី សម្រាប់លេងនៅទីនេះ</a> ។', 'ogg-no-xiphqt' => 'មិនឃើញមាន អង្គផ្សំ XiphQT សម្រាប់ QuickTime។ QuickTime មិនអាចអាន ឯកសារ ដោយ គ្មាន អង្គផ្សំនេះ។ ទាញយក <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download"> និង ដំឡើង XiphQT</a> ឬ ជ្រើសរើស ឧបករណ៍អាន ផ្សេង ។', 'ogg-player-videoElement' => 'Native browser support', 'ogg-player-oggPlugin' => 'កម្មវិធីជំនួយ​របស់​កម្មវិធីរុករក', 'ogg-player-thumbnail' => 'នៅតែជារូបភាព', 'ogg-player-soundthumb' => 'មិនមានឧបករណ៍លេងទេ', 'ogg-player-selected' => '(បានជ្រើសយក)', 'ogg-use-player' => 'ប្រើប្រាស់ឧបករណ៍លេង៖', 'ogg-more' => 'បន្ថែម...', 'ogg-dismiss' => 'បិទ', 'ogg-download' => 'ទាញយកឯកសារ', 'ogg-desc-link' => 'អំពីឯកសារនេះ', ); /** Korean (한국어) * @author AVRS * @author ITurtle * @author Kwj2772 * @author ToePeu * @author 아라 */ $messages['ko'] = array( 'ogg-desc' => 'OGG Theora 및 Vorbis 파일 핸들러와 자바스크립트 플레이어', 'ogg-short-audio' => 'Ogg $1 소리 파일, $2', 'ogg-short-video' => 'Ogg $1 동영상 파일, $2', 'ogg-short-general' => 'Ogg $1 미디어 파일, $2', 'ogg-long-audio' => 'Ogg $1 소리 파일, 길이 $2, $3', 'ogg-long-video' => 'Ogg $1 영상 파일, 길이 $2, $4×$5 픽셀, $3', 'ogg-long-multiplexed' => 'Ogg 다중 소리/영상 파일, $1, 길이 $2, $4×$5 픽셀, 대략 $3', 'ogg-long-general' => 'Ogg 미디어 파일, 길이 $2, $3', 'ogg-long-error' => '잘못된 ogg 파일: $1', 'ogg-play' => '재생', 'ogg-pause' => '일시정지', 'ogg-stop' => '정지', 'ogg-play-video' => '영상 재생하기', 'ogg-play-sound' => '소리 재생하기', 'ogg-no-player' => '죄송합니다. 이 시스템에는 재생을 지원하는 플레이어가 설치되지 않은 것 같습니다. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">플레이어를 내려받으세요.</a>', 'ogg-no-xiphqt' => 'QuickTime의 XiphQT 구성 요소가 없는 것 같습니다. QuickTime은 이 구성 요소 없이는 Ogg 파일을 재생할 수 없습니다. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download"> XiphQT를 내려받거나</a> 다른 플레이어를 선택하십시오.', 'ogg-player-videoElement' => '기본 브라우저 지원', 'ogg-player-oggPlugin' => '브라우저 플러그인', 'ogg-player-thumbnail' => '정지 화면만', 'ogg-player-soundthumb' => '플레이어 없음', 'ogg-player-selected' => '(선택함)', 'ogg-use-player' => '사용할 플레이어:', 'ogg-more' => '더 보기…', 'ogg-dismiss' => '닫기', 'ogg-download' => '파일 다운로드', 'ogg-desc-link' => '파일 정보', 'ogg-oggThumb-version' => 'OggHandler는 oggThumb 버전 $1 이상을 요구합니다.', 'ogg-oggThumb-failed' => 'oggThumb가 섬네일을 만들지 못했습니다.', ); /** Karachay-Balkar (къарачай-малкъар) * @author Iltever */ $messages['krc'] = array( 'ogg-more' => 'Кёбюрек…', ); /** Kinaray-a (Kinaray-a) * @author Jose77 */ $messages['krj'] = array( 'ogg-more' => 'Raku pa...', ); /** Colognian (Ripoarisch) * @author AVRS * @author Purodha */ $messages['ksh'] = array( 'ogg-desc' => 'En Projamm (<i lang="en">handler</i>) för <i lang="en">Ogg Theora</i> un <i lang="en">Ogg Vorbis</i> Dateie, met enem Afspiller-Projramm en Javaskrip.', 'ogg-short-audio' => '<i lang="en">Ogg $1</i> Tondatei, $2', 'ogg-short-video' => '<i lang="en">Ogg $1</i> Viddejodatei, $2', 'ogg-short-general' => '<i lang="en">Ogg $1</i> Medijedatei, $2', 'ogg-long-audio' => '<i lang="en">Ogg $1</i> Tondattei fum Ömfang $2 met $3', 'ogg-long-video' => '<i lang="en">Ogg $1</i> Viddejodatei fum Ömfang $2 un {{PLURAL:$4|ein Pixel|$4 Pixelle|kei Pixel}} × {{PLURAL:$5|ei Pixel|$4 Pixelle|kei Pixel}}, $3', 'ogg-long-multiplexed' => 'Jemultipex <i lang="en">Ogg</i>Ton- un Viddejodattei, $1, fum Ömfang $2 un {{PLURAL:$4|ein Pixel|$4 Pixelle|kei Pixel}} × {{PLURAL:$5|ei Pixel|$4 Pixelle|kei Pixel}}, $3 ennsjesammp', 'ogg-long-general' => '<i lang="en">Ogg</i> Medijedatei fum Ömfang $2 bei $3', 'ogg-long-error' => 'En kapodde <i lang="en">Ogg</i>-Dattei: $1', 'ogg-play' => 'Loßläje!', 'ogg-pause' => 'Aanhallde!', 'ogg-stop' => 'Ophüre!', 'ogg-play-video' => 'Dun der Viddejo affshpelle', 'ogg-play-sound' => 'Dä Ton afshpelle', 'ogg-no-player' => 'Deijt mer leid, süüd_esu uß, wi wann Dinge Kompjutor kei Affspellprojramm hät, wat mer öngerstoze däte. Beß esu joot, un <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">donn e Affspellprojramm erunger lade</a>.', 'ogg-no-xiphqt' => 'Deijt mer leid, süüd_esu uß, wi wann Dinge Kompjutor nit dat XiphQT Affspellprojrammstöck för <i lang="en">QuickTime</i> hät, ävver <i lang="en">QuickTime</i> kann <i lang="en">Ogg</i>-Dateie der oohne nit affspelle. Beß esu joot, un <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">donn dat XiphQT erunger lade</a>, udder sök Der en annder Affspellprojramm uß.', 'ogg-player-videoElement' => 'Ongerstözung för Brauser', 'ogg-player-oggPlugin' => 'Brauser <i lang="en">Plug-In</i>', 'ogg-player-cortado' => 'Cortado (Java)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (<i lang="en">ActiveX</i>)', 'ogg-player-quicktime-mozilla' => '<i lang="en">QuickTime</i>', 'ogg-player-quicktime-activex' => '<i lang="en">QuickTime</i> (<i lang="en">ActiveX</i>)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KM<i lang="en">Player</i>', 'ogg-player-kaffeine' => '<i lang="en">Kaffeine</i>', 'ogg-player-mplayerplug-in' => '<i lang="en">mplayerplug-in</i>', 'ogg-player-thumbnail' => 'Bloß e Standbeld', 'ogg-player-soundthumb' => 'Kei Affspellprojramm', 'ogg-player-selected' => '(Ußjesoht)', 'ogg-use-player' => 'Affspellprojramm:', 'ogg-more' => 'Enshtelle&nbsp;…', 'ogg-dismiss' => 'Zohmaache', 'ogg-download' => 'Datei erunger lade', 'ogg-desc-link' => 'Övver di Datei', 'ogg-oggThumb-version' => 'Dä <code lang="en">OggHandler</code> bruch <code lang="en">oggThumb</code> in dä Version $1 udder hüüter.', 'ogg-oggThumb-failed' => '<code lang="en">oggThumb</code> kunnt kei MiniBelldsche maache.', ); /** Kurdish (Latin script) (Kurdî (latînî)‎) * @author George Animal * @author Ghybu * @author Gomada */ $messages['ku-latn'] = array( 'ogg-play' => 'Bileyzîne', 'ogg-pause' => 'Rawestîne', 'ogg-stop' => 'Bisekne', 'ogg-play-video' => 'Vîdeoyê bileyzîne', 'ogg-play-sound' => 'Deng veke', 'ogg-player-soundthumb' => "Player'ekî din tune", 'ogg-player-selected' => '(hatiye bijartin)', 'ogg-more' => 'Bêhtir...', 'ogg-dismiss' => 'Bigre', 'ogg-download' => 'Daneyê daxe', ); /** Kirghiz (Кыргызча) * @author Chorobek */ $messages['ky'] = array( 'ogg-play' => 'Ойно', 'ogg-pause' => 'Пауза', 'ogg-stop' => 'Токтот', 'ogg-play-video' => 'Видеону ойнот', 'ogg-play-sound' => 'Үндү ойнот', 'ogg-player-videoElement' => 'Колдонуу серепчиге жалгаштырылган', 'ogg-player-oggPlugin' => 'Серепчинин плагини', 'ogg-player-thumbnail' => 'Сүрөттөр гана', 'ogg-player-soundthumb' => 'Ойноткуч жок', 'ogg-player-selected' => '(тандалган)', 'ogg-use-player' => ': ойноткучун колдон', 'ogg-more' => 'Дагы...', 'ogg-dismiss' => 'Жап', 'ogg-download' => 'Файлды жүктө', 'ogg-desc-link' => 'Бул файл тууралуу', ); /** Latin (Latina) * @author SPQRobin */ $messages['la'] = array( 'ogg-more' => 'Plus...', ); /** Luxembourgish (Lëtzebuergesch) * @author AVRS * @author Les Meloures * @author Robby */ $messages['lb'] = array( 'ogg-desc' => 'Steierungsprogramm fir Ogg Theora a Vorbis Fichieren, mat enger JavaScript-Player-Software', 'ogg-short-audio' => 'Ogg-$1-Tounfichier, $2', 'ogg-short-video' => 'Ogg-$1-Videofichier, $2', 'ogg-short-general' => 'Ogg-$1-Mediefichier, $2', 'ogg-long-audio' => 'Ogg-$1-Tounfichier, Dauer: $2, $3', 'ogg-long-video' => 'Ogg-$1-Videofichier, Dauer: $2, $4×$5 Pixel, $3', 'ogg-long-multiplexed' => 'Ogg-Multiplex-Audio-/Video-Fichier, $1, Dauer: $2, $4×$5 Pixel, $3 am Ganzen', 'ogg-long-general' => 'Ogg Media-Fichier, Dauer $2, $3', 'ogg-long-error' => 'Ongëltegen Ogg-Fichier: $1', 'ogg-play' => 'Ofspillen', 'ogg-pause' => 'Paus', 'ogg-stop' => 'Stopp', 'ogg-play-video' => 'Video ofspillen', 'ogg-play-sound' => 'Tounfichier ofspillen', 'ogg-no-player' => 'Pardon, Äre Betriibssystem schengt keng Software ze hunn fir d\'Fichieren ofzespillen. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Lued w.e.g. esou eng Software erof</a> an installéiert se w.e.g. .', 'ogg-no-xiphqt' => 'Dir hutt anscheinend d\'Komponent XiphQT fir QuickTime net installéiert. QuickTime kann Ogg-Fichiere net ouni dës Komponent spillen. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Lued XiphQT w.e.g. erof</a> oder wielt eng aner Software.', 'ogg-player-videoElement' => 'Ënnerstëtzt duerch de Browser', 'ogg-player-oggPlugin' => 'Browser-Plugin', 'ogg-player-thumbnail' => 'Just als Bild weisen', 'ogg-player-soundthumb' => 'Keng Player-Software', 'ogg-player-selected' => '(erausgewielt)', 'ogg-use-player' => "Benotzt d'Player-Software:", 'ogg-more' => 'Méi ...', 'ogg-dismiss' => 'Zoumaachen', 'ogg-download' => 'Fichier eroflueden', 'ogg-desc-link' => 'Iwwer dëse Fichier', 'ogg-oggThumb-version' => 'OggHandler brauch oggThumb Versioun $1 oder méi eng nei.', 'ogg-oggThumb-failed' => 'oggThumb konnt kee Miniaturbild maachen.', ); /** Lezghian (лезги) * @author Migraghvi */ $messages['lez'] = array( 'ogg-play' => 'КЪугъугъ', 'ogg-pause' => 'Пауза', 'ogg-stop' => 'Аквазун', 'ogg-play-video' => 'Видео къугъурун', 'ogg-play-sound' => 'Ван къугъурун', 'ogg-more' => 'Мадни...', 'ogg-dismiss' => 'Агалун', ); /** Lingua Franca Nova (Lingua Franca Nova) * @author Malafaya */ $messages['lfn'] = array( 'ogg-more' => 'Plu…', ); /** Limburgish (Limburgs) * @author AVRS * @author Matthias * @author Ooswesthoesbes */ $messages['li'] = array( 'ogg-desc' => "Handelt Ogg Theora- en Vorbis-bestande aaf met 'n JavaScript-mediaspeler", 'ogg-short-audio' => 'Ogg $1 geluidsbestandj, $2', 'ogg-short-video' => 'Ogg $1 videobestandj, $2', 'ogg-short-general' => 'Ogg $1 mediabestandj, $2', 'ogg-long-audio' => 'Ogg $1 geluidsbestandj, lingdje $2, $3', 'ogg-long-video' => 'Ogg $1 videobestandj, lingdje $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Ogg gemultiplexeerd geluids-/videobestandj, $1, lingdje $2, $4×$5 pixels, $3 totaal', 'ogg-long-general' => 'Ogg mediabestandj, lingdje $2, $3', 'ogg-long-error' => 'Óngeljig ogg-bestandj: $1', 'ogg-play' => 'Aafspele', 'ogg-pause' => 'Óngerbraeke', 'ogg-stop' => 'Oetsjeije', 'ogg-play-video' => 'Video aafspele', 'ogg-play-sound' => 'Geluid aafspele', 'ogg-no-player' => 'Sorry, uch systeem haet gein van de ongersteunde mediaspelers. Installeer estebleef <a href="http://www.java.com/nl/download/manual.jsp">Java</a>.', 'ogg-no-xiphqt' => "'t Liek d'r op det geer 't component XiphQT veur QuickTime neet haet. QuickTime kin Ogg-bestenj neet aafspele zonger dit component. Download <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">XiphQT</a> estebleef of kees 'ne angere speler.", 'ogg-player-videoElement' => 'Native browsersupport', 'ogg-player-oggPlugin' => 'Browserplugin', 'ogg-player-thumbnail' => 'Allein stilstaondj beild', 'ogg-player-soundthumb' => 'Geine mediaspeler', 'ogg-player-selected' => '(geselectieërdj)', 'ogg-use-player' => 'Gebroek speler:', 'ogg-more' => 'Mieë...', 'ogg-dismiss' => 'Sloet', 'ogg-download' => 'Bestandj downloade', 'ogg-desc-link' => 'Euver dit bestandj', 'ogg-oggThumb-version' => 'OggHandler vereis oggThumb versie $1 of hoeger.', 'ogg-oggThumb-failed' => 'oggThumb kós geine thumbnail make.', ); /** Lithuanian (lietuvių) * @author AVRS * @author Homo * @author Matasg */ $messages['lt'] = array( 'ogg-desc' => 'Įrankis groti Ogg Theora ir Vorbis failus su JavaScript grotuvu', 'ogg-short-audio' => 'Ogg $1 garso byla, $2', 'ogg-short-video' => 'Ogg $1 video byla, $2', 'ogg-short-general' => 'Ogg $1 medija byla, $2', 'ogg-long-audio' => '(Ogg $1 garso byla, ilgis $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 video byla, ilgis $2, $4×$5 pikseliai, $3', 'ogg-long-multiplexed' => '(Ogg sutankinta audio/video byla, $1, ilgis $2, $4×$5 pikseliai, $3 viso)', # Fuzzy 'ogg-long-general' => '(Ogg media byla, ilgis $2, $3)', # Fuzzy 'ogg-long-error' => '(Bloga ogg byla: $1)', # Fuzzy 'ogg-play' => 'Groti', 'ogg-pause' => 'Pauzė', 'ogg-stop' => 'Sustabdyti', 'ogg-play-video' => 'Groti video', 'ogg-play-sound' => 'Groti garsą', 'ogg-no-player' => 'Atsiprašome, neatrodo, kad jūsų sistema turi palaikomą grotuvą. Prašome <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">jį atsisiųsti</a>.', 'ogg-no-xiphqt' => 'Neatrodo, kad jūs turite XiphQT komponentą QuickTime grotuvui. QuickTime negali groti Ogg bylų be šio komponento. Prašome <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">atsisiųsti XiphQT</a> arba pasirinkti kitą grotuvą.', 'ogg-player-videoElement' => 'Pagrindinės naršyklės palaikymas', 'ogg-player-oggPlugin' => 'Naršyklės priedas', 'ogg-player-thumbnail' => 'Tik paveikslėlis', 'ogg-player-soundthumb' => 'Nėra grotuvo', 'ogg-player-selected' => '(pasirinkta)', 'ogg-use-player' => 'Naudoti grotuvą:', 'ogg-more' => 'Daugiau...', 'ogg-dismiss' => 'Uždaryti', 'ogg-download' => 'Atsisiųsti bylą', 'ogg-desc-link' => 'Apie šią bylą', ); /** Latvian (latviešu) * @author GreenZeb * @author Papuass * @author Xil */ $messages['lv'] = array( 'ogg-desc' => 'Ogg Theora un Vorbis failu apstrādātājs ar JavaScript atskaņotāju', 'ogg-short-audio' => 'Ogg $1 skaņas fails, $2', 'ogg-short-video' => 'Ogg $1 video fails, $2', 'ogg-short-general' => 'Ogg $1 multimediju fails, $2', 'ogg-long-audio' => 'Ogg $1 skaņas fails, garums $2, $3', 'ogg-long-video' => 'Ogg $1 video fails, garums $2, $4×$5 pikseļi, $3', 'ogg-long-general' => 'Ogg multimediju fails, garums $2, $3', 'ogg-long-error' => 'Nepareizs ogg fails: $1', 'ogg-play' => 'Atskaņot', 'ogg-pause' => 'Pauze', 'ogg-stop' => 'Apstādināt', 'ogg-play-video' => 'Atskaņot videoklipu', 'ogg-play-sound' => 'Atskaņot skaņu', 'ogg-player-oggPlugin' => 'Pārlūka spraudnis', 'ogg-player-selected' => '(izvēlēts)', 'ogg-more' => 'Vairāk...', 'ogg-dismiss' => 'Aizvērt', 'ogg-download' => 'Lejupielādēt failu', 'ogg-desc-link' => 'Par šo failu', 'ogg-oggThumb-version' => 'OggHandler nepieciešama oggThumb $1 vai jaunāka versija.', ); /** Macedonian (македонски) * @author AVRS * @author Bjankuloski06 * @author Brest */ $messages['mk'] = array( 'ogg-desc' => 'Ракувач со Ogg Theora и Vorbis податотеки, со JavaScript изведувач', 'ogg-short-audio' => 'Ogg $1 звучна податотека, $2', 'ogg-short-video' => 'Ogg $1 видеоснимка, $2', 'ogg-short-general' => 'Мултимедијална податотека Ogg $1, $2', 'ogg-long-audio' => 'Ogg $1 аудиоснимка, времетраење: $2, $3', 'ogg-long-video' => 'Ogg $1 видеоснимка, времетраење: $2, $4 × $5 пиксели, $3', 'ogg-long-multiplexed' => 'мултиплексирана Ogg аудио/видеоснимка, $1, времетраење: $2, $4 × $5 пиксели, вкупно $3', 'ogg-long-general' => 'Ogg снимка, времетраење: $2, $3', 'ogg-long-error' => 'Неважечка Ogg-податотека: $1', 'ogg-play' => 'Пушти', 'ogg-pause' => 'Паузирај', 'ogg-stop' => 'Запри', 'ogg-play-video' => 'Пушти видеоснимка', 'ogg-play-sound' => 'Слушни аудио снимка', 'ogg-no-player' => 'Изгледа дека вашиот систем нема инсталирано никаква програмска опрема за преслушување/прегледување на аудио или видео снимки. a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Тука преземете изведувач за таа намена</a>.', 'ogg-no-xiphqt' => 'Изгледа го немате инсталирано делот XiphQT за QuickTime. QuickTime не може да преслушува/прегледува Ogg податотеки без оваа компонента. Можете да го <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">преземете XiphQT</a> или да изберете некоја друга програмска опрема за преслушување/прегледување.', 'ogg-player-videoElement' => 'Вградено во прелистувачот', 'ogg-player-oggPlugin' => 'Вградено во прелистувачот', 'ogg-player-cortado' => 'Cortado (Java)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (ActiveX)', 'ogg-player-quicktime-mozilla' => 'QuickTime', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kaffeine', 'ogg-player-mplayerplug-in' => 'mplayerplug-in', 'ogg-player-thumbnail' => 'Само неподвижни слики', 'ogg-player-soundthumb' => 'Нема изведувач', 'ogg-player-selected' => '(избрано)', 'ogg-use-player' => 'Користи:', 'ogg-more' => 'Повеќе…', 'ogg-dismiss' => 'Затвори', 'ogg-download' => 'Преземи', 'ogg-desc-link' => 'Информации за податотеката', 'ogg-oggThumb-version' => 'OggHandler бара oggThumb - верзија $1 или понова.', 'ogg-oggThumb-failed' => 'oggThumb не успеа да ја создаде минијатурата.', ); /** Malayalam (മലയാളം) * @author AVRS * @author Praveenp * @author Shijualex */ $messages['ml'] = array( 'ogg-desc' => 'ജാവാസ്ക്രിപ്റ്റ് പ്ലേയർ ഉപയോഗിച്ച് ഓഗ് തിയോറ, വോർബിസ് പ്രമാണങ്ങൾ കൈകാര്യം ചെയ്യൽ', 'ogg-short-audio' => 'ഓഗ് $1 ശബ്ദപ്രമാണം, $2', 'ogg-short-video' => 'ഓഗ് $1 വീഡിയോ പ്രമാണം, $2', 'ogg-short-general' => 'ഓഗ് $1 മീഡിയ പ്രമാണം, $2', 'ogg-long-audio' => 'ഓഗ് $1 ശബ്ദ പ്രമാണം, ദൈർഘ്യം $2, $3', 'ogg-long-video' => 'ഓഗ് $1 വീഡിയോ പ്രമാണം, ദൈർഘ്യം $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'ഓഗ് മൾട്ടിപ്ലക്സ്‌‌ഡ് ശബ്ദ/ചലച്ചിത്ര പ്രമാണം, $1, ദൈർഘ്യം $2, $4×$5 ബിന്ദു, ആകെക്കൂടി $3', 'ogg-long-general' => 'ഓഗ് മീഡിയ പ്രമാണം, ദൈർഘ്യം $2, $3', 'ogg-long-error' => 'അസാധുവായ ഓഗ് പ്രമാണം: $1', 'ogg-play' => 'പ്രവർത്തിപ്പിക്കുക', 'ogg-pause' => 'താൽക്കാലികമായി നിർത്തുക', 'ogg-stop' => 'നിർത്തുക', 'ogg-play-video' => 'വീഡിയോ പ്രവർത്തിപ്പിക്കുക', 'ogg-play-sound' => 'ശബ്ദം പ്രവർത്തിപ്പിക്കുക', 'ogg-no-player' => 'ക്ഷമിക്കണം. താങ്കളുടെ കമ്പ്യൂട്ടറിൽ ഓഗ് പ്രമാണം പ്രവർത്തിപ്പിക്കാനാവശ്യമായ സോഫ്റ്റ്‌ഫെയർ ഇല്ല. ദയവു ചെയ്ത് ഒരു പ്ലെയർ <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ഡൗൺലോഡ് ചെയ്യുക</a>.', 'ogg-no-xiphqt' => 'ക്വിക്ക്റ്റൈമിനുള്ള XiphQT ഘടകം താങ്കളുടെ പക്കലുണ്ടെന്നു കാണുന്നില്ല. ഓഗ് പ്രമാണങ്ങൾ ഈ ഘടകമില്ലാതെ പ്രവർത്തിപ്പിക്കാൻ ക്വിക്ക്റ്റൈമിനു കഴിയില്ല. ദയവായി <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT ഡൗൺലോഡ് ചെയ്യുക</a> അല്ലെങ്കിൽ മറ്റൊരു പ്ലേയർ തിരഞ്ഞെടുക്കുക.', 'ogg-player-videoElement' => 'ബ്രൗസറിൽ സ്വതേയുള്ള പിന്തുണ', 'ogg-player-oggPlugin' => 'ബ്രൗസർ പ്ലഗിൻ', 'ogg-player-quicktime-mozilla' => 'ക്വിക്ക്റ്റൈം', 'ogg-player-quicktime-activex' => 'ക്വിക്ക്റ്റൈം (ആക്റ്റീവ്‌‌എക്സ്)', 'ogg-player-thumbnail' => 'നിശ്ചല ചിത്രം മാത്രം', 'ogg-player-soundthumb' => 'പ്ലെയർ ഇല്ല', 'ogg-player-selected' => '(തിരഞ്ഞെടുത്തവ)', 'ogg-use-player' => 'ഈ പ്ലെയർ ഉപയോഗിക്കുക', 'ogg-more' => 'കൂടുതൽ...', 'ogg-dismiss' => 'അടയ്ക്കുക', 'ogg-download' => 'പ്രമാണം ഡൗൺലോഡ് ചെയ്യുക', 'ogg-desc-link' => 'ഈ പ്രമാണത്തെക്കുറിച്ച്', 'ogg-oggThumb-version' => 'ഓഗ്-തമ്പ് പതിപ്പ് $1 അല്ലെങ്കിൽ പുതിയത് ഓഗ്-ഹാൻഡ്ലറിനാവശ്യമാണ്.', 'ogg-oggThumb-failed' => 'ലഘുചിത്രം സൃഷ്ടിക്കുന്നതിൽ ഓഗ്-തമ്പ് പരാജയപ്പെട്ടു.', ); /** Marathi (मराठी) * @author AVRS * @author Kaajawa * @author Kaustubh * @author Mahitgar */ $messages['mr'] = array( 'ogg-desc' => 'ऑग थियोरा व वॉर्बिस संचिकांसाठीचा चालक, जावास्क्रीप्ट प्लेयर सकट', 'ogg-short-audio' => 'ऑग $1 ध्वनी संचिका, $2', 'ogg-short-video' => 'ऑग $1 चलतचित्र संचिका, $2', 'ogg-short-general' => 'ऑग $1 मीडिया संचिका, $2', 'ogg-long-audio' => '(ऑग $1 ध्वनी संचिका, लांबी $2, $3)', # Fuzzy 'ogg-long-video' => 'ऑग $1 चलतचित्र संचिका, लांबी $2, $4×$5 पीक्सेल्स, $3', 'ogg-long-multiplexed' => '(ऑग ध्वनी/चित्र संचिका, $1, लांबी $2, $4×$5 पिक्सेल्स, $3 एकूण)', # Fuzzy 'ogg-long-general' => '(ऑग मीडिया संचिका, लांबी $2, $3)', # Fuzzy 'ogg-long-error' => '(चुकीची ऑग संचिका: $1)', # Fuzzy 'ogg-play' => 'चालू करा', 'ogg-pause' => 'विराम', 'ogg-stop' => 'थांबवा', 'ogg-play-video' => 'चलतचित्र चालू करा', 'ogg-play-sound' => 'ध्वनी चालू करा', 'ogg-no-player' => 'माफ करा, पण तुमच्या संगणकामध्ये कुठलाही प्लेयर आढळला नाही. कृपया <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">प्लेयर डाउनलोड करा</a>.', 'ogg-no-xiphqt' => 'तुमच्या संगणकामध्ये क्वीकटाईम ला लागणारा XiphQT हा तुकडा आढळला नाही. याशिवाय क्वीकटाईम ऑग संचिका चालवू शकणार नाही. कॄपया <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT डाउनलोड करा</a> किंवा दुसरा प्लेयर वापरा.', 'ogg-player-videoElement' => 'मूल ब्राउज़र समर्थन', 'ogg-player-oggPlugin' => 'न्याहाळक प्लगीन', 'ogg-player-cortado' => 'कोर्टाडो (जावा)', 'ogg-player-thumbnail' => 'फक्त स्थिर चित्र', 'ogg-player-soundthumb' => 'प्लेयर उपलब्ध नाही', 'ogg-player-selected' => '(निवडलेले)', 'ogg-use-player' => 'हा प्लेयर वापरा:', 'ogg-more' => 'आणखी...', 'ogg-dismiss' => 'बंद करा', 'ogg-download' => 'संचिका उतरवा', 'ogg-desc-link' => 'या संचिकेबद्दलची माहिती', 'ogg-oggThumb-version' => 'OggHandler ला oggThumb च्या $1 अथवा त्या नंतरच्या आवृउत्तीची गरज आहे', 'ogg-oggThumb-failed' => 'oggThumb इवलेसे-चित्र निर्माणकरण्यात यशस्वी झाले नाही.', ); /** Malay (Bahasa Melayu) * @author AVRS * @author Anakmalaysia * @author Aviator */ $messages['ms'] = array( 'ogg-desc' => 'Pengelola fail Ogg Theora dan Vorbis, dengan pemain JavaScript', 'ogg-short-audio' => 'fail bunyi Ogg $1, $2', 'ogg-short-video' => 'fail video Ogg $1, $2', 'ogg-short-general' => 'fail media Ogg $1, $2', 'ogg-long-audio' => 'Fail bunyi Ogg $1, tempoh $2, $3', 'ogg-long-video' => 'fail video Ogg $1, tempoh $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => 'Fail audio/video multipleks Ogg, $1, tempoh $2, $4×$5 piksel, keseluruhan $3', 'ogg-long-general' => 'Fail media Ogg, tempoh $2, $3', 'ogg-long-error' => 'Fail Ogg tidak sah: $1', 'ogg-play' => 'Mainkan', 'ogg-pause' => 'Jedakan', 'ogg-stop' => 'Hentikan', 'ogg-play-video' => 'Main video', 'ogg-play-sound' => 'Main bunyi', 'ogg-no-player' => 'Maaf, sistem anda tidak mempunyai perisian pemain yang disokong. Sila <a href=\\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\\">muat turun sebuah pemain</a>.', 'ogg-no-xiphqt' => 'Anda tidak mempunyai komponen XiphQT untuk QuickTime. QuickTime tidak boleh memainkan fail Ogg tanpa komponen ini. Sila <a href=\\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\\">muat turun XiphQT</a> atau pilih pemain lain.', 'ogg-player-videoElement' => 'Sokongan dalaman pelayar web', 'ogg-player-oggPlugin' => 'Pemalam untuk pelayar web', 'ogg-player-cortado' => 'Cortado (Java)', 'ogg-player-vlc-activex' => 'VLC (ActiveX)', 'ogg-player-quicktime-mozilla' => 'QuickTime', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-thumbnail' => 'Imej pegun sahaja', 'ogg-player-soundthumb' => 'Tiada pemain', 'ogg-player-selected' => '(dipilih)', 'ogg-use-player' => 'Gunakan pemain:', 'ogg-more' => 'Lagi…', 'ogg-dismiss' => 'Tutup', 'ogg-download' => 'Muat turun fail', 'ogg-desc-link' => 'Perihal fail ini', 'ogg-oggThumb-version' => 'OggHandler memerlukan oggThumb versi $1 ke atas.', 'ogg-oggThumb-failed' => 'oggThumb gagal mencipta gambar kenit.', ); /** Maltese (Malti) * @author Chrisportelli */ $messages['mt'] = array( 'ogg-desc' => 'Maniġer għall-fajls Ogg Theora u Vorbis, bil-plejer tal-Javascript', 'ogg-short-audio' => 'Fajl tal-awdjo Ogg $1, $2', 'ogg-short-video' => 'Fajl tal-vidjo $1, $2', 'ogg-short-general' => 'Fajl multimedjali Ogg $1, $2', 'ogg-long-audio' => 'Fajl tal-awdjo Ogg $1, tul $2, $3', 'ogg-long-video' => 'Fajl tal-vidjo $1, tul $2, dimensjoni $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Fajl tal-awdjo/vidjo <i>multiplexed</i> Ogg $1, tul $2, dimensjoni $4×$5 pixels, kumplessivament $3', 'ogg-long-general' => 'Fajl multimedjali Ogg, tul $2, $3', 'ogg-long-error' => 'Fajl ogg invalidu: $1', 'ogg-play' => 'Esegwixxi', 'ogg-pause' => 'Issospendi', 'ogg-stop' => 'Waqqaf', 'ogg-play-video' => 'Esegwixxi l-vidjo', 'ogg-play-sound' => 'Esegwixxi l-fajl tal-ħoss', 'ogg-no-player' => 'Skużana, is-sistema tiegħek tidher li ma ssostnix l-ebda softwer plejer kompatibbli. Jekk jogħġbok, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">niżżel plejer</a>.', 'ogg-no-xiphqt' => 'Jidher li m\'għandekx il-komponent XiphQT tal-QuickTime. QuickTime ma jistax jesegwixxi fajls Ogg mingħajr il-komponent. Jekk jogħġbok <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">niżżel XiphQT</a> jew għażel plejer ieħor.', 'ogg-player-oggPlugin' => '<i>Plugin</i> tal-browżer', 'ogg-player-thumbnail' => 'Stampi fissi biss', 'ogg-player-soundthumb' => 'L-ebda plejer', 'ogg-player-selected' => '(magħżul)', 'ogg-use-player' => 'Uża l-plejer:', 'ogg-more' => 'Iktar…', 'ogg-dismiss' => 'Agħlaq', 'ogg-download' => 'Niżżel il-fajl', 'ogg-desc-link' => 'Dwar dan il-fajl', 'ogg-oggThumb-version' => "OggHandler għandu bżonn tal-verżjoni $1 jew iktar tard ta' oggThumb.", 'ogg-oggThumb-failed' => 'oggThumb falla li joħloq minjatura.', ); /** Erzya (эрзянь) * @author Botuzhaleny-sodamo */ $messages['myv'] = array( 'ogg-play' => 'Седик', 'ogg-pause' => 'Аштевтик', 'ogg-stop' => 'Лоткавтык', 'ogg-play-video' => 'Нолдык видеонть', 'ogg-play-sound' => 'Нолдык вайгеленть', 'ogg-player-selected' => '(кочказь)', 'ogg-dismiss' => 'Пекстамс', 'ogg-desc-link' => 'Те файладонть', ); /** Nahuatl (Nāhuatl) * @author Fluence */ $messages['nah'] = array( 'ogg-more' => 'Huehca ōmpa...', 'ogg-download' => 'Tictemōz tlahcuilōlli', 'ogg-desc-link' => 'Inīn tlahcuilōltechcopa', ); /** Norwegian Bokmål (norsk bokmål) * @author AVRS * @author Danmichaelo * @author Laaknor * @author Nghtwlkr */ $messages['nb'] = array( 'ogg-desc' => 'Gjør at Ogg Theora- og Ogg Vorbis-filer kan kjøres med hjelp av JavaScript-avspiller.', 'ogg-short-audio' => 'Ogg $1 lydfil, $2', 'ogg-short-video' => 'Ogg $1 videofil, $2', 'ogg-short-general' => 'Ogg $1 mediefil, $2', 'ogg-long-audio' => 'Ogg $1-lydfil, lengde $2, $3', 'ogg-long-video' => 'Ogg $1 videofil, lengde $2, $4×$5 piksler, $3', 'ogg-long-multiplexed' => 'Sammensatt ogg-lyd- og -videofil, $1, lengde $2, $4×$5 piksler, $3 samlet', 'ogg-long-general' => 'Ogg mediefil, lengde $2, $3', 'ogg-long-error' => 'Ugyldig ogg-fil: $1', 'ogg-play' => 'Spill', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Stopp', 'ogg-play-video' => 'Spill av video', 'ogg-play-sound' => 'Spill av lyd', 'ogg-no-player' => 'Beklager, systemet ditt har ingen medieavspillere som støtter filformatet. Vennligst <a href="http://mediawiki.org/wiki/Extension:OggHandler/Client_download">last ned en avspiller</a> som støtter formatet.', 'ogg-no-xiphqt' => 'Du har ingen XiphQT-komponent for QuickTime. QuickTime kan ikke spille Ogg-filer uten denne komponenten. <a href="http://mediawiki.org/wiki/Extension:OggHandler/Client_download">last ned XiphQT</a> eller velg en annen medieavspiller.', 'ogg-player-videoElement' => 'Innebygd nettleserstøtte', 'ogg-player-oggPlugin' => 'Programtillegg for nettleser', 'ogg-player-thumbnail' => 'Kun stillbilder', 'ogg-player-soundthumb' => 'Ingen medieavspiller', 'ogg-player-selected' => '(valgt)', 'ogg-use-player' => 'Bruk avspiller:', 'ogg-more' => 'Mer …', 'ogg-dismiss' => 'Lukk', 'ogg-download' => 'Last ned fil', 'ogg-desc-link' => 'Om denne filen', 'ogg-oggThumb-version' => 'OggHandler krever oggThumb versjon $1 eller senere.', 'ogg-oggThumb-failed' => 'oggThumb klarte ikke å opprette miniatyrbildet.', ); /** Low German (Plattdüütsch) * @author AVRS * @author Slomox */ $messages['nds'] = array( 'ogg-desc' => 'Stüürprogramm för Ogg-Theora- un Vorbis Datein, mitsamt en Afspeler in JavaScript', 'ogg-short-audio' => 'Ogg-$1-Toondatei, $2', 'ogg-short-video' => 'Ogg-$1-Videodatei, $2', 'ogg-short-general' => 'Ogg-$1-Mediendatei, $2', 'ogg-long-audio' => '(Ogg-$1-Toondatei, $2 lang, $3)', # Fuzzy 'ogg-long-video' => 'Ogg-$1-Videodatei, $2 lang, $4×$5 Pixels, $3', 'ogg-long-multiplexed' => '(Ogg-Multiplexed-Audio-/Video-Datei, $1, $2 lang, $4×$5 Pixels, $3 alltohoop)', # Fuzzy 'ogg-long-general' => '(Ogg-Mediendatei, $2 lang, $3)', # Fuzzy 'ogg-long-error' => '(Kaputte Ogg-Datei: $1)', # Fuzzy 'ogg-play' => 'Afspelen', 'ogg-pause' => 'Paus', 'ogg-stop' => 'Stopp', 'ogg-play-video' => 'Video afspelen', 'ogg-play-sound' => 'Toondatei afspelen', 'ogg-no-player' => 'Süht so ut, as wenn dien Reekner keen passlichen Afspeler hett. Du kannst en <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Afspeler dalladen</a>.', 'ogg-no-xiphqt' => 'Süht so ut, as wenn dien Reekner de XiphQT-Kumponent för QuickTime nich hett. Ahn dat Ding kann QuickTime keen Ogg-Datein afspelen. Du kannst <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT dalladen</a> oder en annern Afspeler utwählen.', 'ogg-player-videoElement' => 'Standard-Ünnerstüttung in’n Browser', 'ogg-player-oggPlugin' => 'Browser-Plugin', 'ogg-player-thumbnail' => 'blot Standbild', 'ogg-player-soundthumb' => 'Keen Afspeler', 'ogg-player-selected' => '(utwählt)', 'ogg-use-player' => 'Afspeler bruken:', 'ogg-more' => 'Mehr...', 'ogg-dismiss' => 'Dichtmaken', 'ogg-download' => 'Datei dalladen', 'ogg-desc-link' => 'Över disse Datei', ); /** Low Saxon (Netherlands) (Nedersaksies) * @author AVRS * @author Servien */ $messages['nds-nl'] = array( 'ogg-desc' => 'Haandelt veur Ogg Theora- en Vorbis-bestaanden, mit JavaScript-mediaspeuler', 'ogg-short-audio' => 'Ogg $1 geluudsbestaand, $2', 'ogg-short-video' => 'Ogg $1 videobestaand, $2', 'ogg-short-general' => 'Ogg $1 mediabestaand, $2', 'ogg-long-audio' => 'Ogg $1 geluudsbestaand, lengte $2, $3', 'ogg-long-video' => 'Ogg $1 videobestaand, lengte $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Ogg-emultiplext geluuds-/videobestaand, $1, lengte $2, $4×$5 pixels, $3 totaal', 'ogg-long-general' => 'Ogg-mediabestaand, lengte $2, $3', 'ogg-long-error' => 'Ongeldig ogg-bestaand: $1', 'ogg-play' => 'Aofspeulen', 'ogg-pause' => 'Pauze', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Video aofspeulen', 'ogg-play-sound' => 'Geluud aofspeulen', 'ogg-no-player' => 'Joew system hef gien ondersteunende mediaspeulers. Installeer n <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">mediaspeuler</a>.', 'ogg-no-xiphqt' => 't Lik derop da\'j de komponent XiphQT veur QuickTime niet hebben. QuickTime kan Ogg-bestaanden niet aofspeulen zonder dit komponent. Installeer <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT</a> of kies n aandere mediaspeuler.', 'ogg-player-videoElement' => 'Standardondersteuning in webkieker', 'ogg-player-oggPlugin' => 'Webkiekeruutbreiding', 'ogg-player-thumbnail' => 'Allinnig stilstaond beeld', 'ogg-player-soundthumb' => 'Gien mediaspeuler', 'ogg-player-selected' => '(ekeuzen)', 'ogg-use-player' => 'Gebruuk mediaspeuler:', 'ogg-more' => 'Meer...', 'ogg-dismiss' => 'Sluten', 'ogg-download' => 'Bestaand binnenhaolen', 'ogg-desc-link' => 'Over dit bestaand', 'ogg-oggThumb-version' => "Veur OggHandler he'j oggThumb-versie $1 of hoger neudig.", 'ogg-oggThumb-failed' => 'oggThumb kon gien miniatuuraofbeelding anmaken.', ); /** Dutch (Nederlands) * @author AVRS * @author SPQRobin * @author Siebrand */ $messages['nl'] = array( 'ogg-desc' => 'Handelt Ogg Theora- en Vorbis-bestanden af met een JavaScript-mediaspeler', 'ogg-short-audio' => 'Ogg $1-geluidsbestand, $2', 'ogg-short-video' => 'Ogg $1 videobestand, $2', 'ogg-short-general' => 'Ogg $1-mediabestand, $2', 'ogg-long-audio' => 'Ogg $1-geluidsbestand, lengte $2, $3', 'ogg-long-video' => 'Ogg $1 videobestand, lengte $2, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Ogg gemultiplexed geluids- of videobestand, $1, lengte $2, $4×$5 pixels, $3 totaal', 'ogg-long-general' => 'Ogg mediabestand, lengte $2, $3', 'ogg-long-error' => 'Ongeldig Ogg-bestand: $1', 'ogg-play' => 'Afspelen', 'ogg-pause' => 'Pauzeren', 'ogg-stop' => 'Stoppen', 'ogg-play-video' => 'Video afspelen', 'ogg-play-sound' => 'Geluid afspelen', 'ogg-no-player' => 'Uw systeem heeft geen van de ondersteunde mediaspelers. Installeer <a href="http://www.java.com/nl/download/manual.jsp">Java</a>.', 'ogg-no-xiphqt' => 'Het lijkt erop dat u de component XiphQT voor QuickTime niet hebt. QuickTime kan Ogg-bestanden niet afspelen zonder deze component. Download <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT</a> of kies een andere speler.', 'ogg-player-videoElement' => 'Standaardondersteuning in browser', 'ogg-player-oggPlugin' => 'Browserplugin', 'ogg-player-thumbnail' => 'Alleen stilstaand beeld', 'ogg-player-soundthumb' => 'Geen mediaspeler', 'ogg-player-selected' => '(geselecteerd)', 'ogg-use-player' => 'Gebruik speler:', 'ogg-more' => 'Meer…', 'ogg-dismiss' => 'Sluiten', 'ogg-download' => 'Bestand downloaden', 'ogg-desc-link' => 'Over dit bestand', 'ogg-oggThumb-version' => 'OggHandler vereist oggThumb versie $1 of hoger.', 'ogg-oggThumb-failed' => 'oggThumb kon geen miniatuurafbeelding aanmaken.', ); /** Nederlands (informeel)‎ (Nederlands (informeel)‎) * @author Siebrand */ $messages['nl-informal'] = array( 'ogg-no-player' => 'Je systeem heeft geen van de ondersteunde mediaspelers. Installeer <a href="http://www.java.com/nl/download/manual.jsp">Java</a>.', 'ogg-no-xiphqt' => 'Het lijkt erop dat je de component XiphQT voor QuickTime niet hebt. QuickTime kan Ogg-bestanden niet afspelen zonder deze component. Download <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT</a> of kies een andere speler.', ); /** Norwegian Nynorsk (norsk nynorsk) * @author AVRS * @author Eirik * @author Harald Khan * @author Njardarlogar */ $messages['nn'] = array( 'ogg-desc' => 'Gjer at Ogg Theora- og Ogg Vorbis-filer kan verta køyrte ved hjelp av JavaScript-avspelar.', 'ogg-short-audio' => 'Ogg $1-lydfil, $2', 'ogg-short-video' => 'Ogg $1-videofil, $2', 'ogg-short-general' => 'Ogg $1-mediafil, $2', 'ogg-long-audio' => '(Ogg $1-lydfil, lengd $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1-videofil, lengd $2, $4×$5 pikslar, $3', 'ogg-long-multiplexed' => '(Samansett ogg lyd-/videofil, $1, lengd $2, $4×$5 pikslar, $3 til saman)', # Fuzzy 'ogg-long-general' => '(Ogg mediafil, lengd $2, $3)', # Fuzzy 'ogg-long-error' => '(Ugyldig ogg-fil: $1)', # Fuzzy 'ogg-play' => 'Spel av', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Stopp', 'ogg-play-video' => 'Spel av videofila', 'ogg-play-sound' => 'Spel av lydfila', 'ogg-no-player' => 'Beklagar, systemet ditt har ikkje støtta programvare til avspeling. Ver venleg og <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">last ned ein avspelar</a>.', 'ogg-no-xiphqt' => 'Du ser ikkje ut til å ha XiphQT-komponenten til QuickTime. QuickTime kan ikkje spele av ogg-filer utan denne. Ver venleg og <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">last ned XiphQT</a> eller vel ein annan avspelar.', 'ogg-player-videoElement' => 'Innebygd nettlesarstøtte', 'ogg-player-oggPlugin' => 'Programtillegg for nettlesar', 'ogg-player-thumbnail' => 'Berre stillbilete', 'ogg-player-soundthumb' => 'Ingen avspelar', 'ogg-player-selected' => '(valt)', 'ogg-use-player' => 'Bruk avspelaren:', 'ogg-more' => 'Meir...', 'ogg-dismiss' => 'Lat att', 'ogg-download' => 'Last ned fila', 'ogg-desc-link' => 'Om denne fila', ); /** Occitan (occitan) * @author AVRS * @author Cedric31 */ $messages['oc'] = array( 'ogg-desc' => 'Supòrt pels fichièrs Ogg Theora e Vorbis, amb un lector Javascript', 'ogg-short-audio' => 'Fichièr son Ogg $1, $2', 'ogg-short-video' => 'Fichièr vidèo Ogg $1, $2', 'ogg-short-general' => 'Fichièr mèdia Ogg $1, $2', 'ogg-long-audio' => 'Fichièr son Ogg $1, durada $2, $3', 'ogg-long-video' => 'Fichièr vidèo Ogg $1, durada $2, $4×$5 pixèls, $3', 'ogg-long-multiplexed' => 'Fichièr multiplexat àudio/vidèo Ogg, $1, durada $2, $4×$5 pixèls, $3', 'ogg-long-general' => 'Fichièr mèdia Ogg, durada $2, $3', 'ogg-long-error' => 'Fichièr Ogg invalid : $1', 'ogg-play' => 'Legir', 'ogg-pause' => 'Pausa', 'ogg-stop' => 'Stòp', 'ogg-play-video' => 'Legir la vidèo', 'ogg-play-sound' => 'Legir lo son', 'ogg-no-player' => 'O planhèm, aparentament, vòstre sistèma a pas cap de lectors suportats. Installatz <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/oc">un dels lectors suportats</a>.', 'ogg-no-xiphqt' => 'Aparentament avètz pas lo compausant XiphQT per Quicktime. Quicktime pòt pas legir los fiquièrs Ogg sens aqueste compausant. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/fr"> Telecargatz-lo XiphQT</a> o causissètz un autre lector.', 'ogg-player-videoElement' => 'Supòrt del navigador natiu', 'ogg-player-oggPlugin' => 'Plugin del navigador', 'ogg-player-thumbnail' => 'Imatge estatic solament', 'ogg-player-soundthumb' => 'Cap de lector', 'ogg-player-selected' => '(seleccionat)', 'ogg-use-player' => 'Utilizar lo lector :', 'ogg-more' => 'Mai…', 'ogg-dismiss' => 'Tampar', 'ogg-download' => 'Telecargar lo fichièr', 'ogg-desc-link' => "A prepaus d'aqueste fichièr", ); /** Oriya (ଓଡ଼ିଆ) * @author Odisha1 * @author Psubhashish */ $messages['or'] = array( 'ogg-desc' => 'ଜାଭାସ୍କ୍ରିପ୍ଟ ପ୍ଲେଅର ସହିତ Ogg Theora ଓ Vorbis ଫାଇଲ ନିମନ୍ତେ ପରିଚାଳନାକାରୀ', 'ogg-short-audio' => 'Ogg $1 ଶବ୍ଦ ଫାଇଲ, $2', 'ogg-short-video' => 'Ogg $1 ଭିଡ଼ିଓ ଫାଇଲ, $2', 'ogg-short-general' => 'Ogg $1 ମିଡ଼ିଆ ଫାଇଲ, $2', 'ogg-long-audio' => 'Ogg $1 ଶବ୍ଦ ଫାଇଲ, ଲମ୍ବ $2, $3', 'ogg-long-video' => 'Ogg $1 ଭିଡ଼ିଓ, ଲମ୍ବ $2, $4×$5 ପିକ୍ସେଲ, $3', 'ogg-long-multiplexed' => 'Ogg ମଲଟିପ୍ଲେକ୍ସ audio/video ଫାଇଲ, $1, ଲମ୍ବ $2, $4×$5 ପିକ୍ସେଲ, ମୋଟ $3', 'ogg-long-general' => 'Ogg ମିଡ଼ିଆ ଫାଇଲ, ଲମ୍ବ $2, $3', 'ogg-long-error' => 'ଅଚଳ ogg ଫାଇଲ: $1', 'ogg-play' => 'ଚଲାଇବା', 'ogg-pause' => 'ବିରତି', 'ogg-stop' => 'ବିରାମ', 'ogg-play-video' => 'ଭିଡ଼ିଓ ଚଳାଇବେ', 'ogg-play-sound' => 'ଶବ୍ଦ ଚଳାଇବେ', 'ogg-no-player' => 'କ୍ଷମା କରିବେ, ଆପଣଙ୍କ କମ୍ପୁଟରରେ କୌଣସି ଭିଡ଼ିଓ ଚାଳନ ସଫ୍ଟୱେର ଇନଷ୍ଟଲ ହୋଇଥିବା ଜଣାଯାଉନାହିଁ । ଦୟାକରି <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ଏକ ପ୍ଲେଅର ଡାଉନଲୋଡ଼ କରିନିଅନ୍ତୁ</a> ।', 'ogg-no-xiphqt' => 'ଆପଣଙ୍କ ପାଖରେ QuickTime ପାଇଁ XiphQT କମ୍ପୋନେଣ୍ଟ ନଥିବା ଭଳି ଲାଗୁଛି । ଏହି କମ୍ପୋନେଣ୍ଟ ବିନା QuickTime Ogg ଫାଇଲ ଚଳାଇପାରିବ ନାହିଁ । ଦୟାକରି <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT ଡାଉନଲୋଡ଼ କରନ୍ତୁ</a> ଅବା ଆଉ ଏକ ପ୍ଲେଅର ବାଛନ୍ତୁ ।', 'ogg-player-videoElement' => 'ଆଞ୍ଚଳିକ ବ୍ରାଉଜର ସହଯୋଗ', 'ogg-player-oggPlugin' => 'ବ୍ରାଉଜର ପ୍ଲଗଇନ', 'ogg-player-thumbnail' => 'ଏବେଯାଏଁ କେବଳ ଛବି', 'ogg-player-soundthumb' => 'ଚାଳନଯନ୍ତ୍ର ନାହିଁ', 'ogg-player-selected' => '(ବଛା)', 'ogg-use-player' => 'ଚାଳନ ଯନ୍ତ୍ର ବ୍ୟବହାର କରିବେ:', 'ogg-more' => 'ଅଧିକ...', 'ogg-dismiss' => 'ବନ୍ଦ କରିବେ', 'ogg-download' => 'ଫାଇଲ ଡାଉନଲୋଡ଼', 'ogg-desc-link' => 'ଏହି ଫାଇଲ ବାବଦରେ', 'ogg-oggThumb-version' => 'OggHandler ନିମନ୍ତେ oggThumb ର $1 ତମ ବା ତାହା ପରର ସଂସ୍କରଣ ଲୋଡ଼ା', 'ogg-oggThumb-failed' => 'oggThumb ସାନଦେଖଣା ତିଆରିବାରେ ବିଫଳ ହେଲା ।', ); /** Ossetic (Ирон) * @author Amikeco */ $messages['os'] = array( 'ogg-more' => 'Фылдæр…', 'ogg-download' => 'Файл æрбавгæн', ); /** Punjabi (ਪੰਜਾਬੀ) * @author Gman124 */ $messages['pa'] = array( 'ogg-more' => 'ਹੋਰ...', ); /** Deitsch (Deitsch) * @author Xqt */ $messages['pdc'] = array( 'ogg-short-general' => 'Ogg-$1-Mediafeil, $2', 'ogg-more' => 'Mehr…', 'ogg-dismiss' => 'Zumache', 'ogg-download' => 'Feil runnerlaade', 'ogg-desc-link' => 'Iwwer sell Feil', ); /** Pälzisch (Pälzisch) * @author Manuae */ $messages['pfl'] = array( 'ogg-pause' => 'Paus', 'ogg-stop' => 'Uffhere', ); /** Polish (polski) * @author AVRS * @author BeginaFelicysym * @author Derbeth * @author Leinad * @author Sp5uhe */ $messages['pl'] = array( 'ogg-desc' => 'Obsługa plików w formacie Ogg Theora i Vorbis z odtwarzaczem w JavaScripcie', 'ogg-short-audio' => 'Plik dźwiękowy Ogg $1, $2', 'ogg-short-video' => 'Plik wideo Ogg $1, $2', 'ogg-short-general' => 'Plik multimedialny Ogg $1, $2', 'ogg-long-audio' => 'Plik dźwiękowy Ogg $1, długość $2, $3', 'ogg-long-video' => 'plik wideo Ogg $1, długość $2, rozdzielczość $4×$5, $3', 'ogg-long-multiplexed' => 'Plik audio/wideo Ogg, $1, długość $2, rozdzielczość $4×$5, ogółem $3', 'ogg-long-general' => 'Plik multimedialny Ogg, długość $2, $3', 'ogg-long-error' => 'Niepoprawny plik Ogg: $1', 'ogg-play' => 'Odtwórz', 'ogg-pause' => 'Pauza', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Odtwórz wideo', 'ogg-play-sound' => 'Odtwórz dźwięk', 'ogg-no-player' => 'W Twoim systemie brak obsługiwanego programu odtwarzacza. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/pl">Pobierz i zainstaluj odtwarzacz</a>.', 'ogg-no-xiphqt' => 'Brak komponentu XiphQT dla programu QuickTime. QuickTime nie może odtwarzać plików Ogg bez tego komponentu. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/pl">Pobierz XiphQT</a> lub użyj innego odtwarzacza.', 'ogg-player-videoElement' => 'Obsługa bezpośrednio przez przeglądarkę', 'ogg-player-oggPlugin' => 'Wtyczka do przeglądarki', 'ogg-player-thumbnail' => 'Tylko nieruchomy obraz', 'ogg-player-soundthumb' => 'Bez odtwarzacza', 'ogg-player-selected' => '(wybrany)', 'ogg-use-player' => 'Użyj odtwarzacza:', 'ogg-more' => 'Więcej...', 'ogg-dismiss' => 'Zamknij', 'ogg-download' => 'Pobierz plik', 'ogg-desc-link' => 'Właściwości pliku', 'ogg-oggThumb-version' => 'OggHandler wymaga oggThumb w wersji $1 lub późniejszej.', 'ogg-oggThumb-failed' => 'oggThumb nie udało się utworzyć miniaturki.', ); /** Piedmontese (Piemontèis) * @author AVRS * @author Borichèt * @author Bèrto 'd Sèra * @author Dragonòt */ $messages['pms'] = array( 'ogg-desc' => 'Gestor për ij file Ogg Theora e Vorbis, con riprodotor JavaScript', 'ogg-short-audio' => 'Registrassion Ogg $1, $2', 'ogg-short-video' => 'Film Ogg $1, $2', 'ogg-short-general' => 'Archivi Multimojen Ogg $1, $2', 'ogg-long-audio' => "Registrassion Ogg $1, ch'a dura $2, $3", 'ogg-long-video' => "Film Ogg $1, ch'a dura $2, formà $4×$5 px, $3", 'ogg-long-multiplexed' => "Archivi sonor/filmà multiplessà Ogg, $1, ch'a dura $2, formà $4×$5 pontin, $3 an tut", 'ogg-long-general' => "Archivi multimojen Ogg, ch'a dura $2, $3", 'ogg-long-error' => 'Archivi ogg nen bon: $1', 'ogg-play' => 'Smon', 'ogg-pause' => 'Pàusa', 'ogg-stop' => 'Fërma', 'ogg-play-video' => 'Smon ël film', 'ogg-play-sound' => 'Smon ël sonòr', 'ogg-no-player' => "Darmagi, ma sò calcolator a smija ch'a l'abia pa gnun programa ch'a peul smon-e dj'archivi multi-mojen. Për piasì <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">ch'as në dëscaria un</a>.", 'ogg-no-xiphqt' => "A smija che ansima a sò calcolator a-i sia nen ël component XiphQT dël programa QuickTime. QuickTime a-i la fa pa a dovré dj'archivi an forma Ogg files s'a l'ha nen ës component-lì. Për piasì <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">ch'as dëscaria XiphQT</a> ò pura ch'as sërna n'àotr programa për dovré j'archivi multi-mojen.", 'ogg-player-videoElement' => 'Apògg browser nativ', 'ogg-player-oggPlugin' => 'Spinòt (plugin) për browser', 'ogg-player-thumbnail' => 'Mach na figurin-a fissa', 'ogg-player-soundthumb' => 'Gnun programa për vardé/scoté', 'ogg-player-selected' => '(selessionà)', 'ogg-use-player' => 'Dovré ël programa:', 'ogg-more' => 'Dë pì...', 'ogg-dismiss' => 'sëré', 'ogg-download' => "Dëscarié l'archivi", 'ogg-desc-link' => "Rësgoard a st'archivi", 'ogg-oggThumb-version' => "OggHandler a ciama la version $1 d'oggThumb o pi agiornà.", 'ogg-oggThumb-failed' => "oggThumb a l'ha falì a creé la figurin-a.", ); /** Western Punjabi (پنجابی) * @author Khalid Mahmood */ $messages['pnb'] = array( 'ogg-desc' => 'اوگ تھیورا تے ووربس فائل لئی ہینڈلر، جاواسکرپٹ پلیر نال', 'ogg-short-audio' => 'اوگ $1 واز فائل, $2', 'ogg-short-video' => 'اوگ $1 وڈیو فائل, $2', 'ogg-short-general' => 'اوگ $1 میڈیا فائل, $2', 'ogg-long-audio' => ' اوگ 1$ واز فائل, لمبآی 2$، 3$', # Fuzzy 'ogg-long-video' => 'اوگ $1 وڈیو فائل، لمبائی $2، $4×$5 ykvgS, $3', 'ogg-long-multiplexed' => 'اوگ ملٹیپلیکسڈ آڈیو/وڈیو فائل، $1، لمبآئی $2، $4×$5 پکسلز, $3 اورآل', 'ogg-long-general' => 'اوگ میڈیا فائل، لمبائی $2، $3', 'ogg-long-error' => 'ناں منی جان والی اوگ فائل: $1', 'ogg-play' => 'چلاؤ', 'ogg-pause' => 'وقفہ', 'ogg-stop' => 'رکو', 'ogg-play-video' => 'وڈیو چلاؤ', 'ogg-play-sound' => 'واز چلاؤ', 'ogg-no-player' => 'معاف کرنا تواڈے پربندھ چ لگدا اے موسیقی چلان دا سوفٹویر نئیں۔ مہربانی کرکے <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">موسیقی چلان والا ڈاؤنلوڈ کرو۔</a>', 'ogg-no-xiphqt' => 'تواڈے کول لگدا اے QuickTime دا پرزہ XiphQT کوئی نیں QuickTime ایس توں بنا اوگ فائلاں نئیں چلاسکدا۔ مہربانی کرکے <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">download XiphQT</a> ڈاؤنلوڈ کرو یا ہور سوفٹویر چنو۔', 'ogg-player-videoElement' => 'دیسی براؤزر سپورٹ', 'ogg-player-oggPlugin' => 'براؤزر پلگ ان', 'ogg-player-thumbnail' => 'صرف کذڑیاں مورتاں', 'ogg-player-soundthumb' => 'کوئی چلان والا نغیں۔', 'ogg-player-selected' => '(چنے)', 'ogg-use-player' => 'چلان والا ورتو:', 'ogg-more' => 'مزید۔۔۔', 'ogg-dismiss' => 'بند کرو', 'ogg-download' => 'فائل ڈاؤنلوڈ کرو', 'ogg-desc-link' => 'ایس مورت بارے', 'ogg-oggThumb-version' => 'اوگہینڈلر لئی اوگتھمب ورین $1 یا مگر آن والا۔', 'ogg-oggThumb-failed' => 'اوگتھمب تھمبنیل بنان چ ماڑا', ); /** Pashto (پښتو) * @author Ahmed-Najib-Biabani-Ibrahimkhel */ $messages['ps'] = array( 'ogg-short-audio' => 'Ogg $1 غږيزه دوتنه، $2', 'ogg-short-video' => 'Ogg $1 ويډيويي دوتنه، $2', 'ogg-short-general' => 'Ogg $1 رسنيزه دوتنه، $2', 'ogg-long-audio' => 'Ogg $1 غږيزه دوتنه، اوږدوالی $2، $3', 'ogg-long-video' => 'Ogg $1 ويډيويي دوتنه، اوږدوالی $2، $4×$5 پېکسل، $3', 'ogg-long-general' => 'Ogg رسنيزه دوتنه، اوږدوالی $2، $3', 'ogg-long-error' => 'ناسمه ogg دوتنه: $1', 'ogg-play' => 'غږول', 'ogg-pause' => 'درول', 'ogg-stop' => 'درول', 'ogg-play-video' => 'ويډيو غږول', 'ogg-play-sound' => 'غږ غږول', 'ogg-player-videoElement' => 'د کورني کتنمل ملاتړ', 'ogg-player-thumbnail' => 'يوازې ولاړ انځور', 'ogg-player-soundthumb' => 'هېڅ کوم غږونکی نه', 'ogg-player-selected' => '(ټاکل شوی)', 'ogg-use-player' => 'غږونکی کارول:', 'ogg-more' => 'نور...', 'ogg-dismiss' => 'تړل', 'ogg-download' => 'دوتنه ښکته کول', 'ogg-desc-link' => 'د همدې دوتنې په اړه', ); /** Portuguese (português) * @author AVRS * @author Hamilton Abreu * @author Malafaya * @author SandroHc * @author Waldir * @author 555 */ $messages['pt'] = array( 'ogg-desc' => 'Manuseador para ficheiros Ogg Theora e Vorbis, com reprodutor JavaScript', 'ogg-short-audio' => 'Áudio Ogg $1, $2', 'ogg-short-video' => 'Vídeo Ogg $1, $2', 'ogg-short-general' => 'Multimédia Ogg $1, $2', 'ogg-long-audio' => 'Áudio Ogg $1, $2 de duração, $3', 'ogg-long-video' => 'Vídeo Ogg $1, $2 de duração, $4×$5 pixels, $3', 'ogg-long-multiplexed' => 'Áudio/vídeo Ogg multifacetado, $1, $2 de duração, $4×$5 pixels, $3 no todo', 'ogg-long-general' => 'Multimédia Ogg, $2 de duração, $3', 'ogg-long-error' => 'Ficheiro ogg inválido: $1', 'ogg-play' => 'Reproduzir', 'ogg-pause' => 'Pausar', 'ogg-stop' => 'Parar', 'ogg-play-video' => 'Reproduzir vídeo', 'ogg-play-sound' => 'Reproduzir som', 'ogg-no-player' => "Desculpe, mas o seu sistema não aparenta ter qualquer leitor suportado. Por favor, faça o <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">''download'' de um leitor</a>.", 'ogg-no-xiphqt' => "Aparentemente não tem o componente XiphQT do QuickTime. O QuickTime não pode reproduzir ficheiros Ogg sem este componente. Por favor, faça o <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">''download'' do XiphQT</a> ou escolha outro leitor.", 'ogg-player-videoElement' => 'Suporte nativo do browser', 'ogg-player-oggPlugin' => "''Plugin'' do browser", 'ogg-player-thumbnail' => 'Apenas imagem estática', 'ogg-player-soundthumb' => 'Sem player', 'ogg-player-selected' => '(selecionado)', 'ogg-use-player' => 'Usar player:', 'ogg-more' => 'Mais...', 'ogg-dismiss' => 'Fechar', 'ogg-download' => 'Fazer download do ficheiro', 'ogg-desc-link' => 'Sobre este ficheiro', 'ogg-oggThumb-version' => 'O oggHandler requer o oggThumb versão $1 ou posterior.', 'ogg-oggThumb-failed' => 'O oggThumb não conseguiu criar a miniatura.', ); /** Brazilian Portuguese (português do Brasil) * @author AVRS * @author Eduardo.mps * @author Giro720 * @author Luckas */ $messages['pt-br'] = array( 'ogg-desc' => 'Manipulador para arquivos Ogg Theora e Vorbis, com reprodutor JavaScript', 'ogg-short-audio' => 'Arquivo de áudio Ogg $1, $2', 'ogg-short-video' => 'Arquivo de vídeo Ogg $1, $2', 'ogg-short-general' => 'Arquivo multimídia Ogg $1, $2', 'ogg-long-audio' => '(Arquivo de Áudio Ogg $1, $2 de duração, $3)', # Fuzzy 'ogg-long-video' => 'Vídeo Ogg $1, $2 de duração, $4×$5 pixels, $3', 'ogg-long-multiplexed' => '(Áudio/vídeo Ogg multifacetado, $1, $2 de duração, $4×$5 pixels, $3 no todo)', # Fuzzy 'ogg-long-general' => '(Multimídia Ogg, $2 de duração, $3)', # Fuzzy 'ogg-long-error' => 'Arquivo ogg inválido: $1', 'ogg-play' => 'Reproduzir', 'ogg-pause' => 'Pausar', 'ogg-stop' => 'Parar', 'ogg-play-video' => 'Reproduzir vídeo', 'ogg-play-sound' => 'Reproduzir som', 'ogg-no-player' => 'Lamentamos, mas seu sistema aparenta não ter um reprodutor suportado. Por gentileza, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">faça o download de um reprodutor</a>.', 'ogg-no-xiphqt' => 'Aparentemente você não tem o componente XiphQT para QuickTime. Não será possível reproduzir arquivos Ogg pelo QuickTime sem tal componente. Por gentileza, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">faça o descarregamento do XiphQT</a> ou escolha outro reprodutor.', 'ogg-player-videoElement' => 'Suporte interno do navegador', 'ogg-player-oggPlugin' => 'Plugin do navegador', 'ogg-player-thumbnail' => 'Apenas imagem estática', 'ogg-player-soundthumb' => 'Sem reprodutor', 'ogg-player-selected' => '(selecionado)', 'ogg-use-player' => 'Usar reprodutor:', 'ogg-more' => 'Mais...', 'ogg-dismiss' => 'Fechar', 'ogg-download' => 'Descarregar arquivo', 'ogg-desc-link' => 'Sobre este arquivo', 'ogg-oggThumb-version' => 'O oggHandler requer o oggThumb versão $1 ou posterior.', 'ogg-oggThumb-failed' => 'O oggThumb não conseguiu criar a miniatura.', ); /** Quechua (Runa Simi) * @author AlimanRuna */ $messages['qu'] = array( 'ogg-play' => 'Waqachiy', 'ogg-pause' => "P'itiy", 'ogg-stop' => 'Tukuchiy', 'ogg-play-video' => 'Widyuta rikuchiy', 'ogg-play-sound' => 'Ruqyayta uyarichiy', 'ogg-player-soundthumb' => 'Manam waqachiqchu', 'ogg-player-selected' => '(akllasqa)', 'ogg-use-player' => "Kay waqachiqta llamk'achiy:", 'ogg-more' => 'Astawan...', 'ogg-dismiss' => "Wichq'ay", 'ogg-download' => 'Willañiqita chaqnamuy', 'ogg-desc-link' => 'Kay willañiqimanta', ); /** Romanian (română) * @author AVRS * @author Cin * @author KlaudiuMihaila * @author Mihai * @author Minisarm * @author Stelistcristi */ $messages['ro'] = array( 'ogg-short-audio' => 'Fișier de sunet ogg $1, $2', 'ogg-short-video' => 'Fișier video ogg $1, $2', 'ogg-short-general' => 'Fișier media ogg $1, $2', 'ogg-long-audio' => 'Fișier de sunet ogg $1 de lungime $2, $3', 'ogg-long-video' => 'Fișier video ogg $1, lungime $2, $4×$5 pixeli, $3', 'ogg-long-multiplexed' => 'Fișier multiplexat audio/video ogg, $1, de lungime $2, $4×$5 pixeli, $3', 'ogg-long-general' => 'Fișier media ogg de lungime $2, $3', 'ogg-long-error' => 'Fișier ogg incorect: $1', 'ogg-play' => 'Redă', 'ogg-pause' => 'Pauză', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Redă video', 'ogg-play-sound' => 'Redă sunet', 'ogg-no-player' => 'Îmi pare rău, sistemul tău nu pare să aibă vreun program de redare suportat. Te rog <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">descarcă un program de redare</a>.', 'ogg-player-videoElement' => 'Navigator cu suport nativ', 'ogg-player-oggPlugin' => 'Plugin-ul navigatorului', 'ogg-player-thumbnail' => 'Doar imagine statică', 'ogg-player-soundthumb' => 'Niciun program de redare', 'ogg-player-selected' => '(selectat)', 'ogg-use-player' => 'Folosește programul de redare:', 'ogg-more' => 'Mai mult…', 'ogg-dismiss' => 'Închide', 'ogg-download' => 'Descărcare fișier', 'ogg-desc-link' => 'Despre acest fișier', 'ogg-oggThumb-version' => 'OggHandler necesită oggThumb, versiunea $1 sau mai recentă.', 'ogg-oggThumb-failed' => 'oggThumb nu a reușit să creeze miniatura.', ); /** tarandíne (tarandíne) * @author AVRS * @author Joetaras */ $messages['roa-tara'] = array( 'ogg-desc' => "Gestore pe le file Ogg Theora e Vorbis, cu 'nu programme de riproduzione JavaScript", 'ogg-short-audio' => 'File audie Ogg $1, $2', 'ogg-short-video' => 'File video Ogg $1, $2', 'ogg-short-general' => 'File media Ogg $1, $2', 'ogg-long-audio' => 'File audie Ogg $1, lunghezze $2, $3', 'ogg-long-video' => 'File video Ogg $1, lunghezze $2, $4 x $5 pixel, $3', 'ogg-long-multiplexed' => 'File multiplexed audie e video Ogg $1, lunghezze $2, $4 x $5 pixel, $3 in totale', 'ogg-long-general' => 'File media Ogg, lunghezze $2, $3', 'ogg-long-error' => 'Ogg file invalide: $1', 'ogg-play' => 'Riproduce', 'ogg-pause' => 'Mitte in pause', 'ogg-stop' => 'Stuèppe', 'ogg-play-video' => "Riproduce 'u video", 'ogg-play-sound' => 'Riproduce le suène', 'ogg-no-player' => "Ne dispiace, 'u sisteme tune pare ca non ge tène nisciune softuare p'a riproduzione.<br /> Pe piacere, <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">scareche 'u reproduttore</a>.", 'ogg-no-xiphqt' => "Non ge pare ca tìne 'u combonende XiphQT pu QuickTime.<br /> QuickTime non ge pò reproducere file Ogg senze stu combonende.<br /> Pe piacere <a href=\"http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download\">scareche XiphQT</a> o scacchie 'n'otre reproduttore.", 'ogg-player-videoElement' => 'Supporte browser native', 'ogg-player-oggPlugin' => "Plugin d'u browser", 'ogg-player-thumbnail' => 'Angore sulamende immaggine', 'ogg-player-soundthumb' => 'Nisciune reproduttore', 'ogg-player-selected' => '(scacchiate)', 'ogg-use-player' => "Ause 'u reproduttore:", 'ogg-more' => 'De cchiù...', 'ogg-dismiss' => 'Chiude', 'ogg-download' => 'Scareche stu file', 'ogg-desc-link' => "'Mbormaziune sus a stu file", 'ogg-oggThumb-version' => "OggHandler richiede 'a versione $1 de oggThumb o una cchiù nove.", 'ogg-oggThumb-failed' => 'oggThumb ha fallite sus a crejazione de le miniature.', ); /** Russian (русский) * @author AVRS * @author Ahonc * @author Dim Grits * @author KPu3uC B Poccuu * @author Kaganer * @author Kv75 * @author MaxSem * @author Александр Сигачёв */ $messages['ru'] = array( 'ogg-desc' => 'Обработчик файлов Ogg Theora и Vorbis с использованием JavaScript-проигрывателя', 'ogg-short-audio' => 'Звуковой файл Ogg $1, $2', 'ogg-short-video' => 'Видео-файл Ogg $1, $2', 'ogg-short-general' => 'Медиа-файл Ogg $1, $2', 'ogg-long-audio' => 'звуковой файл Ogg $1, длительность $2, $3', 'ogg-long-video' => 'видео-файл Ogg $1, длительность $2, $4×$5 {{PLURAL:$5|пиксель|пикселя|пикселей}}, $3', 'ogg-long-multiplexed' => 'мультиплексный аудио/видео-файл Ogg, $1, длительность $2, $4×$5 {{PLURAL:$5|пиксель|пикселя|пикселей}}, $3 всего', 'ogg-long-general' => 'медиафайл Ogg, длительность $2, $3', 'ogg-long-error' => 'неправильный Ogg-файл: $1', 'ogg-play' => 'Воспроизвести', 'ogg-pause' => 'Пауза', 'ogg-stop' => 'Остановить', 'ogg-play-video' => 'Воспроизвести видео', 'ogg-play-sound' => 'Воспроизвести звук', 'ogg-no-player' => 'Извините, ваша система не имеет необходимого программного обеспечение для воспроизведения файлов. Пожалуйста, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">скачайте проигрыватель</a>.', 'ogg-no-xiphqt' => 'Отсутствует компонент XiphQT для QuickTime. QuickTime не может воспроизвести файл Ogg без этого компонента. Пожалуйста, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">скачайте XiphQT</a> или выберите другой проигрыватель.', 'ogg-player-videoElement' => 'Встроенная поддержка браузером', 'ogg-player-oggPlugin' => 'Плагин браузера', 'ogg-player-cortado' => 'Cortado (Java)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (ActiveX)', 'ogg-player-quicktime-mozilla' => 'QuickTime', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kaffeine', 'ogg-player-mplayerplug-in' => 'mplayerplug-in', 'ogg-player-thumbnail' => 'Только неподвижное изображение', 'ogg-player-soundthumb' => 'Нет проигрывателя', 'ogg-player-selected' => '(выбран)', 'ogg-use-player' => 'Использовать проигрыватель:', 'ogg-more' => 'Больше…', 'ogg-dismiss' => 'Скрыть', 'ogg-download' => 'Загрузить файл', 'ogg-desc-link' => 'Информация об этом файле', 'ogg-oggThumb-version' => 'OggHandler требует oggThumb версии $1 или более поздней.', 'ogg-oggThumb-failed' => 'oggThumb не удалось создать миниатюру.', ); /** Rusyn (русиньскый) * @author AVRS * @author Gazeb */ $messages['rue'] = array( 'ogg-desc' => 'Обслуга файлів Ogg Theora і Vorbis з JavaScript-овым перегравачом', 'ogg-short-audio' => 'Звуковый файл Ogg $1, $2', 'ogg-short-video' => 'Відео-файл Ogg $1, $2', 'ogg-short-general' => 'Файл Ogg $1, $2', 'ogg-long-audio' => 'Звуковый файл Ogg $1, довжка $2, $3', 'ogg-long-video' => 'відео-файл Ogg $1, довжка $2, $4×$5 пікселів, $3', 'ogg-long-multiplexed' => 'Авдіо/відео файл ogg, $1, довжка $2, $4×$5 пікселів, вшыткого $3', 'ogg-long-general' => 'Ogg медія файл, довжка $2, $3', 'ogg-long-error' => 'Неправильный файл Ogg: $1', 'ogg-play' => 'Заграти', 'ogg-pause' => 'Пауза', 'ogg-stop' => 'Заставити', 'ogg-play-video' => 'Переграти відео', 'ogg-play-sound' => 'Переграти звук', 'ogg-no-player' => 'Ваша сістема асі не має жаден підпорованый перегравач. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">скачайте перегравач</a>.', 'ogg-no-xiphqt' => 'Не маєте росшырїна XiphQT про QuickTime. QuickTime не може перегравати файлы без того росшырїня. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Скачайте XiphQT</a> або звольте іншый перегравач.', 'ogg-player-videoElement' => 'Вставляна підпора в переглядачу', 'ogg-player-oggPlugin' => 'Модул до переглядача', 'ogg-player-thumbnail' => 'Лем снимок нагляду', 'ogg-player-soundthumb' => 'Жадный перегравач', 'ogg-player-selected' => '(выбране)', 'ogg-use-player' => 'Выберте перегравач:', 'ogg-more' => 'Веце…', 'ogg-dismiss' => 'Заперти', 'ogg-download' => 'Скачати файл', 'ogg-desc-link' => 'О файлі', 'ogg-oggThumb-version' => 'OggHandler потребує oggThumb верзії $1 або новшый.', 'ogg-oggThumb-failed' => 'oggThumb не быв годен створити нагляд.', ); /** Sanskrit (संस्कृतम्) * @author Ansumang * @author Shubha */ $messages['sa'] = array( 'ogg-desc' => 'जावालिप्या सह आग् थियोरा, वोब्रिस्-सञ्चिकानां चालकः', 'ogg-short-audio' => 'ऑग $1 ध्वनिसञ्चिका, $2', 'ogg-short-video' => 'ऑग $1 दृश्यसञ्चिका, $2', 'ogg-short-general' => 'ऑग $1 माध्यमसञ्चिका, $2', 'ogg-long-audio' => 'आग् $1 ध्वनिसञ्चिका, औन्नत्यम् $2, $3', 'ogg-long-video' => 'ऑग $1 चलनचित्रसञ्चिका, दैर्घ्यं $2, $4×$5 पीक्सेल्स, $3', 'ogg-long-multiplexed' => 'आग् सङ्कीर्णश्रव्य/दृश्यसञ्चिका, $1, दैर्घ्यम् $2, $4×$5 पिक्सल्स्, $3 समग्रम्', 'ogg-long-general' => 'आग् माध्यमसञ्चिका, औन्नत्यम् $2, $3', 'ogg-long-error' => 'अमान्या आग् सञ्चिका : $1', 'ogg-play' => 'प्रवर्तनम्', 'ogg-pause' => 'विरामः', 'ogg-stop' => 'स्थापयति', 'ogg-play-video' => 'दृश्यं प्रवर्त्यताम्', 'ogg-play-sound' => 'शब्दस्य प्रवर्तनम्', 'ogg-no-player' => 'क्षम्यताम्, भवतः व्यवस्थायाम् अनुकूलचालकतन्त्रांशः कोपि न विद्यते । कृपया <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">चालकमेकम् उपारोप्यताम्</a> ।', 'ogg-no-xiphqt' => 'भवत्सकाशे QuickTime निमित्तं XiphQT घटकं न विद्यते इति भाति । अनेन घटकेन विना QuickTime, Ogg सञ्चिकानां चालने असमर्थं भवति । कृपया <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT अवारोप्यताम् </a> अथवा अन्यः चालकः चेतव्यः ।', 'ogg-player-videoElement' => 'मूलगवेषकसमर्थनम्', 'ogg-player-oggPlugin' => 'गवेशकप्लगिन्', 'ogg-player-thumbnail' => 'स्थिरचित्रमात्रम्', 'ogg-player-soundthumb' => 'क्रीडकः नास्ति', 'ogg-player-selected' => '(चितम्)', 'ogg-use-player' => 'क्रीडकस्य उपयोगः स्वीक्रियताम् :', 'ogg-more' => 'अधिकम्.....', 'ogg-dismiss' => 'पिदधातु', 'ogg-download' => 'सञ्चिकायाः अवारोपणम्', 'ogg-desc-link' => 'अस्याः सञ्चिकायाः विषये', 'ogg-oggThumb-version' => 'आग्चालकस्य कृते आग्थम्ब्-आवृत्तिः $1 तदग्रिमा वा अपेक्षिता ।', 'ogg-oggThumb-failed' => 'लघ्वाकृतेः निर्माणे आग्थम्ब् असमर्थं जातम् ।', ); /** Sakha (саха тыла) * @author AVRS * @author HalanTul * @author Kyraha */ $messages['sah'] = array( 'ogg-desc' => 'Обработчик файлов Ogg Theora и Vorbis с использованием JavaScript-проигрывателя', 'ogg-short-audio' => 'Звуковой файл Ogg $1, $2', 'ogg-short-video' => 'Видео-файл Ogg $1, $2', 'ogg-short-general' => 'Медиа-файл Ogg $1, $2', 'ogg-long-audio' => '(звуковой файл Ogg $1, уһуна $2, $3)', # Fuzzy 'ogg-long-video' => 'видео-файл Ogg $1, уһуна $2, $4×$5 пииксэллээх, $3', 'ogg-long-multiplexed' => '(мультиплексный аудио/видео-файл Ogg, $1, уһуна $2, $4×$5 пииксэллээх, барыта $3)', # Fuzzy 'ogg-long-general' => '(медиа-файл Ogg, уһуна $2, $3)', # Fuzzy 'ogg-long-error' => '(сыыһа ogg-файл: $1)', # Fuzzy 'ogg-play' => 'Оонньот', 'ogg-pause' => 'Тохтото түс', 'ogg-stop' => 'Тохтот', 'ogg-play-video' => 'Көрдөр', 'ogg-play-sound' => 'Иһитиннэр', 'ogg-no-player' => 'Хомойуох иһин эн систиэмэҕэр иһитиннэрэр/көрдөрөр анал бырагырааммалар суохтар эбит. Бука диэн, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">плееры хачайдан</a>.', 'ogg-no-xiphqt' => 'QuickTime маннык тэрээбэтэ: XiphQT суох эбит. Онон QuickTime бу Ogg билэни (файлы) оонньотор кыаҕа суох. Бука диэн, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download"> XiphQT хачайдан</a> эбэтэр атын плееры тал.', 'ogg-player-videoElement' => 'Браузер бэйэтин өйөөһүнэ', 'ogg-player-oggPlugin' => 'Браузер плагина', 'ogg-player-thumbnail' => 'Хамсаабат ойууну эрэ', 'ogg-player-soundthumb' => 'Плеер суох', 'ogg-player-selected' => '(талыллыбыт)', 'ogg-use-player' => 'Бу плееры туттарга:', 'ogg-more' => 'Өссө...', 'ogg-dismiss' => 'Кистээ/сап', 'ogg-download' => 'Билэни хачайдаа', 'ogg-desc-link' => 'Бу билэ туһунан', 'ogg-oggThumb-version' => 'OggHandler oggThumb $1 эбэтэр ордук версиятын наадыйар', 'ogg-oggThumb-failed' => 'oggThumb миниатюраны кыайан оҥорбото.', ); /** Sicilian (sicilianu) * @author Aushulz */ $messages['scn'] = array( 'ogg-dismiss' => 'Chiùi', ); /** Samogitian (žemaitėška) * @author Hugo.arg */ $messages['sgs'] = array( 'ogg-play' => 'Gruotė', 'ogg-pause' => 'Pauzė', 'ogg-stop' => 'Sostabdītė', 'ogg-play-video' => 'Gruotė video', 'ogg-play-sound' => 'Gruotė garsa', 'ogg-download' => 'Atsėsiōstė faila', ); /** Sinhala (සිංහල) * @author AVRS * @author Budhajeewa * @author නන්දිමිතුරු * @author පසිඳු කාවින්ද */ $messages['si'] = array( 'ogg-desc' => 'Ogg Theora සහ Vorbis ගොනු සඳහා හසුරුවනය, ජාවාස්ක්‍රිප්ට් ප්ලේයර් සමඟ', 'ogg-short-audio' => 'Ogg $1 ශ්‍රව්‍ය ගොනුව, $2', 'ogg-short-video' => 'Ogg $1 දෘශ්‍ය ගොනුව, $2', 'ogg-short-general' => 'Ogg $1 මාධ්‍ය ගොනුව, $2', 'ogg-long-audio' => 'Ogg $1 ශ්‍රව්‍ය ගොනුව, ප්‍රවර්තනය $2, $3', 'ogg-long-video' => 'Ogg $1 දෘශ්‍ය ගොනුව, ප්‍රවර්තනය $2, $4×$5 පික්සල්, $3', 'ogg-long-multiplexed' => 'Ogg බහුපථකාරක ශ්‍රව්‍ය/දෘශ්‍ය ගොනුව, $1, ප්‍රවර්තනය $2, $4×$5 පික්සල්, $3 සමස්ත', 'ogg-long-general' => 'Ogg මාධ්‍ය ගොනුව, ප්‍රවර්තනය $2, $3', 'ogg-long-error' => 'අනීතික ogg ගොනුව: $1', 'ogg-play' => 'වාදනය කරන්න', 'ogg-pause' => 'විරාම කරන්න', 'ogg-stop' => 'නවතන්න', 'ogg-play-video' => 'දෘශ්‍ය වාදනය කරන්න', 'ogg-play-sound' => 'ශබ්දය වාදනය කරන්න', 'ogg-no-player' => 'කණගාටුයි, කිසිම සහායක ධාවක මෘදුකාංගයක් ඔබ පද්ධතිය සතුව ඇති බවක් නොපෙනේ. කරුණාකර <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ධාවකයක් බා ගන්න</a>.', 'ogg-no-xiphqt' => 'QuickTime සඳහා XiphQT සංරචකය ඔබ සතුව ඇති බවක් නොපෙනේ. මෙම සංරචකය නොමැතිව Ogg ගොනු ධාවනය කිරීම QuickTime විසින් සිදුකල නොහැක. කරුණාකර <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download"> XiphQT බා ගන්න</a> නැතහොත් වෙනත් ධාවකයක් තෝරාගන්න.', 'ogg-player-videoElement' => 'පියවි පරික්සක සහය', 'ogg-player-oggPlugin' => 'බ්‍රවුසර ප්ලගිත', 'ogg-player-cortado' => 'Cortado (ජාවා)', 'ogg-player-thumbnail' => 'නිශ්චල රූප පමණි', 'ogg-player-soundthumb' => 'ධාවකයක් නොමැත', 'ogg-player-selected' => '(තෝරාගෙන)', 'ogg-use-player' => 'ධාවකය භාවිතා කරන්න:', 'ogg-more' => 'ඉතිරිය…', 'ogg-dismiss' => 'වසන්න', 'ogg-download' => 'ගොනුව බා ගන්න', 'ogg-desc-link' => 'මෙම ගොනුව පිළිබඳ', 'ogg-oggThumb-version' => 'OggHandler සඳහා oggThumb $1 සංස්කරණය හෝ අලුත් එකක් අවැසිය.', 'ogg-oggThumb-failed' => 'තම්බ්නේලය තැනුමට oggThumb අසමත්විය.', ); /** Slovak (slovenčina) * @author AVRS * @author Helix84 * @author Jkjk */ $messages['sk'] = array( 'ogg-desc' => 'Obsluha súborov Ogg Theora a Vorbis s JavaScriptovým prehrávačom', 'ogg-short-audio' => 'Zvukový súbor ogg $1, $2', 'ogg-short-video' => 'Video súbor ogg $1, $2', 'ogg-short-general' => 'Multimediálny súbor ogg $1, $2', 'ogg-long-audio' => 'Zvukový súbor ogg $1, dĺžka $2, $3', 'ogg-long-video' => 'Video súbor ogg $1, dĺžka $2, $4×$5 pixelov, $3', 'ogg-long-multiplexed' => 'Multiplexovaný zvukový/video súbor ogg, $1, dĺžka $2, $4×$5 pixlov, $3 celkom', 'ogg-long-general' => 'Multimediálny súbor ogg, dĺžka $2, $3', 'ogg-long-error' => 'Neplatný súbor ogg: $1', 'ogg-play' => 'Prehrať', 'ogg-pause' => 'Pozastaviť', 'ogg-stop' => 'Zastaviť', 'ogg-play-video' => 'Prehrať video', 'ogg-play-sound' => 'Prehrať zvuk', 'ogg-no-player' => 'Prepáčte, zdá sa, že váš systém nemá žiadny podporovaný softvér na prehrávanie. Prosím, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">stiahnite si prehrávač</a>.', 'ogg-no-xiphqt' => 'Zdá sa, že nemáte komponent QuickTime XiphQT. QuickTime nedokáže prehrávať ogg súbory bez tohto komponentu. Prosím, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">stiahnite si XiphQT</a> alebo si vyberte iný prehrávač.', 'ogg-player-videoElement' => 'Natívna podpora prehliadača', 'ogg-player-oggPlugin' => 'Zásuvný modul prehliadača', 'ogg-player-thumbnail' => 'iba nepohyblivý obraz', 'ogg-player-soundthumb' => 'žiadny prehrávač', 'ogg-player-selected' => '(vybraný)', 'ogg-use-player' => 'Použiť prehrávač:', 'ogg-more' => 'viac...', 'ogg-dismiss' => 'Zatvoriť', 'ogg-download' => 'Stiahnuť súbor', 'ogg-desc-link' => 'O tomto súbore', 'ogg-oggThumb-version' => 'OggHandler vyžaduje verziu oggThumbu $1 alebo novšiu.', 'ogg-oggThumb-failed' => 'oggThumbu sa neporarilo vytvoriť obraz.', ); /** Slovenian (slovenščina) * @author AVRS * @author Dbc334 */ $messages['sl'] = array( 'ogg-desc' => 'Upravljavec datotek Ogg Theora in Vorbis, s predvajalnikom JavaScript', 'ogg-short-audio' => 'Zvočna datoteka Ogg $1, $2', 'ogg-short-video' => 'Videodatoteka Ogg $1, $2', 'ogg-short-general' => 'Predstavnostna datoteka Ogg $1, $2', 'ogg-long-audio' => 'zvočna datoteka ogg $1, dolžine $2, $3', 'ogg-long-video' => 'videodatoteka ogg $1, dolžine $2, $4 × $5 pik, $3', 'ogg-long-multiplexed' => 'multipleksna zvočna/videodatoteka ogg, $1, dolžina $2, $4 × $5 pik, $3 skupno', 'ogg-long-general' => 'predstavnostna datoteka ogg, dolžina $2, $3', 'ogg-long-error' => 'Neveljavna datoteka ogg: $1', 'ogg-play' => 'Predvajaj', 'ogg-pause' => 'Pavza', 'ogg-stop' => 'Ustavi', 'ogg-play-video' => 'Predvajaj video', 'ogg-play-sound' => 'Predvajaj zvok', 'ogg-no-player' => 'Oprostite, kaže da vaš sistem nima nameščenega programja nobenega podprtega predvajalnika. Prosimo, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">prenesite predvajalnik</a>.', 'ogg-no-xiphqt' => 'Kot kaže, nimate komponente XiphQT za QuickTime. QuickTime ne more oredvajati datotek Ogg brez te komponente. Prosimo, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">prenesite XiphQT</a> ali izberite drug predvajalnik.', 'ogg-player-videoElement' => 'Vgrajena podpora brskalnika', 'ogg-player-oggPlugin' => 'Vtičnik brskalnika', 'ogg-player-thumbnail' => 'Samo stoječa slika', 'ogg-player-soundthumb' => 'Brez predvajalnika', 'ogg-player-selected' => '(izbrano)', 'ogg-use-player' => 'Uporabi predvajalnik:', 'ogg-more' => 'Več ...', 'ogg-dismiss' => 'Zapri', 'ogg-download' => 'Prenesi datoteko', 'ogg-desc-link' => 'O datoteki', 'ogg-oggThumb-version' => 'OggHandler potrebuje oggThumb različice $1 ali novejše.', 'ogg-oggThumb-failed' => 'oggThumb ni uspel ustvariti predogledne sličice.', ); /** Albanian (shqip) * @author AVRS * @author Dori * @author Olsi */ $messages['sq'] = array( 'ogg-desc' => 'Mbajtës për Ogg Theora dhe skeda Vorbis, me luajtës JavaScript', 'ogg-short-audio' => 'Skedë zanore Ogg $1, $2', 'ogg-short-video' => 'Skedë pamore Ogg $1, $2', 'ogg-short-general' => 'Skedë mediatike Ogg $1, $2', 'ogg-long-audio' => '(Skedë zanore Ogg $1, kohëzgjatja $2, $3)', # Fuzzy 'ogg-long-video' => 'Skedë pamore Ogg $1, kohëzgjatja $2, $4×$5 pixel, $3', 'ogg-long-multiplexed' => 'Skedë ogg audio/video, $1, gjatësia $2, $4×$5 piksel, $3 gjithsej', 'ogg-long-general' => 'Skedë Ogg, kohëzgjatja $2, $3', 'ogg-long-error' => 'Skedë ogg e pavlefshme: $1', 'ogg-play' => 'Fillo', 'ogg-pause' => 'Pusho', 'ogg-stop' => 'Ndalo', 'ogg-play-video' => 'Fillo videon', 'ogg-play-sound' => 'Fillo zërin', 'ogg-no-player' => 'Ju kërkojmë ndjesë por sistemi juaj nuk ka mundësi për të kryer këtë veprim. Mund të <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">shkarkoni një mjet</a> tjetër.', 'ogg-no-xiphqt' => 'Ju nuk duket të keni komponentin XiphQT për QuickTime. QuickTime nuk mund të luajë skeda Ogg pa këtë komponent. Ju lutemi <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">shkarkoni XiphQT</a> ose zgjidhni një luajtës tjetër.', 'ogg-player-videoElement' => 'Mbështetje amtare shfletuesi', 'ogg-player-oggPlugin' => 'Plugin shfletuesi', 'ogg-player-thumbnail' => 'Ende vetëm figurë', 'ogg-player-soundthumb' => 'Nuk ka luajtës', 'ogg-player-selected' => '(përzgjedhur)', 'ogg-use-player' => 'Përdorni luajtës:', 'ogg-more' => 'Më shumë...', 'ogg-dismiss' => 'Mbylle', 'ogg-download' => 'Shkarko skedën', 'ogg-desc-link' => 'Rreth kësaj skede', 'ogg-oggThumb-version' => 'OggHandler kërkon versionin oggThumb $1 ose më të vonshëm.', 'ogg-oggThumb-failed' => 'oggThumb dështoi të krijojë parapamjen.', ); /** Serbian (Cyrillic script) (српски (ћирилица)‎) * @author AVRS * @author Millosh * @author Rancher * @author Sasa Stefanovic * @author Жељко Тодоровић * @author Михајло Анђелковић */ $messages['sr-ec'] = array( 'ogg-desc' => 'Руководилац OGG теора и ворбис датотекама с јаваскрипт плејером', 'ogg-short-audio' => 'Ogg $1 звучна датотека, $2', 'ogg-short-video' => 'Ogg $1 видео-снимак, $2.', 'ogg-short-general' => 'Ogg $1 медијска датотека, $2.', 'ogg-long-audio' => 'Ogg $1 звучна датотека, трајање $2, $3', 'ogg-long-video' => 'Ogg $1 видео-снимак, трајање $2, $4 × $5 пиксела, $3', 'ogg-long-multiplexed' => 'Мултиплексирани .ogg аудио/видео снимак, $1, трајање $2, $4 × $5 пиксела, $3', 'ogg-long-general' => 'Ogg медијска датотека, трајање $2, $3.', 'ogg-long-error' => 'Неисправна ogg датотека: $1', 'ogg-play' => 'Пусти', 'ogg-pause' => 'Паузирај', 'ogg-stop' => 'Заустави', 'ogg-play-video' => 'Пусти видео-снимак', 'ogg-play-sound' => 'Пусти звучни снимак', 'ogg-no-player' => 'Изгледа да немате инсталиран никакав програм за пуштање медијских датотека. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Овде преузмите програм за ту намену</a>.', 'ogg-no-xiphqt' => 'Изгледа да немате инсталиран део XiphQT за Квиктајм. Квиктајм не може да пусти .ogg датотеке без ове компоненте. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Преузмите XiphQT</a> или изаберите други плејер.', 'ogg-player-videoElement' => 'Подршка од прегледача', 'ogg-player-oggPlugin' => 'Додатак за прегледач', 'ogg-player-cortado' => 'Кортадо (Јава)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (Активикс)', 'ogg-player-quicktime-mozilla' => 'Квиктајм', 'ogg-player-quicktime-activex' => 'Квиктајм (Активикс)', 'ogg-player-totem' => 'Тотем', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Кафин', 'ogg-player-mplayerplug-in' => 'mplayerplug-in', 'ogg-player-thumbnail' => 'још увек само слика', 'ogg-player-soundthumb' => 'нема плејера', 'ogg-player-selected' => '(изабрано)', 'ogg-use-player' => 'Користи плејер:', 'ogg-more' => 'Више...', 'ogg-dismiss' => 'Затвори', 'ogg-download' => 'Преузми датотеку', 'ogg-desc-link' => 'Подаци о овој датотеци', 'ogg-oggThumb-version' => 'OggHandler захтева oggThumb – верзију $1 или новију.', 'ogg-oggThumb-failed' => 'oggThumb не може да направи минијатуру.', ); /** Serbian (Latin script) (srpski (latinica)‎) * @author AVRS * @author Michaello * @author Rancher */ $messages['sr-el'] = array( 'ogg-desc' => 'Rukovaoc ogg Teora i Vorbis fajlovima sa javaskript plejerom', 'ogg-short-audio' => 'Ogg $1 zvučni fajl, $2.', 'ogg-short-video' => 'Ogg $1 video fajl, $2.', 'ogg-short-general' => 'Ogg $1 medijski fajl, $2.', 'ogg-long-audio' => 'Ogg $1 zvučna datoteka, trajanje $2, $3', 'ogg-long-video' => 'Ogg $1 video fajl, dužina $2, $4×$5 piksela, $3.', 'ogg-long-multiplexed' => 'Multipleksirani .ogg audio/video snimak, $1, trajanje $2, $4 × $5 piksela, $3', 'ogg-long-general' => 'Ogg medijska datoteka, trajanje $2, $3.', 'ogg-long-error' => 'Neispravna ogg datoteka: $1', 'ogg-play' => 'Pusti', 'ogg-pause' => 'Pauza', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Pusti video', 'ogg-play-sound' => 'Pusti zvuk', 'ogg-no-player' => 'Izgleda da nemate instaliran nikakav program za puštanje medijskih datoteka. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Ovde preuzmite program za tu namenu</a>.', 'ogg-no-xiphqt' => 'Izgleda da nemate instaliran deo XiphQT za Kviktajm. Kviktajm ne može da pusti .ogg datoteke bez ove komponente. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Preuzmite XiphQT</a> ili izaberite drugi plejer.', 'ogg-player-videoElement' => 'Ugrađena podrška u brauzer', 'ogg-player-oggPlugin' => 'Plagin za brauzer', 'ogg-player-cortado' => 'Kortado (Java)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (Aktiviks)', 'ogg-player-quicktime-mozilla' => 'Kviktajm', 'ogg-player-quicktime-activex' => 'Kviktajm (Aktiviks)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kafin', 'ogg-player-mplayerplug-in' => 'mplayerplug-in', 'ogg-player-thumbnail' => 'još uvek samo slika', 'ogg-player-soundthumb' => 'nema plejera', 'ogg-player-selected' => '(označeno)', 'ogg-use-player' => 'Koristi plejer:', 'ogg-more' => 'Više...', 'ogg-dismiss' => 'Zatvori', 'ogg-download' => 'Preuzmi datoteku', 'ogg-desc-link' => 'O ovom fajlu', 'ogg-oggThumb-version' => 'OggHandler zahteva oggThumb – verziju $1 ili noviju.', 'ogg-oggThumb-failed' => 'oggThumb ne može da napravi minijaturu.', ); /** Seeltersk (Seeltersk) * @author AVRS * @author Pyt */ $messages['stq'] = array( 'ogg-desc' => 'Stjuurengsprogramm foar Ogg Theora- un Vorbis-Doatäie, inklusive n JavaScript-Ouspielsoftware', 'ogg-short-audio' => 'Ogg-$1-Audiodoatäi, $2', 'ogg-short-video' => 'Ogg-$1-Videodoatäi, $2', 'ogg-short-general' => 'Ogg-$1-Mediadoatäi, $2', 'ogg-long-audio' => '(Ogg-$1-Audiodoatäi, Loangte: $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg-$1-Videodoatäi, Loangte: $2, $4×$5 Pixel, $3', 'ogg-long-multiplexed' => '(Ogg-Audio-/Video-Doatäi, $1, Loangte: $2, $4×$5 Pixel, $3)', # Fuzzy 'ogg-long-general' => '(Ogg-Mediadoatäi, Loangte: $2, $3)', # Fuzzy 'ogg-long-error' => '(Uungultige Ogg-Doatäi: $1)', # Fuzzy 'ogg-play' => 'Start', 'ogg-pause' => 'Pause', 'ogg-stop' => 'Stop', 'ogg-play-video' => 'Video ouspielje', 'ogg-play-sound' => 'Audio ouspielje', 'ogg-no-player' => 'Dien System skient uur neen Ouspielsoftware tou ferföigjen. Installier <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ne Ouspielsoftware</a>.', 'ogg-no-xiphqt' => 'Dien System skient nit uur ju XiphQT-Komponente foar QuickTime tou ferföigjen. QuickTime kon sunner disse Komponente neen Ogg-Doatäie ouspielje. Dou <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">leede XiphQT</a> of wääl ne uur Ouspielsoftware.', 'ogg-player-videoElement' => 'Anweesende Browser-Unnerstutsenge', 'ogg-player-oggPlugin' => 'Browser-Plugin', 'ogg-player-thumbnail' => 'Wies Foarbekiekbielde', 'ogg-player-soundthumb' => 'Naan Player', 'ogg-player-selected' => '(uutwääld)', 'ogg-use-player' => 'Ouspielsoftware:', 'ogg-more' => 'Optione …', 'ogg-dismiss' => 'Sluute', 'ogg-download' => 'Doatäi spiekerje', 'ogg-desc-link' => 'Uur disse Doatäi', ); /** Sundanese (Basa Sunda) * @author AVRS * @author Kandar */ $messages['su'] = array( 'ogg-short-audio' => 'Koropak sora $1 ogg, $2', 'ogg-short-video' => 'Koropak vidéo $1 ogg, $2', 'ogg-short-general' => 'Koropak média $1 ogg, $2', 'ogg-long-audio' => '(Koropak sora $1 ogg, lilana $2, $3)', # Fuzzy 'ogg-long-video' => 'Koropak vidéo $1 ogg, lilana $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => '(Koropak sora/vidéo ogg multipléks, $1, lilana $2, $4×$5 piksel, $3 gembleng)', # Fuzzy 'ogg-long-general' => '(Koropak média ogg, lilana $2, $3)', # Fuzzy 'ogg-long-error' => '(Koropak ogg teu valid: $1)', # Fuzzy 'ogg-play' => 'Setél', 'ogg-pause' => 'Eureun', 'ogg-stop' => 'Anggeusan', 'ogg-play-video' => 'Setél vidéo', 'ogg-play-sound' => 'Setél sora', 'ogg-player-oggPlugin' => 'Plugin ogg', # Fuzzy 'ogg-player-thumbnail' => 'Gambar statis wungkul', 'ogg-player-selected' => '(pinilih)', 'ogg-use-player' => 'Paké panyetél:', 'ogg-more' => 'Lianna...', 'ogg-dismiss' => 'Tutup', 'ogg-download' => 'Bedol', 'ogg-desc-link' => 'Ngeunaan ieu koropak', ); /** Swedish (svenska) * @author AVRS * @author Ainali * @author Jon Harald Søby * @author Lejonel * @author Rotsee * @author Skalman * @author WikiPhoenix */ $messages['sv'] = array( 'ogg-desc' => 'Stöder filtyperna Ogg Theora och Ogg Vorbis med en JavaScript-baserad mediaspelare', 'ogg-short-audio' => 'Ogg $1 ljudfil, $2', 'ogg-short-video' => 'Ogg $1 videofil, $2', 'ogg-short-general' => 'Ogg $1 mediafil, $2', 'ogg-long-audio' => 'Ogg $1-ljudfil, längd $2, $3', 'ogg-long-video' => 'Ogg $1 videofil, längd $2, $4×$5 pixel, $3', 'ogg-long-multiplexed' => 'Ogg multiplexad ljud/video-fil, $1, längd $2, $4×$5 pixlar, $3 totalt', 'ogg-long-general' => 'Ogg mediafil, längd $2, $3', 'ogg-long-error' => 'Felaktig ogg-fil: $1', 'ogg-play' => 'Spela upp', 'ogg-pause' => 'Pausa', 'ogg-stop' => 'Stoppa', 'ogg-play-video' => 'Spela upp video', 'ogg-play-sound' => 'Spela upp ljud', 'ogg-no-player' => 'Tyvärr verkar det inte finnas någon mediaspelare som stöds installerad i ditt system. Det finns <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">spelare att ladda ner</a>.', 'ogg-no-xiphqt' => 'Du verkar inte ha XiphQT-komponenten för QuickTime. Utan den kan inte QuickTime spela upp ogg-filer.Du kan <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ladda ner XiphQT</a> eller välja någon annan spelare.', 'ogg-player-videoElement' => '<video>-element', 'ogg-player-oggPlugin' => 'Ogg-plugin', 'ogg-player-thumbnail' => 'Endast stillbilder', 'ogg-player-soundthumb' => 'Ingen spelare', 'ogg-player-selected' => '(vald)', 'ogg-use-player' => 'Välj mediaspelare:', 'ogg-more' => 'Mer...', 'ogg-dismiss' => 'Stäng', 'ogg-download' => 'Ladda ner filen', 'ogg-desc-link' => 'Om filen', 'ogg-oggThumb-version' => 'OggHandler kräver oggThumb version $1 eller senare.', 'ogg-oggThumb-failed' => 'oggThumb misslyckades med att skapa miniatyrbilden.', ); /** Swahili (Kiswahili) * @author Kwisha * @author Stephenwanjau */ $messages['sw'] = array( 'ogg-play' => 'Cheza', 'ogg-stop' => 'Komesha', 'ogg-play-video' => 'Cheza video', 'ogg-play-sound' => 'Cheza sauti', 'ogg-player-selected' => '(imechaguliwa)', 'ogg-more' => 'zaidi...', 'ogg-dismiss' => 'Funga', 'ogg-download' => 'Pakua faili', 'ogg-desc-link' => 'Kuhusu faili hii', ); /** Tamil (தமிழ்) * @author Karthi.dr * @author Shanmugamp7 * @author Sodabottle * @author TRYPPN */ $messages['ta'] = array( 'ogg-short-audio' => 'Ogg $1 ஒலி கோப்பு ,$2', 'ogg-short-video' => 'Ogg $1 வீடியோ கோப்பு$2', 'ogg-short-general' => 'Ogg $1 ஊடக கோப்பு$2', 'ogg-long-audio' => 'Ogg $1 ஒலி கோப்பு, நீளம் $2 ,$3', 'ogg-long-video' => 'Ogg $1 வீடியோ கோப்பு, நீளம் $2 , $4 × $5 பிக்சல்கள்,$3', 'ogg-long-general' => 'Ogg ஊடக கோப்பு நீளம் $2 ,$3', 'ogg-long-error' => 'செல்லாத ogg கோப்பு:$1', 'ogg-play' => 'ஓட்டு', 'ogg-pause' => 'இடைநிறுத்து', 'ogg-stop' => 'நிறுத்து', 'ogg-play-video' => 'காணொளியை ஓடவிடு', 'ogg-play-sound' => 'ஒலி ஓடவிடு', 'ogg-no-player' => 'மன்னிக்கவும், உங்கள் கணினியில் எந்த ஒரு ஆதரவு ஓடல் மென்பொருளும் இருப்பதாக தெரியவில்லை. தயவுசெய்து <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ஒரு ஓடல் மென்பொருளை தகவலிறக்கம் செய்யவும்</a>.', 'ogg-player-videoElement' => 'சொந்த உலாவி ஆதரவு', 'ogg-player-oggPlugin' => 'உலாவி செருகுநிரல்', 'ogg-player-thumbnail' => 'நிழற்படம் மட்டும்', 'ogg-player-soundthumb' => 'ஓடல் மென்பொருள் இல்லை', 'ogg-player-selected' => '(தேர்ந்தெடுத்தது)', 'ogg-use-player' => 'ஓடல் மென்பொருள் பயன்படுத்தவும்:', 'ogg-more' => 'மேலும்...', 'ogg-dismiss' => 'மூடுக', 'ogg-download' => 'கோப்பை பதிவிறக்கம் செய்', 'ogg-desc-link' => 'இந்தக் கோப்பைப் பற்றி', 'ogg-oggThumb-version' => 'OggHandler ஆனது oggThumb பதிப்பு $1 அதற்கு மேல் உள்ளவற்றை வேண்டுகிறது.', 'ogg-oggThumb-failed' => 'இந்த சிறுஉருவம் உருவாக்க oggThumb தோல்வியுற்றது.', ); /** Telugu (తెలుగు) * @author Kiranmayee * @author Veeven * @author వైజాసత్య */ $messages['te'] = array( 'ogg-short-audio' => 'Ogg $1 శ్రావ్యక ఫైలు, $2', 'ogg-short-video' => 'Ogg $1 వీడియో ఫైలు, $2', 'ogg-short-general' => 'Ogg $1 మీడియా ఫైలు, $2', 'ogg-long-audio' => '(Ogg $1 శ్రవణ ఫైలు, నిడివి $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 వీడియో ఫైలు, నిడివి $2, $4×$5 పిక్సెళ్ళు, $3', 'ogg-long-multiplexed' => '(ఓగ్ మల్టిప్లెక్సుడ్ శ్రవణ/దృశ్యక ఫైలు, $1, నిడివి $2, $4×$5 పిక్సెళ్ళు, $3 మొత్తం)', # Fuzzy 'ogg-long-general' => '(Ogg మీడియా ఫైలు, నిడివి $2, $3)', # Fuzzy 'ogg-long-error' => '(తప్పుడు ogg ఫైలు: $1)', # Fuzzy 'ogg-play' => 'ఆడించు', 'ogg-pause' => 'ఆపు', 'ogg-stop' => 'ఆపివేయి', 'ogg-play-video' => 'వీడియోని ఆడించు', 'ogg-play-sound' => 'శబ్ధాన్ని వినిపించు', 'ogg-player-videoElement' => 'విహారిణిలో సహజాత తోడ్పాటు', 'ogg-player-oggPlugin' => 'బ్రౌజరు ప్లగిన్', 'ogg-player-thumbnail' => 'నిచ్చల చిత్రాలు మాత్రమే', 'ogg-player-soundthumb' => 'ప్లేయర్ లేదు', 'ogg-player-selected' => '(ఎంచుకున్నారు)', 'ogg-use-player' => 'ప్లేయర్ ఉపయోగించు:', 'ogg-more' => 'మరిన్ని...', 'ogg-dismiss' => 'మూసివేయి', 'ogg-download' => 'ఫైలుని దిగుమతి చేసుకోండి', 'ogg-desc-link' => 'ఈ ఫైలు గురించి', ); /** Tajik (Cyrillic script) (тоҷикӣ) * @author AVRS * @author Ibrahim */ $messages['tg-cyrl'] = array( 'ogg-desc' => 'Ба дастгирандае барои парвандаҳои Ogg Theora ва Vorbis, бо пахшкунандаи JavaScript', 'ogg-short-audio' => 'Ogg $1 парвандаи савтӣ, $2', 'ogg-short-video' => 'Ogg $1 парвандаи наворӣ, $2', 'ogg-short-general' => 'Ogg $1 парвандаи расона, $2', 'ogg-long-audio' => '(Ogg $1 парвандаи савтӣ, тӯл $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 парвандаи наворӣ, тӯл $2, $4×$5 пикселҳо, $3', 'ogg-long-multiplexed' => '(Парвандаи Ogg савтӣ/наворӣ печида, $1, тӯл $2, $4×$5 пикселҳо, дар маҷмӯъ $3)', # Fuzzy 'ogg-long-general' => '(Парвандаи расонаи Ogg, тӯл $2, $3)', # Fuzzy 'ogg-long-error' => '(Парвандаи ғайримиҷози ogg: $1)', # Fuzzy 'ogg-play' => 'Пахш', 'ogg-pause' => 'Сукут', 'ogg-stop' => 'Қатъ', 'ogg-play-video' => 'Пахши навор', 'ogg-play-sound' => 'Пахши овоз', 'ogg-no-player' => 'Бубахшед, дастгоҳи шумо нармафзори пахшкунандаи муносибе надорад. Лутфан <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">як барномаи пахшкунандаро боргирӣ кунед</a>.', 'ogg-no-xiphqt' => 'Афзунаи XiphQT барои QuickTime ба назар намерасад. QuickTime наметавонад бидуни ин афзуна парвандаҳои Ogg-ро пахш кунад. Лутфан <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT-ро боргирӣ кунед</a> ё дигар нармафзори пахшкунандаро интихоб намоед.', 'ogg-player-videoElement' => 'унсури <наворӣ>', # Fuzzy 'ogg-player-oggPlugin' => 'Афзунаи ogg', # Fuzzy 'ogg-player-thumbnail' => 'Фақат акс ҳанӯз', 'ogg-player-soundthumb' => 'Пахшкунанда нест', 'ogg-player-selected' => '(интихобшуда)', 'ogg-use-player' => 'Истифода аз пахшкунанда:', 'ogg-more' => 'Бештар...', 'ogg-dismiss' => 'Бастан', 'ogg-download' => 'Боргирии парванда', 'ogg-desc-link' => 'Дар бораи ин парванда', ); /** Tajik (Latin script) (tojikī) * @author AVRS * @author Liangent */ $messages['tg-latn'] = array( 'ogg-desc' => 'Ba dastgirandae baroi parvandahoi Ogg Theora va Vorbis, bo paxşkunandai JavaScript', 'ogg-short-audio' => 'Ogg $1 parvandai savtī, $2', 'ogg-short-video' => 'Ogg $1 parvandai navorī, $2', 'ogg-short-general' => 'Ogg $1 parvandai rasona, $2', 'ogg-long-audio' => '(Ogg $1 parvandai savtī, tūl $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 parvandai navorī, tūl $2, $4×$5 pikselho, $3', 'ogg-long-multiplexed' => "(Parvandai Ogg savtī/navorī pecida, $1, tūl $2, $4×$5 pikselho, dar maçmū' $3)", # Fuzzy 'ogg-long-general' => '(Parvandai rasonai Ogg, tūl $2, $3)', # Fuzzy 'ogg-long-error' => '(Parvandai ƣajrimiçozi ogg: $1)', # Fuzzy 'ogg-play' => 'Paxş', 'ogg-pause' => 'Sukut', 'ogg-stop' => "Qat'", 'ogg-play-video' => 'Paxşi navor', 'ogg-play-sound' => 'Paxşi ovoz', 'ogg-no-player' => 'Bubaxşed, dastgohi şumo narmafzori paxşkunandai munosibe nadorad. Lutfan <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">jak barnomai paxşkunandaro borgirī kuned</a>.', 'ogg-no-xiphqt' => 'Afzunai XiphQT baroi QuickTime ba nazar namerasad. QuickTime nametavonad biduni in afzuna parvandahoi Ogg-ro paxş kunad. Lutfan <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT-ro borgirī kuned</a> jo digar narmafzori paxşkunandaro intixob namoed.', 'ogg-player-thumbnail' => 'Faqat aks hanūz', 'ogg-player-soundthumb' => 'Paxşkunanda nest', 'ogg-player-selected' => '(intixobşuda)', 'ogg-use-player' => 'Istifoda az paxşkunanda:', 'ogg-more' => 'Beştar...', 'ogg-dismiss' => 'Bastan', 'ogg-download' => 'Borgiriji parvanda', 'ogg-desc-link' => 'Dar borai in parvanda', ); /** Thai (ไทย) * @author Manop * @author Woraponboonkerd */ $messages['th'] = array( 'ogg-play' => 'เล่น', 'ogg-pause' => 'หยุดชั่วคราว', 'ogg-stop' => 'หยุด', 'ogg-play-video' => 'เล่นวิดีโอ', 'ogg-play-sound' => 'เล่นเสียง', 'ogg-no-player' => 'ขออภัย ระบบของคุณไม่มีซอฟต์แวร์ที่สนับสนุนไฟล์สื่อนี้ กรุณา<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ดาวน์โหลดซอฟต์แวร์เล่นสื่อ</a>', 'ogg-no-xiphqt' => 'ไม่พบซอฟต์แวร์เสริม XiphQT ของโปรแกรม QuickTime บนระบบของคุณ โปรแกรม QuickTime ไม่สามารถเล่นไฟล์สกุล Ogg ได้ถ้าไม่มีโปรแกรมเสริมนี้ กรุณา<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">ดวาน์โหลด XiphQT</a> หรือเลือกโปรแกรมอื่น', ); /** Turkmen (Türkmençe) * @author AVRS * @author Hanberke */ $messages['tk'] = array( 'ogg-desc' => 'Ogg Theora we Vorbis faýllary üçin işleýji, JavaScript pleýeri bilen bilelikde', 'ogg-short-audio' => 'Ogg $1 ses faýly, $2', 'ogg-short-video' => 'Ogg $1 wideo faýly, $2', 'ogg-short-general' => 'Ogg $1 media faýly, $2', 'ogg-long-audio' => '(Ogg $1 ses faýly, uzynlyk $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 wideo faýly, uzynlyk $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => '(Ogg multipleks audio/wideo faýly, $1, uzynlyk $2, $4×$5 piksel, $3 jemi)', # Fuzzy 'ogg-long-general' => '(Ogg media faýly, uzynlyk $2, $3)', # Fuzzy 'ogg-long-error' => '(Nädogry ogg faýly: $1)', # Fuzzy 'ogg-play' => 'Oýnat', 'ogg-pause' => 'Pauza', 'ogg-stop' => 'Duruz', 'ogg-play-video' => 'Wideo oýnat', 'ogg-play-sound' => 'Ses oýnat', 'ogg-no-player' => 'Gynansak-da, ulgamyňyzda goldanylýan haýsydyr bir pleýer programmaňyz ýok ýaly-la. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download"> Pleýer düşüriň</a>.', 'ogg-no-xiphqt' => 'QuickTime üçin XiphQT komponentiňiz ýok bolarly. QuickTime bu komponent bolmasa Ogg faýllaryny oýnadyp bilmeýär. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT-i düşüriň</a> ýa-da başga bir pleýer saýlaň.', 'ogg-player-videoElement' => 'Milli brauzer goldawy', 'ogg-player-oggPlugin' => 'Brauzer goşmaça moduly', 'ogg-player-thumbnail' => 'Diňe hereketsiz surat', 'ogg-player-soundthumb' => 'Pleýer ýok', 'ogg-player-selected' => '(saýlanylan)', 'ogg-use-player' => 'Pleýer ulan:', 'ogg-more' => 'Has köp...', 'ogg-dismiss' => 'Ýap', 'ogg-download' => 'Faýl düşür', 'ogg-desc-link' => 'Bu faýl hakda', 'ogg-oggThumb-version' => 'OggHandler oggThumb programmasynyň $1 wersiýasyny ýa-da has täzesini talap edýär.', 'ogg-oggThumb-failed' => 'oggThumb miniatýura döredip bilmedi.', ); /** Tagalog (Tagalog) * @author AVRS * @author AnakngAraw */ $messages['tl'] = array( 'ogg-desc' => 'Tagahawak para sa mga talaksang Ogg Theora at Vorbis, na may panugtog/pampaandar na JavaScript', 'ogg-short-audio' => '$1 na talaksang pangtunog ng Ogg, $2', 'ogg-short-video' => "$1 talaksang pampalabas (''video'') ng Ogg, $2", 'ogg-short-general' => '$1 talaksang pangmidya ng Ogg, $2', 'ogg-long-audio' => '$1 talaksan ng tunog ng Ogg, $2 ang haba, $3', 'ogg-long-video' => '$1 talaksan ng palabas ng Ogg, haba $2, $4×$5 mga piksel, $3', 'ogg-long-multiplexed' => 'Magkasanib at nagsasabayang talaksang naririnig/bidyo ng Ogg, $1, $2 ang haba, $4×$5 mga piksel, $3 sa pangkalahatan', 'ogg-long-general' => 'Talaksan ng midya ng Ogg, $2 ang haba, $3', 'ogg-long-error' => 'Hindi katanggap-tanggap na talaksan ng Ogg: $1', 'ogg-play' => 'Paandarin', 'ogg-pause' => 'Pansamantalang pahintuin', 'ogg-stop' => 'Ihinto/itigil', 'ogg-play-video' => "Paandarin ang palabas (''video'')", 'ogg-play-sound' => 'Patugtugin ang tunog', 'ogg-no-player' => 'Paumanhin, tila parang walang anumang sinusuportahang pamapatugtog/pampaandar na sopwer ang sistema mo. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Magkarga lamang po muna ng isang panugtog/pampaandar</a>.', 'ogg-no-xiphqt' => 'Tila parang wala ka pang sangkap (komponente) na XiphQT para sa QuickTime. Hindi makapagpapatugtog ang QuickTime ng mga talaksang Ogg kapag wala ang ganitong sangkap. <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">Magkarga muna po ng XiphQT</a> o pumili ng iba pang panugtog/pampaandar.', 'ogg-player-videoElement' => "Katutubong tagapagtangkilik/pangsuporta ng pantingin-tingin (''browser'')", 'ogg-player-oggPlugin' => "Pampasak sa pantingin-tingin (''browser'')", 'ogg-player-cortado' => 'Cortado (Java)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (ActiveX)', 'ogg-player-quicktime-mozilla' => 'QuickTime', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kaffeine', 'ogg-player-mplayerplug-in' => "pampasak na pampatugtog/pampaandar ng tunog (''mplayerplug-in'')", 'ogg-player-thumbnail' => 'Larawang hindi gumagalaw lamang', 'ogg-player-soundthumb' => 'Walang pampatugtog/pampaandar', 'ogg-player-selected' => '(napili na)', 'ogg-use-player' => 'Gamitin ang pampaandar:', 'ogg-more' => 'Marami pa…', 'ogg-dismiss' => 'Isara', 'ogg-download' => 'Ikarga ang talaksan', 'ogg-desc-link' => 'Tungkol sa talaksang ito', 'ogg-oggThumb-version' => 'Nangangailangan ang OggHandler ng bersyong $1 o mas luma.', 'ogg-oggThumb-failed' => 'Nabigo ang oggThumb na lumikha ng munting larawan.', ); /** Tok Pisin (Tok Pisin) * @author Iketsi */ $messages['tpi'] = array( 'ogg-more' => 'Moa...', ); /** Turkish (Türkçe) * @author AVRS * @author Emperyan * @author Erkan Yilmaz * @author Joseph * @author Mach * @author Runningfridgesrule * @author Srhat */ $messages['tr'] = array( 'ogg-desc' => 'Ogg Theora ve Vorbis dosyaları için işleyici, JavaScript oynatıcısı ile', 'ogg-short-audio' => 'Ogg $1 ses dosyası, $2', 'ogg-short-video' => 'Ogg $1 video dosyası, $2', 'ogg-short-general' => 'Ogg $1 medya dosyası, $2', 'ogg-long-audio' => '(Ogg $1 ses dosyası, süre $2, $3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 film dosyası, süre $2, $4×$5 piksel, $3', 'ogg-long-multiplexed' => '(Ogg çok düzeyli ses/film dosyası, $1, süre $2, $4×$5 piksel, $3 genelde)', # Fuzzy 'ogg-long-general' => '(Ogg medya dosyası, süre $2, $3)', # Fuzzy 'ogg-long-error' => '(Geçersiz ogg dosyası: $1)', # Fuzzy 'ogg-play' => 'Oynat', 'ogg-pause' => 'Duraklat', 'ogg-stop' => 'Durdur', 'ogg-play-video' => 'Video filmini oynat', 'ogg-play-sound' => 'Sesi oynat', 'ogg-no-player' => 'Üzgünüz, sisteminiz desteklenen herhangi bir oynatıcı yazılımına sahip gibi görünmüyor. Lütfen <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">bir oynatıcı indirin</a>.', 'ogg-no-xiphqt' => 'QuickTime için XiphQT bileşenine sahip değil görünüyorsunuz. QuickTime bu bileşen olmadan Ogg dosyalarını oynatamaz. Lütfen <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">XiphQT\'i indirin</a> ya da başka bir oynatıcı seçin.', 'ogg-player-videoElement' => 'Yerel tarayıcı desteği', 'ogg-player-oggPlugin' => 'Tarayıcı eklentisi', 'ogg-player-thumbnail' => 'Henüz sadece resimdir', 'ogg-player-soundthumb' => 'Oynatıcı yok', 'ogg-player-selected' => '(seçilmiş)', 'ogg-use-player' => 'Oynatıcıyı kullanın:', 'ogg-more' => 'Daha...', 'ogg-dismiss' => 'Kapat', 'ogg-download' => 'Dosya indir', 'ogg-desc-link' => 'Bu dosya hakkında', 'ogg-oggThumb-version' => 'OggHandler, oggThumb sürüm $1 veya üstü gerektirir.', 'ogg-oggThumb-failed' => 'oggThumb küçük resim oluşturmayı başaramadı.', ); /** Tsonga (Xitsonga) * @author Thuvack */ $messages['ts'] = array( 'ogg-more' => 'Swinwana…', 'ogg-dismiss' => 'Pfala', ); /** Tatar (Cyrillic script) (татарча) * @author Ильнар */ $messages['tt-cyrl'] = array( 'ogg-play' => 'Җырлату', 'ogg-pause' => 'Туктатып тору', 'ogg-stop' => 'Туктату', 'ogg-play-video' => 'Видеоязманы карау', 'ogg-play-sound' => 'Көйне тыңлау', 'ogg-no-player' => 'Гафу итегез, ләкин сезнең системагыз бу файллар төрен ача алмый, зинһар кирәк булган программаларны <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">үзегезгә йөкләп алыгыз</a>.', 'ogg-player-videoElement' => 'Браузер ярдәмендә тыңлау', 'ogg-player-oggPlugin' => 'Ogg модуль', 'ogg-player-thumbnail' => 'Тыйнак рәсемнәрне генә куллану', 'ogg-player-soundthumb' => 'Уйнаутучы юк', 'ogg-player-selected' => '(сайланган)', 'ogg-use-player' => 'Бирелгән уйнаткычны куллану:', 'ogg-more' => 'Тулырак...', 'ogg-dismiss' => 'Ябу', 'ogg-download' => 'Файлны алу', 'ogg-desc-link' => 'Файл турында мәгълүмат', 'ogg-oggThumb-version' => 'OggHandler $1 юрамасыннан да югарырак oggThumb тәэминатын сорый.', 'ogg-oggThumb-failed' => 'oggThumb нигезендә миниатюраны ясап булмады.', ); /** Central Atlas Tamazight (ⵜⴰⵎⴰⵣⵉⵖⵜ) * @author Tifinaghes */ $messages['tzm'] = array( 'ogg-stop' => 'ⵙⴱⴻⴷⴷ', 'ogg-player-selected' => '(ⵓⴼⵔⵉⵏ)', ); /** Uyghur (Arabic script) (ئۇيغۇرچە) * @author Sahran */ $messages['ug-arab'] = array( 'ogg-play' => 'چال', 'ogg-pause' => 'ۋاقىتلىق توختا', 'ogg-stop' => 'توختا', 'ogg-play-sound' => 'ئاۋاز قوي', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kaffeine', 'ogg-dismiss' => 'ياپ', ); /** Ukrainian (українська) * @author A1 * @author AS * @author AVRS * @author Ahonc * @author Arturyatsko * @author Dim Grits * @author NickK * @author Prima klasy4na * @author Тест */ $messages['uk'] = array( 'ogg-desc' => 'Оброблювач файлів Ogg Theora і Vorbis з використанням JavaScript-програвача', 'ogg-short-audio' => 'Звуковий файл Ogg $1, $2', 'ogg-short-video' => 'Відео-файл Ogg $1, $2', 'ogg-short-general' => 'Файл Ogg $1, $2', 'ogg-long-audio' => 'звуковий файл Ogg $1, довжина $2, $3', 'ogg-long-video' => 'відео-файл Ogg $1, довжина $2, $4×$5 пікселів, $3', 'ogg-long-multiplexed' => 'мультиплексний аудіо/відео-файл ogg, $1, довжина $2, $4×$5 пікселів, $3 усього', 'ogg-long-general' => 'медіа-файл Ogg, довжина $2, $3', 'ogg-long-error' => 'Неправильний ogg-файл: $1', 'ogg-play' => 'Відтворити', 'ogg-pause' => 'Пауза', 'ogg-stop' => 'Зупинити', 'ogg-play-video' => 'Відтворити відео', 'ogg-play-sound' => 'Відтворити звук', 'ogg-no-player' => 'Вибачте, ваша ситема не має необхідного програмного забезпечення для відтворення файлів. Будь ласка, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">завантажте програвач</a>.', 'ogg-no-xiphqt' => 'Відсутній компонент XiphQT для QuickTime. QuickTime не може відтворювати ogg-файли без цього компонента. Будь ласка, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">завантажте XiphQT</a> або оберіть інший програвач.', 'ogg-player-videoElement' => 'Рідна підтримка веб-оглядача', 'ogg-player-oggPlugin' => 'Плаґін для браузера', 'ogg-player-cortado' => 'Cortado (Java)', 'ogg-player-vlc-mozilla' => 'VLC', 'ogg-player-vlc-activex' => 'VLC (ActiveX)', 'ogg-player-quicktime-mozilla' => 'QuickTime', 'ogg-player-quicktime-activex' => 'QuickTime (ActiveX)', 'ogg-player-totem' => 'Totem', 'ogg-player-kmplayer' => 'KMPlayer', 'ogg-player-kaffeine' => 'Kaffeine', 'ogg-player-mplayerplug-in' => 'mplayerplug-in', 'ogg-player-thumbnail' => 'Тільки нерухоме зображення', 'ogg-player-soundthumb' => 'Нема програвача', 'ogg-player-selected' => '(обраний)', 'ogg-use-player' => 'Використовувати програвач:', 'ogg-more' => 'Більше…', 'ogg-dismiss' => 'Закрити', 'ogg-download' => 'Завантажити файл', 'ogg-desc-link' => 'Інформація про цей файл', 'ogg-oggThumb-version' => 'OggHandler вимагає oggThumb версії $1 або більш пізньої.', 'ogg-oggThumb-failed' => 'oggThumb не вдалося створити мініатюру.', ); /** Urdu (اردو) * @author පසිඳු කාවින්ද */ $messages['ur'] = array( 'ogg-play' => 'کھیل', 'ogg-pause' => 'روک دیں', 'ogg-stop' => 'بند', 'ogg-play-video' => 'کھیلنے کے ویڈیو', 'ogg-play-sound' => 'کھیلنے کے آواز', 'ogg-player-videoElement' => 'مقامی براؤزر کی حمایت', 'ogg-player-oggPlugin' => 'براؤزر پلگ ان', 'ogg-player-soundthumb' => 'کوئی کھلاڑی', 'ogg-more' => 'مزید...', 'ogg-dismiss' => 'بند', 'ogg-download' => 'فائل ڈاؤن لوڈ ، اتارنا', 'ogg-desc-link' => 'اس فائل کے بارے میں', ); /** vèneto (vèneto) * @author AVRS * @author Candalua * @author GatoSelvadego */ $messages['vec'] = array( 'ogg-desc' => 'Gestor par i file Ogg Theora e Vorbis, con riprodutor JavaScript', 'ogg-short-audio' => 'File audio Ogg $1, $2', 'ogg-short-video' => 'File video Ogg $1, $2', 'ogg-short-general' => 'File multimedial Ogg $1, $2', 'ogg-long-audio' => 'File audio Ogg $1, durata $2, $3', 'ogg-long-video' => 'File video Ogg $1, durata $2, dimensioni $4×$5 pixel, $3', 'ogg-long-multiplexed' => 'File audio/video multiplexed Ogg $1, durata $2, dimension $4×$5 pixel, conplesivamente $3', 'ogg-long-general' => 'File multimedial Ogg, durata $2, $3', 'ogg-long-error' => 'File ogg mìa vałido: $1', 'ogg-play' => 'Riprodusi', 'ogg-pause' => 'Pausa', 'ogg-stop' => 'Fèrma', 'ogg-play-video' => 'Varda el video', 'ogg-play-sound' => 'Scolta el file', 'ogg-no-player' => 'Semo spiacenti, ma sul to sistema no risulta instalà nissun software de riproduzion conpatibile. Par piaser <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">scàrichete un letor</a> che vaga ben.', 'ogg-no-xiphqt' => 'No risulta mìa instalà el conponente XiphQT de QuickTime. Senza sto conponente no se pode mìa riprodur i file Ogg con QuickTime. Par piaser, <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">scàrichete XiphQT</a> o siegli n\'altro letor.', 'ogg-player-videoElement' => 'Suporto browser zà de suo (nativo)', 'ogg-player-oggPlugin' => 'Plugin browser', 'ogg-player-thumbnail' => 'Solo imagini fisse', 'ogg-player-soundthumb' => 'Nissun letor', 'ogg-player-selected' => '(selezionà)', 'ogg-use-player' => 'Dòpara el letor:', 'ogg-more' => 'Altro...', 'ogg-dismiss' => 'Sara', 'ogg-download' => 'Descarga el file', 'ogg-desc-link' => 'Informazion su sto file', 'ogg-oggThumb-version' => 'Par OggHandler ghe vole oggThumb version $1 o sucessiva.', 'ogg-oggThumb-failed' => "oggThumb no'l xe stà bon de crear la miniatura.", ); /** Veps (vepsän kel’) * @author Игорь Бродский */ $messages['vep'] = array( 'ogg-play' => 'Väta', 'ogg-pause' => 'Pauz', 'ogg-stop' => 'Azotada', 'ogg-play-video' => 'Ozutada video', 'ogg-play-sound' => 'Väta kulundad', 'ogg-player-oggPlugin' => 'Kaclim-plagin', 'ogg-player-soundthumb' => 'Ei ole plejerad', 'ogg-player-selected' => '(valitud)', 'ogg-use-player' => 'Kävutada plejer:', 'ogg-more' => 'Enamba...', 'ogg-dismiss' => 'Peitta', 'ogg-download' => 'Jügutoitta fail', 'ogg-desc-link' => 'Informacii neciš failas', ); /** Vietnamese (Tiếng Việt) * @author AVRS * @author Minh Nguyen * @author Vinhtantran */ $messages['vi'] = array( 'ogg-desc' => 'Bộ trình bày các tập tin Ogg Theora và Vorbis dùng hộp chơi phương tiện bằng JavaScript', 'ogg-short-audio' => 'Tập tin âm thanh Ogg $1, $2', 'ogg-short-video' => 'tập tin video Ogg $1, $2', 'ogg-short-general' => 'tập tin Ogg $1, $2', 'ogg-long-audio' => 'Tập tin âm thanh Ogg $1, dài $2, $3', 'ogg-long-video' => 'tập tin video Ogg $1, dài $2, $4×$5 điểm ảnh, $3', 'ogg-long-multiplexed' => 'tập tin Ogg có âm thanh và video ghép kênh, $1, dài $2, $4×$5 điểm ảnh, $3 tất cả', 'ogg-long-general' => 'Tập tin phương tiện Ogg, dài $2, $3', 'ogg-long-error' => 'Tập tin Ogg có lỗi: $1', 'ogg-play' => 'Chơi', 'ogg-pause' => 'Tạm ngừng', 'ogg-stop' => 'Ngừng', 'ogg-play-video' => 'Coi video', 'ogg-play-sound' => 'Nghe âm thanh', 'ogg-no-player' => 'Rất tiếc, hình như máy tính của bạn cần thêm phần mềm. Xin <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/vi">tải về chương trình chơi nhạc</a>.', 'ogg-no-xiphqt' => 'Hình như bạn không có bộ phận XiphQT cho QuickTime, nên QuickTime không thể chơi những tập tin Ogg được. Xin <a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download/vi">truyền xuống XiphQT</a> hay chọn một chương trình chơi nhạc khác.', 'ogg-player-videoElement' => 'Bộ chơi có sẵn trong trình duyệt', 'ogg-player-oggPlugin' => 'Phần bổ trợ trình duyệt', 'ogg-player-thumbnail' => 'Chỉ hiển thị hình tĩnh', 'ogg-player-soundthumb' => 'Tắt', 'ogg-player-selected' => '(được chọn)', 'ogg-use-player' => 'Chọn chương trình chơi:', 'ogg-more' => 'Thêm nữa…', 'ogg-dismiss' => 'Đóng', 'ogg-download' => 'Tải về tập tin', 'ogg-desc-link' => 'Chi tiết của tập tin này', 'ogg-oggThumb-version' => 'OggHandler cần oggThumb, phiên bản $1 trở lên.', 'ogg-oggThumb-failed' => 'oggThumb bị thất bại trong việc tạo hình thu nhỏ.', ); /** Volapük (Volapük) * @author Malafaya * @author Smeira */ $messages['vo'] = array( 'ogg-stop' => 'Stöpön', 'ogg-player-videoElement' => 'Stüt bevüresodanaföm gebidon', 'ogg-more' => 'Pluikos...', 'ogg-dismiss' => 'Färmükön', 'ogg-download' => 'Donükön ragivi', 'ogg-desc-link' => 'Tefü ragiv at', ); /** Walloon (walon) */ $messages['wa'] = array( 'ogg-dismiss' => 'Clôre', ); /** Yiddish (ייִדיש) * @author Imre * @author פוילישער */ $messages['yi'] = array( 'ogg-short-audio' => 'Ogg $1 קלאנג טעקע, $2', 'ogg-short-video' => 'Ogg $1 ווידעא טעקע, $2', 'ogg-short-general' => 'Ogg $1 מעדיע טעקע, $2', 'ogg-long-audio' => 'Ogg $1 קול טעקע, לענג $2, $3', 'ogg-long-video' => 'Ogg $1 ווידעא טעקע, לענג $2, $4×$5 פיקסעלן, $3', 'ogg-play' => 'שפּיל', 'ogg-pause' => 'פויזע', 'ogg-stop' => 'הערט אויף!', 'ogg-play-video' => 'שפילן ווידעא', 'ogg-play-sound' => 'שפילן קלאַנג', 'ogg-player-soundthumb' => 'קיין שפילער', 'ogg-player-selected' => '(אויסגעוויילט)', 'ogg-use-player' => 'ניצן שפילער:', 'ogg-more' => 'נאך…', 'ogg-dismiss' => 'שליסן', 'ogg-download' => 'אראָפלאָדן טעקע', 'ogg-desc-link' => 'וועגן דער טעקע', ); /** Yoruba (Yorùbá) * @author Demmy */ $messages['yo'] = array( 'ogg-short-audio' => 'Fáìlì amóhùn Ogg $1, $2', 'ogg-play' => 'Ìmúṣeré', 'ogg-pause' => 'Ìjáwọ́', 'ogg-stop' => 'Ìdẹ́kun', 'ogg-player-selected' => '(ṣíṣàyàn)', 'ogg-dismiss' => 'Padé', 'ogg-download' => 'Ìrùsílẹ̀ fáìlì', 'ogg-desc-link' => 'Nípa fáìlì yìí', ); /** Cantonese (粵語) * @author AVRS */ $messages['yue'] = array( 'ogg-desc' => 'Ogg Theora 同 Vorbis 檔案嘅處理器,加埋 JavaScript 播放器', 'ogg-short-audio' => 'Ogg $1 聲檔,$2', 'ogg-short-video' => 'Ogg $1 畫檔,$2', 'ogg-short-general' => 'Ogg $1 媒檔,$2', 'ogg-long-audio' => '(Ogg $1 聲檔,長度$2,$3)', # Fuzzy 'ogg-long-video' => 'Ogg $1 畫檔,長度$2,$4×$5像素,$3', 'ogg-long-multiplexed' => '(Ogg 多工聲/畫檔,$1,長度$2,$4×$5像素,總共$3)', # Fuzzy 'ogg-long-general' => '(Ogg 媒檔,長度$2,$3)', # Fuzzy 'ogg-long-error' => '(無效嘅ogg檔: $1)', # Fuzzy 'ogg-play' => '去', 'ogg-pause' => '暫停', 'ogg-stop' => '停', 'ogg-play-video' => '去畫', 'ogg-play-sound' => '去聲', 'ogg-no-player' => '對唔住,你嘅系統並無任何可以支援得到嘅播放器。請安裝<a href="http://www.java.com/zh_TW/download/manual.jsp">Java</a>。', 'ogg-no-xiphqt' => '你似乎無畀QuickTime用嘅XiphQT組件。響未有呢個組件嗰陣,QuickTime係唔可以播放Ogg檔案。請<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">下載XiphQT</a>或者揀過另外一個播放器。', 'ogg-player-videoElement' => '<video>元素', 'ogg-player-oggPlugin' => 'Ogg插件', 'ogg-player-thumbnail' => '只有靜止圖像', 'ogg-player-soundthumb' => '無播放器', 'ogg-player-selected' => '(揀咗)', 'ogg-use-player' => '使用播放器:', 'ogg-more' => '更多...', 'ogg-dismiss' => '閂', 'ogg-download' => '下載檔案', 'ogg-desc-link' => '關於呢個檔案', ); /** Simplified Chinese (中文(简体)‎) * @author AVRS * @author Gaoxuewei * @author Liangent */ $messages['zh-hans'] = array( 'ogg-desc' => 'Ogg Theora 和 Vorbis 文件的处理器,含 JavaScript 播放器', 'ogg-short-audio' => 'Ogg $1 声音文件,$2', 'ogg-short-video' => 'Ogg $1 视频文件,$2', 'ogg-short-general' => 'Ogg $1 媒体文件,$2', 'ogg-long-audio' => 'Ogg $1 声音文件,长度$2,$3', 'ogg-long-video' => 'Ogg $1 视频文件,长度$2,$4×$5像素,$3', 'ogg-long-multiplexed' => 'Ogg 多工声音/视频文件,$1,长度$2,$4×$5像素,共$3', 'ogg-long-general' => 'Ogg 媒体文件,长度$2,$3', 'ogg-long-error' => '无效的ogg文件:$1', 'ogg-play' => '播放', 'ogg-pause' => '暂停', 'ogg-stop' => '停止', 'ogg-play-video' => '播放视频', 'ogg-play-sound' => '播放声音', 'ogg-no-player' => '抱歉,您的系统并无任何可以支持播放的播放器。请安装<a href="http://www.java.com/zh_CN/download/manual.jsp">Java</a>。', 'ogg-no-xiphqt' => '您似乎没有给QuickTime用的XiphQT组件。在未有这个组件的情况下,QuickTime是不能播放Ogg文件的。请<a href="http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download">下载XiphQT</a>或者选取另一个播放器。', 'ogg-player-videoElement' => '<video>元素', 'ogg-player-oggPlugin' => 'Ogg插件', 'ogg-player-thumbnail' => '只有静止图像', 'ogg-player-soundthumb' => '沒有播放器', 'ogg-player-selected' => '(已选取)', 'ogg-use-player' => '使用播放器:', 'ogg-more' => '更多...', 'ogg-dismiss' => '关闭', 'ogg-download' => '下载文件', 'ogg-desc-link' => '关于这个文件', 'ogg-oggThumb-version' => 'OggHandler需要oggThumb $1或者之后的版本。', 'ogg-oggThumb-failed' => 'oggThumb未能创建缩略图。', ); /** Traditional Chinese (中文(繁體)‎) * @author AVRS * @author Gaoxuewei * @author Horacewai2 * @author Mark85296341 * @author Simon Shek * @author Waihorace */ $messages['zh-hant'] = array( 'ogg-desc' => 'Ogg Theora 和 Vorbis 檔案的處理器,含 JavaScript 播放器', 'ogg-short-audio' => 'Ogg $1 聲音檔案,$2', 'ogg-short-video' => 'Ogg $1 影片檔案,$2', 'ogg-short-general' => 'Ogg $1 媒體檔案,$2', 'ogg-long-audio' => 'Ogg $1 聲音檔案,長度$2,$3', 'ogg-long-video' => 'Ogg $1 影片檔案,長度$2,$4×$5像素,$3', 'ogg-long-multiplexed' => 'Ogg 多工聲音/影片檔案,$1,長度$2,$4×$5像素,共$3', 'ogg-long-general' => 'Ogg 媒體檔案,長度$2,$3', 'ogg-long-error' => '無效的ogg檔案:$1', 'ogg-play' => '播放', 'ogg-pause' => '暫停', 'ogg-stop' => '停止', 'ogg-play-video' => '播放影片', 'ogg-play-sound' => '播放聲音', 'ogg-no-player' => '抱歉,您的系統並無任何可以支援播放的播放器。請安裝<a href=「http://www.java.com/zh_TW/download/manual.jsp」>Java</a>。', 'ogg-no-xiphqt' => '您似乎沒有給 QuickTime 用的 XiphQT 元件。在未有這個元件的情況下,QuickTime 是不能播放 Ogg 檔案的。請<a href=「http://www.mediawiki.org/wiki/Extension:OggHandler/Client_download」>下載 XiphQT</a> 或者選取另一個播放器。', 'ogg-player-videoElement' => '<video>元素', 'ogg-player-oggPlugin' => 'Ogg 外掛程式', 'ogg-player-thumbnail' => '只有靜止圖片', 'ogg-player-soundthumb' => '沒有播放器', 'ogg-player-selected' => '(已選取)', 'ogg-use-player' => '使用播放器:', 'ogg-more' => '更多...', 'ogg-dismiss' => '關閉', 'ogg-download' => '下載檔案', 'ogg-desc-link' => '關於這個檔案', 'ogg-oggThumb-version' => 'OggHandler 需要 oggThumb $1 或者之後的版本', 'ogg-oggThumb-failed' => 'oggThumb 無法建立縮圖。', );
etsursalesforce/kolzchut
extensions/OggHandler/OggHandler.i18n.php
PHP
gpl-2.0
254,502
package com.picturebooks.mobilepicturebooks; import android.os.Bundle; import org.apache.cordova.*; import database.DatabaseHelper; public class MenuActivity extends DroidGap { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); DatabaseHelper dbHelper = new DatabaseHelper(this); HTMLConnector mc = new HTMLConnector(this, appView, dbHelper, this); appView.addJavascriptInterface(mc, "Connector"); super.loadUrl("file:///android_asset/www/main.html"); } }
SharmaineLim/funimals
src/com/picturebooks/mobilepicturebooks/MenuActivity.java
Java
gpl-2.0
545
/* * Variables en modo produccion. * */ var URL_SERVICE = "http://inver.nuevebit.com";
NueveBit/inver
src/www/js/env_prod.js
JavaScript
gpl-2.0
91
package com.brainnet.smartremote.device; public class DeviceIRDA extends DeviceBase { public DeviceIRDA(String name, String id, String pwd, String type,DeviceController controller) { super(name, id, pwd, type,controller); // TODO Auto-generated constructor stub } @Override public void update() { // TODO Auto-generated method stub } }
githubdelegate/remoteControl
SmartRemote/src/com/brainnet/smartremote/device/DeviceIRDA.java
Java
gpl-2.0
368
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package mx.avanti.siract.application.helper; import java.io.Serializable; import java.util.Objects; import mx.avanti.siract.business.entity.Practicalaboratorio; import mx.avanti.siract.business.entity.Practicascampo; import mx.avanti.siract.business.entity.Practicataller; import mx.avanti.siract.business.entity.Subtemaunidad; import mx.avanti.siract.business.entity.Temaunidad; import mx.avanti.siract.business.entity.Unidad; /** * * @author Y */ public class NodoMultiClass implements Serializable, Comparable<NodoMultiClass> { Unidad unidad; Temaunidad temaUnidad; Subtemaunidad subTema; String nombre; String subtemaId; String numero; String horas; String unidadId; String temaId; String id; Boolean horasCompletas=true; Boolean deReporteAnterior=false; public Boolean isDeReporteAnterior() { return deReporteAnterior; } public void setDeReporteAnterior(Boolean deReporteAnterior) { this.deReporteAnterior = deReporteAnterior; } public Boolean isHorasCompletas() { return horasCompletas; } public void setHorasCompletas(Boolean horasCompletas) { this.horasCompletas = horasCompletas; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public Practicalaboratorio getPracticaL() { return practicaL; } public void setPracticaL(Practicalaboratorio practicaL) { this.practicaL = practicaL; } public Practicataller getPracticaT() { return practicaT; } public void setPracticaT(Practicataller practicaT) { this.practicaT = practicaT; } public Practicascampo getPracticaC() { return practicaC; } public void setPracticaC(Practicascampo practicaC) { this.practicaC = practicaC; } String tipo = "/"; Practicalaboratorio practicaL; Practicataller practicaT; Practicascampo practicaC; String observaciones = ""; String porcentajeAvance = "0"; String sumar = "0"; boolean impartido=false; public boolean isImpartido() { return impartido; } public void setImpartido(boolean impartido) { this.impartido = impartido; } public String getObservaciones() { return observaciones; } public void setObservaciones(String observaciones) { this.observaciones = observaciones; } public String getSubtemaId() { return subtemaId; } public void setSubtemaId(String id) { this.subtemaId = id; } public String getHoras() { return horas; } public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public void setHoras(String horas) { this.horas = horas; } public String getPorcentajeAvance() { return porcentajeAvance; } public void setPorcentajeAvance(String porcentajeAvance) { this.porcentajeAvance = porcentajeAvance; } public NodoMultiClass() { } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public Unidad getUnidad() { return unidad; } public void setUnidad(Unidad unidad) { this.unidad = unidad; } public Temaunidad getTemaUnidad() { return temaUnidad; } public void setTemaUnidad(Temaunidad temaUnidad) { this.temaUnidad = temaUnidad; } public Subtemaunidad getSubTema() { return subTema; } public void setSubTema(Subtemaunidad subTema) { this.subTema = subTema; } public NodoMultiClass(Object obj) { definirNodo(obj); } public NodoMultiClass(Object obj, int perteneceAUnidad) { this.unidadId = String.valueOf(perteneceAUnidad); definirNodo(obj); } public NodoMultiClass(Object obj, int perteneceAUnidad, int perteneceATema) { this.unidadId = String.valueOf(perteneceAUnidad); this.temaId = String.valueOf(perteneceATema); definirNodo(obj); } public void definirNodo(Object obj) { if (obj instanceof Unidad) { unidad = (Unidad) obj; nombre = unidad.getUninombre(); horas = String.valueOf(unidad.getUnihoras()); porcentajeAvance = String.valueOf(unidad.getUnivalorPorcentaje()); unidadId = String.valueOf(unidad.getUniid()); numero = String.valueOf(unidad.getUninumero()); sumar = String.valueOf(unidad.getUnivalorPorcentaje()); tipo = "unidad"; id = String.valueOf(unidad.getUniid()); horasCompletas=unidad.getUnihorasCompletas(); } if (obj instanceof Temaunidad) { temaUnidad = (Temaunidad) obj; nombre = temaUnidad.getTunnombre(); horas = String.valueOf(temaUnidad.getTunhoras()); porcentajeAvance = String.valueOf(temaUnidad.getTunvalorPorcentaje()); temaId = String.valueOf(temaUnidad.getTunid()); numero = String.valueOf(temaUnidad.getTunnumero()); sumar = String.valueOf(temaUnidad.getTunvalorPorcentaje()); id = String.valueOf(temaUnidad.getTunid()); tipo = "temaunidad"; horasCompletas=temaUnidad.getTunhorasCompletas(); } if (obj instanceof Subtemaunidad) { subTema = (Subtemaunidad) obj; nombre = subTema.getSutnombre(); horas = String.valueOf(subTema.getSuthoras()); porcentajeAvance = String.valueOf(subTema.getSutvalorPorcentaje()); subtemaId = String.valueOf(subTema.getSutid()); numero = String.valueOf(subTema.getSutnumero()); sumar = String.valueOf(subTema.getSutvalorPorcentaje()); id = String.valueOf(subTema.getSutid()); tipo = "subtemaunidad"; } if (obj instanceof Practicalaboratorio) { practicaL = (Practicalaboratorio) obj; nombre = practicaL.getPrlnombre(); horas = String.valueOf(practicaL.getPrlhoras()); porcentajeAvance = String.valueOf(practicaL.getPrlvalorPorcentaje()); unidadId = String.valueOf(practicaL.getPrlid()); numero = String.valueOf(practicaL.getPrlnumero()); sumar = String.valueOf(practicaL.getPrlvalorPorcentaje()); id = String.valueOf(practicaL.getPrlid()); tipo = "practicalaboratorio"; } if (obj instanceof Practicataller) { practicaT = (Practicataller) obj; nombre = practicaT.getPrtnombre(); horas = String.valueOf(practicaT.getPrthoras()); porcentajeAvance = String.valueOf(practicaT.getPrtvalorPorcentaje()); unidadId = String.valueOf(practicaT.getPrtid()); numero = String.valueOf(practicaT.getPrtnumero()); sumar = String.valueOf(practicaT.getPrtvalorPorcentaje()); id = String.valueOf(practicaT.getPrtid()); tipo = "practicataller"; } if (obj instanceof Practicascampo) { practicaC = (Practicascampo) obj; nombre = practicaC.getPrcnombre(); horas = String.valueOf(practicaC.getPrchoras()); porcentajeAvance = String.valueOf(practicaC.getPrcvalorPorcentaje()); unidadId = String.valueOf(practicaC.getPrcid()); numero = String.valueOf(practicaC.getPrcnumero()); sumar = String.valueOf(practicaC.getPrcvalorPorcentaje()); id = String.valueOf(practicaC.getPrcid()); tipo = "practicaCampo"; } } @Override public int hashCode() { int hash = 3; hash = 37 * hash + Objects.hashCode(this.unidad); hash = 37 * hash + Objects.hashCode(this.temaUnidad); hash = 37 * hash + Objects.hashCode(this.subTema); hash = 37 * hash + Objects.hashCode(this.nombre); hash = 37 * hash + Objects.hashCode(this.subtemaId); hash = 37 * hash + Objects.hashCode(this.numero); hash = 37 * hash + Objects.hashCode(this.horas); hash = 37 * hash + Objects.hashCode(this.unidadId); hash = 37 * hash + Objects.hashCode(this.temaId); hash = 37 * hash + Objects.hashCode(this.tipo); hash = 37 * hash + Objects.hashCode(this.practicaL); hash = 37 * hash + Objects.hashCode(this.practicaT); hash = 37 * hash + Objects.hashCode(this.practicaC); hash = 37 * hash + Objects.hashCode(this.observaciones); hash = 37 * hash + Objects.hashCode(this.porcentajeAvance); hash = 37 * hash + Objects.hashCode(this.sumar); hash = 37 * hash + (this.impartido ? 1 : 0); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final NodoMultiClass other = (NodoMultiClass) obj; if (!Objects.equals(this.unidad, other.unidad)) { return false; } if (!Objects.equals(this.temaUnidad, other.temaUnidad)) { return false; } if (!Objects.equals(this.subTema, other.subTema)) { return false; } if (!Objects.equals(this.nombre, other.nombre)) { return false; } if (!Objects.equals(this.subtemaId, other.subtemaId)) { return false; } if (!Objects.equals(this.numero, other.numero)) { return false; } if (!Objects.equals(this.horas, other.horas)) { return false; } if (!Objects.equals(this.unidadId, other.unidadId)) { return false; } if (!Objects.equals(this.temaId, other.temaId)) { return false; } if (!Objects.equals(this.tipo, other.tipo)) { return false; } if (!Objects.equals(this.practicaL, other.practicaL)) { return false; } if (!Objects.equals(this.practicaT, other.practicaT)) { return false; } if (!Objects.equals(this.practicaC, other.practicaC)) { return false; } if (!Objects.equals(this.observaciones, other.observaciones)) { return false; } if (!Objects.equals(this.porcentajeAvance, other.porcentajeAvance)) { return false; } if (!Objects.equals(this.sumar, other.sumar)) { return false; } if (this.impartido != other.impartido) { return false; } return true; } @Override public String toString() { if (observaciones.isEmpty() || observaciones == null) { observaciones = " "; } return tipo + "-//-" + unidadId + "-//-" + temaId + "-//-" + subtemaId + "-//-" + nombre + "-//-" + sumar + "-//-" + observaciones; } @Override public int compareTo(NodoMultiClass document) { return this.getNombre().compareTo(document.getNombre()); } }
UABCAvanTI/AvanTI-SIRACT
Siract/src/java/mx/avanti/siract/application/helper/NodoMultiClass.java
Java
gpl-2.0
11,590
/* * Copyright (C) 2010-2012 Team XBMC * http://www.xbmc.org * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #ifndef UINT16_MAX #define UINT16_MAX (65535U) #endif #include "BitstreamConverter.h" void CBitstreamConverter::bits_reader_set( bits_reader_t *br, uint8_t *buf, int len ) { br->buffer = br->start = buf; br->offbits = 0; br->length = len; br->oflow = 0; } uint32_t CBitstreamConverter::read_bits( bits_reader_t *br, int nbits ) { int i, nbytes; uint32_t ret = 0; uint8_t *buf; buf = br->buffer; nbytes = (br->offbits + nbits)/8; if ( ((br->offbits + nbits) %8 ) > 0 ) nbytes++; if ( (buf + nbytes) > (br->start + br->length) ) { br->oflow = 1; return 0; } for ( i=0; i<nbytes; i++ ) ret += buf[i]<<((nbytes-i-1)*8); i = (4-nbytes)*8+br->offbits; ret = ((ret<<i)>>i)>>((nbytes*8)-nbits-br->offbits); br->offbits += nbits; br->buffer += br->offbits / 8; br->offbits %= 8; return ret; } void CBitstreamConverter::skip_bits( bits_reader_t *br, int nbits ) { br->offbits += nbits; br->buffer += br->offbits / 8; br->offbits %= 8; if ( br->buffer > (br->start + br->length) ) { br->oflow = 1; } } uint32_t CBitstreamConverter::get_bits( bits_reader_t *br, int nbits ) { int i, nbytes; uint32_t ret = 0; uint8_t *buf; buf = br->buffer; nbytes = (br->offbits + nbits)/8; if ( ((br->offbits + nbits) %8 ) > 0 ) nbytes++; if ( (buf + nbytes) > (br->start + br->length) ) { br->oflow = 1; return 0; } for ( i=0; i<nbytes; i++ ) ret += buf[i]<<((nbytes-i-1)*8); i = (4-nbytes)*8+br->offbits; ret = ((ret<<i)>>i)>>((nbytes*8)-nbits-br->offbits); return ret; } //////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////// // GStreamer h264 parser // Copyright (C) 2005 Michal Benes <michal.benes@itonis.tv> // (C) 2008 Wim Taymans <wim.taymans@gmail.com> // gsth264parse.c: // * License as published by the Free Software Foundation; either // * version 2.1 of the License, or (at your option) any later version. void CBitstreamConverter::nal_bs_init(nal_bitstream *bs, const uint8_t *data, size_t size) { bs->data = data; bs->end = data + size; bs->head = 0; // fill with something other than 0 to detect // emulation prevention bytes bs->cache = 0xffffffff; } uint32_t CBitstreamConverter::nal_bs_read(nal_bitstream *bs, int n) { uint32_t res = 0; int shift; if (n == 0) return res; // fill up the cache if we need to while (bs->head < n) { uint8_t a_byte; bool check_three_byte; check_three_byte = true; next_byte: if (bs->data >= bs->end) { // we're at the end, can't produce more than head number of bits n = bs->head; break; } // get the byte, this can be an emulation_prevention_three_byte that we need // to ignore. a_byte = *bs->data++; if (check_three_byte && a_byte == 0x03 && ((bs->cache & 0xffff) == 0)) { // next byte goes unconditionally to the cache, even if it's 0x03 check_three_byte = false; goto next_byte; } // shift bytes in cache, moving the head bits of the cache left bs->cache = (bs->cache << 8) | a_byte; bs->head += 8; } // bring the required bits down and truncate if ((shift = bs->head - n) > 0) res = bs->cache >> shift; else res = bs->cache; // mask out required bits if (n < 32) res &= (1 << n) - 1; bs->head = shift; return res; } bool CBitstreamConverter::nal_bs_eos(nal_bitstream *bs) { return (bs->data >= bs->end) && (bs->head == 0); } // read unsigned Exp-Golomb code int CBitstreamConverter::nal_bs_read_ue(nal_bitstream *bs) { int i = 0; while (nal_bs_read(bs, 1) == 0 && !nal_bs_eos(bs) && i < 32) i++; return ((1 << i) - 1 + nal_bs_read(bs, i)); } void CBitstreamConverter::parseh264_sps(uint8_t *sps, uint32_t sps_size, bool *interlaced, int32_t *max_ref_frames) { nal_bitstream bs; sps_info_struct sps_info; nal_bs_init(&bs, sps, sps_size); sps_info.profile_idc = nal_bs_read(&bs, 8); nal_bs_read(&bs, 1); // constraint_set0_flag nal_bs_read(&bs, 1); // constraint_set1_flag nal_bs_read(&bs, 1); // constraint_set2_flag nal_bs_read(&bs, 1); // constraint_set3_flag nal_bs_read(&bs, 4); // reserved sps_info.level_idc = nal_bs_read(&bs, 8); sps_info.sps_id = nal_bs_read_ue(&bs); if (sps_info.profile_idc == 100 || sps_info.profile_idc == 110 || sps_info.profile_idc == 122 || sps_info.profile_idc == 244 || sps_info.profile_idc == 44 || sps_info.profile_idc == 83 || sps_info.profile_idc == 86) { sps_info.chroma_format_idc = nal_bs_read_ue(&bs); if (sps_info.chroma_format_idc == 3) sps_info.separate_colour_plane_flag = nal_bs_read(&bs, 1); sps_info.bit_depth_luma_minus8 = nal_bs_read_ue(&bs); sps_info.bit_depth_chroma_minus8 = nal_bs_read_ue(&bs); sps_info.qpprime_y_zero_transform_bypass_flag = nal_bs_read(&bs, 1); sps_info.seq_scaling_matrix_present_flag = nal_bs_read (&bs, 1); if (sps_info.seq_scaling_matrix_present_flag) { /* TODO: unfinished */ } } sps_info.log2_max_frame_num_minus4 = nal_bs_read_ue(&bs); if (sps_info.log2_max_frame_num_minus4 > 12) { // must be between 0 and 12 return; } sps_info.pic_order_cnt_type = nal_bs_read_ue(&bs); if (sps_info.pic_order_cnt_type == 0) { sps_info.log2_max_pic_order_cnt_lsb_minus4 = nal_bs_read_ue(&bs); } else if (sps_info.pic_order_cnt_type == 1) { // TODO: unfinished /* delta_pic_order_always_zero_flag = gst_nal_bs_read (bs, 1); offset_for_non_ref_pic = gst_nal_bs_read_se (bs); offset_for_top_to_bottom_field = gst_nal_bs_read_se (bs); num_ref_frames_in_pic_order_cnt_cycle = gst_nal_bs_read_ue (bs); for( i = 0; i < num_ref_frames_in_pic_order_cnt_cycle; i++ ) offset_for_ref_frame[i] = gst_nal_bs_read_se (bs); */ } sps_info.max_num_ref_frames = nal_bs_read_ue(&bs); sps_info.gaps_in_frame_num_value_allowed_flag = nal_bs_read(&bs, 1); sps_info.pic_width_in_mbs_minus1 = nal_bs_read_ue(&bs); sps_info.pic_height_in_map_units_minus1 = nal_bs_read_ue(&bs); sps_info.frame_mbs_only_flag = nal_bs_read(&bs, 1); if (!sps_info.frame_mbs_only_flag) sps_info.mb_adaptive_frame_field_flag = nal_bs_read(&bs, 1); sps_info.direct_8x8_inference_flag = nal_bs_read(&bs, 1); sps_info.frame_cropping_flag = nal_bs_read(&bs, 1); if (sps_info.frame_cropping_flag) { sps_info.frame_crop_left_offset = nal_bs_read_ue(&bs); sps_info.frame_crop_right_offset = nal_bs_read_ue(&bs); sps_info.frame_crop_top_offset = nal_bs_read_ue(&bs); sps_info.frame_crop_bottom_offset = nal_bs_read_ue(&bs); } *interlaced = !sps_info.frame_mbs_only_flag; *max_ref_frames = sps_info.max_num_ref_frames; } const uint8_t *CBitstreamConverter::avc_find_startcode_internal(const uint8_t *p, const uint8_t *end) { const uint8_t *a = p + 4 - ((intptr_t)p & 3); for (end -= 3; p < a && p < end; p++) { if (p[0] == 0 && p[1] == 0 && p[2] == 1) return p; } for (end -= 3; p < end; p += 4) { uint32_t x = *(const uint32_t*)p; if ((x - 0x01010101) & (~x) & 0x80808080) // generic { if (p[1] == 0) { if (p[0] == 0 && p[2] == 1) return p; if (p[2] == 0 && p[3] == 1) return p+1; } if (p[3] == 0) { if (p[2] == 0 && p[4] == 1) return p+2; if (p[4] == 0 && p[5] == 1) return p+3; } } } for (end += 3; p < end; p++) { if (p[0] == 0 && p[1] == 0 && p[2] == 1) return p; } return end + 3; } const uint8_t *CBitstreamConverter::avc_find_startcode(const uint8_t *p, const uint8_t *end) { const uint8_t *out= avc_find_startcode_internal(p, end); if (p<out && out<end && !out[-1]) out--; return out; } const int CBitstreamConverter::avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size) { const uint8_t *p = buf_in; const uint8_t *end = p + size; const uint8_t *nal_start, *nal_end; size = 0; nal_start = avc_find_startcode(p, end); for (;;) { while (nal_start < end && !*(nal_start++)); if (nal_start == end) break; nal_end = avc_find_startcode(nal_start, end); m_dllAvFormat->avio_wb32(pb, nal_end - nal_start); m_dllAvFormat->avio_write(pb, nal_start, nal_end - nal_start); size += 4 + nal_end - nal_start; nal_start = nal_end; } return size; } const int CBitstreamConverter::avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) { AVIOContext *pb; int ret = m_dllAvFormat->avio_open_dyn_buf(&pb); if (ret < 0) return ret; avc_parse_nal_units(pb, buf_in, *size); m_dllAvUtil->av_freep(buf); *size = m_dllAvFormat->avio_close_dyn_buf(pb, buf); return 0; } const int CBitstreamConverter::isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) { // extradata from bytestream h264, convert to avcC atom data for bitstream if (len > 6) { /* check for h264 start code */ if (BS_RB32(data) == 0x00000001 || BS_RB24(data) == 0x000001) { uint8_t *buf=NULL, *end, *start; uint32_t sps_size=0, pps_size=0; uint8_t *sps=0, *pps=0; int ret = avc_parse_nal_units_buf(data, &buf, &len); if (ret < 0) return ret; start = buf; end = buf + len; /* look for sps and pps */ while (end - buf > 4) { uint32_t size; uint8_t nal_type; size = FFMIN(BS_RB32(buf), end - buf - 4); buf += 4; nal_type = buf[0] & 0x1f; if (nal_type == 7) /* SPS */ { sps = buf; sps_size = size; } else if (nal_type == 8) /* PPS */ { pps = buf; pps_size = size; } buf += size; } if (!sps || !pps || sps_size < 4 || sps_size > UINT16_MAX || pps_size > UINT16_MAX) assert(0); m_dllAvFormat->avio_w8(pb, 1); /* version */ m_dllAvFormat->avio_w8(pb, sps[1]); /* profile */ m_dllAvFormat->avio_w8(pb, sps[2]); /* profile compat */ m_dllAvFormat->avio_w8(pb, sps[3]); /* level */ m_dllAvFormat->avio_w8(pb, 0xff); /* 6 bits reserved (111111) + 2 bits nal size length - 1 (11) */ m_dllAvFormat->avio_w8(pb, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps (00001) */ m_dllAvFormat->avio_wb16(pb, sps_size); m_dllAvFormat->avio_write(pb, sps, sps_size); if (pps) { m_dllAvFormat->avio_w8(pb, 1); /* number of pps */ m_dllAvFormat->avio_wb16(pb, pps_size); m_dllAvFormat->avio_write(pb, pps, pps_size); } m_dllAvUtil->av_free(start); } else { m_dllAvFormat->avio_write(pb, data, len); } } return 0; } CBitstreamConverter::CBitstreamConverter() { m_convert_bitstream = false; m_convertBuffer = NULL; m_convertSize = 0; m_inputBuffer = NULL; m_inputSize = 0; m_to_annexb = false; m_extradata = NULL; m_extrasize = 0; m_convert_3byteTo4byteNALSize = false; m_dllAvUtil = NULL; m_dllAvFormat = NULL; m_convert_bytestream = false; } CBitstreamConverter::~CBitstreamConverter() { Close(); } bool CBitstreamConverter::Open(enum CodecID codec, uint8_t *in_extradata, int in_extrasize, bool to_annexb) { m_to_annexb = to_annexb; m_codec = codec; switch(codec) { case CODEC_ID_H264: if (in_extrasize < 7 || in_extradata == NULL) { CLog::Log(LOGERROR, "CBitstreamConverter::Open avcC data too small or missing\n"); return false; } // valid avcC data (bitstream) always starts with the value 1 (version) if(m_to_annexb) { if ( *(char*)in_extradata == 1 ) { CLog::Log(LOGINFO, "CBitstreamConverter::Open bitstream to annexb init\n"); m_convert_bitstream = BitstreamConvertInit(in_extradata, in_extrasize); return true; } } else { // valid avcC atom data always starts with the value 1 (version) if ( *in_extradata != 1 ) { if (in_extradata[0] == 0 && in_extradata[1] == 0 && in_extradata[2] == 0 && in_extradata[3] == 1) { CLog::Log(LOGINFO, "CBitstreamConverter::Open annexb to bitstream init\n"); // video content is from x264 or from bytestream h264 (AnnexB format) // NAL reformating to bitstream format needed m_dllAvUtil = new DllAvUtil; m_dllAvFormat = new DllAvFormat; if (!m_dllAvUtil->Load() || !m_dllAvFormat->Load()) return false; AVIOContext *pb; if (m_dllAvFormat->avio_open_dyn_buf(&pb) < 0) return false; m_convert_bytestream = true; // create a valid avcC atom data from ffmpeg's extradata isom_write_avcc(pb, in_extradata, in_extrasize); // unhook from ffmpeg's extradata in_extradata = NULL; // extract the avcC atom data into extradata then write it into avcCData for VDADecoder in_extrasize = m_dllAvFormat->avio_close_dyn_buf(pb, &in_extradata); // make a copy of extradata contents m_extradata = (uint8_t *)malloc(in_extrasize); memcpy(m_extradata, in_extradata, in_extrasize); m_extrasize = in_extrasize; // done with the converted extradata, we MUST free using av_free m_dllAvUtil->av_free(in_extradata); return true; } else { CLog::Log(LOGNOTICE, "CBitstreamConverter::Open invalid avcC atom data"); return false; } } else { if (in_extradata[4] == 0xFE) { CLog::Log(LOGINFO, "CBitstreamConverter::Open annexb to bitstream init 3 byte to 4 byte nal\n"); // video content is from so silly encoder that think 3 byte NAL sizes // are valid, setup to convert 3 byte NAL sizes to 4 byte. m_dllAvUtil = new DllAvUtil; m_dllAvFormat = new DllAvFormat; if (!m_dllAvUtil->Load() || !m_dllAvFormat->Load()) return false; in_extradata[4] = 0xFF; m_convert_3byteTo4byteNALSize = true; m_extradata = (uint8_t *)malloc(in_extrasize); memcpy(m_extradata, in_extradata, in_extrasize); m_extrasize = in_extrasize; return true; } } } return false; break; default: return false; break; } return false; } void CBitstreamConverter::Close(void) { if (m_convert_bitstream) { if (m_sps_pps_context.sps_pps_data) { free(m_sps_pps_context.sps_pps_data); m_sps_pps_context.sps_pps_data = NULL; } if(m_convertBuffer) free(m_convertBuffer); m_convertSize = 0; } if (m_convert_bytestream) { if(m_convertBuffer) { m_dllAvUtil->av_free(m_convertBuffer); m_convertBuffer = NULL; } m_convertSize = 0; } if(m_extradata) free(m_extradata); m_extradata = NULL; m_extrasize = 0; m_inputBuffer = NULL; m_inputSize = 0; m_convert_3byteTo4byteNALSize = false; m_convert_bitstream = false; if (m_dllAvUtil) { delete m_dllAvUtil; m_dllAvUtil = NULL; } if (m_dllAvFormat) { delete m_dllAvFormat; m_dllAvFormat = NULL; } } bool CBitstreamConverter::Convert(uint8_t *pData, int iSize) { if(m_convertBuffer) free(m_convertBuffer); m_convertBuffer = NULL; m_convertSize = 0; m_inputBuffer = NULL; m_inputSize = 0; if (pData) { if(m_codec == CODEC_ID_H264) { if(m_to_annexb) { int demuxer_bytes = iSize; uint8_t *demuxer_content = pData; if (m_convert_bitstream) { // convert demuxer packet from bitstream to bytestream (AnnexB) int bytestream_size = 0; uint8_t *bytestream_buff = NULL; BitstreamConvert(demuxer_content, demuxer_bytes, &bytestream_buff, &bytestream_size); if (bytestream_buff && (bytestream_size > 0)) { m_convertSize = bytestream_size; m_convertBuffer = bytestream_buff; } else { Close(); m_inputBuffer = pData; m_inputSize = iSize; CLog::Log(LOGERROR, "CBitstreamConverter::Convert error converting. disable converter\n"); } } else { m_inputBuffer = pData; m_inputSize = iSize; } return true; } else { m_inputBuffer = pData; m_inputSize = iSize; if (m_convert_bytestream) { if(m_convertBuffer) { m_dllAvUtil->av_free(m_convertBuffer); m_convertBuffer = NULL; } m_convertSize = 0; // convert demuxer packet from bytestream (AnnexB) to bitstream AVIOContext *pb; if(m_dllAvFormat->avio_open_dyn_buf(&pb) < 0) { return false; } m_convertSize = avc_parse_nal_units(pb, pData, iSize); m_convertSize = m_dllAvFormat->avio_close_dyn_buf(pb, &m_convertBuffer); } else if (m_convert_3byteTo4byteNALSize) { if(m_convertBuffer) { m_dllAvUtil->av_free(m_convertBuffer); m_convertBuffer = NULL; } m_convertSize = 0; // convert demuxer packet from 3 byte NAL sizes to 4 byte AVIOContext *pb; if (m_dllAvFormat->avio_open_dyn_buf(&pb) < 0) return false; uint32_t nal_size; uint8_t *end = pData + iSize; uint8_t *nal_start = pData; while (nal_start < end) { nal_size = BS_RB24(nal_start); m_dllAvFormat->avio_wb16(pb, nal_size); nal_start += 3; m_dllAvFormat->avio_write(pb, nal_start, nal_size); nal_start += nal_size; } m_convertSize = m_dllAvFormat->avio_close_dyn_buf(pb, &m_convertBuffer); } return true; } } } return false; } uint8_t *CBitstreamConverter::GetConvertBuffer() { if((m_convert_bitstream || m_convert_bytestream || m_convert_3byteTo4byteNALSize) && m_convertBuffer != NULL) return m_convertBuffer; else return m_inputBuffer; } int CBitstreamConverter::GetConvertSize() { if((m_convert_bitstream || m_convert_bytestream || m_convert_3byteTo4byteNALSize) && m_convertBuffer != NULL) return m_convertSize; else return m_inputSize; } uint8_t *CBitstreamConverter::GetExtraData() { return m_extradata; } int CBitstreamConverter::GetExtraSize() { return m_extrasize; } bool CBitstreamConverter::BitstreamConvertInit(void *in_extradata, int in_extrasize) { // based on h264_mp4toannexb_bsf.c (ffmpeg) // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr> // and Licensed GPL 2.1 or greater m_sps_pps_size = 0; m_sps_pps_context.sps_pps_data = NULL; // nothing to filter if (!in_extradata || in_extrasize < 6) return false; uint16_t unit_size; uint32_t total_size = 0; uint8_t *out = NULL, unit_nb, sps_done = 0; const uint8_t *extradata = (uint8_t*)in_extradata + 4; static const uint8_t nalu_header[4] = {0, 0, 0, 1}; // retrieve length coded size m_sps_pps_context.length_size = (*extradata++ & 0x3) + 1; if (m_sps_pps_context.length_size == 3) return false; // retrieve sps and pps unit(s) unit_nb = *extradata++ & 0x1f; // number of sps unit(s) if (!unit_nb) { unit_nb = *extradata++; // number of pps unit(s) sps_done++; } while (unit_nb--) { unit_size = extradata[0] << 8 | extradata[1]; total_size += unit_size + 4; if ( (extradata + 2 + unit_size) > ((uint8_t*)in_extradata + in_extrasize) ) { free(out); return false; } out = (uint8_t*)realloc(out, total_size); if (!out) return false; memcpy(out + total_size - unit_size - 4, nalu_header, 4); memcpy(out + total_size - unit_size, extradata + 2, unit_size); extradata += 2 + unit_size; if (!unit_nb && !sps_done++) unit_nb = *extradata++; // number of pps unit(s) } m_sps_pps_context.sps_pps_data = out; m_sps_pps_context.size = total_size; m_sps_pps_context.first_idr = 1; return true; } bool CBitstreamConverter::BitstreamConvert(uint8_t* pData, int iSize, uint8_t **poutbuf, int *poutbuf_size) { // based on h264_mp4toannexb_bsf.c (ffmpeg) // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr> // and Licensed GPL 2.1 or greater uint8_t *buf = pData; uint32_t buf_size = iSize; uint8_t unit_type; int32_t nal_size; uint32_t cumul_size = 0; const uint8_t *buf_end = buf + buf_size; do { if (buf + m_sps_pps_context.length_size > buf_end) goto fail; if (m_sps_pps_context.length_size == 1) nal_size = buf[0]; else if (m_sps_pps_context.length_size == 2) nal_size = buf[0] << 8 | buf[1]; else nal_size = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3]; buf += m_sps_pps_context.length_size; unit_type = *buf & 0x1f; if (buf + nal_size > buf_end || nal_size < 0) goto fail; // prepend only to the first type 5 NAL unit of an IDR picture if (m_sps_pps_context.first_idr && unit_type == 5) { BitstreamAllocAndCopy(poutbuf, poutbuf_size, m_sps_pps_context.sps_pps_data, m_sps_pps_context.size, buf, nal_size); m_sps_pps_context.first_idr = 0; } else { BitstreamAllocAndCopy(poutbuf, poutbuf_size, NULL, 0, buf, nal_size); if (!m_sps_pps_context.first_idr && unit_type == 1) m_sps_pps_context.first_idr = 1; } buf += nal_size; cumul_size += nal_size + m_sps_pps_context.length_size; } while (cumul_size < buf_size); return true; fail: free(*poutbuf); *poutbuf = NULL; *poutbuf_size = 0; return false; } void CBitstreamConverter::BitstreamAllocAndCopy( uint8_t **poutbuf, int *poutbuf_size, const uint8_t *sps_pps, uint32_t sps_pps_size, const uint8_t *in, uint32_t in_size) { // based on h264_mp4toannexb_bsf.c (ffmpeg) // which is Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr> // and Licensed GPL 2.1 or greater #define CHD_WB32(p, d) { \ ((uint8_t*)(p))[3] = (d); \ ((uint8_t*)(p))[2] = (d) >> 8; \ ((uint8_t*)(p))[1] = (d) >> 16; \ ((uint8_t*)(p))[0] = (d) >> 24; } uint32_t offset = *poutbuf_size; uint8_t nal_header_size = offset ? 3 : 4; *poutbuf_size += sps_pps_size + in_size + nal_header_size; *poutbuf = (uint8_t*)realloc(*poutbuf, *poutbuf_size); if (sps_pps) memcpy(*poutbuf + offset, sps_pps, sps_pps_size); memcpy(*poutbuf + sps_pps_size + nal_header_size + offset, in, in_size); if (!offset) { CHD_WB32(*poutbuf + sps_pps_size, 1); } else { (*poutbuf + offset + sps_pps_size)[0] = 0; (*poutbuf + offset + sps_pps_size)[1] = 0; (*poutbuf + offset + sps_pps_size)[2] = 1; } }
mekinik232/ambipi
xbmc/utils/BitstreamConverter.cpp
C++
gpl-2.0
24,207
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/> <title>领域-研发埠|yanfabu.com-研发创新互动平台</title> <meta name="Keywords" content="CAE,yanfabu.com,研发埠,研发部,Open,Innovation,流体,光学,化学,机械工程,冶金工程,电子,兵器科学,大学,文献,开放,创新"> <meta name="Description" content="研发埠,yanfabu.com-Open,Innovation,开放,创新,研发创新互动平台"> <meta name="author" content=""> <!-- default styles --> <link href="css/bootcss.css" rel="stylesheet"> <link href="css/style.css" rel="stylesheet"> <link href="css/custom.css" rel="stylesheet"> <!--[if lte IE 7]><link href="/css/font-ie7.css" rel="stylesheet"><![endif]--> <!--[if IE]><script src="js/html5.js"></script><![endif]--> <link rel="shortcut icon" href="assets/ico/favicon.ico"> <link rel="apple-touch-icon-precomposed" sizes="144x144" href="ico/apple-touch-icon-144-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="114x114" href="ico/apple-touch-icon-114-precomposed.png"> <link rel="apple-touch-icon-precomposed" sizes="72x72" href="ico/apple-touch-icon-72-precomposed.png"> <link rel="apple-touch-icon-precomposed" href="ico/apple-touch-icon-57-precomposed.png"> </head> <body class="g-body"> <!--header--> <?php include 'library/index_header.php'; ?> <!-- end header--> <div class="g_t_line"> <div class="container"> <div class="breadcrumb-nav" > <div class="pull-right"> <form class="side-search" action="#"> <input type="text" name="" value="" placeholder="在结果中查询" class="top-search-ipt input-block-level"> <input type="button" name="" value="" class="top-search-btn"> </form> </div> <a href="#" class="f-column">检索</a>&nbsp;/&nbsp;<span>查询结果(102)</span></div> <div class="g-notop-line b-sbg clearfix"> <aside class="ui-sidebar pull-left topic-aside"> <div class="wrapper-box"> <div class="title-header g_b_line"><h3>相关检索</h3></div> <ul class="list list-related"> <li><a href="#" title="">轻兵器</a></li> <li><a href="#" title="">日本核泄漏</a></li> <li><a href="#" title="">高钙奶更补钙</a></li> <li><a href="#" title="">越吃越瘦的食物</a></li> <li><a href="#" title="">一支雪糕加入19种添加剂</a></li> <li><a href="#" title="">疫苗,没我们想得那么脆弱</a></li> <li><a href="#" title="">需要担心自来水中的氯需要担心自来水中的氯</a></li> </ul> <div class="title-header g_b_line top20"><h3>日期</h3></div> <ul class="list"> <li>•&nbsp;<a href="#" title="">近一个月</a></li> <li>•&nbsp;<a href="#" title="">近三个月</a></li> <li>•&nbsp;<a href="#" title="">近六个月</a></li> <li>•&nbsp;<a href="#" title="">近一年</a></li> </ul> <div class="title-header g_b_line top20"><a href="#" class="pull-right more-link">显示全部</a><h3>最近浏览</h3></div> <ul class="list history-list"> <li> <a class="question_link" target="_blank" href="#">换季应该吃什么食物好呢?</a> <div class="media-bar"><span class="icon-comment"></span><font class="b-font">6</font>个回答</div> </li> <li> <a class="question_link" target="_blank" href="#">SRC_RC竖向混合结构转换柱破坏机理?</a> <div class="answer-bar"> <span class="stars-rating rater1"></span> <font class="b-font">5</font>人评价</div> </li> <li> <a class="question_link" target="_blank" href="#">Bernoulli_Euler梁横向振动固有频率的轴力影响系数</a> <div class="answer-bar"> <span class="stars-rating rater1"></span> <font class="b-font">2</font>人评价</div> </li> <li> <a class="question_link" target="_blank" href="#">如何鉴别塑料袋是否是食品用塑料袋?</a> <div class="media-bar"><span class="icon-comment"></span><font class="b-font">2</font>个回答</div> </li> <li> <a class="question_link" target="_blank" href="#">Bernoulli_Euler梁横向振动固有频率的轴力影响系数</a> <div class="answer-bar"> <span class="stars-rating rater1"></span> <font class="b-font">2</font>人评价</div> </li> </ul> </div> </aside><!-- end ui-sidebar --> <div class="main-panel w-bg l-border"> <div class="wrapper-box"> <div class="tab-content min_h760" > <!-- 没有数据显示下面内容 --> <div class="no_data"> <h3>亲!是否辛苦找了一圈,居然没找到您要结果。</h3> <h3>那赶紧来<a href="#" class="label label-info">提问</a>,一旦成为精选问题,您将获得<font class="l-font">神秘礼物</font>哟~~</h3> </div> <div class="header-title g_b_line top10 layer-rel" > <h2>领域精选</h2> <div class="hot-tabbox" id="hoTab"> <a href="#tab1" class="active"><b>FDTD Solutions</b><span></span></a>| <a href="#tab2"><b>脚本语言</b><span></span></a>| <a href=""><b>engine</b><span></span></a>| <a href=""><b>纳米光学</b><span></span></a>| <a href=""><b>S7-300PL</b><span></span></a> </div> </div> <div class="slide-listbox" id="slide-hot"> <ul class="hot-list" id="tab1"> <li class="media grid-1-3 first"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3 first"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> </ul> <ul class="hot-list hide" id="tab2" > <li class="media grid-1-3 first"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">2信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body" > <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3 first"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> <li class="media grid-1-3"> <div class="p5"> <a class="pull-left" href="#"> <img class="avatar-img" src="images/photo/no_topic.png" width="80" height="80"> </a> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">信息与系统科学</a></h4> <div class="media-detail">研究信息技术及系统控制的理论、方法、技术及其工程应用。</div> <div class="media-bar"> <a href="" title="" class="add-btn-link"><span class="link-icon">+</span>加关注</a> </div> </div> <!-- end:media-body --> </div> </li> </ul> </div> <!-- 有检索结果 显示如下 --> <div class="media-content msg-list "> <!-- start:feed-item 01 问题--> <div class="media"> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">换季应该吃什么食物好呢?</a></h4> <div class="media-detail">春季可以选择水果1.菠萝 含有丰富维生素B、协助肝脏代谢脂肪,维生素纤维含量很高,可以增进肠胃蠕动,协助脂肪排泄,适合脂肪肝、高血压、肥胖者…</div> <div class="media-bar"> <span class="time">03-29 18:40</span> <a href="" title="领域"><span class="icon-user-md"></span>医学与生物学</a> <a href="" title="关注"><span class="ui-icon icon-atten"></span>3 人关注</a> <a href="" title="回答"><span class="icon-comment"></span>2 个回答</a> </div><!--end:media-bar--> </div><!--end:media-body--> </div> <!-- start:feed-item 02 问题--> <div class="media"> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">换季应该吃什么食物好呢?</a></h4> <div class="media-detail">春季可以选择水果1.菠萝 含有丰富维生素B、协助肝脏代谢脂肪,维生素纤维含量很高,可以增进肠胃蠕动,协助脂肪排泄,适合脂肪肝、高血压、肥胖者…</div> <div class="media-bar"> <span class="time">03-29 18:40</span> <a href="" title="领域"><span class="icon-user-md"></span>医学与生物学</a> <a href="" title="关注"><span class="ui-icon icon-atten"></span>3 人关注</a> <a href="" title="回答"><span class="ui-icon icon-comment"></span>2 个回答</a> </div><!--end:media-bar--> </div><!--end:media-body--> </div> <!-- start:feed-item 03 讨论 --> <div class="media"> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">换季应该吃什么食物好呢?</a></h4> <div class="media-detail"> <ul class="avatar-list"> <li><a href="data/user_pop_info.php" title="用户1" id="visitors_1" class="avatar" data-toggle="popover"data-original-title="用户1"><img alt="" src="images/photo/no_avatar_small.jpg"></a></li> <li><a href="data/user_pop_info.php" title="" id="visitors_2" class="avatar" data-toggle="popover" data-original-title="用户2"><img alt="" src="images/photo/no_avatar_small.jpg"></a></li> <li><a href="data/user_pop_info.php" title="" id="visitors_3" class="avatar" data-toggle="popover" data-original-title="用户3"><img alt="" src="images/photo/no_avatar_small.jpg"></a></li> <li><a href="data/user_pop_info.php" title="" id="visitors_4" class="avatar" data-toggle="popover" data-original-title="用户4"><img alt="" src="images/photo/no_avatar_small.jpg"></a></li> <li><a href="data/user_pop_info.php" title="" id="visitors_5" class="avatar" data-toggle="popover" data-original-title="用户5"><img alt="" src="images/photo/no_avatar_small.jpg"></a></li> <li><a href="data/user_pop_info.php" title="" id="visitors_6" class="avatar" data-toggle="popover" data-original-title="用户6"><img alt="" src="images/photo/no_avatar_small.jpg"></a></li> </ul> </div> <div class="media-bar"> <span class="time">03-29 18:40</span> <a href="" title="领域"><span class="icon-user-md"></span>医学与生物学</a> <a href="" title="申请加入"><span class="icon-user-add"></span>申请加入</a> </div><!--end:media-bar--> </div><!--end:media-body--> </div> <!-- start:feed-item 04 文档 --> <div class="media"> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#"><span class="file-txt"></span>组态王与PLC S7-200 建立GPRS 无线通信</a></h4> <div class="media-detail">文档简介…</div> <div class="media-bar"> <span class="time">03-29 18:40</span> <span class="stars-rating rater3"></span><font class="b-font">5</font>人评价 <a href="" title="回答问题"><span class="ui-icon icon-share"></span>下载文档</a></div><!--end:media-bar--> </div><!--end:media-body--> </div> <!-- start:feed-item 05 日志 --> <div class="media"> <div class="media-body"> <h4 class="media-heading"><a class="question_link" target="_blank" href="#">漫谈弓箭:更新第一部:弓箭史话</a></h4> <div class="media-detail">在征服者威廉到来之前,盎格鲁撒克时代的不列颠历史是模糊的,那些上古的英雄故事似乎总是和神话混合在一起。此前的英伦三岛,浪漫与野蛮同行。然而诺曼征服以来,欧洲大陆的影响重塑了不列颠的风貌,英国那至今为人乐道的夹杂着古典浪漫和现代实用主义的风气差不多根植于此。与此同时,一种影响中世纪历史数百年的武器也从此登上历史舞台——长弓,从此被大规模的应用于战争。事实上,黑斯廷斯战役之前11年,也就是1055年,进入威尔士山地的英格兰骑兵们就尝到过这种武器的厉害,他们被准确而穿透力强劲的箭矢所伏击(Ref.1)。</div> <div class="media-bar"> <span class="time">03-29 18:40</span> <a href="" title="默认分类">分类:默认分类</a> <a href="" title="回答问题"><span class="icon-chat-1"></span>评论(12)</a> </div> </div><!--end:media-body--> </div><!--end:media--> <!-- start:feed-item 06 文档 --> <div class="media"> <div class="media-body"> <h4 class="media-heading"> <a class="question_link" target="_blank" href="#"><span class="file-doc"></span>组态王与PLC S7-200 建立GPRS 无线通信</a></h4> <div class="media-detail">文档简介…</div> <div class="media-bar"> <span class="time">03-29 18:40</span> <span class="stars-rating rater3"></span><font class="b-font">5</font>人评价 <a href="" title="回答问题"><span class="ui-icon icon-share"></span>下载文档</a></div><!--end:media-bar--> </div><!--end:media-body--> </div> <?php include 'library/pagination.php'; ?> </div> </div> </div><!-- end page-wrapper --> </div><!-- end main-panel --> </div> <!-- w-body --> </div> <!-- end:container --> </div> <!-- end:g_t_line --> <?php include 'library/footer.php'; ?> <script type="text/javascript" src="js/require.js"></script> <script type="text/javascript" > requirejs.config({ paths: { 'jquery': 'js/jquery', 'underscore': 'js/underscore/underscore-min', 'bootstrap': 'js/bootcss', 'slider': 'js/slider', 'fuelux':'js/fuelux' } }); require(['jquery','js/mainjs'], function ($){ $('#hoTab a').click(function (e){ var id = $(this).attr('href'); id = id && id.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 $(this).addClass("active").siblings().removeClass("active"); $(id).removeClass("hide").siblings().addClass("hide"); }); }); </script> </body> </html>
aimeet/yanfabuUI
search_list.php
PHP
gpl-2.0
21,651
package ua.org.project.util.json; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import java.io.IOException; /** * Created by Dmitry Petrov on 26.06.14. */ @Service("jodaDateTimeSerializer") public class JodaDateTimeSerializer extends JsonSerializer<DateTime> { private MessageSource messageSource; @Autowired public void setMessageSource(MessageSource messageSource) { this.messageSource = messageSource; } public MessageSource getMessageSource() { return messageSource; } @Override public void serialize(DateTime value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { String dateFormatPattern = messageSource.getMessage( "date_format_pattern_comments", new Object[]{}, LocaleContextHolder.getLocale()); String dateTimeString = ""; if (value != null) { DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern(dateFormatPattern); dateTimeString = dateTimeFormatter.print(value); } jgen.writeString(dateTimeString); } }
akvamor/blog
src/main/java/ua/org/project/util/json/JodaDateTimeSerializer.java
Java
gpl-2.0
1,669
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright 2007 University of Washington * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * Authors: Tom Henderson (tomhend@u.washington.edu) */ #include "ns3/log.h" #include "ns3/assert.h" #include "ns3/abort.h" #include "ns3/channel.h" #include "ns3/net-device.h" #include "ns3/node.h" #include "ns3/node-list.h" #include "ns3/ipv4.h" #include "ns3/bridge-net-device.h" #include "ipv4-global-routing.h" #include "global-router-interface.h" #include <vector> #include <iostream> NS_LOG_COMPONENT_DEFINE ("GlobalRouter"); namespace ns3 { // --------------------------------------------------------------------------- // // GlobalRoutingLinkRecord Implementation // // --------------------------------------------------------------------------- GlobalRoutingLinkRecord::GlobalRoutingLinkRecord () : m_linkId ("0.0.0.0"), m_linkData ("0.0.0.0"), m_linkType (Unknown), m_metric (0) { NS_LOG_FUNCTION_NOARGS (); } GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ( LinkType linkType, Ipv4Address linkId, Ipv4Address linkData, uint16_t metric) : m_linkId (linkId), m_linkData (linkData), m_linkType (linkType), m_metric (metric) { NS_LOG_FUNCTION (this << linkType << linkId << linkData << metric); } GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord () { NS_LOG_FUNCTION_NOARGS (); } Ipv4Address GlobalRoutingLinkRecord::GetLinkId (void) const { NS_LOG_FUNCTION_NOARGS (); return m_linkId; } void GlobalRoutingLinkRecord::SetLinkId (Ipv4Address addr) { NS_LOG_FUNCTION_NOARGS (); m_linkId = addr; } Ipv4Address GlobalRoutingLinkRecord::GetLinkData (void) const { NS_LOG_FUNCTION_NOARGS (); return m_linkData; } void GlobalRoutingLinkRecord::SetLinkData (Ipv4Address addr) { NS_LOG_FUNCTION_NOARGS (); m_linkData = addr; } GlobalRoutingLinkRecord::LinkType GlobalRoutingLinkRecord::GetLinkType (void) const { NS_LOG_FUNCTION_NOARGS (); return m_linkType; } void GlobalRoutingLinkRecord::SetLinkType ( GlobalRoutingLinkRecord::LinkType linkType) { NS_LOG_FUNCTION_NOARGS (); m_linkType = linkType; } uint16_t GlobalRoutingLinkRecord::GetMetric (void) const { NS_LOG_FUNCTION_NOARGS (); return m_metric; } void GlobalRoutingLinkRecord::SetMetric (uint16_t metric) { NS_LOG_FUNCTION_NOARGS (); m_metric = metric; } // --------------------------------------------------------------------------- // // GlobalRoutingLSA Implementation // // --------------------------------------------------------------------------- GlobalRoutingLSA::GlobalRoutingLSA() : m_lsType (GlobalRoutingLSA::Unknown), m_linkStateId ("0.0.0.0"), m_advertisingRtr ("0.0.0.0"), m_linkRecords (), m_networkLSANetworkMask ("0.0.0.0"), m_attachedRouters (), m_status (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED), m_node_id (0) { NS_LOG_FUNCTION_NOARGS (); } GlobalRoutingLSA::GlobalRoutingLSA ( GlobalRoutingLSA::SPFStatus status, Ipv4Address linkStateId, Ipv4Address advertisingRtr) : m_lsType (GlobalRoutingLSA::Unknown), m_linkStateId (linkStateId), m_advertisingRtr (advertisingRtr), m_linkRecords (), m_networkLSANetworkMask ("0.0.0.0"), m_attachedRouters (), m_status (status), m_node_id (0) { NS_LOG_FUNCTION (this << status << linkStateId << advertisingRtr); } GlobalRoutingLSA::GlobalRoutingLSA (GlobalRoutingLSA& lsa) : m_lsType (lsa.m_lsType), m_linkStateId (lsa.m_linkStateId), m_advertisingRtr (lsa.m_advertisingRtr), m_networkLSANetworkMask (lsa.m_networkLSANetworkMask), m_status (lsa.m_status), m_node_id (lsa.m_node_id) { NS_LOG_FUNCTION_NOARGS (); NS_ASSERT_MSG (IsEmpty (), "GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor"); CopyLinkRecords (lsa); } GlobalRoutingLSA& GlobalRoutingLSA::operator= (const GlobalRoutingLSA& lsa) { NS_LOG_FUNCTION_NOARGS (); m_lsType = lsa.m_lsType; m_linkStateId = lsa.m_linkStateId; m_advertisingRtr = lsa.m_advertisingRtr; m_networkLSANetworkMask = lsa.m_networkLSANetworkMask, m_status = lsa.m_status; m_node_id = lsa.m_node_id; ClearLinkRecords (); CopyLinkRecords (lsa); return *this; } void GlobalRoutingLSA::CopyLinkRecords (const GlobalRoutingLSA& lsa) { NS_LOG_FUNCTION_NOARGS (); for (ListOfLinkRecords_t::const_iterator i = lsa.m_linkRecords.begin (); i != lsa.m_linkRecords.end (); i++) { GlobalRoutingLinkRecord *pSrc = *i; GlobalRoutingLinkRecord *pDst = new GlobalRoutingLinkRecord; pDst->SetLinkType (pSrc->GetLinkType ()); pDst->SetLinkId (pSrc->GetLinkId ()); pDst->SetLinkData (pSrc->GetLinkData ()); pDst->SetMetric (pSrc->GetMetric ()); m_linkRecords.push_back (pDst); pDst = 0; } m_attachedRouters = lsa.m_attachedRouters; } GlobalRoutingLSA::~GlobalRoutingLSA() { NS_LOG_FUNCTION_NOARGS (); ClearLinkRecords (); } void GlobalRoutingLSA::ClearLinkRecords (void) { NS_LOG_FUNCTION_NOARGS (); for ( ListOfLinkRecords_t::iterator i = m_linkRecords.begin (); i != m_linkRecords.end (); i++) { NS_LOG_LOGIC ("Free link record"); GlobalRoutingLinkRecord *p = *i; delete p; p = 0; *i = 0; } NS_LOG_LOGIC ("Clear list"); m_linkRecords.clear (); } uint32_t GlobalRoutingLSA::AddLinkRecord (GlobalRoutingLinkRecord* lr) { NS_LOG_FUNCTION_NOARGS (); m_linkRecords.push_back (lr); return m_linkRecords.size (); } uint32_t GlobalRoutingLSA::GetNLinkRecords (void) const { NS_LOG_FUNCTION_NOARGS (); return m_linkRecords.size (); } GlobalRoutingLinkRecord * GlobalRoutingLSA::GetLinkRecord (uint32_t n) const { NS_LOG_FUNCTION_NOARGS (); uint32_t j = 0; for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin (); i != m_linkRecords.end (); i++, j++) { if (j == n) { return *i; } } NS_ASSERT_MSG (false, "GlobalRoutingLSA::GetLinkRecord (): invalid index"); return 0; } bool GlobalRoutingLSA::IsEmpty (void) const { NS_LOG_FUNCTION_NOARGS (); return m_linkRecords.size () == 0; } GlobalRoutingLSA::LSType GlobalRoutingLSA::GetLSType (void) const { NS_LOG_FUNCTION_NOARGS (); return m_lsType; } void GlobalRoutingLSA::SetLSType (GlobalRoutingLSA::LSType typ) { NS_LOG_FUNCTION_NOARGS (); m_lsType = typ; } Ipv4Address GlobalRoutingLSA::GetLinkStateId (void) const { NS_LOG_FUNCTION_NOARGS (); return m_linkStateId; } void GlobalRoutingLSA::SetLinkStateId (Ipv4Address addr) { NS_LOG_FUNCTION_NOARGS (); m_linkStateId = addr; } Ipv4Address GlobalRoutingLSA::GetAdvertisingRouter (void) const { NS_LOG_FUNCTION_NOARGS (); return m_advertisingRtr; } void GlobalRoutingLSA::SetAdvertisingRouter (Ipv4Address addr) { NS_LOG_FUNCTION_NOARGS (); m_advertisingRtr = addr; } void GlobalRoutingLSA::SetNetworkLSANetworkMask (Ipv4Mask mask) { NS_LOG_FUNCTION_NOARGS (); m_networkLSANetworkMask = mask; } Ipv4Mask GlobalRoutingLSA::GetNetworkLSANetworkMask (void) const { NS_LOG_FUNCTION_NOARGS (); return m_networkLSANetworkMask; } GlobalRoutingLSA::SPFStatus GlobalRoutingLSA::GetStatus (void) const { NS_LOG_FUNCTION_NOARGS (); return m_status; } uint32_t GlobalRoutingLSA::AddAttachedRouter (Ipv4Address addr) { NS_LOG_FUNCTION_NOARGS (); m_attachedRouters.push_back (addr); return m_attachedRouters.size (); } uint32_t GlobalRoutingLSA::GetNAttachedRouters (void) const { NS_LOG_FUNCTION_NOARGS (); return m_attachedRouters.size (); } Ipv4Address GlobalRoutingLSA::GetAttachedRouter (uint32_t n) const { NS_LOG_FUNCTION_NOARGS (); uint32_t j = 0; for ( ListOfAttachedRouters_t::const_iterator i = m_attachedRouters.begin (); i != m_attachedRouters.end (); i++, j++) { if (j == n) { return *i; } } NS_ASSERT_MSG (false, "GlobalRoutingLSA::GetAttachedRouter (): invalid index"); return Ipv4Address ("0.0.0.0"); } void GlobalRoutingLSA::SetStatus (GlobalRoutingLSA::SPFStatus status) { NS_LOG_FUNCTION_NOARGS (); m_status = status; } Ptr<Node> GlobalRoutingLSA::GetNode (void) const { NS_LOG_FUNCTION_NOARGS (); return NodeList::GetNode (m_node_id); } void GlobalRoutingLSA::SetNode (Ptr<Node> node) { NS_LOG_FUNCTION (node); m_node_id = node->GetId (); } void GlobalRoutingLSA::Print (std::ostream &os) const { os << std::endl; os << "========== Global Routing LSA ==========" << std::endl; os << "m_lsType = " << m_lsType; if (m_lsType == GlobalRoutingLSA::RouterLSA) { os << " (GlobalRoutingLSA::RouterLSA)"; } else if (m_lsType == GlobalRoutingLSA::NetworkLSA) { os << " (GlobalRoutingLSA::NetworkLSA)"; } else if (m_lsType == GlobalRoutingLSA::ASExternalLSAs) { os << " (GlobalRoutingLSA::ASExternalLSA)"; } else { os << "(Unknown LSType)"; } os << std::endl; os << "m_linkStateId = " << m_linkStateId << " (Router ID)" << std::endl; os << "m_advertisingRtr = " << m_advertisingRtr << " (Router ID)" << std::endl; if (m_lsType == GlobalRoutingLSA::RouterLSA) { for ( ListOfLinkRecords_t::const_iterator i = m_linkRecords.begin (); i != m_linkRecords.end (); i++) { GlobalRoutingLinkRecord *p = *i; os << "---------- RouterLSA Link Record ----------" << std::endl; os << "m_linkType = " << p->m_linkType; if (p->m_linkType == GlobalRoutingLinkRecord::PointToPoint) { os << " (GlobalRoutingLinkRecord::PointToPoint)" << std::endl; os << "m_linkId = " << p->m_linkId << std::endl; os << "m_linkData = " << p->m_linkData << std::endl; os << "m_metric = " << p->m_metric << std::endl; } else if (p->m_linkType == GlobalRoutingLinkRecord::TransitNetwork) { os << " (GlobalRoutingLinkRecord::TransitNetwork)" << std::endl; os << "m_linkId = " << p->m_linkId << " (Designated router for network)" << std::endl; os << "m_linkData = " << p->m_linkData << " (This router's IP address)" << std::endl; os << "m_metric = " << p->m_metric << std::endl; } else if (p->m_linkType == GlobalRoutingLinkRecord::StubNetwork) { os << " (GlobalRoutingLinkRecord::StubNetwork)" << std::endl; os << "m_linkId = " << p->m_linkId << " (Network number of attached network)" << std::endl; os << "m_linkData = " << p->m_linkData << " (Network mask of attached network)" << std::endl; os << "m_metric = " << p->m_metric << std::endl; } else { os << " (Unknown LinkType)" << std::endl; os << "m_linkId = " << p->m_linkId << std::endl; os << "m_linkData = " << p->m_linkData << std::endl; os << "m_metric = " << p->m_metric << std::endl; } os << "---------- End RouterLSA Link Record ----------" << std::endl; } } else if (m_lsType == GlobalRoutingLSA::NetworkLSA) { os << "---------- NetworkLSA Link Record ----------" << std::endl; os << "m_networkLSANetworkMask = " << m_networkLSANetworkMask << std::endl; for ( ListOfAttachedRouters_t::const_iterator i = m_attachedRouters.begin (); i != m_attachedRouters.end (); i++) { Ipv4Address p = *i; os << "attachedRouter = " << p << std::endl; } os << "---------- End NetworkLSA Link Record ----------" << std::endl; } else if (m_lsType == GlobalRoutingLSA::ASExternalLSAs) { os << "---------- ASExternalLSA Link Record --------" << std::endl; os << "m_linkStateId = " << m_linkStateId << std::endl; os << "m_networkLSANetworkMask = " << m_networkLSANetworkMask << std::endl; } else { NS_ASSERT_MSG (0, "Illegal LSA LSType: " << m_lsType); } os << "========== End Global Routing LSA ==========" << std::endl; } std::ostream& operator<< (std::ostream& os, GlobalRoutingLSA& lsa) { lsa.Print (os); return os; } // --------------------------------------------------------------------------- // // GlobalRouter Implementation // // --------------------------------------------------------------------------- NS_OBJECT_ENSURE_REGISTERED (GlobalRouter); TypeId GlobalRouter::GetTypeId (void) { static TypeId tid = TypeId ("ns3::GlobalRouter") .SetParent<Object> (); return tid; } GlobalRouter::GlobalRouter () : m_LSAs () { NS_LOG_FUNCTION_NOARGS (); m_routerId.Set (GlobalRouteManager::AllocateRouterId ()); } GlobalRouter::~GlobalRouter () { NS_LOG_FUNCTION_NOARGS (); ClearLSAs (); } void GlobalRouter::SetRoutingProtocol (Ptr<Ipv4GlobalRouting> routing) { m_routingProtocol = routing; } Ptr<Ipv4GlobalRouting> GlobalRouter::GetRoutingProtocol (void) { return m_routingProtocol; } void GlobalRouter::DoDispose () { NS_LOG_FUNCTION_NOARGS (); m_routingProtocol = 0; for (InjectedRoutesI k = m_injectedRoutes.begin (); k != m_injectedRoutes.end (); k = m_injectedRoutes.erase (k)) { delete (*k); } Object::DoDispose (); } void GlobalRouter::ClearLSAs () { NS_LOG_FUNCTION_NOARGS (); for ( ListOfLSAs_t::iterator i = m_LSAs.begin (); i != m_LSAs.end (); i++) { NS_LOG_LOGIC ("Free LSA"); GlobalRoutingLSA *p = *i; delete p; p = 0; *i = 0; } NS_LOG_LOGIC ("Clear list of LSAs"); m_LSAs.clear (); } Ipv4Address GlobalRouter::GetRouterId (void) const { NS_LOG_FUNCTION_NOARGS (); return m_routerId; } // // DiscoverLSAs is called on all nodes in the system that have a GlobalRouter // interface aggregated. We need to go out and discover any adjacent routers // and build the Link State Advertisements that reflect them and their associated // networks. // uint32_t GlobalRouter::DiscoverLSAs () { NS_LOG_FUNCTION_NOARGS (); Ptr<Node> node = GetObject<Node> (); NS_ABORT_MSG_UNLESS (node, "GlobalRouter::DiscoverLSAs (): GetObject for <Node> interface failed"); NS_LOG_LOGIC ("For node " << node->GetId () ); ClearLSAs (); // // While building the Router-LSA, keep a list of those NetDevices for // which the current node is the designated router and we will later build // a NetworkLSA for. // NetDeviceContainer c; // // We're aggregated to a node. We need to ask the node for a pointer to its // Ipv4 interface. This is where the information regarding the attached // interfaces lives. If we're a router, we had better have an Ipv4 interface. // Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> (); NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::DiscoverLSAs (): GetObject for <Ipv4> interface failed"); // // Every router node originates a Router-LSA // GlobalRoutingLSA *pLSA = new GlobalRoutingLSA; pLSA->SetLSType (GlobalRoutingLSA::RouterLSA); pLSA->SetLinkStateId (m_routerId); pLSA->SetAdvertisingRouter (m_routerId); pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED); pLSA->SetNode (node); // // Ask the node for the number of net devices attached. This isn't necessarily // equal to the number of links to adjacent nodes (other routers) as the number // of devices may include those for stub networks (e.g., ethernets, etc.) and // bridge devices also take up an "extra" net device. // uint32_t numDevices = node->GetNDevices (); // // Iterate through the devices on the node and walk the channel to see what's // on the other side of the standalone devices.. // for (uint32_t i = 0; i < numDevices; ++i) { Ptr<NetDevice> ndLocal = node->GetDevice (i); // // There is an assumption that bridge ports must never have an IP address // associated with them. This turns out to be a very convenient place to // check and make sure that this is the case. // if (NetDeviceIsBridged (ndLocal)) { // Initialize to value out of bounds to silence compiler uint32_t interfaceBridge = ipv4Local->GetNInterfaces () + 1; bool rc = FindInterfaceForDevice (node, ndLocal, interfaceBridge); NS_ABORT_MSG_IF (rc, "GlobalRouter::DiscoverLSAs(): Bridge ports must not have an IPv4 interface index"); } // // Check to see if the net device we just got has a corresponding IP // interface (could be a pure L2 NetDevice) -- for example a net device // associated with a bridge. We are only going to involve devices with // IP addresses in routing. // bool isForwarding = false; for (uint32_t j = 0; j < ipv4Local->GetNInterfaces (); ++j ) { if (ipv4Local->GetNetDevice (j) == ndLocal && ipv4Local->IsUp (j) && ipv4Local->IsForwarding (j)) { isForwarding = true; break; } } if (!isForwarding) { NS_LOG_LOGIC ("Net device " << ndLocal << "has no IP interface or is not enabled for forwarding, skipping"); continue; } // // We have a net device that we need to check out. If it suports // broadcast and is not a point-point link, then it will be either a stub // network or a transit network depending on the number of routers on // the segment. We add the appropriate link record to the LSA. // // If the device is a point to point link, we treat it separately. In // that case, there may be zero, one, or two link records added. // if (ndLocal->IsBroadcast () && !ndLocal->IsPointToPoint () ) { NS_LOG_LOGIC ("Broadcast link"); ProcessBroadcastLink (ndLocal, pLSA, c); } else if (ndLocal->IsPointToPoint () ) { NS_LOG_LOGIC ("Point=to-point link"); ProcessPointToPointLink (ndLocal, pLSA); } else { NS_ASSERT_MSG (0, "GlobalRouter::DiscoverLSAs (): unknown link type"); } } NS_LOG_LOGIC ("========== LSA for node " << node->GetId () << " =========="); NS_LOG_LOGIC (*pLSA); m_LSAs.push_back (pLSA); pLSA = 0; // // Now, determine whether we need to build a NetworkLSA. This is the case if // we found at least one designated router. // uint32_t nDesignatedRouters = c.GetN (); if (nDesignatedRouters > 0) { NS_LOG_LOGIC ("Build Network LSAs"); BuildNetworkLSAs (c); } // // Build injected route LSAs as external routes // RFC 2328, section 12.4.4 // for (InjectedRoutesCI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++) { GlobalRoutingLSA *pLSA = new GlobalRoutingLSA; pLSA->SetLSType (GlobalRoutingLSA::ASExternalLSAs); pLSA->SetLinkStateId ((*i)->GetDestNetwork ()); pLSA->SetAdvertisingRouter (m_routerId); pLSA->SetNetworkLSANetworkMask ((*i)->GetDestNetworkMask ()); pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED); m_LSAs.push_back (pLSA); } return m_LSAs.size (); } void GlobalRouter::ProcessBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c) { NS_LOG_FUNCTION (nd << pLSA << &c); if (nd->IsBridge ()) { ProcessBridgedBroadcastLink (nd, pLSA, c); } else { ProcessSingleBroadcastLink (nd, pLSA, c); } } void GlobalRouter::ProcessSingleBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c) { NS_LOG_FUNCTION (nd << pLSA << &c); GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord; NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessSingleBroadcastLink(): Can't alloc link record"); // // We have some preliminaries to do to get enough information to proceed. // This information we need comes from the internet stack, so notice that // there is an implied assumption that global routing is only going to // work with devices attached to the internet stack (have an ipv4 interface // associated to them. // Ptr<Node> node = nd->GetNode (); Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> (); NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessSingleBroadcastLink (): GetObject for <Ipv4> interface failed"); // Initialize to value out of bounds to silence compiler uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; bool rc = FindInterfaceForDevice (node, nd, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessSingleBroadcastLink(): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address addrLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetLocal (); Ipv4Mask maskLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetMask (); NS_LOG_LOGIC ("Working with local address " << addrLocal); uint16_t metricLocal = ipv4Local->GetMetric (interfaceLocal); // // Check to see if the net device is connected to a channel/network that has // another router on it. If there is no other router on the link (but us) then // this is a stub network. If we find another router, then what we have here // is a transit network. // if (AnotherRouterOnLink (nd, true) == false) { // // This is a net device connected to a stub network // NS_LOG_LOGIC ("Router-LSA Stub Network"); plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); // // According to OSPF, the Link ID is the IP network number of // the attached network. // plr->SetLinkId (addrLocal.CombineMask (maskLocal)); // // and the Link Data is the network mask; converted to Ipv4Address // Ipv4Address maskLocalAddr; maskLocalAddr.Set (maskLocal.Get ()); plr->SetLinkData (maskLocalAddr); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); plr = 0; } else { // // We have multiple routers on a broadcast interface, so this is // a transit network. // NS_LOG_LOGIC ("Router-LSA Transit Network"); plr->SetLinkType (GlobalRoutingLinkRecord::TransitNetwork); // // By definition, the router with the lowest IP address is the // designated router for the network. OSPF says that the Link ID // gets the IP interface address of the designated router in this // case. // Ipv4Address desigRtr = FindDesignatedRouterForLink (nd, true); // // Let's double-check that any designated router we find out on our // network is really on our network. // if (desigRtr != "255.255.255.255") { Ipv4Address networkHere = addrLocal.CombineMask (maskLocal); Ipv4Address networkThere = desigRtr.CombineMask (maskLocal); NS_ABORT_MSG_UNLESS (networkHere == networkThere, "GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion"); } if (desigRtr == addrLocal) { c.Add (nd); NS_LOG_LOGIC ("Node " << node->GetId () << " elected a designated router"); } plr->SetLinkId (desigRtr); // // OSPF says that the Link Data is this router's own IP address. // plr->SetLinkData (addrLocal); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); plr = 0; } } void GlobalRouter::ProcessBridgedBroadcastLink (Ptr<NetDevice> nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c) { NS_LOG_FUNCTION (nd << pLSA << &c); NS_ASSERT_MSG (nd->IsBridge (), "GlobalRouter::ProcessBridgedBroadcastLink(): Called with non-bridge net device"); #if 0 // // It is possible to admit the possibility that a bridge device on a node // can also participate in routing. This would surprise people who don't // come from Microsoft-land where they do use such a construct. Based on // the principle of least-surprise, we will leave the relatively simple // code in place to do this, but not enable it until someone really wants // the capability. Even then, we will not enable this code as a default // but rather something you will have to go and turn on. // Ptr<BridgeNetDevice> bnd = nd->GetObject<BridgeNetDevice> (); NS_ABORT_MSG_UNLESS (bnd, "GlobalRouter::DiscoverLSAs (): GetObject for <BridgeNetDevice> failed"); // // We have some preliminaries to do to get enough information to proceed. // This information we need comes from the internet stack, so notice that // there is an implied assumption that global routing is only going to // work with devices attached to the internet stack (have an ipv4 interface // associated to them. // Ptr<Node> node = nd->GetNode (); Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> (); NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessBridgedBroadcastLink (): GetObject for <Ipv4> interface failed"); // Initialize to value out of bounds to silence compiler uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; bool rc = FindInterfaceForDevice (node, nd, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessBridgedBroadcastLink(): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address addrLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetLocal (); Ipv4Mask maskLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetMask ();; NS_LOG_LOGIC ("Working with local address " << addrLocal); uint16_t metricLocal = ipv4Local->GetMetric (interfaceLocal); // // We need to handle a bridge on the router. This means that we have been // given a net device that is a BridgeNetDevice. It has an associated Ipv4 // interface index and address. Some number of other net devices live "under" // the bridge device as so-called bridge ports. In a nutshell, what we have // to do is to repeat what is done for a single broadcast link on all of // those net devices living under the bridge (trolls?) // bool areTransitNetwork = false; Ipv4Address desigRtr ("255.255.255.255"); for (uint32_t i = 0; i < bnd->GetNBridgePorts (); ++i) { Ptr<NetDevice> ndTemp = bnd->GetBridgePort (i); // // We have to decide if we are a transit network. This is characterized // by the presence of another router on the network segment. If we find // another router on any of our bridged links, we are a transit network. // if (AnotherRouterOnLink (ndTemp, true)) { areTransitNetwork = true; // // If we're going to be a transit network, then we have got to elect // a designated router for the whole bridge. This means finding the // router with the lowest IP address on the whole bridge. We ask // for the lowest address on each segment and pick the lowest of them // all. // Ipv4Address desigRtrTemp = FindDesignatedRouterForLink (ndTemp, true); // // Let's double-check that any designated router we find out on our // network is really on our network. // if (desigRtrTemp != "255.255.255.255") { Ipv4Address networkHere = addrLocal.CombineMask (maskLocal); Ipv4Address networkThere = desigRtrTemp.CombineMask (maskLocal); NS_ABORT_MSG_UNLESS (networkHere == networkThere, "GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion"); } if (desigRtrTemp < desigRtr) { desigRtr = desigRtrTemp; } } } // // That's all the information we need to put it all together, just like we did // in the case of a single broadcast link. // GlobalRoutingLinkRecord *plr = new GlobalRoutingLinkRecord; NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessBridgedBroadcastLink(): Can't alloc link record"); if (areTransitNetwork == false) { // // This is a net device connected to a bridge of stub networks // NS_LOG_LOGIC ("Router-LSA Stub Network"); plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); // // According to OSPF, the Link ID is the IP network number of // the attached network. // plr->SetLinkId (addrLocal.CombineMask (maskLocal)); // // and the Link Data is the network mask; converted to Ipv4Address // Ipv4Address maskLocalAddr; maskLocalAddr.Set (maskLocal.Get ()); plr->SetLinkData (maskLocalAddr); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); plr = 0; } else { // // We have multiple routers on a bridged broadcast interface, so this is // a transit network. // NS_LOG_LOGIC ("Router-LSA Transit Network"); plr->SetLinkType (GlobalRoutingLinkRecord::TransitNetwork); // // By definition, the router with the lowest IP address is the // designated router for the network. OSPF says that the Link ID // gets the IP interface address of the designated router in this // case. // if (desigRtr == addrLocal) { c.Add (nd); NS_LOG_LOGIC ("Node " << node->GetId () << " elected a designated router"); } plr->SetLinkId (desigRtr); // // OSPF says that the Link Data is this router's own IP address. // plr->SetLinkData (addrLocal); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); plr = 0; } #endif } void GlobalRouter::ProcessPointToPointLink (Ptr<NetDevice> ndLocal, GlobalRoutingLSA *pLSA) { NS_LOG_FUNCTION (ndLocal << pLSA); // // We have some preliminaries to do to get enough information to proceed. // This information we need comes from the internet stack, so notice that // there is an implied assumption that global routing is only going to // work with devices attached to the internet stack (have an ipv4 interface // associated to them. // Ptr<Node> nodeLocal = ndLocal->GetNode (); Ptr<Ipv4> ipv4Local = nodeLocal->GetObject<Ipv4> (); NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessPointToPointLink (): GetObject for <Ipv4> interface failed"); uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; bool rc = FindInterfaceForDevice (nodeLocal, ndLocal, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessPointToPointLink (): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address addrLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetLocal (); NS_LOG_LOGIC ("Working with local address " << addrLocal); uint16_t metricLocal = ipv4Local->GetMetric (interfaceLocal); // // Now, we're going to walk over to the remote net device on the other end of // the point-to-point channel we know we have. This is where our adjacent // router (to use OSPF lingo) is running. // Ptr<Channel> ch = ndLocal->GetChannel (); // // Get the net device on the other side of the point-to-point channel. // //ndLocal->GetIfIndex(); //std::cout<<addrLocal<<"\n"; //std::cout<<"!!!\n"; //fflush(stdout); Ptr<NetDevice> ndRemote = GetAdjacent (ndLocal, ch); // // The adjacent net device is aggregated to a node. We need to ask that net // device for its node, then ask that node for its Ipv4 interface. Note a // requirement that nodes on either side of a point-to-point link must have // internet stacks; and an assumption that point-to-point links are incompatible // with bridging. // Ptr<Node> nodeRemote = ndRemote->GetNode (); Ptr<Ipv4> ipv4Remote = nodeRemote->GetObject<Ipv4> (); NS_ABORT_MSG_UNLESS (ipv4Remote, "GlobalRouter::ProcessPointToPointLink(): GetObject for remote <Ipv4> failed"); // // Further note the requirement that nodes on either side of a point-to-point // link must participate in global routing and therefore have a GlobalRouter // interface aggregated. // Ptr<GlobalRouter> rtrRemote = nodeRemote->GetObject<GlobalRouter> (); if (rtrRemote == 0) { // This case is possible if the remote does not participate in global routing return; } // // We're going to need the remote router ID, so we might as well get it now. // Ipv4Address rtrIdRemote = rtrRemote->GetRouterId (); NS_LOG_LOGIC ("Working with remote router " << rtrIdRemote); // // Now, just like we did above, we need to get the IP interface index for the // net device on the other end of the point-to-point channel. // uint32_t interfaceRemote = ipv4Remote->GetNInterfaces () + 1; rc = FindInterfaceForDevice (nodeRemote, ndRemote, interfaceRemote); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::ProcessPointToPointLinks(): No interface index associated with remote device"); // // Now that we have the Ipv4 interface, we can get the (remote) address and // mask we need. // if (ipv4Remote->GetNAddresses (interfaceRemote) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address addrRemote = ipv4Remote->GetAddress (interfaceRemote, 0).GetLocal (); Ipv4Mask maskRemote = ipv4Remote->GetAddress (interfaceRemote, 0).GetMask (); NS_LOG_LOGIC ("Working with remote address " << addrRemote); // // Now we can fill out the link records for this link. There are always two // link records; the first is a point-to-point record describing the link and // the second is a stub network record with the network number. // GlobalRoutingLinkRecord *plr; if (ipv4Remote->IsUp (interfaceRemote)) { NS_LOG_LOGIC ("Remote side interface " << interfaceRemote << " is up-- add a type 1 link"); plr = new GlobalRoutingLinkRecord; NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record"); plr->SetLinkType (GlobalRoutingLinkRecord::PointToPoint); plr->SetLinkId (rtrIdRemote); plr->SetLinkData (addrLocal); plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); plr = 0; } // Regardless of state of peer, add a type 3 link (RFC 2328: 12.4.1.1) plr = new GlobalRoutingLinkRecord; NS_ABORT_MSG_IF (plr == 0, "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record"); plr->SetLinkType (GlobalRoutingLinkRecord::StubNetwork); plr->SetLinkId (addrRemote); plr->SetLinkData (Ipv4Address (maskRemote.Get ())); // Frown plr->SetMetric (metricLocal); pLSA->AddLinkRecord (plr); plr = 0; } void GlobalRouter::BuildNetworkLSAs (NetDeviceContainer c) { NS_LOG_FUNCTION (&c); uint32_t nDesignatedRouters = c.GetN (); for (uint32_t i = 0; i < nDesignatedRouters; ++i) { // // Build one NetworkLSA for each net device talking to a network that we are the // designated router for. These devices are in the provided container. // Ptr<NetDevice> ndLocal = c.Get (i); Ptr<Node> node = ndLocal->GetNode (); Ptr<Ipv4> ipv4Local = node->GetObject<Ipv4> (); NS_ABORT_MSG_UNLESS (ipv4Local, "GlobalRouter::ProcessPointToPointLink (): GetObject for <Ipv4> interface failed"); uint32_t interfaceLocal = ipv4Local->GetNInterfaces () + 1; bool rc = FindInterfaceForDevice (node, ndLocal, interfaceLocal); NS_ABORT_MSG_IF (rc == false, "GlobalRouter::BuildNetworkLSAs (): No interface index associated with device"); if (ipv4Local->GetNAddresses (interfaceLocal) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address addrLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetLocal (); Ipv4Mask maskLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetMask (); GlobalRoutingLSA *pLSA = new GlobalRoutingLSA; NS_ABORT_MSG_IF (pLSA == 0, "GlobalRouter::BuildNetworkLSAs(): Can't alloc link record"); pLSA->SetLSType (GlobalRoutingLSA::NetworkLSA); pLSA->SetLinkStateId (addrLocal); pLSA->SetAdvertisingRouter (m_routerId); pLSA->SetNetworkLSANetworkMask (maskLocal); pLSA->SetStatus (GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED); pLSA->SetNode (node); // // Build a list of AttachedRouters by walking the devices in the channel // and, if we find a node with a GlobalRouter interface and an IPv4 // interface associated with that device, we call it an attached router. // Ptr<Channel> ch = ndLocal->GetChannel (); uint32_t nDevices = ch->GetNDevices (); NS_ASSERT (nDevices); for (uint32_t i = 0; i < nDevices; i++) { Ptr<NetDevice> tempNd = ch->GetDevice (i); NS_ASSERT (tempNd); Ptr<Node> tempNode = tempNd->GetNode (); // // Does the node in question have a GlobalRouter interface? If not it can // hardly be considered an attached router. // Ptr<GlobalRouter> rtr = tempNode->GetObject<GlobalRouter> (); if (rtr == 0) { continue; } // // Does the attached node have an ipv4 interface for the device we're probing? // If not, it can't play router. // uint32_t tempInterface = 0; if (FindInterfaceForDevice (tempNode, tempNd, tempInterface)) { Ptr<Ipv4> tempIpv4 = tempNode->GetObject<Ipv4> (); NS_ASSERT (tempIpv4); if (!tempIpv4->IsUp (tempInterface)) { NS_LOG_LOGIC ("Remote side interface " << tempInterface << " not up"); } else { if (tempIpv4->GetNAddresses (tempInterface) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address tempAddr = tempIpv4->GetAddress (tempInterface, 0).GetLocal (); pLSA->AddAttachedRouter (tempAddr); } } } m_LSAs.push_back (pLSA); pLSA = 0; } } // // Given a local net device, we need to walk the channel to which the net device is // attached and look for nodes with GlobalRouter interfaces on them (one of them // will be us). Of these, the router with the lowest IP address on the net device // connecting to the channel becomes the designated router for the link. // Ipv4Address GlobalRouter::FindDesignatedRouterForLink (Ptr<NetDevice> ndLocal, bool allowRecursion) const { NS_LOG_FUNCTION (ndLocal << allowRecursion); Ptr<Channel> ch = ndLocal->GetChannel (); uint32_t nDevices = ch->GetNDevices (); NS_ASSERT (nDevices); NS_LOG_LOGIC ("Looking for designated router off of net device " << ndLocal << " on node " << ndLocal->GetNode ()->GetId ()); Ipv4Address desigRtr ("255.255.255.255"); // // Look through all of the devices on the channel to which the net device // in question is attached. // for (uint32_t i = 0; i < nDevices; i++) { Ptr<NetDevice> ndOther = ch->GetDevice (i); NS_ASSERT (ndOther); Ptr<Node> nodeOther = ndOther->GetNode (); NS_LOG_LOGIC ("Examine channel device " << i << " on node " << nodeOther->GetId ()); // // For all other net devices, we need to check and see if a router // is present. If the net device on the other side is a bridged // device, we need to consider all of the other devices on the // bridge as well (all of the bridge ports. // NS_LOG_LOGIC ("checking to see if the device is bridged"); Ptr<BridgeNetDevice> bnd = NetDeviceIsBridged (ndOther); if (bnd) { NS_LOG_LOGIC ("Device is bridged by BridgeNetDevice " << bnd); // // It is possible that the bridge net device is sitting under a // router, so we have to check for the presence of that router // before we run off and follow all the links // // We require a designated router to have a GlobalRouter interface and // an internet stack that includes the Ipv4 interface. If it doesn't // it can't play router. // NS_LOG_LOGIC ("Checking for router on bridge net device " << bnd); Ptr<GlobalRouter> rtr = nodeOther->GetObject<GlobalRouter> (); Ptr<Ipv4> ipv4 = nodeOther->GetObject<Ipv4> (); if (rtr && ipv4) { // Initialize to value out of bounds to silence compiler uint32_t interfaceOther = ipv4->GetNInterfaces () + 1; if (FindInterfaceForDevice (nodeOther, bnd, interfaceOther)) { NS_LOG_LOGIC ("Found router on bridge net device " << bnd); if (!ipv4->IsUp (interfaceOther)) { NS_LOG_LOGIC ("Remote side interface " << interfaceOther << " not up"); continue; } if (ipv4->GetNAddresses (interfaceOther) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address addrOther = ipv4->GetAddress (interfaceOther, 0).GetLocal (); desigRtr = addrOther < desigRtr ? addrOther : desigRtr; NS_LOG_LOGIC ("designated router now " << desigRtr); } } NS_LOG_LOGIC ("Looking through bridge ports of bridge net device " << bnd); for (uint32_t j = 0; j < bnd->GetNBridgePorts (); ++j) { Ptr<NetDevice> ndBridged = bnd->GetBridgePort (j); NS_LOG_LOGIC ("Examining bridge port " << j << " device " << ndBridged); if (ndBridged == ndOther) { NS_LOG_LOGIC ("That bridge port is me, don't walk backward"); continue; } if (allowRecursion) { NS_LOG_LOGIC ("Recursively looking for routers down bridge port " << ndBridged); Ipv4Address addrOther = FindDesignatedRouterForLink (ndBridged, false); desigRtr = addrOther < desigRtr ? addrOther : desigRtr; NS_LOG_LOGIC ("designated router now " << desigRtr); } } } else { NS_LOG_LOGIC ("This device is not bridged"); Ptr<Node> nodeOther = ndOther->GetNode (); NS_ASSERT (nodeOther); // // We require a designated router to have a GlobalRouter interface and // an internet stack that includes the Ipv4 interface. If it doesn't // Ptr<GlobalRouter> rtr = nodeOther->GetObject<GlobalRouter> (); Ptr<Ipv4> ipv4 = nodeOther->GetObject<Ipv4> (); if (rtr && ipv4) { // Initialize to value out of bounds to silence compiler uint32_t interfaceOther = ipv4->GetNInterfaces () + 1; if (FindInterfaceForDevice (nodeOther, ndOther, interfaceOther)) { if (!ipv4->IsUp (interfaceOther)) { NS_LOG_LOGIC ("Remote side interface " << interfaceOther << " not up"); continue; } NS_LOG_LOGIC ("Found router on net device " << ndOther); if (ipv4->GetNAddresses (interfaceOther) > 1) { NS_LOG_WARN ("Warning, interface has multiple IP addresses; using only the primary one"); } Ipv4Address addrOther = ipv4->GetAddress (interfaceOther, 0).GetLocal (); desigRtr = addrOther < desigRtr ? addrOther : desigRtr; NS_LOG_LOGIC ("designated router now " << desigRtr); } } } } return desigRtr; } // // Given a node and an attached net device, take a look off in the channel to // which the net device is attached and look for a node on the other side // that has a GlobalRouter interface aggregated. Life gets more complicated // when there is a bridged net device on the other side. // bool GlobalRouter::AnotherRouterOnLink (Ptr<NetDevice> nd, bool allowRecursion) const { NS_LOG_FUNCTION (nd << allowRecursion); Ptr<Channel> ch = nd->GetChannel (); if (!ch) { // It may be that this net device is a stub device, without a channel return false; } uint32_t nDevices = ch->GetNDevices (); NS_ASSERT (nDevices); NS_LOG_LOGIC ("Looking for routers off of net device " << nd << " on node " << nd->GetNode ()->GetId ()); // // Look through all of the devices on the channel to which the net device // in question is attached. // for (uint32_t i = 0; i < nDevices; i++) { Ptr<NetDevice> ndOther = ch->GetDevice (i); NS_ASSERT (ndOther); NS_LOG_LOGIC ("Examine channel device " << i << " on node " << ndOther->GetNode ()->GetId ()); // // Ignore the net device itself. // if (ndOther == nd) { NS_LOG_LOGIC ("Myself, skip"); continue; } // // For all other net devices, we need to check and see if a router // is present. If the net device on the other side is a bridged // device, we need to consider all of the other devices on the // bridge. // NS_LOG_LOGIC ("checking to see if device is bridged"); Ptr<BridgeNetDevice> bnd = NetDeviceIsBridged (ndOther); if (bnd) { NS_LOG_LOGIC ("Device is bridged by net device " << bnd); NS_LOG_LOGIC ("Looking through bridge ports of bridge net device " << bnd); for (uint32_t j = 0; j < bnd->GetNBridgePorts (); ++j) { Ptr<NetDevice> ndBridged = bnd->GetBridgePort (j); NS_LOG_LOGIC ("Examining bridge port " << j << " device " << ndBridged); if (ndBridged == ndOther) { NS_LOG_LOGIC ("That bridge port is me, skip"); continue; } if (allowRecursion) { NS_LOG_LOGIC ("Recursively looking for routers on bridge port " << ndBridged); if (AnotherRouterOnLink (ndBridged, false)) { NS_LOG_LOGIC ("Found routers on bridge port, return true"); return true; } } } NS_LOG_LOGIC ("No routers on bridged net device, return false"); return false; } NS_LOG_LOGIC ("This device is not bridged"); Ptr<Node> nodeTemp = ndOther->GetNode (); NS_ASSERT (nodeTemp); Ptr<GlobalRouter> rtr = nodeTemp->GetObject<GlobalRouter> (); if (rtr) { NS_LOG_LOGIC ("Found GlobalRouter interface, return true"); return true; } else { NS_LOG_LOGIC ("No GlobalRouter interface on device, continue search"); } } NS_LOG_LOGIC ("No routers found, return false"); return false; } uint32_t GlobalRouter::GetNumLSAs (void) const { NS_LOG_FUNCTION_NOARGS (); return m_LSAs.size (); } // // Get the nth link state advertisement from this router. // bool GlobalRouter::GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const { NS_LOG_FUNCTION_NOARGS (); NS_ASSERT_MSG (lsa.IsEmpty (), "GlobalRouter::GetLSA (): Must pass empty LSA"); // // All of the work was done in GetNumLSAs. All we have to do here is to // walk the list of link state advertisements created there and return the // one the client is interested in. // ListOfLSAs_t::const_iterator i = m_LSAs.begin (); uint32_t j = 0; for (; i != m_LSAs.end (); i++, j++) { if (j == n) { GlobalRoutingLSA *p = *i; lsa = *p; return true; } } return false; } void GlobalRouter::InjectRoute (Ipv4Address network, Ipv4Mask networkMask) { NS_LOG_FUNCTION (network << networkMask); Ipv4RoutingTableEntry *route = new Ipv4RoutingTableEntry (); // // Interface number does not matter here, using 1. // *route = Ipv4RoutingTableEntry::CreateNetworkRouteTo (network, networkMask, 1); m_injectedRoutes.push_back (route); } Ipv4RoutingTableEntry * GlobalRouter::GetInjectedRoute (uint32_t index) { NS_LOG_FUNCTION (index); if (index < m_injectedRoutes.size ()) { uint32_t tmp = 0; for (InjectedRoutesCI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++) { if (tmp == index) { return *i; } tmp++; } } NS_ASSERT (false); // quiet compiler. return 0; } uint32_t GlobalRouter::GetNInjectedRoutes () { return m_injectedRoutes.size (); } void GlobalRouter::RemoveInjectedRoute (uint32_t index) { NS_LOG_FUNCTION (index); NS_ASSERT (index < m_injectedRoutes.size ()); uint32_t tmp = 0; for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++) { if (tmp == index) { NS_LOG_LOGIC ("Removing route " << index << "; size = " << m_injectedRoutes.size ()); delete *i; m_injectedRoutes.erase (i); return; } tmp++; } } bool GlobalRouter::WithdrawRoute (Ipv4Address network, Ipv4Mask networkMask) { NS_LOG_FUNCTION (network << networkMask); for (InjectedRoutesI i = m_injectedRoutes.begin (); i != m_injectedRoutes.end (); i++) { if ((*i)->GetDestNetwork () == network && (*i)->GetDestNetworkMask () == networkMask) { NS_LOG_LOGIC ("Withdrawing route to network/mask " << network << "/" << networkMask); delete *i; m_injectedRoutes.erase (i); return true; } } return false; } // // Link through the given channel and find the net device that's on the // other end. This only makes sense with a point-to-point channel. // Ptr<NetDevice> GlobalRouter::GetAdjacent (Ptr<NetDevice> nd, Ptr<Channel> ch) const { NS_LOG_FUNCTION_NOARGS (); //std::cout<<"Device num:"<<ch->GetNDevices ()<<"\n"; //fflush(stdout); NS_ASSERT_MSG (ch->GetNDevices () == 2, "GlobalRouter::GetAdjacent (): Channel with other than two devices"); // // This is a point to point channel with two endpoints. Get both of them. // Ptr<NetDevice> nd1 = ch->GetDevice (0); Ptr<NetDevice> nd2 = ch->GetDevice (1); // // One of the endpoints is going to be "us" -- that is the net device attached // to the node on which we're running -- i.e., "nd". The other endpoint (the // one to which we are connected via the channel) is the adjacent router. // if (nd1 == nd) { return nd2; } else if (nd2 == nd) { return nd1; } else { NS_ASSERT_MSG (false, "GlobalRouter::GetAdjacent (): Wrong or confused channel?"); return 0; } } // // Given a node and a net device, find an IPV4 interface index that corresponds // to that net device. This function may fail for various reasons. If a node // does not have an internet stack (for example if it is a bridge) we won't have // an IPv4 at all. If the node does have a stack, but the net device in question // is bridged, there will not be an interface associated directly with the device. // bool GlobalRouter::FindInterfaceForDevice (Ptr<Node> node, Ptr<NetDevice> nd, uint32_t &index) const { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("For node " << node->GetId () << " for net device " << nd ); Ptr<Ipv4> ipv4 = node->GetObject<Ipv4> (); if (ipv4 == 0) { NS_LOG_LOGIC ("No Ipv4 interface on node " << node->GetId ()); return false; } for (uint32_t i = 0; i < ipv4->GetNInterfaces (); ++i ) { if (ipv4->GetNetDevice (i) == nd) { NS_LOG_LOGIC ("Device " << nd << " has associated ipv4 index " << i); index = i; return true; } } NS_LOG_LOGIC ("Device " << nd << " has no associated ipv4 index"); return false; } // // Decide whether or not a given net device is being bridged by a BridgeNetDevice. // Ptr<BridgeNetDevice> GlobalRouter::NetDeviceIsBridged (Ptr<NetDevice> nd) const { NS_LOG_FUNCTION (nd); Ptr<Node> node = nd->GetNode (); uint32_t nDevices = node->GetNDevices (); // // There is no bit on a net device that says it is being bridged, so we have // to look for bridges on the node to which the device is attached. If we // find a bridge, we need to look through its bridge ports (the devices it // bridges) to see if we find the device in question. // for (uint32_t i = 0; i < nDevices; ++i) { Ptr<NetDevice> ndTest = node->GetDevice (i); NS_LOG_LOGIC ("Examine device " << i << " " << ndTest); if (ndTest->IsBridge ()) { NS_LOG_LOGIC ("device " << i << " is a bridge net device"); Ptr<BridgeNetDevice> bnd = ndTest->GetObject<BridgeNetDevice> (); NS_ABORT_MSG_UNLESS (bnd, "GlobalRouter::DiscoverLSAs (): GetObject for <BridgeNetDevice> failed"); for (uint32_t j = 0; j < bnd->GetNBridgePorts (); ++j) { NS_LOG_LOGIC ("Examine bridge port " << j << " " << bnd->GetBridgePort (j)); if (bnd->GetBridgePort (j) == nd) { NS_LOG_LOGIC ("Net device " << nd << " is bridged by " << bnd); return bnd; } } } } NS_LOG_LOGIC ("Net device " << nd << " is not bridged"); return 0; } } // namespace ns3
piran9/Project
src/internet/model/global-router-interface.cc
C++
gpl-2.0
55,105
/* * Copyright (c) 1998-2011 Caucho Technology -- all rights reserved * * This file is part of Resin(R) Open Source * * Each copy or derived work must preserve the copyright notice and this * notice unmodified. * * Resin Open Source is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * Resin Open Source is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty * of NON-INFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with Resin Open Source; if not, write to the * * Free Software Foundation, Inc. * 59 Temple Place, Suite 330 * Boston, MA 02111-1307 USA * * @author Scott Ferguson */ package com.caucho.jsp; import com.caucho.java.LineMap; import com.caucho.jsp.java.JspNode; import com.caucho.util.CharBuffer; import com.caucho.util.L10N; import com.caucho.util.LineCompileException; import com.caucho.vfs.Path; import com.caucho.vfs.ReadStream; import com.caucho.xml.QName; import com.caucho.xml.XmlChar; import java.io.IOException; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; /** * Parses the JSP page. Both the XML and JSP tags are understood. However, * escaping is always done using JSP rules. */ public class JspParser { static L10N L = new L10N(JspParser.class); private static final Logger log = Logger.getLogger(JspParser.class.getName()); public static final String JSP_NS = "http://java.sun.com/JSP/Page"; public static final String JSTL_CORE_URI = "http://java.sun.com/jsp/jstl/core"; public static final String JSTL_FMT_URI = "http://java.sun.com/jsp/jstl/fmt"; public static final QName PREFIX = new QName("prefix"); public static final QName TAGLIB = new QName("taglib"); public static final QName TAGDIR = new QName("tagdir"); public static final QName URI = new QName("uri"); public static final QName JSP_DECLARATION = new QName("jsp", "declaration", JSP_NS); public static final QName JSP_SCRIPTLET = new QName("jsp", "scriptlet", JSP_NS); public static final QName JSP_EXPRESSION = new QName("jsp", "expression", JSP_NS); public static final QName JSP_DIRECTIVE_PAGE = new QName("jsp", "directive.page", JSP_NS); public static final QName JSP_DIRECTIVE_INCLUDE = new QName("jsp", "directive.include", JSP_NS); public static final QName JSP_DIRECTIVE_CACHE = new QName("jsp", "directive.cache", JSP_NS); public static final QName JSP_DIRECTIVE_TAGLIB = new QName("jsp", "directive.taglib", JSP_NS); public static final QName JSP_DIRECTIVE_ATTRIBUTE = new QName("jsp", "directive.attribute", JSP_NS); public static final QName JSP_DIRECTIVE_VARIABLE = new QName("jsp", "directive.variable", JSP_NS); public static final QName JSP_DIRECTIVE_TAG = new QName("jsp", "directive.tag", JSP_NS); public static final QName JSTL_CORE_OUT = new QName("resin-c", "out", "urn:jsptld:" + JSTL_CORE_URI); public static final QName JSTL_CORE_CHOOSE = new QName("resin-c", "choose", "urn:jsptld:" + JSTL_CORE_URI); public static final QName JSTL_CORE_WHEN = new QName("resin-c", "when", "urn:jsptld:" + JSTL_CORE_URI); public static final QName JSTL_CORE_OTHERWISE = new QName("resin-c", "otherwise", "urn:jsptld:" + JSTL_CORE_URI); public static final QName JSTL_CORE_FOREACH = new QName("resin-c", "forEach", "urn:jsptld:" + JSTL_CORE_URI); private static final int TAG_UNKNOWN = 0; private static final int TAG_JSP = 1; private static final int TAG_RAW = 2; private ParseState _parseState; private JspBuilder _jspBuilder; private ParseTagManager _tagManager; private LineMap _lineMap; private ArrayList<String> _preludeList = new ArrayList<String>(); private ArrayList<String> _codaList = new ArrayList<String>(); private ArrayList<Include> _includes = new ArrayList<Include>(); private Set<String> _prefixes = new HashSet<String>(); // jsp/18cy, jsp/18cz private Set<String> _localPrefixes = new HashSet<String>(); private Path _jspPath; private ReadStream _stream; private String _uriPwd; private String _contextPath = ""; private String _filename = ""; private int _line; private int _lineStart; private int _charCount; private int _startText; private int _peek = -1; private boolean _seenCr = false; private Namespace _namespaces = new Namespace(null, "jsp", JSP_NS); private boolean _isXml; private boolean _isTop = true; private CharBuffer _tag = new CharBuffer(); private CharBuffer _value = new CharBuffer(); private CharBuffer _text = new CharBuffer(); /** * Sets the JSP builder, which receives the SAX-like events from * JSP parser. */ void setJspBuilder(JspBuilder builder) { _jspBuilder = builder; } /** * Sets the context path for error messages. */ void setContextPath(String contextPath) { _contextPath = contextPath; } /** * Sets the parse state, which stores state information for the parsing. */ void setParseState(ParseState parseState) { _parseState = parseState; } /** * Sets the parse state, which stores state information for the parsing. */ ParseState getParseState() { return _parseState; } /** * Sets the tag manager */ void setTagManager(ParseTagManager manager) { _tagManager = manager; } /** * Returns true if JSP EL expressions are enabled. */ private boolean isELIgnored() { return _parseState.isELIgnored(); } /** * Returns true if Velocity-style statements are enabled. */ private boolean isVelocity() { return _parseState.isVelocityEnabled(); } /** * Returns true if JSP EL expressions are enabled. */ private boolean isDeferredSyntaxAllowedAsLiteral() { return _parseState.isDeferredSyntaxAllowedAsLiteral(); } /** * Adds a prelude. */ public void addPrelude(String prelude) { _preludeList.add(prelude); } /** * Adds a coda. */ public void addCoda(String coda) { _codaList.add(coda); } /** * Starts parsing the JSP page. * * @param path the JSP source file * @param uri the URI for the JSP source file. */ void parse(Path path, String uri) throws Exception { _parseState.pushNamespace("jsp", JSP_NS); _isXml = _parseState.isXml(); _filename = _contextPath + uri; if (uri != null) { int p = uri.lastIndexOf('/'); _uriPwd = p <= 0 ? "/" : uri.substring(0, p + 1); } else { _uriPwd = "/"; } _parseState.setUriPwd(_uriPwd); ReadStream is = path.openRead(); path.setUserPath(uri); try { parseJsp(is); } finally { is.close(); for (int i = 0; i < _includes.size(); i++) { Include inc = _includes.get(i); inc._stream.close(); } } } /** * Starts parsing the JSP page as a tag. * * @param path the JSP source file * @param uri the URI for the JSP source file. */ void parseTag(Path path, String uri) throws Exception { _parseState.setTag(true); parse(path, uri); } /** * Top-level JSP parser. * * @param stream the read stream containing the JSP file * * @return an XML DOM containing the JSP. */ private void parseJsp(ReadStream stream) throws Exception { _text.clear(); _includes.clear(); String uriPwd = _uriPwd; for (int i = _codaList.size() - 1; i >= 0; i--) pushInclude(_codaList.get(i), true); addInclude(stream, uriPwd); for (int i = _preludeList.size() - 1; i >= 0; i--) pushInclude(_preludeList.get(i), true); setLocation(); _jspBuilder.startDocument(); String pageEncoding = _parseState.getPageEncoding(); int ch; if (pageEncoding != null) { _parseState.setPageEncoding(pageEncoding); stream.setEncoding(pageEncoding); } switch ((ch = stream.read())) { case 0xfe: if ((ch = stream.read()) != 0xff) { throw error(L.l("Expected 0xff in UTF-16 header. UTF-16 pages with the initial byte 0xfe expect 0xff immediately following. The 0xfe 0xff sequence is used by some application to suggest UTF-16 encoding without a directive.")); } else { //_parseState.setContentType("text/html; charset=UTF-16BE"); log.finer(L.l("JSP '{0}': setting page encoding using BOM 'fe ff' -> 'UTF-16BE'", _jspPath.toString())); _parseState.setBom(0xfeff); _parseState.setPageEncoding("UTF-16BE"); stream.setEncoding("UTF-16BE"); } break; case 0xff: if ((ch = stream.read()) != 0xfe) { throw error(L.l("Expected 0xfe in UTF-16 header. UTF-16 pages with the initial byte 0xff expect 0xfe immediately following. The 0xff 0xfe sequence is used by some application to suggest UTF-16 encoding without a directive.")); } else { //_parseState.setContentType("text/html; charset=UTF-16LE"); log.finer(L.l("JSP '{0}': setting page encoding using BOM 'ff fe' -> 'UTF-16LE'", _jspPath.toString())); _parseState.setBom(0xfffe); _parseState.setPageEncoding("UTF-16LE"); stream.setEncoding("UTF-16LE"); } break; case 0xef: if ((ch = stream.read()) != 0xbb) { stream.unread(); stream.unread(); } else if ((ch = stream.read()) != 0xbf) { throw error(L.l("Expected 0xbf in UTF-8 header. UTF-8 pages with the initial byte 0xbb expect 0xbf immediately following. The 0xbb 0xbf sequence is used by some application to suggest UTF-8 encoding without a directive.")); } else { // jsp/002a, #3062 // _parseState.setContentType("text/html; charset=UTF-8"); log.finer(L.l("JSP '{0}': setting page encoding using BOM 'ef bb bf' -> 'UTF-8'", _jspPath.toString())); _parseState.setBom(0xefbbbf); _parseState.setPageEncoding("UTF-8"); stream.setEncoding("UTF-8"); } break; case -1: break; default: stream.unread(); break; } ch = read(); ch = parseXmlDeclaration(ch); try { parseNode(ch); } finally { for (int i = 0; i < _includes.size(); i++) { Include inc = _includes.get(i); inc._stream.close(); } } setLocation(); _jspBuilder.endDocument(); } private int parseXmlDeclaration(int ch) throws IOException, JspParseException { if (ch != '<') return ch; else if ((ch = read()) != '?') { unread(ch); return '<'; } else if ((ch = read()) != 'x') { addText("<?"); return ch; } else if ((ch = read()) != 'm') { addText("<?x"); return ch; } else if ((ch = read()) != 'l') { addText("<?xm"); return ch; } else if (! XmlChar.isWhitespace((ch = read()))) { addText("<?xml"); return ch; } String encoding = null; addText("<?xml "); ch = skipWhitespace(ch); while (XmlChar.isNameStart(ch)) { ch = readName(ch); String name = _tag.toString(); addText(name); if (XmlChar.isWhitespace(ch)) addText(' '); ch = skipWhitespace(ch); if (ch != '=') return ch; readValue(name, ch, true); String value = _value.toString(); addText("=\""); addText(value); addText("\""); if (name.equals("encoding")) encoding = value; ch = read(); if (XmlChar.isWhitespace(ch)) addText(' '); ch = skipWhitespace(ch); } if (ch != '?') return ch; else if ((ch = read()) != '>') { addText('?'); return ch; } else { addText("?>"); if (encoding != null) { _stream.setEncoding(encoding); _parseState.setPageEncoding(encoding); } return read(); } } private void parseNode(int ch) throws IOException, JspParseException { while (ch != -1) { switch (ch) { case '<': { switch ((ch = read())) { case '%': if (_isXml) throw error(L.l("'<%' syntax is not allowed in JSP/XML syntax.")); parseScriptlet(); _startText = _charCount; // escape '\\' after scriptlet at end of line if ((ch = read()) == '\\') { if ((ch = read()) == '\n') { ch = read(); } else if (ch == '\r') { if ((ch = read()) == '\n') ch = read(); } else addText('\\'); } break; case '/': ch = parseCloseTag(); break; case '\\': if ((ch = read()) == '%') { addText("<%"); ch = read(); } else addText("<\\"); break; case '!': if (! _isXml) addText("<!"); else if ((ch = read()) == '[') parseCdata(); else if (ch == '-' && (ch = read()) == '-') parseXmlComment(); else throw error(L.l("'{0}' was not expected after '<!'. In the XML syntax, only <!-- ... --> and <![CDATA[ ... ]> are legal. You can use '&amp;!' to escape '<!'.", badChar(ch))); ch = read(); break; default: if (! XmlChar.isNameStart(ch)) { addText('<'); break; } ch = readName(ch); String name = _tag.toString(); int tagCode = getTag(name); if (! _isXml && tagCode == TAG_UNKNOWN) { addText("<"); addText(name); break; } if (_isTop && name.equals("jsp:root")) { if (_parseState.isForbidXml()) throw error(L.l("jsp:root must be in a JSP (XML) document, not a plain JSP.")); _text.clear(); _isXml = true; _parseState.setELIgnoredDefault(false); _parseState.setXml(true); } _isTop = false; parseOpenTag(name, ch, tagCode == TAG_UNKNOWN); ch = read(); // escape '\\' after scriptlet at end of line if (! _isXml && ch == '\\') { if ((ch = read()) == '\n') { ch = read(); } else if (ch == '\r') { if ((ch = read()) == '\n') ch = read(); } } } break; } case '&': if (! _isXml) addText((char) ch); else { addText((char) parseEntity()); } ch = read(); break; case '$': ch = read(); if (ch == '{' && ! isELIgnored()) ch = parseJspExpression(); else addText('$'); break; case '#': ch = read(); if (isVelocity()) { ch = parseVelocity(ch); } else if (ch != '{' || isELIgnored()) { addText('#'); } else if (isDeferredSyntaxAllowedAsLiteral()) { addText('#'); } else throw error(L.l("Deferred syntax ('#{...}') not allowed as literal.")); break; case '\\': switch (ch = read()) { case '$': if (! isELIgnored()) { addText('$'); ch = read(); } else addText('\\'); break; case '#': if (! isELIgnored()) { addText('#'); ch = read(); } else addText('\\'); break; case '\\': addText('\\'); break; default: addText('\\'); break; } break; default: addText((char) ch); ch = read(); break; } } addText(); /* XXX: end document if (! _activeNode.getNodeName().equals("jsp:root")) throw error(L.l("'</{0}>' expected at end of file. For XML, the top-level tag must have a matching closing tag.", activeNode.getNodeName())); */ } /** * JSTL-style expressions. Currently understood: * * <code><pre> * ${a * b} - any arbitrary expression * </pre></code> */ private int parseJspExpression() throws IOException, JspParseException { addText(); Path jspPath = _jspPath; String filename = _filename; int line = _line; CharBuffer cb = CharBuffer.allocate(); int ch; cb.append("${"); for (ch = read(); ch >= 0 && ch != '}'; ch = read()) cb.append((char) ch); cb.append("}"); ch = read(); String prefix = _parseState.findPrefix(JSTL_CORE_URI); if (prefix == null) { prefix = "resin-c"; /* _jspBuilder.startElement(JSP_DIRECTIVE_TAGLIB); _jspBuilder.attribute(new QName("prefix"), prefix); _jspBuilder.attribute(new QName("uri"), JSTL_CORE_URI); _jspBuilder.endAttributes(); _jspBuilder.endElement(JSP_DIRECTIVE_TAGLIB.getName()); */ _jspBuilder.addNamespace(prefix, JSTL_CORE_URI); processTaglib(prefix, JSTL_CORE_URI); } setLocation(jspPath, filename, line); _jspBuilder.startElement(JSTL_CORE_OUT); _jspBuilder.attribute(new QName("value"), cb.close()); _jspBuilder.attribute(new QName("escapeXml"), "false"); _jspBuilder.endAttributes(); _jspBuilder.endElement(JSTL_CORE_OUT.getName()); return ch; } private int parseVelocity(int ch) throws IOException, JspParseException { if (ch == '{') { return parseVelocityScriptlet(); } else if ('a' <= ch && ch <= 'z') { ch = readName(ch); String name = _tag.toString(); if (name.equals("if")) { ch = parseVelocityIf("if"); } else if (name.equals("elseif")) { addText(); setLocation(); JspNode node = _jspBuilder.getCurrentNode(); if (! "resin-c:when".equals(node.getTagName())) throw error(L.l("#elseif is missing a corresponding #if. Velocity-style #if syntax needs matching #if ... #elseif ... #else ... #end. The #if statements must also nest properly with any tags.")); _jspBuilder.endElement("resin-c:when"); ch = parseVelocityIf("elseif"); } else if (name.equals("else")) { addText(); setLocation(); _jspBuilder.endElement("resin-c:when"); setLocation(_jspPath, _filename, _lineStart); _lineStart = _line; _jspBuilder.startElement(JSTL_CORE_OTHERWISE); _jspBuilder.endAttributes(); ch = skipWhitespaceToEndOfLine(ch); } else if (name.equals("foreach")) { ch = parseVelocityForeach("resin-c:forEach"); } else if (name.equals("end")) { addText(); JspNode node = _jspBuilder.getCurrentNode(); String nodeName = null; if (node != null) nodeName = node.getTagName(); if (nodeName.equals("resin-c:when") || nodeName.equals("resin-c:otherwise")) { _jspBuilder.endElement(nodeName); _jspBuilder.endElement(JSTL_CORE_CHOOSE.getName()); } else if (nodeName.equals("resin-c:forEach")) _jspBuilder.endElement(nodeName); else { throw error(L.l("#end is missing a corresponding #if or #foreach. Velocity-style #if syntax needs matching #if ... #elseif ... #else ... #end. The #if statements must also nest properly with any tags.")); } ch = skipWhitespaceToEndOfLine(ch); } else { addText('#'); addText(name); } } else addText('#'); return ch; } /** * This syntax isn't part of velocity. * * <code><pre> * #{ int foo = 3; }# * </pre></code> */ private int parseVelocityScriptlet() throws IOException, JspParseException { addText(); setLocation(_jspPath, _filename, _line); _lineStart = _line; _jspBuilder.startElement(JSP_SCRIPTLET); _jspBuilder.endAttributes(); int ch = read(); while (ch >= 0) { if (ch == '}') { ch = read(); if (ch == '#') break; else addText('}'); } else { addText((char) ch); ch = read(); } } createText(); _jspBuilder.endElement(JSP_SCRIPTLET.getName()); ch = read(); if (ch == '\r') { ch = read(); if (ch == '\n') return read(); else return ch; } else if (ch == '\n') return read(); else return ch; } /** * parses a #foreach statement * * <pre> * #foreach ([Type] var in expr) * ... * #end * </pre> * * <pre> * #foreach ([Type] var in [min .. max]) * ... * #end * </pre> */ private int parseVelocityForeach(String eltName) throws IOException, JspParseException { int ch; for (ch = read(); XmlChar.isWhitespace(ch); ch = read()) { } if (ch != '(') throw error(L.l("Expected `(' after #foreach at `{0}'. The velocity-style #foreach syntax needs parentheses: #foreach ($a in expr)", badChar(ch))); addText(); processTaglib("resin-c", JSTL_CORE_URI); setLocation(_jspPath, _filename, _lineStart); _lineStart = _line; _jspBuilder.startElement(JSTL_CORE_FOREACH); CharBuffer cb = CharBuffer.allocate(); parseVelocityName(cb); if (cb.length() == 0) { throw error(L.l("Expected iteration variable for #foreach at `{0}'. The velocity-style #foreach syntax is: #foreach ($a in expr)", badChar(ch))); } String name = cb.toString(); cb.clear(); parseVelocityName(cb); if (cb.length() == 0) { throw error(L.l("Expected 'in' for #foreach at `{0}'. The velocity-style #foreach syntax is: #foreach ($a in expr)", badChar(ch))); } String value = cb.toString(); if (! value.equals("in")) { throw error(L.l("Expected 'in' for #foreach at `{0}'. The velocity-style #foreach syntax is: #foreach ($a in expr)", badChar(ch))); } if (name.startsWith("$")) name = name.substring(1); _jspBuilder.attribute(new QName("var"), name); cb.clear(); parseVelocityExpr(cb, ')'); String expr = cb.close(); if (expr.indexOf("..") > 0) { int h = 0; for (; Character.isWhitespace(expr.charAt(h)); h++) { } if (expr.charAt(h) != '[') throw error(L.l("Expected '[' for #foreach `{0}'. The velocity-style #foreach syntax is: #foreach ([Type] $a in [min .. max])", badChar(expr.charAt(h)))); int t = expr.length() - 1; for (; Character.isWhitespace(expr.charAt(t)); t--) { } if (expr.charAt(t) != ']') throw error(L.l("Expected ']' for #foreach `{0}'. The velocity-style #foreach syntax is: #foreach ($a in [min .. max])", badChar(expr.charAt(t)))); int p = expr.indexOf(".."); String min = expr.substring(h + 1, p); String max = expr.substring(p + 2, t); _jspBuilder.attribute(new QName("begin"), "${" + min + "}"); _jspBuilder.attribute(new QName("end"), "${" + max + "}"); } else { _jspBuilder.attribute(new QName("items"), "${" + expr + "}"); } _jspBuilder.endAttributes(); return skipWhitespaceToEndOfLine(read()); } /** * parses an #if statement */ private int parseVelocityIf(String eltName) throws IOException, JspParseException { int ch; for (ch = read(); XmlChar.isWhitespace(ch); ch = read()) { } if (ch != '(') throw error(L.l("Expected `(' after #if at `{0}'. The velocity-style #if syntax needs parentheses: #if (...)", badChar(ch))); addText(); processTaglib("resin-c", JSTL_CORE_URI); setLocation(_jspPath, _filename, _line); if (eltName.equals("if")) { _jspBuilder.startElement(JSTL_CORE_CHOOSE); _jspBuilder.endAttributes(); } _jspBuilder.startElement(JSTL_CORE_WHEN); _lineStart = _line; CharBuffer cb = CharBuffer.allocate(); parseVelocityExpr(cb, ')'); _jspBuilder.attribute(new QName("test"), "${" + cb.close() + "}"); _jspBuilder.endAttributes(); return skipWhitespaceToEndOfLine(read()); } private int parseVelocityName(CharBuffer cb) throws IOException, JspParseException { int ch; for (ch = read(); XmlChar.isWhitespace(ch); ch = read()) { } for (; Character.isJavaIdentifierPart((char) ch); ch = read()) cb.append((char) ch); return ch; } private int parseVelocityMin(CharBuffer cb) throws IOException, JspParseException { int ch; for (ch = read(); ch >= 0; ch = read()) { if (ch != '$') cb.append((char) ch); if (ch == '(') { ch = parseVelocityExpr(cb, ')'); cb.append((char) ch); } else if (ch == '[') { ch = parseVelocityExpr(cb, ']'); cb.append((char) ch); } else if (ch == '.') { ch = read(); if (ch == '.') return ch; else { cb.append('.'); _peek = ch; } } } return ch; } private int parseVelocityExpr(CharBuffer cb, int end) throws IOException, JspParseException { int ch; for (ch = read(); ch >= 0 && ch != end; ch = read()) { if (ch != '$') cb.append((char) ch); if (ch == '(') { ch = parseVelocityExpr(cb, ')'); cb.append((char) ch); } else if (ch == '[') { ch = parseVelocityExpr(cb, ']'); cb.append((char) ch); } } return ch; } /** * Parses a &lt;![CDATA[ block. All text in the CDATA is uninterpreted. */ private void parseCdata() throws IOException, JspParseException { int ch; ch = readName(read()); String name = _tag.toString(); if (! name.equals("CDATA")) throw error(L.l("Expected <![CDATA[ at <!['{0}'.", name, "XML only recognizes the <![CDATA directive.")); if (ch != '[') throw error(L.l("Expected '[' at '{0}'. The XML CDATA syntax is <![CDATA[...]]>.", String.valueOf(ch))); String filename = _filename; int line = _line; while ((ch = read()) >= 0) { while (ch == ']') { if ((ch = read()) != ']') addText(']'); else if ((ch = read()) != '>') addText("]]"); else return; } addText((char) ch); } throw error(L.l("Expected closing ]]> at end of file to match <![[CDATA at {0}.", filename + ":" + line)); } /** * Parses an XML name for elements and attribute names. The parsed name * is stored in the 'tag' class variable. * * @param ch the next character * * @return the character following the name */ private int readName(int ch) throws IOException, JspParseException { _tag.clear(); for (; XmlChar.isNameChar((char) ch); ch = read()) _tag.append((char) ch); return ch; } private void parsePageDirective(String name, String value) throws IOException, JspParseException { if ("isELIgnored".equals(name)) { if ("true".equals(value)) _parseState.setELIgnored(true); } } /** * Parses a special JSP syntax. */ private void parseScriptlet() throws IOException, JspParseException { addText(); _lineStart = _line; int ch = read(); // probably should be a qname QName eltName = null; switch (ch) { case '=': eltName = JSP_EXPRESSION; ch = read(); break; case '!': eltName = JSP_DECLARATION; ch = read(); break; case '@': parseDirective(); return; case '-': if ((ch = read()) == '-') { parseComment(); return; } else { eltName = JSP_SCRIPTLET; addText('-'); } break; default: eltName = JSP_SCRIPTLET; break; } setLocation(_jspPath, _filename, _lineStart); _jspBuilder.startElement(eltName); _jspBuilder.endAttributes(); while (ch >= 0) { switch (ch) { case '\\': addText('\\'); ch = read(); if (ch >= 0) addText((char) ch); ch = read(); break; case '%': ch = read(); if (ch == '>') { createText(); setLocation(); _jspBuilder.endElement(eltName.getName()); return; } else if (ch == '\\') { ch = read(); if (ch == '>') { addText("%"); } else addText("%\\"); } else addText('%'); break; default: addText((char) ch); ch = read(); break; } } createText(); setLocation(); _jspBuilder.endElement(eltName.getName()); } /** * Parses the JSP directive syntax. */ private void parseDirective() throws IOException, JspParseException { String language = null; int ch = skipWhitespace(read()); String directive = ""; if (XmlChar.isNameStart(ch)) { ch = readName(ch); directive = _tag.toString(); } else throw error(L.l("Expected jsp directive name at '{0}'. JSP directive syntax is <%@ name attr1='value1' ... %>", badChar(ch))); QName qname; if (directive.equals("page")) qname = JSP_DIRECTIVE_PAGE; else if (directive.equals("include")) qname = JSP_DIRECTIVE_INCLUDE; else if (directive.equals("taglib")) qname = JSP_DIRECTIVE_TAGLIB; else if (directive.equals("cache")) qname = JSP_DIRECTIVE_CACHE; else if (directive.equals("attribute")) qname = JSP_DIRECTIVE_ATTRIBUTE; else if (directive.equals("variable")) qname = JSP_DIRECTIVE_VARIABLE; else if (directive.equals("tag")) qname = JSP_DIRECTIVE_TAG; else throw error(L.l("'{0}' is an unknown jsp directive. Only <%@ page ... %>, <%@ include ... %>, <%@ taglib ... %>, and <%@ cache ... %> are known.", directive)); unread(ch); ArrayList<QName> keys = new ArrayList<QName>(); ArrayList<String> values = new ArrayList<String>(); ArrayList<String> prefixes = new ArrayList<String>(); ArrayList<String> uris = new ArrayList<String>(); parseAttributes(keys, values, prefixes, uris); ch = skipWhitespace(read()); if (ch != '%' || (ch = read()) != '>') { throw error(L.l("expected '%>' at {0}. JSP directive syntax is '<%@ name attr1='value1' ... %>'. (Started at line {1})", badChar(ch), _lineStart)); } setLocation(_jspPath, _filename, _lineStart); _lineStart = _line; _jspBuilder.startElement(qname); for (int i = 0; i < keys.size(); i++) { _jspBuilder.attribute(keys.get(i), values.get(i)); } _jspBuilder.endAttributes(); if (qname.equals(JSP_DIRECTIVE_TAGLIB)) processTaglibDirective(keys, values); setLocation(); _jspBuilder.endElement(qname.getName()); if (qname.equals(JSP_DIRECTIVE_PAGE) || qname.equals(JSP_DIRECTIVE_TAG)) { String contentEncoding = _parseState.getPageEncoding(); if (contentEncoding == null) contentEncoding = _parseState.getCharEncoding(); if (contentEncoding != null) { try { _stream.setEncoding(contentEncoding); } catch (Exception e) { log.log(Level.FINER, e.toString(), e); throw error(L.l("unknown content encoding '{0}'", contentEncoding), e); } } } /* if (directive.equals("include")) parseIncludeDirective(elt); else if (directive.equals("taglib")) parseTaglibDirective(elt); */ } /** * Parses an XML comment. */ private void parseComment() throws IOException, JspParseException { int ch = read(); while (ch >= 0) { if (ch == '-') { ch = read(); while (ch == '-') { if ((ch = read()) == '-') continue; else if (ch == '%' && (ch = read()) == '>') return; else if (ch == '-') ch = read(); } } else ch = read(); } } private void parseXmlComment() throws IOException, JspParseException { int ch; while ((ch = read()) >= 0) { while (ch == '-') { if ((ch = read()) == '-' && (ch = read()) == '>') return; } } } /** * Parses the open tag. */ private void parseOpenTag(String name, int ch, boolean isXml) throws IOException, JspParseException { addText(); ch = skipWhitespace(ch); ArrayList<QName> keys = new ArrayList<QName>(); ArrayList<String> values = new ArrayList<String>(); ArrayList<String> prefixes = new ArrayList<String>(); ArrayList<String> uris = new ArrayList<String>(); unread(ch); parseAttributes(keys, values, prefixes, uris); QName qname = getElementQName(name); setLocation(_jspPath, _filename, _lineStart); _lineStart = _line; _jspBuilder.startElement(qname); for (int i = 0; i < keys.size(); i++) { QName key = keys.get(i); String value = values.get(i); _jspBuilder.attribute(key, value); } _jspBuilder.endAttributes(); for (int i = 0; i < prefixes.size(); i++) { String prefix = prefixes.get(i); String uri = uris.get(i); _jspBuilder.addNamespace(prefix, uri); } if (qname.equals(JSP_DIRECTIVE_TAGLIB)) processTaglibDirective(keys, values); ch = skipWhitespace(read()); JspNode node = _jspBuilder.getCurrentNode(); if (ch == '/') { if ((ch = read()) != '>') throw error(L.l("expected '/>' at '{0}' (for tag '<{1}>' at line {2}). The XML empty tag syntax is: <tag attr1='value1'/>", badChar(ch), name, String.valueOf(_lineStart))); setLocation(); _jspBuilder.endElement(qname.getName()); } else if (ch != '>') throw error(L.l("expected '>' at '{0}' (for tag '<{1}>' at line {2}). The XML tag syntax is: <tag attr1='value1'>", badChar(ch), name, String.valueOf(_lineStart))); // If tagdependent and not XML mode, then read the raw text. else if ("tagdependent".equals(node.getBodyContent()) && ! _isXml) { String tail = "</" + name + ">"; for (ch = read(); ch >= 0; ch = read()) { _text.append((char) ch); if (_text.endsWith(tail)) { _text.setLength(_text.length() - tail.length()); addText(); _jspBuilder.endElement(qname.getName()); return; } } throw error(L.l("expected '{0}' at end of file (for tag <{1}> at line {2}). Tags with 'tagdependent' content need close tags.", tail, String.valueOf(_lineStart))); } } /** * Returns the full QName for the JSP page's name. */ private QName getElementQName(String name) { int p = name.lastIndexOf(':'); if (p > 0) { String prefix = name.substring(0, p); String url = Namespace.find(_namespaces, prefix); _prefixes.add(prefix); if (url != null) return new QName(prefix, name.substring(p + 1), url); else return new QName("", name, ""); } else { String url = Namespace.find(_namespaces, ""); if (url != null) return new QName("", name, url); else return new QName("", name, ""); } } /** * Returns the full QName for the JSP page's name. */ private QName getAttributeQName(String name) { int p = name.lastIndexOf(':'); if (p > 0) { String prefix = name.substring(0, p); String url = Namespace.find(_namespaces, prefix); if (url != null) return new QName(prefix, name.substring(p + 1), url); else return new QName("", name, ""); } else return new QName("", name, ""); } /** * Parses the attributes of an element. */ private void parseAttributes(ArrayList<QName> names, ArrayList<String> values, ArrayList<String> prefixes, ArrayList<String> uris) throws IOException, JspParseException { int ch = skipWhitespace(read()); while (XmlChar.isNameStart(ch)) { ch = readName(ch); String key = _tag.toString(); readValue(key, ch, _isXml); String value = _value.toString(); if (key.startsWith("xmlns:")) { String prefix = key.substring(6); _jspBuilder.startPrefixMapping(prefix, value); //_parseState.pushNamespace(prefix, value); prefixes.add(prefix); uris.add(value); _namespaces = new Namespace(_namespaces, prefix, value); } else if (key.equals("xmlns")) { _jspBuilder.startPrefixMapping("", value); //_parseState.pushNamespace(prefix, value); //_parseState.pushNamespace("", value); _namespaces = new Namespace(_namespaces, "", value); } else { names.add(getAttributeQName(key)); values.add(value); } ch = skipWhitespace(read()); } unread(ch); } /** * Reads an attribute value. */ private void readValue(String attribute, int ch, boolean isXml) throws IOException, JspParseException { boolean isRuntimeAttribute = false; _value.clear(); ch = skipWhitespace(ch); if (ch != '=') { unread(ch); return; } ch = skipWhitespace(read()); if (ch != '\'' && ch != '"') { if (XmlChar.isNameChar(ch)) { ch = readName(ch); throw error(L.l("'{0}' attribute value must be quoted at '{1}'. JSP attribute syntax is either attr=\"value\" or attr='value'.", attribute, _tag)); } else throw error(L.l("'{0}' attribute value must be quoted at '{1}'. JSP attribute syntax is either attr=\"value\" or attr='value'.", attribute, badChar(ch))); } int end = ch; int lastCh = 0; ch = read(); if (ch != '<') { } else if ((ch = read()) != '%') _value.append('<'); else if ((ch = read()) != '=') _value.append("<%"); else { _value.append("<%"); isRuntimeAttribute = true; } while (ch != -1 && (ch != end || isRuntimeAttribute)) { if (ch == '\\') { switch ((ch = read())) { case '\\': case '\'': case '\"': // jsp/1505 vs jsp/184s // _value.append('\\'); _value.append((char) ch); ch = read(); break; case '>': if (lastCh == '%') { _value.append('>'); ch = read(); } else _value.append('\\'); break; case '%': if (lastCh == '<') { _value.append('%'); ch = read(); } else _value.append('\\'); break; default: _value.append('\\'); break; } } else if (ch == '%' && isRuntimeAttribute) { _value.append('%'); ch = read(); if (ch == '>') isRuntimeAttribute = false; } else if (ch == '&' && isXml) { lastCh = -1; _value.append((char) parseEntity()); ch = read(); } else if (ch == '&') { if ((ch = read()) == 'a') { if ((ch = read()) != 'p') _value.append("&a"); else if ((ch = read()) != 'o') _value.append("&ap"); else if ((ch = read()) != 's') _value.append("&apo"); else if ((ch = read()) != ';') _value.append("&apos"); else { _value.append('\''); ch = read(); } } else if (ch == 'q') { if ((ch = read()) != 'u') _value.append("&q"); else if ((ch = read()) != 'o') _value.append("&qu"); else if ((ch = read()) != 't') _value.append("&quo"); else if ((ch = read()) != ';') _value.append("&quot"); else { _value.append('"'); ch = read(); } } else _value.append('&'); } else { _value.append((char) ch); lastCh = ch; ch = read(); } } } /** * Parses an XML entity. */ int parseEntity() throws IOException, JspParseException { int ch = read(); if (_isXml && ch == '#') { int value = 0; for (ch = read(); ch >= '0' && ch <= '9'; ch = read()) value = 10 * value + ch - '0'; if (ch != ';') throw error(L.l("expected ';' at '{0}' in character entity. The XML character entities syntax is &#nn;", badChar(ch))); return (char) value; } CharBuffer cb = CharBuffer.allocate(); for (; ch >= 'a' && ch <= 'z'; ch = read()) cb.append((char) ch); if (ch != ';') { log.warning(L.l("expected ';' at '{0}' in entity '&{1}'. The XML entity syntax is &name;", badChar(ch), cb)); } String entity = cb.close(); if (entity.equals("lt")) return '<'; else if (entity.equals("gt")) return '>'; else if (entity.equals("amp")) return '&'; else if (entity.equals("apos")) return '\''; else if (entity.equals("quot")) return '"'; else throw error(L.l("unknown entity '&{0};'. XML only recognizes the special entities &lt;, &gt;, &amp;, &apos; and &quot;", entity)); } private int parseCloseTag() throws IOException, JspParseException { int ch; if (! XmlChar.isNameStart(ch = read())) { addText("</"); return ch; } ch = readName(ch); String name = _tag.toString(); if (! _isXml && getTag(name) == TAG_UNKNOWN) { addText("</"); addText(name); return ch; } ch = skipWhitespace(ch); if (ch != '>') throw error(L.l("expected '>' at {0}. The XML close tag syntax is </name>.", badChar(ch))); JspNode node = _jspBuilder.getCurrentNode(); String nodeName = node.getTagName(); if (nodeName.equals(name)) { } else if (nodeName.equals("resin-c:when")) { throw error(L.l("#if expects closing #end before </{0}> (#if at {1}). #if statements require #end before the enclosing tag closes.", name, String.valueOf(node.getStartLine()))); } else if (nodeName.equals("resin-c:otherwise")) { throw error(L.l("#else expects closing #end before </{0}> (#else at {1}). #if statements require #end before the enclosing tag closes.", name, String.valueOf(node.getStartLine()))); } else { throw error(L.l("expected </{0}> at </{1}>. Closing tags must match opened tags.", nodeName, name)); } addText(); setLocation(); _jspBuilder.endElement(name); return read(); } private void processTaglibDirective(ArrayList<QName> keys, ArrayList<String> values) throws IOException, JspParseException { int p = keys.indexOf(PREFIX); if (p < 0) throw error(L.l("The taglib directive requires a 'prefix' attribute. 'prefix' is the XML prefix for all tags in the taglib.")); String prefix = values.get(p); if (_prefixes.contains(prefix) && _parseState.getQName(prefix) == null) { throw error(L.l("The taglib prefix '{0}' must be defined before it is used.", prefix)); } if (_localPrefixes.contains(prefix)) throw error(L.l( "<{0}> cannot occur after an action that uses the same prefix: {1}.", JSP_DIRECTIVE_TAGLIB.getName(), prefix)); String uri = null; p = keys.indexOf(URI); if (p >= 0) uri = values.get(p); String tagdir = null; p = keys.indexOf(TAGDIR); if (p >= 0) tagdir = values.get(p); if (uri != null) processTaglib(prefix, uri); else if (tagdir != null) processTaglibDir(prefix, tagdir); } /** * Adds a new known taglib prefix to the current namespace. */ private void processTaglib(String prefix, String uri) throws JspParseException { Taglib taglib = null; int colon = uri.indexOf(':'); int slash = uri.indexOf('/'); String location = null; if (colon > 0 && colon < slash) location = uri; else if (slash == 0) location = uri; else location = _uriPwd + uri; try { taglib = _tagManager.addTaglib(prefix, uri, location); String tldURI = "urn:jsptld:" + uri; _parseState.pushNamespace(prefix, tldURI); _namespaces = new Namespace(_namespaces, prefix, tldURI); return; } catch (JspParseException e) { throw error(e); } catch (Exception e) { log.log(Level.WARNING, e.toString(), e); } if (colon > 0 && colon < slash) throw error(L.l("Unknown taglib '{0}'. Taglibs specified with an absolute URI must either be:\n1) specified in the web.xml\n2) defined in a jar's .tld in META-INF\n3) defined in a .tld in WEB-INF\n4) predefined by Resin", uri)); } /** * Adds a new known tag dir to the current namespace. */ private void processTaglibDir(String prefix, String tagDir) throws JspParseException { Taglib taglib = null; try { taglib = _tagManager.addTaglibDir(prefix, tagDir); String tagURI = "urn:jsptagdir:" + tagDir; _parseState.pushNamespace(prefix, tagURI); _namespaces = new Namespace(_namespaces, prefix, tagURI); return; } catch (JspParseException e) { throw error(e); } catch (Exception e) { log.log(Level.WARNING, e.toString(), e); } } private void processIncludeDirective(ArrayList keys, ArrayList values) throws IOException, JspParseException { int p = keys.indexOf("file"); if (p < 0) throw error(L.l("The include directive requires a 'file' attribute.")); String file = (String) values.get(p); pushInclude(file); } public void pushInclude(String value) throws IOException, JspParseException { pushInclude(value, false); } public void pushInclude(String value, boolean allowDuplicate) throws IOException, JspParseException { if (value.equals("")) throw error("include directive needs 'file' attribute. Use either <%@ include file='myfile.jsp' %> or <jsp:directive.include file='myfile.jsp'/>"); Path include; if (value.length() > 0 && value.charAt(0) == '/') include = _parseState.resolvePath(value); else include = _parseState.resolvePath(_uriPwd + value); String newUrl = _uriPwd; if (value.startsWith("/")) newUrl = value; else newUrl = _uriPwd + value; include.setUserPath(newUrl); String newUrlPwd; int p = newUrl.lastIndexOf('/'); newUrlPwd = newUrl.substring(0, p + 1); if (_jspPath != null && _jspPath.equals(include) && ! allowDuplicate) throw error(L.l("circular include of '{0}' forbidden. A JSP file may not include itself.", include)); for (int i = 0; i < _includes.size(); i++) { Include inc = _includes.get(i); if (inc._stream != null && inc._stream.getPath() != null && inc._stream.getPath().equals(include) && ! allowDuplicate) throw error(L.l("circular include of '{0}'. A JSP file may not include itself.", include)); } try { addInclude(include.openRead(), newUrlPwd); } catch (IOException e) { log.log(Level.WARNING, e.toString(), e); if (include.exists()) throw error(L.l("can't open include of '{0}'. '{1}' exists but it's not readable.", value, include.getNativePath())); else throw error(L.l("can't open include of '{0}'. '{1}' does not exist.", value, include.getNativePath())); } } private void addInclude(ReadStream stream, String newUrlPwd) throws IOException, JspParseException { addText(); readLf(); Include inc = null; if (_stream != null) { inc = new Include(_localPrefixes, _stream, _line, _uriPwd, _parseState.isLocalScriptingInvalid()); _parseState.setLocalScriptingInvalid(false); _includes.add(inc); _localPrefixes = new HashSet<String>(); } _parseState.addDepend(stream.getPath()); try { String encoding = _stream.getEncoding(); if (encoding != null) stream.setEncoding(encoding); } catch (Exception e) { } _stream = stream; _filename = stream.getUserPath(); _jspPath = stream.getPath(); _line = 1; _lineStart = _line; _uriPwd = newUrlPwd; _parseState.setUriPwd(_uriPwd); } /** * Skips whitespace characters. * * @param ch the current character * * @return the first non-whitespace character */ private int skipWhitespace(int ch) throws IOException, JspParseException { for (; XmlChar.isWhitespace(ch); ch = read()) { } return ch; } /** * Skips whitespace to end of line * * @param ch the current character * * @return the first non-whitespace character */ private int skipWhitespaceToEndOfLine(int ch) throws IOException, JspParseException { for (; XmlChar.isWhitespace(ch); ch = read()) { if (ch == '\n') return read(); else if (ch == '\r') { ch = read(); if (ch == '\n') return read(); else return ch; } } return ch; } private void addText(char ch) { _text.append(ch); } private void addText(String s) { _text.append(s); } private void addText() throws JspParseException { if (_text.length() > 0) createText(); _startText = _charCount; _lineStart = _line; } private void createText() throws JspParseException { String string = _text.toString(); setLocation(_jspPath, _filename, _lineStart); if (_parseState.isTrimWhitespace() && isWhitespace(string)) { } else _jspBuilder.text(string, _filename, _lineStart, _line); _lineStart = _line; _text.clear(); _startText = _charCount; } private boolean isWhitespace(String s) { int length = s.length(); for (int i = 0; i < length; i++) { if (! Character.isWhitespace(s.charAt(i))) return false; } return true; } /** * Checks to see if the element name represents a tag. */ private int getTag(String name) throws JspParseException { int p = name.indexOf(':'); if (p < 0) return TAG_UNKNOWN; String prefix = name.substring(0, p); String local = name.substring(p + 1); _prefixes.add(prefix); _localPrefixes.add(prefix); String url = Namespace.find(_namespaces, prefix); if (url != null) return TAG_JSP; else return TAG_UNKNOWN; /* QName qname; if (url != null) qname = new QName(prefix, local, url); else qname = new QName(prefix, local, null); TagInfo tag = _tagManager.getTag(qname); if (tag != null) return TAG_JSP; else return TAG_UNKNOWN; */ } private void unread(int ch) { _peek = ch; } /** * Reads the next character we're in the middle of cr/lf. */ private void readLf() throws IOException, JspParseException { if (_seenCr) { int ch = read(); if (ch != '\n') _peek = ch; } } /** * Reads the next character. */ private int read() throws IOException, JspParseException { int ch; if (_peek >= 0) { ch = _peek; _peek = -1; return ch; } try { if ((ch = _stream.readChar()) >= 0) { _charCount++; if (ch == '\r') { _line++; _charCount = 0; _seenCr = true; } else if (ch == '\n' && _seenCr) { _seenCr = false; _charCount = 0; } else if (ch == '\n') { _line++; _charCount = 0; } else { _seenCr = false; } return ch; } } catch (IOException e) { throw error(e.toString()); } _stream.close(); _seenCr = false; if (_includes.size() > 0) { setLocation(_jspPath, _filename, _line); Include include = _includes.get(_includes.size() - 1); _includes.remove(_includes.size() - 1); _stream = include._stream; _filename = _stream.getUserPath(); _jspPath = _stream.getPath(); _line = include._line; _lineStart = _line; _uriPwd = include._uriPwd; _localPrefixes = include._localPrefixes; _parseState.setUriPwd(_uriPwd); _parseState.setLocalScriptingInvalid(include._oldLocalScriptingDisabled); setLocation(_jspPath, _filename, _line); return read(); } return -1; } void clear(Path appDir, String errorPage) { } /** * Creates an error message adding the filename and line. * * @param e the exception */ public JspParseException error(Exception e) { String message = e.getMessage(); if (e instanceof JspParseException) { log.log(Level.FINE, e.toString(), e); } if (e instanceof JspLineParseException) return (JspLineParseException) e; else if (e instanceof LineCompileException) return new JspLineParseException(e); if (_lineMap == null) return new JspLineParseException(_filename + ":" + _line + ": " + message, e); else { LineMap.Line line = _lineMap.getLine(_line); return new JspLineParseException(line.getSourceFilename() + ":" + line.getSourceLine(_line) + ": " + message, e); } } /** * Creates an error message adding the filename and line. * * @param message the error message */ public JspParseException error(String message) { JspGenerator gen = _jspBuilder.getGenerator(); if (_lineMap == null) { if (gen != null) return new JspLineParseException(_filename + ":" + _line + ": " + message + gen.getSourceLines(_jspPath, _line)); else return new JspLineParseException(_filename + ":" + _line + ": " + message); } else { LineMap.Line line = _lineMap.getLine(_line); return new JspLineParseException(line.getSourceFilename() + ":" + line.getSourceLine(_line) + ": " + message); } } /** * Creates an error message adding the filename and line. * * @param message the error message */ public JspParseException error(String message, Throwable e) { if (_lineMap == null) return new JspLineParseException(_filename + ":" + _line + ": " + message, e); else { LineMap.Line line = _lineMap.getLine(_line); return new JspLineParseException(line.getSourceFilename() + ":" + line.getSourceLine(_line) + ": " + message, e); } } /** * Sets the current location in the original file */ private void setLocation() { setLocation(_jspPath, _filename, _line); } /** * Sets the current location in the original file * * @param filename the filename * @param line the line in the source file */ private void setLocation(Path jspPath, String filename, int line) { if (_lineMap == null) { _jspBuilder.setLocation(jspPath, filename, line); } else { LineMap.Line srcLine = _lineMap.getLine(line); if (srcLine != null) { _jspBuilder.setLocation(jspPath, srcLine.getSourceFilename(), srcLine.getSourceLine(line)); } } } private String badChar(int ch) { if (ch < 0) return "end of file"; else if (ch == '\n' || ch == '\r') return "end of line"; else if (ch >= 0x20 && ch <= 0x7f) return "'" + (char) ch + "'"; else return "'" + (char) ch + "' (\\u" + hex(ch) + ")"; } private String hex(int value) { CharBuffer cb = new CharBuffer(); for (int b = 3; b >= 0; b--) { int v = (value >> (4 * b)) & 0xf; if (v < 10) cb.append((char) (v + '0')); else cb.append((char) (v - 10 + 'a')); } return cb.toString(); } class Include { ReadStream _stream; int _line; String _uriPwd; Set<String> _localPrefixes; boolean _oldLocalScriptingDisabled; Include(Set<String> prefixes, ReadStream stream, int line, String uriPwd, boolean oldLocalScriptingDisabled ) { _stream = stream; _line = line; _uriPwd = uriPwd; _localPrefixes = prefixes; _oldLocalScriptingDisabled = oldLocalScriptingDisabled; } } }
dlitz/resin
modules/resin/src/com/caucho/jsp/JspParser.java
Java
gpl-2.0
58,114
""" Top-level conftest.py does a couple of things: 1) Add cfme_pages repo to the sys.path automatically 2) Load a number of plugins and fixtures automatically """ from pkgutil import iter_modules import pytest import requests import cfme.fixtures import fixtures import markers import metaplugins from fixtures.artifactor_plugin import art_client, appliance_ip_address from cfme.fixtures.rdb import Rdb from fixtures.pytest_store import store from utils import ports from utils.conf import rdb from utils.log import logger from utils.path import data_path from utils.net import net_check from utils.wait import TimedOutError class _AppliancePoliceException(Exception): def __init__(self, message, port, *args, **kwargs): super(_AppliancePoliceException, self).__init__(message, port, *args, **kwargs) self.message = message self.port = port def __str__(self): return "{} (port {})".format(self.message, self.port) @pytest.mark.hookwrapper def pytest_addoption(parser): # Create the cfme option group for use in other plugins parser.getgroup('cfme', 'cfme: options related to cfme/miq appliances') yield @pytest.fixture(scope="session", autouse=True) def set_session_timeout(): store.current_appliance.set_session_timeout(86400) @pytest.fixture(scope="session", autouse=True) def fix_merkyl_workaround(): """Workaround around merkyl not opening an iptables port for communication""" ssh_client = store.current_appliance.ssh_client if ssh_client.run_command('test -s /etc/init.d/merkyl').rc != 0: logger.info('Rudely overwriting merkyl init.d on appliance;') local_file = data_path.join("bundles").join("merkyl").join("merkyl") remote_file = "/etc/init.d/merkyl" ssh_client.put_file(local_file.strpath, remote_file) ssh_client.run_command("service merkyl restart") art_client.fire_hook('setup_merkyl', ip=appliance_ip_address) @pytest.fixture(scope="session", autouse=True) def fix_missing_hostname(): """Fix for hostname missing from the /etc/hosts file Note: Affects RHOS-based appliances but can't hurt the others so it's applied on all. """ ssh_client = store.current_appliance.ssh_client logger.info("Checking appliance's /etc/hosts for its own hostname") if ssh_client.run_command('grep $(hostname) /etc/hosts').rc != 0: logger.info("Adding it's hostname to its /etc/hosts") # Append hostname to the first line (127.0.0.1) ret = ssh_client.run_command('sed -i "1 s/$/ $(hostname)/" /etc/hosts') if ret.rc == 0: logger.info("Hostname added") else: logger.error("Failed to add hostname") @pytest.fixture(autouse=True, scope="function") def appliance_police(): if not store.slave_manager: return try: port_numbers = { 'ssh': ports.SSH, 'https': store.current_appliance.ui_port, 'postgres': ports.DB} port_results = {pn: net_check(pp, force=True) for pn, pp in port_numbers.items()} for port, result in port_results.items(): if not result: raise _AppliancePoliceException('Unable to connect', port_numbers[port]) try: status_code = requests.get(store.current_appliance.url, verify=False, timeout=120).status_code except Exception: raise _AppliancePoliceException('Getting status code failed', port_numbers['https']) if status_code != 200: raise _AppliancePoliceException('Status code was {}, should be 200'.format( status_code), port_numbers['https']) return except _AppliancePoliceException as e: # special handling for known failure conditions if e.port == 443: # Lots of rdbs lately where evm seems to have entirely crashed # and (sadly) the only fix is a rude restart store.current_appliance.restart_evm_service(rude=True) try: store.current_appliance.wait_for_web_ui(900) store.write_line('EVM was frozen and had to be restarted.', purple=True) return except TimedOutError: pass e_message = str(e) except Exception as e: e_message = str(e) # Regardles of the exception raised, we didn't return anywhere above # time to call a human msg = 'Help! My appliance {} crashed with: {}'.format(store.current_appliance.url, e_message) store.slave_manager.message(msg) if 'appliance_police_recipients' in rdb: rdb_kwargs = { 'subject': 'RDB Breakpoint: Appliance failure', 'recipients': rdb.appliance_police_recipients, } else: rdb_kwargs = {} Rdb(msg).set_trace(**rdb_kwargs) store.slave_manager.message('Resuming testing following remote debugging') def _pytest_plugins_generator(*extension_pkgs): # Finds all submodules in pytest extension packages and loads them for extension_pkg in extension_pkgs: path = extension_pkg.__path__ prefix = '%s.' % extension_pkg.__name__ for importer, modname, is_package in iter_modules(path, prefix): yield modname pytest_plugins = tuple(_pytest_plugins_generator(fixtures, markers, cfme.fixtures, metaplugins)) collect_ignore = ["tests/scenarios"]
lehinevych/cfme_tests
conftest.py
Python
gpl-2.0
5,434
package system import ( "github.com/zenazn/goji/web" "net/http" ) // Makes sure templates are stored in the context func (application *Application) ApplyTemplates(c *web.C, h http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { c.Env["Template"] = application.Template h.ServeHTTP(w, r) } return http.HandlerFunc(fn) } func (application *Application) ApplyDbMap(c *web.C, h http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { c.Env["DbMap"] = application.DbMap h.ServeHTTP(w, r) } return http.HandlerFunc(fn) }
tzjin/sniksnak
system/middleware.go
GO
gpl-2.0
589
#include "TestbedNodeManager.h" #include "omnetpp.h" using namespace omnetpp; namespace traci { Define_Module(TestbedNodeManager) void TestbedNodeManager::initialize() { m_twinId = par("twinId").stringValue(); m_twinName = par("twinName").stringValue(); BasicNodeManager::initialize(); } cModule* TestbedNodeManager::createModule(const std::string& id, omnetpp::cModuleType* type) { if (id == m_twinId) { return type->create(m_twinName.c_str(), getSystemModule()); } else { return BasicNodeManager::createModule(id, type); } } } /* namespace traci */
riebl/artery
src/traci/TestbedNodeManager.cc
C++
gpl-2.0
597
using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; using Alceste.Model; using Alceste.Plugin.AudioController.InputFileFormat; using Alceste.Plugin.Ftp; namespace Alceste.Plugin.Utils { public static class UtilsController { public static byte[] ObjectToByteArray(object obj) { if (obj == null) return null; byte[] result = null; using (var ms = new MemoryStream()) { var bf = new BinaryFormatter(); bf.Serialize(ms, obj); result = ms.ToArray(); } return result; } public static object ByteArrayToObject(byte[] buff) { if (buff == null) return null; object result; using (var ms = new MemoryStream(buff)) { var bf = new BinaryFormatter(); result = bf.Deserialize(ms); } return result; } public static MediaFileItem AudioFileInfoToMediaFileItem(IAudioDataInfo audioDataInfoNew) { if (audioDataInfoNew == null) return null; return new MediaFileItem { FileId = audioDataInfoNew.AudioFileId, Length = (int)Math.Floor(audioDataInfoNew.Length.TotalSeconds), WaveFormat = audioDataInfoNew.WaveFormat }; } public static List<string> GetListFromStream(MemoryStream memoryStream) { var fileList = new List<string>(); memoryStream.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(memoryStream)) { while (!reader.EndOfStream) { fileList.Add(reader.ReadLine()); } } return fileList; } public static string GetDirUrlFromPath(string filepath) { var index = filepath.LastIndexOf("/", StringComparison.InvariantCulture); if (index == -1) return filepath; return filepath.Substring(0, index); } public static string GetFileNameFromPath(string filepath) { var index = filepath.LastIndexOf("/", StringComparison.InvariantCulture); if (index == -1) return filepath; return filepath.Substring(index + 1); } public static string PrepareFTPFileName(string fileName) { return fileName.Replace(" ", string.Empty); } public static IList<FtpFileRecordItem> ParseFtpFileItems(List<string> filesStr) { var ftpFileRecordItems = new List<FtpFileRecordItem>(); filesStr.ForEach(item => { string[] itemFields = item.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries); DateTime date; long size; string fileName; int fieldDate = itemFields.Length - 4; int fieldTime = itemFields.Length - 3; int fieldSize = itemFields.Length - 2; int fieldFileName = itemFields.Length - 1; DateTime.TryParse(string.Format("{0} {1}", itemFields[fieldDate], itemFields[fieldTime]), out date); long.TryParse(itemFields[fieldSize], out size); fileName = itemFields[fieldFileName]; ftpFileRecordItems.Add(new FtpFileRecordItem { Date = date, Size = size, FileName = fileName }); }); return ftpFileRecordItems; } public static bool СompareWithWildcards(string strToCompare, string mask) { int i = 0, j = 0; bool isAsterisk = false; if (mask.Length > strToCompare.Length) return false; for (i = 0; i < strToCompare.Length; i++) { if (mask[j] == '*') { isAsterisk = true; } if (mask[j] == strToCompare[i]) { if (strToCompare[i] != '*') { isAsterisk = false; } j++; } else { if (mask[j] == '?') { j++; } else if (!isAsterisk) { return false; } } } return j <= i; } public static bool HasWildcards(string mask) { return mask.IndexOf("*", StringComparison.InvariantCulture) > -1 || mask.IndexOf("?", StringComparison.InvariantCulture) > -1; } public static TimeSpan DurationToPCM(object durationStr) { if (durationStr != DBNull.Value) { int secs; if (int.TryParse(durationStr.ToString(), out secs)) return new TimeSpan(0, 0, 0, secs); } return TimeSpan.Zero; } public static TimeSpan StartEndToTimeSpan(DateTime startDateTime, DateTime endDateTime) { return endDateTime - startDateTime; } } }
rikkimongoose/alceste
src/Alceste.Plugin/Utils/UtilsController.cs
C#
gpl-2.0
5,569
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("TestCases")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hewlett-Packard")] [assembly: AssemblyProduct("TestCases")] [assembly: AssemblyCopyright("Copyright © Hewlett-Packard 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("f83b37d0-e681-4464-9369-47ece07e4582")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
Meowse/TechnicolorMillinery
Chris.DelaPena/Homework 5/Homework 5 Triangles/TestCases/Properties/AssemblyInfo.cs
C#
gpl-2.0
1,424
/* Copyright 2007-2011 The University of Texas at Austin Authors: Joe Rivera <transfix@ices.utexas.edu> Advisor: Chandrajit Bajaj <bajaj@cs.utexas.edu> This file is part of VolMagick. VolMagick is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 2.1 as published by the Free Software Foundation. VolMagick is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* readvtk/writevtk: * Copyright (c) The Technical University of Denmark * Author: Ojaswa Sharma * E-mail: os@imm.dtu.dk * File: vtkIO.h * .vtk I/O */ #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <errno.h> #include <boost/format.hpp> #include <cvc/volmagick.h> #include <cvc/endians.h> #include <cvc/app.h> #ifdef __WINDOWS__ #define SNPRINTF _snprintf #define FSEEK fseek #else #define SNPRINTF snprintf #define FSEEK fseeko #endif namespace { #define LINE_LENGTH 256 typedef float FLOAT; // doubles are supported by VTK format, but here we just want to read as float. struct DataInfo { unsigned int n[3]; // Number of elements in each dimension unsigned int n_input[3]; // NUmber of elements in the input volume unsigned long nTotal; // Total number of voxels = n[0]*n[1]*n[3] char dataType[256]; // data type of values. -ve value indicated signed data bool volumeCovered; //cover the input volume with a one voxel layer around - binary flag. }; FLOAT* readvtk(const char * filename, DataInfo& di, unsigned int subvol_dim, bool coverVolume = false); void writevtk(const char * filename, const DataInfo& di, const FLOAT* data, float value_increment); static inline void geterrstr(int errnum, char *strerrbuf, size_t buflen) { #ifdef HAVE_STRERROR_R strerror_r(errnum,strerrbuf,buflen); #else SNPRINTF(strerrbuf,buflen,"%s",strerror(errnum)); /* hopefully this is thread-safe on the target system! */ #endif } // ------- // readvtk // ------- // Purpose: // Reads a VTK file and returns a pointer to the data. The binary file is in Big-Endian format. // ---- Change History ---- // ??/??/2008 -- Ojaswa S. -- Creation. FLOAT* readvtk(const char * filename, DataInfo& di, unsigned int subvol_dim, bool coverVolume) { using namespace std; using namespace boost; char buf[256]; // Read file supplied as an argument... fprintf(stderr, "Reading datafile %s...", filename); FILE *fd = fopen(filename, "rb"); if(fd == NULL) { geterrstr(errno,buf,256); string errStr = "Error opening file '" + string(filename) + "': " + string(buf); throw CVC_NAMESPACE::read_error(errStr); } char version[LINE_LENGTH]; char comments[LINE_LENGTH]; char format_[LINE_LENGTH]; //"BINARY", "ASCII" char type[LINE_LENGTH]; //"DATASET STRUCTURED_POINTS" char dimensions[LINE_LENGTH]; //"DIMENSIONS NX NY NZ" char origin[LINE_LENGTH]; //"ORIGIN OX OY OZ" char spacing[LINE_LENGTH]; //"SPACING SX SY SZ" char num_pts[LINE_LENGTH]; //"POINT_DATA NN", NN = NX*NY*NZ char data_type[LINE_LENGTH]; //"SCALARS name data_type", e.g. "image_data unsigned_short" char lookup_t[LINE_LENGTH]; //"LOOKUP_TABLE default" fgets(version, LINE_LENGTH, fd); fgets(comments, LINE_LENGTH, fd); fgets(format_, LINE_LENGTH, fd); fgets(type, LINE_LENGTH, fd); fgets(dimensions, LINE_LENGTH, fd); fgets(origin, LINE_LENGTH, fd); fgets(spacing, LINE_LENGTH, fd); fgets(num_pts, LINE_LENGTH, fd); fgets(data_type, LINE_LENGTH, fd); fgets(lookup_t, LINE_LENGTH, fd); if(strncmp(format_, "BINARY", 6) != 0) { string errStr = "Error reading file '" + string(filename) + "': Only binary .vtk files are supported."; fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } char _type[256]; sscanf(type, "%*s %s", _type); if(strncmp(_type, "STRUCTURED_POINTS", 17) != 0) { string errStr = "Error reading file '" + string(filename) + "': Only structured points are supported."; fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } char _dimstr[256]; sscanf(dimensions, "%s %u %u %u", _dimstr, &(di.n_input[0]), &(di.n_input[1]), &(di.n_input[2])); if(strncmp(_dimstr, "DIMENSIONS", 10) != 0) { string errStr = "Error reading file '" + string(filename) + "': Corrupt header for dimension."; fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } di.volumeCovered = coverVolume; if(coverVolume) { di.n[0] = di.n_input[0] + 2; di.n[1] = di.n_input[1] + 2; di.n[2] = di.n_input[2] + 2; } //pad to match subvolume multiples subvol_dim -=2; // Since we have a 2 voxel overlap between subvolumes. unsigned int n = ((di.n[0] % subvol_dim) != 0)? (di.n[0] / subvol_dim + 1):(di.n[0] / subvol_dim); di.n[0] = 2 + n*subvol_dim; n = ((di.n[1] % subvol_dim) != 0)? (di.n[1] / subvol_dim + 1):(di.n[1] / subvol_dim); di.n[1] = 2 + n*subvol_dim; n = ((di.n[2] % subvol_dim) != 0)? (di.n[2] / subvol_dim + 1):(di.n[2] / subvol_dim); di.n[2] = 2 + n*subvol_dim; char _numptsstr[256]; sscanf(num_pts, "%s %lu", _numptsstr, &(di.nTotal)); if(strncmp(_numptsstr, "POINT_DATA", 10) != 0) { string errStr = "Error reading file '" + string(filename) + "': Corrupt header for data type."; fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } char _datastr[256], _dataname[256]; sscanf(data_type, "%s %s %s", _datastr, _dataname, di.dataType); if(strncmp(_datastr, "SCALARS", 7) != 0 || strncmp(_dataname, "image_data", 10) !=0) { string errStr = "Error reading file '" + string(filename) + "': Only scalar data of type \"image_data\" of type \"unsigned_short\" is supported."; fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } fprintf(stderr, "\nInput volume size: %d x %d x %d, %s\n", di.n_input[0], di.n_input[1], di.n_input[2], di.dataType); fprintf(stderr, "\nPadded volume size: %d x %d x %d\n", di.n[0], di.n[1], di.n[2]); //fprintf(stderr, "%s.\n%s.\n%s.\n%s.\n%s.\n%s.\n%s.\n%s.\n%s.\n%s.\n", version, comments, format, type, dimensions, origin, spacing, num_pts, data_type, lookup_t); //Allocate memory unsigned long nMem = (di.n[0]*di.n[1]*di.n[2]); unsigned byte_size = 0; if(strncmp(di.dataType, "unsigned_char", 13) == 0) byte_size = sizeof(unsigned char); else if(strncmp(di.dataType, "char", 4) == 0) byte_size = sizeof(char); else if(strncmp(di.dataType, "unsigned_short", 14) == 0) byte_size = sizeof(unsigned short); else if(strncmp(di.dataType, "short", 5) == 0) byte_size = sizeof(short); else if(strncmp(di.dataType, "unsigned_int", 12) == 0) byte_size = sizeof(unsigned int); else if(strncmp(di.dataType, "int", 3) == 0) byte_size = sizeof(int); else if(strncmp(di.dataType, "float", 5) == 0) byte_size = sizeof(float); else if(strncmp(di.dataType, "double", 6) == 0) byte_size = sizeof(double); // N.B.: our data currently is 16 bit unsigned int (unsigned short). We therefore do not worry about other types!!! if(strncmp(di.dataType, "unsigned_short", 14) != 0) { string errStr = "Error reading file '" + string(filename) + "': Only 16 bit unsignd integers are supported at the moment."; fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } FLOAT* dataPtr = (FLOAT*)calloc(nMem, sizeof(FLOAT)); // initialize mem to zero - so that padded part is set to zero! if(dataPtr == NULL) { string errStr(str(format("Error reading file '%1%': Could not allocate %2% bytes of memory!") % string(filename) % (nMem*sizeof(FLOAT)))); fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } unsigned short dataVal; register unsigned int _r, _c, _d; FLOAT *ptr = NULL; for(_d = 0; _d < di.n_input[2]; _d++) for(_c = 0; _c < di.n_input[1]; _c++) for(_r = 0; _r < di.n_input[0]; _r++) { if(feof(fd) > 0) { string errStr = "Error reading file '" + string(filename) + "': Insufficient elements in the file."; free(dataPtr); fclose(fd); throw CVC_NAMESPACE::read_error(errStr); } fread(&dataVal, byte_size, 1, fd); //dataVal = ntohs(dataVal); if(!CVC_NAMESPACE::big_endian()) SWAP_16(&dataVal); ptr = coverVolume?(dataPtr + _r + 1 + (_c + 1)*di.n[0] + (_d + 1)*di.n[0]*di.n[1]):(dataPtr + _r + _c*di.n[0] + _d*di.n[0]*di.n[1]); *ptr = (FLOAT)(dataVal); } fclose(fd); fprintf(stderr, "Done.\n"); return dataPtr; //return pointer to data } // -------- // writevtk // -------- // Purpose: // Writes a VTK file. // ---- Change History ---- // ??/??/2008 -- Ojaswa S. -- Creation. void writevtk(const char * filename, const DataInfo& di, const FLOAT* dataPtr, float value_increment) { using namespace std; using namespace boost; char buf[256]; // write file supplied as an argument... //bool stripCover = di.volumeCovered; fprintf(stderr, "Writing datafile %s...", filename); FILE *fd = fopen(filename, "wb"); if(fd == NULL) { geterrstr(errno,buf,256); string errStr = "Error opening file '" + string(filename) + "': " + string(buf); throw CVC_NAMESPACE::write_error(errStr); } char str[256]; unsigned long nMem = di.n[0]*di.n[1]*di.n[2]; sprintf(str, "# vtk DataFile Version 3.0\n"); fputs(str, fd); sprintf(str, "created by levelSet (Ojaswa Sharma). Zero level: %f\n", value_increment); fputs(str, fd); sprintf(str, "BINARY\n"); fputs(str, fd); sprintf(str, "DATASET STRUCTURED_POINTS\n"); fputs(str, fd); sprintf(str, "DIMENSIONS %d %d %d\n", di.n[0], di.n[1], di.n[2]); fputs(str, fd); sprintf(str, "ORIGIN 0.000000 0.000000 0.000000\n"); fputs(str, fd); sprintf(str, "SPACING 1.000000 1.000000 1.000000\n"); fputs(str, fd); sprintf(str, "POINT_DATA %lu\n", nMem); fputs(str, fd); sprintf(str, "SCALARS image_data unsigned_short\n"); fputs(str, fd); sprintf(str, "LOOKUP_TABLE default\n"); fputs(str, fd); unsigned short dataval; FLOAT datavalf; register unsigned int _r, _c, _d; const FLOAT *ptr = NULL; for(_d = 0; _d < di.n[2]; _d++) for(_c = 0; _c < di.n[1]; _c++) for(_r = 0; _r < di.n[0]; _r++) { ptr = dataPtr + _r + _c*di.n[0] + _d*di.n[0]*di.n[1]; datavalf = *ptr + value_increment; if(datavalf < 0.0) datavalf = 0.0; //dataval = (unsigned short)(round(datavalf)); dataval = (unsigned short)(floor(datavalf+0.5)); //dataval = htons(dataval); if(!CVC_NAMESPACE::big_endian()) SWAP_16(&dataval); if(fwrite(&dataval, sizeof(unsigned short), 1, fd)!=1) { geterrstr(errno,buf,256); std::string errStr = "Error writing volume data to file '" + string(filename) + "': " + buf; fclose(fd); throw CVC_NAMESPACE::write_error(errStr); } } fclose(fd); fprintf(stderr, "Done\n"); } } namespace CVC_NAMESPACE { // ------ // vtk_io // ------ // Purpose: // Provides VTK file support. // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. struct vtk_io : public volume_file_io { // -------------- // vtk_io::vtk_io // -------------- // Purpose: // Initializes the extension list and id. // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. vtk_io() : _id("vtk_io : v1.0") { _extensions.push_back(".vtk"); } // ---------- // vtk_io::id // ---------- // Purpose: // Returns a string that identifies this volume_file_io object. This should // be unique, but is freeform. // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. virtual const std::string& id() const { return _id; } // ------------------ // vtk_io::extensions // ------------------ // Purpose: // Returns a list of extensions that this volume_file_io object supports. // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. virtual const extension_list& extensions() const { return _extensions; } // ------------------------- // vtk_io::getVolumeFileInfo // ------------------------- // Purpose: // Writes to a structure containing all info that VolMagick needs // from a volume file. // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. virtual void getVolumeFileInfo(volume_file_info::data& /*d*/, const std::string& /*filename*/) const { thread_info ti(BOOST_CURRENT_FUNCTION); throw read_error("Reading VTK files doesn't work yet!"); } // ---------------------- // vtk_io::readVolumeFile // ---------------------- // Purpose: // Writes to a Volume object after reading from a volume file. // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. virtual void readVolumeFile(volume& /*vol*/, const std::string& /*filename*/, unsigned int /*var*/, unsigned int /*time*/, uint64 /*off_x*/, uint64 /*off_y*/, uint64 /*off_z*/, const dimension& /*subvoldim*/) const { thread_info ti(BOOST_CURRENT_FUNCTION); throw read_error("Reading VTK files doesn't work yet!"); } // ------------------------ // vtk_io::createVolumeFile // ------------------------ // Purpose: // Creates an empty volume file to be later filled in by writeVolumeFile // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. virtual void createVolumeFile(const std::string& /*filename*/, const bounding_box& /*boundingBox*/, const dimension& /*dimension*/, const std::vector<data_type>& /*voxelTypes*/, unsigned int /*numVariables*/, unsigned int /*numTimesteps*/, double /*min_time*/, double /*max_time*/) const { thread_info ti(BOOST_CURRENT_FUNCTION); throw CVC_NAMESPACE::write_error("Writing VTK files doesn't work yet!"); } // ----------------------- // vtk_io::writeVolumeFile // ----------------------- // Purpose: // Writes the volume contained in wvol to the specified volume file. Should create // a volume file if the filename provided doesn't exist. Else it will simply // write data to the existing file. A common user error arises when you try to // write over an existing volume file using this function for unrelated volumes. // If what you desire is to overwrite an existing volume file, first run // createVolumeFile to replace the volume file. // ---- Change History ---- // 11/20/2009 -- Joe R. -- Creation. virtual void writeVolumeFile(const volume& /*wvol*/, const std::string& /*filename*/, unsigned int /*var*/, unsigned int /*time*/, uint64 /*off_x*/, uint64 /*off_y*/, uint64 /*off_z*/) const { thread_info ti(BOOST_CURRENT_FUNCTION); throw CVC_NAMESPACE::write_error("Writing VTK files doesn't work yet!"); } protected: std::string _id; std::list<std::string> _extensions; }; } namespace { class vtk_io_init { public: vtk_io_init() { CVC_NAMESPACE::volume_file_io::insertHandler( CVC_NAMESPACE::volume_file_io::ptr(new CVC_NAMESPACE::vtk_io) ); } } static_init; }
transfix/trans-cvc
src/cvc/vtk_io.cpp
C++
gpl-2.0
15,864
/* Copyright (C) 2003 - 2016 by David White <dave@whitevine.net> Part of the Battle for Wesnoth Project http://www.wesnoth.org/ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the COPYING file for more details. */ #define GETTEXT_DOMAIN "wesnoth-lib" #include "global.hpp" #include "widgets/combo.hpp" #include "show_dialog.hpp" class CVideo; namespace gui { const std::string combo::empty_combo_label = ""; const int combo::font_size = font::SIZE_SMALL; const int combo::horizontal_padding = 10; const int combo::vertical_padding = 10; combo::combo(CVideo& video, const std::vector<std::string>& items) : button(video, items.empty() ? empty_combo_label : items[0]), items_(items), selected_(0), oldSelected_(0), video_(&video) { } int combo::selected() const { return selected_; } bool combo::changed() { if (oldSelected_ != selected_) { oldSelected_ = selected_; return true; } else return false; } void combo::set_items(const std::vector<std::string>& items) { items_ = items; selected_ = -1; } void combo::set_selected_internal(int val) { const size_t index = size_t(val); if (val == selected_ || index >= items_.size()) return; set_label(items_[index]); oldSelected_ = selected_; selected_ = val; } void combo::set_selected(int val) { set_selected_internal(val); oldSelected_ = selected_; } void combo::make_drop_down_menu() { SDL_Rect const &loc = location(); set_selected_internal(gui::show_dialog(*video_, NULL, "", "", gui::MESSAGE, &items_, NULL, "", NULL, -1, NULL, loc.x, loc.y + loc.h)); } void combo::process_event() { if (!pressed()) return; make_drop_down_menu(); } }
t-zuehlsdorff/wesnoth
src/widgets/combo.cpp
C++
gpl-2.0
1,985
<?php /** * The header for our theme. * * Displays all of the <head> section and everything up till <div id="content"> * * @package tresource */ ?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta charset="<?php bloginfo( 'charset' ); ?>"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="profile" href="http://gmpg.org/xfn/11"> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> <?php wp_head(); ?> </head> <body <?php body_class(); ?> id="top"> <!-- <div id="page" class="hfeed site"> <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'tresource' ); ?></a> <header id="masthead" class="site-header" role="banner"> <div class="site-branding"> <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> </div> <nav id="site-navigation" class="main-navigation" role="navigation"> <button class="menu-toggle" aria-controls="menu" aria-expanded="false"><?php _e( 'Primary Menu', 'tresource' ); ?></button> <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?> </nav> </header> --> <header class="header group" role="banner"> <div class="search-keyline"> <div class="header-wrapper group"> <ul class="utility-nav"> <!-- <li>Welcome, <a href="">Username</a>!</li> <li class="disk" aria-hidden="true"> ● </li> <li><a href="">Logout</a></li> --> <li><a href="">LOGIN</a></li> <li class="disk" aria-hidden="true"> ● </li> <li><a href="">JOIN</a></li> </ul> <form action="" class="search-form header-search-position"> <input type="submit" value="submit" class="search-submit header-search-submit-position" > <input type="search" name="q" placeholder="Search" class="search-term header-search-term-width" > </form> </div> <!--/ header-wrapper--> </div> <!--/ search-keyline--> <div class="header-wrapper group"> <a class="logo-wrapper" href="<?php echo esc_url( home_url( '/' ) ); ?>"> <img class="header-logo" src="<?php bloginfo('stylesheet_directory'); ?>/assets/i/header_logo_75x82.png" alt="families connecting"> </a> <h1 class="header-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>">TreSource</a></h1> <nav class="nav" id="primary-nav" role="navigation"> <p class="menu-link nav-toggle"> <a>Open Navigation</a> </p> <?php $menu_args = array( 'theme_location' => 'primary', 'menu' => 'Main Menu', 'container' => false ); wp_nav_menu( $menu_args ); ?> </nav> </div> <!--/ header-wrapper--> </header> <!--/ header--> <div class="main" role="main">
mattsteele/tresource.dev
wp-content/themes/tresource/header.php
PHP
gpl-2.0
2,828
require 'test_helper' class Catalogs::Products::PricesHelperTest < ActionView::TestCase end
929528/PetroleumAccounting
test/helpers/catalogs/products/prices_helper_test.rb
Ruby
gpl-2.0
93
package ug3.selp.timetable.tab_adapters; import ug3.selp.timetable.fragments.DayFragment; import ug3.selp.timetable.service.Resources; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; import android.util.Log; public class ViewPagerAdapter extends FragmentStatePagerAdapter { private final int PAGES = 5; private final String TAG = "ViewPagerAdapter"; public ViewPagerAdapter(FragmentManager fm) { super(fm); } @Override public int getCount() { return PAGES; } @Override public Fragment getItem(int position) { DayFragment day = new DayFragment(); Bundle bundle = new Bundle(); // Attach the correct day to the fragment for future retriaval in the fragment switch (position) { case 0: bundle.putString(Resources.BUNDLE_DAY_KEY, Resources.BUNDLE_DAY_MONDAY); day.setArguments(bundle); return day; case 1: bundle.putString(Resources.BUNDLE_DAY_KEY, Resources.BUNDLE_DAY_TUESDAY); day.setArguments(bundle); return day; case 2: bundle.putString(Resources.BUNDLE_DAY_KEY, Resources.BUNDLE_DAY_WEDNESDAY); day.setArguments(bundle); return day; case 3: bundle.putString(Resources.BUNDLE_DAY_KEY, Resources.BUNDLE_DAY_THURSDAY); day.setArguments(bundle); return day; case 4: bundle.putString(Resources.BUNDLE_DAY_KEY, Resources.BUNDLE_DAY_FRIDAY); day.setArguments(bundle); return day; default: Log.d(TAG, "Unavailable position."); return null; } } }
easyCZ/UoE-Informatics-Timetable
SELP3/src/ug3/selp/timetable/tab_adapters/ViewPagerAdapter.java
Java
gpl-2.0
1,724
// OpenVPN -- An application to securely tunnel IP networks // over a single port, with support for SSL/TLS-based // session authentication and key exchange, // packet encryption, packet authentication, and // packet compression. // // Copyright (C) 2012-2017 OpenVPN Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License Version 3 // as published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program in the COPYING file. // If not, see <http://www.gnu.org/licenses/>. // Wrap the OpenSSL cipher API defined in <openssl/evp.h> so // that it can be used as part of the crypto layer of the OpenVPN core. #ifndef OPENVPN_OPENSSL_CRYPTO_CIPHER_H #define OPENVPN_OPENSSL_CRYPTO_CIPHER_H #include <string> #include <openssl/objects.h> #include <openssl/evp.h> #include <openvpn/common/size.hpp> #include <openvpn/common/exception.hpp> #include <openvpn/crypto/static_key.hpp> #include <openvpn/crypto/cryptoalgs.hpp> #include <openvpn/openssl/util/error.hpp> namespace openvpn { namespace OpenSSLCrypto { class CipherContext { CipherContext(const CipherContext&) = delete; CipherContext& operator=(const CipherContext&) = delete; public: OPENVPN_SIMPLE_EXCEPTION(openssl_cipher_mode_error); OPENVPN_SIMPLE_EXCEPTION(openssl_cipher_uninitialized); OPENVPN_EXCEPTION(openssl_cipher_error); // mode parameter for constructor enum { MODE_UNDEF = -1, ENCRYPT = 1, DECRYPT = 0 }; // OpenSSL cipher constants enum { MAX_IV_LENGTH = EVP_MAX_IV_LENGTH, CIPH_CBC_MODE = EVP_CIPH_CBC_MODE }; CipherContext() : initialized(false) { } ~CipherContext() { erase() ; } void init(const CryptoAlgs::Type alg, const unsigned char *key, const int mode) { // check that mode is valid if (!(mode == ENCRYPT || mode == DECRYPT)) throw openssl_cipher_mode_error(); erase(); EVP_CIPHER_CTX_init (&ctx); if (!EVP_CipherInit_ex (&ctx, cipher_type(alg), nullptr, key, nullptr, mode)) { openssl_clear_error_stack(); throw openssl_cipher_error("EVP_CipherInit_ex (init)"); } initialized = true; } void reset(const unsigned char *iv) { check_initialized(); if (!EVP_CipherInit_ex (&ctx, nullptr, nullptr, nullptr, iv, -1)) { openssl_clear_error_stack(); throw openssl_cipher_error("EVP_CipherInit_ex (reset)"); } } bool update(unsigned char *out, const size_t max_out_size, const unsigned char *in, const size_t in_size, size_t& out_acc) { check_initialized(); int outlen; if (EVP_CipherUpdate (&ctx, out, &outlen, in, int(in_size))) { out_acc += outlen; return true; } else { openssl_clear_error_stack(); return false; } } bool final(unsigned char *out, const size_t max_out_size, size_t& out_acc) { check_initialized(); int outlen; if (EVP_CipherFinal_ex (&ctx, out, &outlen)) { out_acc += outlen; return true; } else { openssl_clear_error_stack(); return false; } } bool is_initialized() const { return initialized; } size_t iv_length() const { check_initialized(); return EVP_CIPHER_CTX_iv_length (&ctx); } size_t block_size() const { check_initialized(); return EVP_CIPHER_CTX_block_size (&ctx); } // return cipher mode (such as CIPH_CBC_MODE, etc.) int cipher_mode() const { check_initialized(); return EVP_CIPHER_CTX_mode (&ctx); } private: static const EVP_CIPHER *cipher_type(const CryptoAlgs::Type alg) { switch (alg) { case CryptoAlgs::AES_128_CBC: return EVP_aes_128_cbc(); case CryptoAlgs::AES_192_CBC: return EVP_aes_192_cbc(); case CryptoAlgs::AES_256_CBC: return EVP_aes_256_cbc(); case CryptoAlgs::AES_256_CTR: return EVP_aes_256_ctr(); case CryptoAlgs::DES_CBC: return EVP_des_cbc(); case CryptoAlgs::DES_EDE3_CBC: return EVP_des_ede3_cbc(); case CryptoAlgs::BF_CBC: return EVP_bf_cbc(); default: OPENVPN_THROW(openssl_cipher_error, CryptoAlgs::name(alg) << ": not usable"); } } void erase() { if (initialized) { EVP_CIPHER_CTX_cleanup(&ctx); initialized = false; } } void check_initialized() const { #ifdef OPENVPN_ENABLE_ASSERT if (!initialized) throw openssl_cipher_uninitialized(); #endif } bool initialized; EVP_CIPHER_CTX ctx; }; } } #endif
proxysh/Safejumper-for-Android
app/src/main/cpp/openvpn3/openvpn/openssl/crypto/cipher.hpp
C++
gpl-2.0
5,022
/* * * * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. */ package com.sun.cldchi.tools.memoryprofiler.data; /** * This class is container for Java Class information. It contains unique class id and class name. * * @see com.sun.cldchi.tools.memoryprofiler.data.MPDataProvider * */ public class JavaClass { public final int id; public final String name; JavaClass(int p_id, String p_value) { id = p_id; name = p_value; } public String toString() { return name; } public int get_id() {return id;} }
tommythorn/yari
shared/cacao-related/phoneme_feature/cldc/src/tools/memprof_client/src/data/JavaClass.java
Java
gpl-2.0
1,528
<?php /** * ForgeIgniter * * A user friendly, modular content management system. * Forged on CodeIgniter - http://codeigniter.com * * @package ForgeIgniter * @author ForgeIgniter Team * @copyright Copyright (c) 2015, ForgeIgniter * @license http://forgeigniter.com/license * @link http://forgeigniter.com/ * @since Hal Version 1.0 * @filesource */ // ------------------------------------------------------------------------ class Admin extends CI_Controller { // set defaults var $table = 'images'; // table to update var $includes_path = '/includes/admin'; // path to includes for header and footer var $redirect = '/admin/images/viewall'; // default redirect var $objectID = 'imageID'; // default unique ID var $permissions = array(); var $sitePermissions = array(); var $selections = array(); function __construct() { parent::__construct(); // check user is logged in, if not send them away from this controller if (!$this->session->userdata('session_admin')) { redirect('/admin/login/'.$this->core->encode($this->uri->uri_string())); } // get site permissions and redirect if it don't have access to this module $this->permission->sitePermissions = $this->permission->get_group_permissions($this->site->config['groupID']); // get permissions and redirect if they don't have access to this module if (!$this->permission->permissions) { if (@$this->core->is_ajax()) { die('<p>Sorry, you do not have permissions to do what you just tried to do. <a class="halogycms_close" href="#">Close</a></p>'); } else { redirect('/admin/dashboard/permissions'); } } if (!in_array($this->uri->segment(2), $this->permission->permissions)) { if (@$this->core->is_ajax()) { die('<p>Sorry, you do not have permissions to do what you just tried to do. <a class="halogycms_close" href="#">Close</a></p>'); } else { redirect('/admin/dashboard/permissions'); } } // get preset selections for this module $selections = $this->session->userdata('selections'); $this->selections = (is_array($selections)) ? @$selections[$this->uri->segment(2)] : ''; // get siteID, if available if (defined('SITEID')) { $this->siteID = SITEID; } // load libs etc $this->load->model('images_model', 'images'); } function index() { redirect($this->redirect); } function viewall($folderID = '') { if (count($_FILES)) { // allowed ZIP mime types $allowedZips = array('application/x-zip', 'application/zip', 'application/x-zip-compressed'); if ($this->input->post('upload_zip')) { if (substr($_FILES['zip']['name'],-3) == 'zip' && in_array($_FILES['zip']['type'], $allowedZips)) { // get started $success = FALSE; $this->load->library('zip'); $this->load->library('encrypt'); $this->load->library('image_lib'); // unzip files $uploadsPath = $this->uploads->uploadsPath; $zip = zip_open($_FILES['zip']['tmp_name']); if ($zip) { // cycle through the zip while ($zip_entry = zip_read($zip)) { if (!preg_match('/(\_)+MACOSX/', zip_entry_name($zip_entry)) && preg_match('/\.(jpg|gif|png)$/i', zip_entry_name($zip_entry))) { if (zip_entry_filesize($zip_entry) > 300000) { $this->form_validation->set_error('<p>Some files were too big to upload. Please only use small gfx files under 300kb.</p>'); } else { // format filename $filenames = explode('.', zip_entry_name($zip_entry)); $filename = trim(basename($filenames[0])); $extension = end($filenames); // get file name $imageRef = url_title(trim(strtolower($filename))); // check ref is unique and upload if ($this->form_validation->unique($imageRef, 'images.imageRef')) { // set stuff $this->core->set['dateCreated'] = date("Y-m-d H:i:s"); $this->core->set['imageName'] = 'Graphic'; $this->core->set['filename'] = md5($filename).'.'.$extension; $this->core->set['imageRef'] = $imageRef; $this->core->set['filesize'] = floor(zip_entry_filesize($zip_entry) / 1024); $this->core->set['groupID'] = 1; $this->core->set['userID'] = $this->session->userdata('userID'); // update and then unset easy if ($this->core->update('images')); // upload file $fp = fopen('.'.$uploadsPath.'/'.md5($filename).'.'.$extension, "w+"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); zip_entry_close($zip_entry); } fwrite($fp, $buf); fclose($fp); // get image size $imageSize = @getimagesize('.'.$uploadsPath.'/'.md5($filename).'.'.$extension); // make a thumbnail if ($imageSize[0] > $this->uploads->thumbSize || $imageSize[1] > $this->uploads->thumbSize) { $config['image_library'] = 'gd2'; $config['source_image'] = '.'.$uploadsPath.'/'.md5($filename).'.'.$extension; $config['create_thumb'] = true; $config['maintain_ratio'] = true; $config['width'] = $this->uploads->thumbSize; $config['height'] = $this->uploads->thumbSize; $this->image_lib->initialize($config); $this->image_lib->resize(); } $success = TRUE; } } } } zip_close($zip); } // redirect if ($success === TRUE) { redirect('/admin/images/viewall/'.(($this->input->post('folderID')) ? $this->input->post('folderID') : '')); } } else { $this->form_validation->set_error('<p>There was a problem opening the zip file, sorry.</p>'); } } // upload image elseif ($oldFileName = @$_FILES['image']['name']) { $this->uploads->allowedTypes = 'jpg|gif|png'; // get image name $imageName = ($this->input->post('imageName')) ? $this->input->post('imageName') : preg_replace('/.([a-z]+)$/i', '', $oldFileName); // set image reference and only add to db if its unique $imageRef = url_title(trim(substr(strtolower($imageName),0,30))); if ($this->form_validation->unique($imageRef, 'images.imageRef')) { if ($imageData = $this->uploads->upload_image()) { $this->core->set['filename'] = $imageData['file_name']; $this->core->set['filesize'] = $imageData['file_size']; } // get image errors if there are any if ($this->uploads->errors) { $this->form_validation->set_error($this->uploads->errors); } else { // set image ref $this->core->set['class'] = 'default'; $this->core->set['imageRef'] = $imageRef; $this->core->set['imageName'] = ($this->input->post('imageName')) ? $this->input->post('imageName') : 'Image'; $this->core->set['dateCreated'] = date("Y-m-d H:i:s"); $this->core->set['userID'] = $this->session->userdata('userID'); // update if ($this->core->update('images')) { // where to redirect to redirect('/admin/images/viewall/'.(($this->input->post('folderID')) ? $this->input->post('folderID') : '')); } } } else { $this->form_validation->set_error('<p>The image reference you entered has already been used, please try another.</p>'); } } } // search if ($this->input->post('searchbox')) { $output['images'] = $this->images->search_images($this->input->post('searchbox')); } // get images else { // set default wheres $where = array('siteID' => $this->siteID, 'deleted' => 0); // get preset selections for this dropdown if ($folderID == '' && @array_key_exists('folderID', $this->selections)) { $folderID = $this->selections['folderID']; } // folderID if ($folderID != '') { // get ones uploaded by this user if ($folderID == 'me') { $where['userID'] = $this->session->userdata('userID'); } // make sure that all is not selected elseif ($folderID != 'all' && $folderID != 'page' && $folderID != 'me') { $where['folderID'] = $folderID; } // set preset selections for this dropdown $this->session->set_userdata('selections', array($this->uri->segment(2) => array('folderID' => $folderID))); } // check they have permissions to see all images if (!@in_array('images_all', $this->permission->permissions)) { $where['userID'] = $this->session->userdata('userID'); } // grab data and display $output = $this->core->viewall($this->table, $where, NULL, 15); } // get folderID if set $output['folderID'] = $folderID; // get quota $output['quota'] = $this->site->get_quota(); // get categories $output['folders'] = $this->images->get_folders(); $this->load->view($this->includes_path.'/header'); $this->load->view('admin/viewall',$output); $this->load->view($this->includes_path.'/footer'); } function edit($imageID, $redirect = '', $popup = FALSE) { // required $this->core->required = array( 'imageRef' => array('label' => 'Image name', 'rules' => 'required|unique[images.imageRef]') ); // set object ID $objectID = array($this->objectID => $imageID); // get values $output['data'] = $this->core->get_values($this->table, $objectID); // handle post if (count($_POST)) { // set image reference and only add to db if its unique $imageRef = url_title(trim(substr(strtolower($this->input->post('imageRef')),0,30))); if ($oldFileName = @$_FILES['image']['name']) { $this->uploads->allowedTypes = 'jpg|gif|png'; if (!$this->form_validation->unique($imageRef, 'images.imageRef') && $this->input->post('imageRef') != $output['data']['imageRef']) { $this->uploads->errors = '<p>The image reference you entered has already been used, please try another.</p>'; } else { if ($imageData = $this->uploads->upload_image()) { $this->core->set['filename'] = $imageData['file_name']; $this->core->set['filesize'] = $imageData['file_size']; } } } // get image errors if there are any if ($this->uploads->errors) { $this->form_validation->set_error($this->uploads->errors); } else { // set image ref $this->core->set['imageRef'] = $imageRef; $this->core->set['dateModified'] = date("Y-m-d H:i:s"); // update if ($this->core->update('images', $objectID)) { // if its not coming from ajax then just go to admin if ($redirect && !$popup) { $redirect = $this->core->decode($redirect); } elseif (!$redirect && !$popup) { $redirect = '/admin/images/viewall'; } // where to redirect to redirect($redirect); } } } // define view (based on popup) $view = ($popup) ? 'admin/popup' : 'admin/edit'; // get categories $output['folders'] = $this->images->get_folders(); // templates if (!@$this->core->is_ajax()) $this->load->view($this->includes_path.'/header'); $this->load->view($view, $output); if (!@$this->core->is_ajax()) $this->load->view($this->includes_path.'/footer'); } function delete($objectID, $redirect = '') { // delete image $query = $this->db->get_where($this->table, array($this->objectID => $objectID)); if ($row = $query->row_array()) { $this->uploads->delete_file($row['filename']); } if ($this->core->delete($this->table, array($this->objectID => $objectID))); { $redirect = ($redirect) ? $this->core->decode($redirect) : $this->redirect; // where to redirect to redirect($redirect); } } function popup($encodedID) { // decodes the image ID and splits it in to the URI and image ID $decode = explode('|', $this->core->decode($encodedID)); $uri = $decode[0]; $imageID = $decode[1]; $this->edit($imageID, $uri, TRUE); } function browser() { // set default wheres $where = array('siteID' => $this->siteID, 'deleted' => 0); // check they have permissions to see all images if (!@in_array('images_all', $this->permission->permissions)) { $where['userID'] = $this->session->userdata('userID'); } // grab data and display $output = $this->core->viewall($this->table, array('folderID' => 0), 'imageRef', 999); // get folders if ($folders = $this->images->get_folders()) { foreach($folders as $folder) { // grab data and display $data = $this->core->viewall($this->table, array('folderID' => $folder['folderID']), 'imageRef', 999); $output['folders'][$folder['folderID']]['folderName'] = $folder['folderName']; $output['folders'][$folder['folderID']]['images'] = $data['images']; } } $this->load->view('admin/browser',$output); } function folders() { // check permissions for this page if (!in_array('images', $this->permission->permissions)) { redirect('/admin/dashboard/permissions'); } // required fields $this->core->required = array('folderName' => 'Folder Name'); // set date $this->core->set['dateCreated'] = date("Y-m-d H:i:s"); $this->core->set['folderSafe'] = strtolower(url_title($this->input->post('folderName'))); // get values $output = $this->core->get_values('image_folders'); // update if ($this->core->update('image_folders') && count($_POST)) { // where to redirect to redirect('/admin/images/folders'); } $output['folders'] = $this->images->get_folders(); $this->load->view($this->includes_path.'/header'); $this->load->view('admin/folders',$output); $this->load->view($this->includes_path.'/footer'); } function edit_folder() { // check permissions for this page if (!in_array('images', $this->permission->permissions)) { redirect('/admin/dashboard/permissions'); } // go through post and edit each list item $listArray = $this->core->get_post(); if (count($listArray)) { foreach($listArray as $ID => $value) { if ($ID != '' && sizeof($value) > 0) { // set object ID $objectID = array('folderID' => $ID); $this->core->set['folderName'] = $value['folderName']; $this->core->set['folderSafe'] = strtolower(url_title($value['folderName'])); $this->core->update('image_folders', $objectID); } } } // where to redirect to redirect('/admin/images/folders'); } function delete_folder($folderID) { // check permissions for this page if (!in_array('images', $this->permission->permissions)) { redirect('/admin/dashboard/permissions'); } // where $objectID = array('folderID' => $folderID); if ($this->core->soft_delete('image_folders', $objectID)) { // set children to no parent $this->images->update_children($folderID); // where to redirect to redirect('/admin/images/folders'); } } function order($field = '') { $this->core->order(key($_POST), $field); } function ac_images() { $q = strtolower($_POST["q"]); if (!$q) return; // form dropdown $results = $this->images->search_images($q); // go foreach foreach((array)$results as $row) { $items[$row['imageRef']] = $row['imageName']; } // output $output = ''; foreach ($items as $key=>$value) { $output .= "$key|$value\n"; } $this->output->set_output($output); } }
Forgeigniter/ForgeIgniter-CI-2.x
ForgeIgniter/modules/images/controllers/admin.php
PHP
gpl-2.0
15,680
package com.data_mining.model.clusters; import java.util.ArrayList; import java.util.List; /** * List of Bisect clusters * @author Janakiraman * */ public class BisectClusterList { private List<BisectCluster> bisectList; public BisectClusterList() { bisectList = new ArrayList<BisectCluster>(); } public void addBisectCluster(BisectCluster bisect) { bisectList.add(bisect); } public List<BisectCluster> getBisectList() { return bisectList; } public double SSEat(int index) { return bisectList.get(index).getTotalSSE(); } public int size() { return bisectList.size(); } }
Johny-kann/Clustering_Algorithms
src/com/data_mining/model/clusters/BisectClusterList.java
Java
gpl-2.0
614
<?php // $Id$ require_once("$CFG->dirroot/question/format/qti_two/qt_common.php"); //////////////////////////////////////////////////////////////////////////// /// IMS QTI 2.0 FORMAT /// /// HISTORY: created 28.01.2005 brian@mediagonal.ch //////////////////////////////////////////////////////////////////////////// // Based on format.php, included by ../../import.php /** * @package questionbank * @subpackage importexport */ define('CLOZE_TRAILING_TEXT_ID', 9999999); class qformat_qti_two extends qformat_default { var $lang; function provide_export() { return true; } function indent_xhtml($source, $indenter = ' ') { // xml tidier-upper // (c) Ari Koivula http://ventionline.com // Remove all pre-existing formatting. // Remove all newlines. $source = str_replace("\n", '', $source); $source = str_replace("\r", '', $source); // Remove all tabs. $source = str_replace("\t", '', $source); // Remove all space after ">" and before "<". $source = preg_replace("/>( )*", ">/", $source); $source = preg_replace("/( )*<", "</", $source); // Iterate through the source. $level = 0; $source_len = strlen($source); $pt = 0; while ($pt < $source_len) { if ($source{$pt} === '<') { // We have entered a tag. // Remember the point where the tag starts. $started_at = $pt; $tag_level = 1; // If the second letter of the tag is "/", assume its an ending tag. if ($source{$pt+1} === '/') { $tag_level = -1; } // If the second letter of the tag is "!", assume its an "invisible" tag. if ($source{$pt+1} === '!') { $tag_level = 0; } // Iterate throught the source until the end of tag. while ($source{$pt} !== '>') { $pt++; } // If the second last letter is "/", assume its a self ending tag. if ($source{$pt-1} === '/') { $tag_level = 0; } $tag_lenght = $pt+1-$started_at; // Decide the level of indention for this tag. // If this was an ending tag, decrease indent level for this tag.. if ($tag_level === -1) { $level--; } // Place the tag in an array with proper indention. $array[] = str_repeat($indenter, $level).substr($source, $started_at, $tag_lenght); // If this was a starting tag, increase the indent level after this tag. if ($tag_level === 1) { $level++; } // if it was a self closing tag, dont do shit. } // Were out of the tag. // If next letter exists... if (($pt+1) < $source_len) { // ... and its not an "<". if ($source{$pt+1} !== '<') { $started_at = $pt+1; // Iterate through the source until the start of new tag or until we reach the end of file. while ($source{$pt} !== '<' && $pt < $source_len) { $pt++; } // If we found a "<" (we didnt find the end of file) if ($source{$pt} === '<') { $tag_lenght = $pt-$started_at; // Place the stuff in an array with proper indention. $array[] = str_repeat($indenter, $level).substr($source, $started_at, $tag_lenght); } // If the next tag is "<", just advance pointer and let the tag indenter take care of it. } else { $pt++; } // If the next letter doesnt exist... Were done... well, almost.. } else { break; } } // Replace old source with the new one we just collected into our array. $source = implode($array, "\n"); return $source; } function importpreprocess() { global $CFG; print_error('cannotimportformat', 'question', "$CFG->wwwroot/mod/quiz/import.php?category=$category->id"); } function exportpreprocess() { global $CFG; require_once("{$CFG->libdir}/smarty/Smarty.class.php"); // assign the language for the export: by parameter, SESSION, USER, or the default of 'en' $lang = current_language(); $this->lang = $lang; return parent::exportpreprocess(); } function export_file_extension() { // override default type so extension is .xml return ".zip"; } function get_qtype( $type_id ) { // translates question type code number into actual name switch( $type_id ) { case TRUEFALSE: $name = 'truefalse'; break; case MULTICHOICE: $name = 'multichoice'; break; case SHORTANSWER: $name = 'shortanswer'; break; case NUMERICAL: $name = 'numerical'; break; case MATCH: $name = 'matching'; break; case DESCRIPTION: $name = 'description'; break; case MULTIANSWER: $name = 'multianswer'; break; default: $name = 'Unknown'; } return $name; } function writetext( $raw ) { // generates <text></text> tags, processing raw text therein // for now, don't allow any additional tags in text // otherwise xml rules would probably get broken $raw = strip_tags( $raw ); return "<text>$raw</text>\n"; } /** * flattens $object['media'], copies $object['media'] to $path, and sets $object['mediamimetype'] * * @param array &$object containing a field 'media' * @param string $path the full path name to where the media files need to be copied * @param int $courseid * @return: mixed - true on success or in case of an empty media field, an error string if the file copy fails */ function copy_and_flatten(&$object, $path, $courseid) { global $CFG; if (!empty($object['media'])) { $location = $object['media']; $object['media'] = $this->flatten_image_name($location); if (!@copy("{$CFG->dataroot}/$courseid/$location", "$path/{$object['media']}")) { return "Failed to copy {$CFG->dataroot}/$courseid/$location to $path/{$object['media']}"; } if (empty($object['mediamimetype'])) { $object['mediamimetype'] = mimeinfo('type', $object['media']); } } return true; } /** * copies all files needed by the questions to the given $path, and flattens the file names * * @param array $questions the question objects * @param string $path the full path name to where the media files need to be copied * @param int $courseid * @return mixed true on success, an array of error messages otherwise */ function handle_questions_media(&$questions, $path, $courseid) { global $CFG; $errors = array(); foreach ($questions as $key=>$question) { // todo: handle in-line media (specified in the question text) if (!empty($question->image)) { $location = $questions[$key]->image; $questions[$key]->mediaurl = $this->flatten_image_name($location); if (!@copy("{$CFG->dataroot}/$courseid/$location", "$path/{$questions[$key]->mediaurl}")) { $errors[] = "Failed to copy {$CFG->dataroot}/$courseid/$location to $path/{$questions[$key]->mediaurl}"; } if (empty($question->mediamimetype)) { $questions[$key]->mediamimetype = mimeinfo('type', $question->image); } } } return empty($errors) ? true : $errors; } /** * exports the questions in a question category to the given location * * The parent class method was overridden because the IMS export consists of multiple files * * @param string $filename the directory name which will hold the exported files * @return boolean - or errors out */ function exportprocess() { global $CFG, $OUTPUT; $courseid = $this->course->id; // create a directory for the exports (if not already existing) if (!$export_dir = make_upload_directory($this->question_get_export_dir().'/'.$this->filename)) { print_error('cannotcreatepath', 'quiz', '', $export_dir); } $path = $CFG->dataroot.'/'.$this->question_get_export_dir().'/'.$this->filename; // get the questions (from database) in this category $questions = get_questions_category( $this->category ); echo $OUTPUT->notification("Exporting ".count($questions)." questions."); $count = 0; // create the imsmanifest file $smarty =& $this->init_smarty(); $this->add_qti_info($questions); // copy files used by the main questions to the export directory $result = $this->handle_questions_media($questions, $path, $courseid); if ($result !== true) { echo $OUTPUT->notification(implode("<br />", $result)); } $manifestquestions = $this->objects_to_array($questions); $manifestid = str_replace(array(':', '/'), array('-','_'), "question_category_{$this->category->id}---{$CFG->wwwroot}"); $smarty->assign('externalfiles', 1); $smarty->assign('manifestidentifier', $manifestid); $smarty->assign('quiztitle', "question_category_{$this->category->id}"); $smarty->assign('quizinfo', "All questions in category {$this->category->id}"); $smarty->assign('questions', $manifestquestions); $smarty->assign('lang', $this->lang); $smarty->error_reporting = 99; $expout = $smarty->fetch('imsmanifest.tpl'); $filepath = $path.'/imsmanifest.xml'; if (empty($expout)) { print_error('emptyxml', 'question'); } if (!$fh=fopen($filepath,"w")) { print_error('cannotopenforwriting', 'question', '', $filepath); } if (!fwrite($fh, $expout)) { print_error('cannotwriteto', 'question', '', $filepath); } fclose($fh); // iterate through questions foreach($questions as $question) { // results are first written into string (and then to a file) $count++; echo "<hr /><p><b>$count</b>. ".$question->questiontext."</p>"; $expout = $this->writequestion( $question , null, true, $path) . "\n"; $expout = $this->presave_process( $expout ); $filepath = $path.'/'.$this->get_assesment_item_id($question) . ".xml"; if (!$fh=fopen($filepath,"w")) { print_error('cannotopenforwriting', 'question', '', $filepath); } if (!fwrite($fh, $expout)) { print_error('cannotwriteto', 'question', '', $filepath); } fclose($fh); } // zip files into single export file zip_files( array($path), "$path.zip" ); // remove the temporary directory remove_dir( $path ); return true; } /** * exports a quiz (as opposed to exporting a category of questions) * * The parent class method was overridden because the IMS export consists of multiple files * * @param object $quiz * @param array $questions - an array of question objects * @param object $result - if set, contains result of calling quiz_grade_responses() * @param string $redirect - a URL to redirect to in case of failure * @param string $submiturl - the URL for the qti player to send the results to (e.g. attempt.php) * @todo use $result in the ouput */ function export_quiz($course, $quiz, $questions, $result, $redirect, $submiturl = null) { $this->xml_entitize($course); $this->xml_entitize($quiz); $this->xml_entitize($questions); $this->xml_entitize($result); $this->xml_entitize($submiturl); if (! $this->exportpreprocess(0, $course)) { // Do anything before that we need to print_error('errorpreprocess', 'question', $redirect); } if (! $this->exportprocess_quiz($quiz, $questions, $result, $submiturl, $course)) { // Process the export data print_error('errorprocess','question', $redirect); } if (! $this->exportpostprocess()) { // In case anything needs to be done after print_error('errorpostprocess', 'question', $redirect); } } /** * This function is called to export a quiz (as opposed to exporting a category of questions) * * @uses $USER * @param object $quiz * @param array $questions - an array of question objects * @param object $result - if set, contains result of calling quiz_grade_responses() * @todo use $result in the ouput */ function exportprocess_quiz($quiz, $questions, $result, $submiturl, $course) { global $USER; global $CFG; $gradingmethod = array (1 => 'GRADEHIGHEST', 2 => 'GRADEAVERAGE', 3 => 'ATTEMPTFIRST' , 4 => 'ATTEMPTLAST'); $questions = $this->quiz_export_prepare_questions($questions, $quiz->id, $course->id, $quiz->shuffleanswers); $smarty =& $this->init_smarty(); $smarty->assign('questions', $questions); // quiz level smarty variables $manifestid = str_replace(array(':', '/'), array('-','_'), "quiz{$quiz->id}-{$CFG->wwwroot}"); $smarty->assign('manifestidentifier', $manifestid); $smarty->assign('submiturl', $submiturl); $smarty->assign('userid', $USER->id); $smarty->assign('username', htmlspecialchars($USER->username, ENT_COMPAT, 'UTF-8')); $smarty->assign('quiz_level_export', 1); $smarty->assign('quiztitle', format_string($quiz->name,true)); //assigned specifically so as not to cause problems with category-level export $smarty->assign('quiztimeopen', date('Y-m-d\TH:i:s', $quiz->timeopen)); // ditto $smarty->assign('quiztimeclose', date('Y-m-d\TH:i:s', $quiz->timeclose)); // ditto $smarty->assign('grademethod', $gradingmethod[$quiz->grademethod]); $smarty->assign('quiz', $quiz); $smarty->assign('course', $course); $smarty->assign('lang', $this->lang); $expout = $smarty->fetch('imsmanifest.tpl'); echo $expout; return true; } /** * Prepares questions for quiz export * * The questions are changed as follows: * - the question answers atached to the questions * - image set to an http reference instead of a file path * - qti specific info added * - exporttext added, which contains an xml-formatted qti assesmentItem * * @param array $questions - an array of question objects * @param int $quizid * @return an array of question arrays */ function quiz_export_prepare_questions($questions, $quizid, $courseid, $shuffleanswers = null) { global $CFG; // add the answers to the questions and format the image property foreach ($questions as $key=>$question) { $questions[$key] = get_question_data($question); $questions[$key]->courseid = $courseid; $questions[$key]->quizid = $quizid; if ($question->image) { if (empty($question->mediamimetype)) { $questions[$key]->mediamimetype = mimeinfo('type',$question->image); } $localfile = (substr(strtolower($question->image), 0, 7) == 'http://') ? false : true; if ($localfile) { // create the http url that the player will need to access the file if ($CFG->slasharguments) { // Use this method if possible for better caching $questions[$key]->mediaurl = "$CFG->wwwroot/file.php/$question->image"; } else { $questions[$key]->mediaurl = "$CFG->wwwroot/file.php?file=$question->image"; } } else { $questions[$key]->mediaurl = $question->image; } } } $this->add_qti_info($questions); $questions = $this->questions_with_export_info($questions, $shuffleanswers); $questions = $this->objects_to_array($questions); return $questions; } /** * calls htmlspecialchars for each string field, to convert, for example, & to &amp; * * collections are processed recursively * * @param array $collection - an array or object or string */ function xml_entitize(&$collection) { if (is_array($collection)) { foreach ($collection as $key=>$var) { if (is_string($var)) { $collection[$key]= htmlspecialchars($var, ENT_COMPAT, 'UTF-8'); } else if (is_array($var) || is_object($var)) { $this->xml_entitize($collection[$key]); } } } else if (is_object($collection)) { $vars = get_object_vars($collection); foreach ($vars as $key=>$var) { if (is_string($var)) { $collection->$key = htmlspecialchars($var, ENT_COMPAT, 'UTF-8'); } else if (is_array($var) || is_object($var)) { $this->xml_entitize($collection->$key); } } } else if (is_string($collection)) { $collection = htmlspecialchars($collection, ENT_COMPAT, 'UTF-8'); } } /** * adds exporttext property to the questions * * Adds the qti export text to the questions * * @param array $questions - an array of question objects * @return an array of question objects */ function questions_with_export_info($questions, $shuffleanswers = null) { $exportquestions = array(); foreach($questions as $key=>$question) { $expout = $this->writequestion( $question , $shuffleanswers) . "\n"; $expout = $this->presave_process( $expout ); $key = $this->get_assesment_item_id($question); $exportquestions[$key] = $question; $exportquestions[$key]->exporttext = $expout; } return $exportquestions; } /** * Creates the export text for a question * * @todo handle in-line media (specified in the question/subquestion/answer text) for course-level exports * @param object $question * @param boolean $shuffleanswers whether or not to shuffle the answers * @param boolean $courselevel whether or not this is a course-level export * @param string $path provide the path to copy question media files to, if $courselevel == true * @return string containing export text */ function writequestion($question, $shuffleanswers = null, $courselevel = false, $path = '') { // turns question into string // question reflects database fields for general question and specific to type global $CFG; $expout = ''; //need to unencode the html entities in the questiontext field. // the whole question object was earlier run throught htmlspecialchars in xml_entitize(). $question->questiontext = html_entity_decode($question->questiontext, ENT_COMPAT); $hasimage = empty($question->image) ? 0 : 1; $hassize = empty($question->mediax) ? 0 : 1; $allowedtags = '<a><br><b><h1><h2><h3><h4><i><img><li><ol><strong><table><tr><td><th><u><ul><object>'; // all other tags will be stripped from question text $smarty =& $this->init_smarty(); $assesmentitemid = $this->get_assesment_item_id($question); $question_type = $this->get_qtype( $question->qtype ); $questionid = "question{$question->id}$question_type"; $smarty->assign('question_has_image', $hasimage); $smarty->assign('hassize', $hassize); $smarty->assign('questionid', $questionid); $smarty->assign('assessmentitemidentifier', $assesmentitemid); $smarty->assign('assessmentitemtitle', $question->name); $smarty->assign('courselevelexport', $courselevel); if ($question->qtype == MULTIANSWER) { $question->questiontext = strip_tags($question->questiontext, $allowedtags . '<intro>'); $smarty->assign('questionText', $this->get_cloze_intro($question->questiontext)); } else { $smarty->assign('questionText', strip_tags($question->questiontext, $allowedtags)); } $smarty->assign('question', $question); // the following two are left for compatibility; the templates should be changed, though, to make object tags for the questions //$smarty->assign('questionimage', $question->image); //$smarty->assign('questionimagealt', "image: $question->image"); // output depends on question type switch($question->qtype) { case TRUEFALSE: $qanswers = $question->options->answers; $answers[0] = (array)$qanswers['true']; $answers[0]['answer'] = get_string("true", "quiz"); $answers[1] = (array)$qanswers['false']; $answers[1]['answer'] = get_string("false", "quiz"); if (!empty($shuffleanswers)) { $answers = $this->shuffle_things($answers); } if (isset($question->response)) { $correctresponseid = $question->response[$questionid]; if ($answers[0]['id'] == $correctresponseid) { $correctresponse = $answers[0]; } else { $correctresponse = $answers[1]; } } else { $correctresponse = ''; } $smarty->assign('correctresponse', $correctresponse); $smarty->assign('answers', $answers); $expout = $smarty->fetch('choice.tpl'); break; case MULTICHOICE: $answers = $this->objects_to_array($question->options->answers); $correctresponses = $this->get_correct_answers($answers); $correctcount = count($correctresponses); $smarty->assign('responsedeclarationcardinality', $question->options->single ? 'single' : 'multiple'); $smarty->assign('operator', $question->options->single ? 'match' : 'member'); $smarty->assign('correctresponses', $correctresponses); $smarty->assign('answers', $answers); $smarty->assign('maxChoices', $question->options->single ? '1' : count($answers)); $smarty->assign('maxChoices', $question->options->single ? '1' : count($answers)); $smarty->assign('shuffle', empty($shuffleanswers) ? 'false' : 'true'); $smarty->assign('generalfeedback', $question->generalfeedback); $smarty->assign('correctfeedback', $question->options->correctfeedback); $smarty->assign('partiallycorrectfeedback', $question->options->partiallycorrectfeedback); $smarty->assign('incorrectfeedback', $question->options->incorrectfeedback); $expout = $smarty->fetch('choiceMultiple.tpl'); break; case SHORTANSWER: $answers = $this->objects_to_array($question->options->answers); if (!empty($shuffleanswers)) { $answers = $this->shuffle_things($answers); } $correctresponses = $this->get_correct_answers($answers); $correctcount = count($correctresponses); $smarty->assign('responsedeclarationcardinality', $correctcount > 1 ? 'multiple' : 'single'); $smarty->assign('correctresponses', $correctresponses); $smarty->assign('answers', $answers); $expout = $smarty->fetch('textEntry.tpl'); break; case NUMERICAL: $qanswer = array_pop( $question->options->answers ); $smarty->assign('lowerbound', $qanswer->answer - $qanswer->tolerance); $smarty->assign('upperbound', $qanswer->answer + $qanswer->tolerance); $smarty->assign('answer', $qanswer->answer); $expout = $smarty->fetch('numerical.tpl'); break; case MATCH: $this->xml_entitize($question->options->subquestions); $subquestions = $this->objects_to_array($question->options->subquestions); if (!empty($shuffleanswers)) { $subquestions = $this->shuffle_things($subquestions); } $setcount = count($subquestions); $smarty->assign('setcount', $setcount); $smarty->assign('matchsets', $subquestions); $expout = $smarty->fetch('match.tpl'); break; case DESCRIPTION: $expout = $smarty->fetch('extendedText.tpl'); break; // loss of get_answers() from quiz_embedded_close_qtype class during // Gustav's refactor breaks MULTIANSWER badly - one for another day!! /* case MULTIANSWER: $answers = $this->get_cloze_answers_array($question); $questions = $this->get_cloze_questions($question, $answers, $allowedtags); $smarty->assign('cloze_trailing_text_id', CLOZE_TRAILING_TEXT_ID); $smarty->assign('answers', $answers); $smarty->assign('questions', $questions); $expout = $smarty->fetch('composite.tpl'); break; */ default: $smarty->assign('questionText', "This question type (Unknown: type $question_type) has not yet been implemented"); $expout = $smarty->fetch('notimplemented.tpl'); } // run through xml tidy function //$tidy_expout = $this->indent_xhtml( $expout, ' ' ) . "\n\n"; //return $tidy_expout; return $expout; } /** * Gets an id to use for a qti assesment item * * @param object $question * @return string containing a qti assesment item id */ function get_assesment_item_id($question) { return "question{$question->id}"; } /** * gets the answers whose grade fraction > 0 * * @param array $answers * @return array (0-indexed) containing the answers whose grade fraction > 0 */ function get_correct_answers($answers) { $correctanswers = array(); foreach ($answers as $answer) { if ($answer['fraction'] > 0) { $correctanswers[] = $answer; } } return $correctanswers; } /** * gets a new Smarty object, with the template and compile directories set * * @return object a smarty object */ function & init_smarty() { global $CFG; // create smarty compile dir in dataroot $path = $CFG->dataroot."/smarty_c"; if (!is_dir($path)) { if (!mkdir($path, $CFG->directorypermissions)) { print_error('cannotcreatepath', 'question', '', $path); } } $smarty = new Smarty; $smarty->template_dir = "{$CFG->dirroot}/question/format/qti_two/templates"; $smarty->compile_dir = "$path"; return $smarty; } /** * converts an array of objects to an array of arrays (not recursively) * * @param array $objectarray * @return array - an array of answer arrays */ function objects_to_array($objectarray) { $arrayarray = array(); foreach ($objectarray as $object) { $arrayarray[] = (array)$object; } return $arrayarray; } /** * gets a question's cloze answer objects as arrays containing only arrays and basic data types * * @param object $question * @return array - an array of answer arrays */ function get_cloze_answers_array($question) { $answers = $this->get_answers($question); $this->xml_entitize($answers); foreach ($answers as $answerkey => $answer) { $answers[$answerkey]->subanswers = $this->objects_to_array($answer->subanswers); } return $this->objects_to_array($answers); } /** * gets an array with text and question arrays for the given cloze question * * To make smarty processing easier, the returned text and question sub-arrays have an equal number of elements. * If it is necessary to add a dummy element to the question sub-array, the question will be given an id of CLOZE_TRAILING_TEXT_ID. * * @param object $question * @param array $answers - an array of arrays containing the question's answers * @param string $allowabletags - tags not to strip out of the question text (e.g. '<i><br>') * @return array with text and question arrays for the given cloze question */ function get_cloze_questions($question, $answers, $allowabletags) { $questiontext = strip_tags($question->questiontext, $allowabletags); if (preg_match_all('/(.*){#([0-9]+)}/U', $questiontext, $matches)) { // matches[1] contains the text inbetween the question blanks // matches[2] contains the id of the question blanks (db: question_multianswer.positionkey) // find any trailing text after the last {#XX} and add it to the array if (preg_match('/.*{#[0-9]+}(.*)$/', $questiontext, $tail)) { $matches[1][] = $tail[1]; $tailadded = true; } $questions['text'] = $matches[1]; $questions['question'] = array(); foreach ($matches[2] as $key => $questionid) { foreach ($answers as $answer) { if ($answer['positionkey'] == $questionid) { $questions['question'][$key] = $answer; break; } } } if ($tailadded) { // to have a matching number of question and text array entries: $questions['question'][] = array('id'=>CLOZE_TRAILING_TEXT_ID, 'answertype'=>SHORTANSWER); } } else { $questions['text'][0] = $question->questiontext; $questions['question'][0] = array('id'=>CLOZE_TRAILING_TEXT_ID, 'answertype'=>SHORTANSWER); } return $questions; } /** * strips out the <intro>...</intro> section, if any, and returns the text * * changes the text object passed to it. * * @param string $&text * @return string the intro text, if there was an intro tag. '' otherwise. */ function get_cloze_intro(&$text) { if (preg_match('/(.*)?\<intro>(.+)?\<\/intro>(.*)/s', $text, $matches)) { $text = $matches[1] . $matches[3]; return $matches[2]; } else { return ''; } } /** * adds qti metadata properties to the questions * * The passed array of questions is altered by this function * * @param &questions an array of question objects */ function add_qti_info(&$questions) { foreach ($questions as $key=>$question) { $questions[$key]->qtiinteractiontype = $this->get_qti_interaction_type($question->qtype); $questions[$key]->qtiscoreable = $this->get_qti_scoreable($question); $questions[$key]->qtisolutionavailable = $this->get_qti_solution_available($question); } } /** * returns whether or not a given question is scoreable * * @param object $question * @return boolean */ function get_qti_scoreable($question) { switch ($question->qtype) { case DESCRIPTION: return 'false'; default: return 'true'; } } /** * returns whether or not a solution is available for a given question * * The results are based on whether or not Moodle stores answers for the given question type * * @param object $question * @return boolean */ function get_qti_solution_available($question) { switch($question->qtype) { case TRUEFALSE: return 'true'; case MULTICHOICE: return 'true'; case SHORTANSWER: return 'true'; case NUMERICAL: return 'true'; case MATCH: return 'true'; case DESCRIPTION: return 'false'; case MULTIANSWER: return 'true'; default: return 'true'; } } /** * maps a moodle question type to a qti 2.0 question type * * @param int type_id - the moodle question type * @return string qti 2.0 question type */ function get_qti_interaction_type($type_id) { switch( $type_id ) { case TRUEFALSE: $name = 'choiceInteraction'; break; case MULTICHOICE: $name = 'choiceInteraction'; break; case SHORTANSWER: $name = 'textInteraction'; break; case NUMERICAL: $name = 'textInteraction'; break; case MATCH: $name = 'matchInteraction'; break; case DESCRIPTION: $name = 'extendedTextInteraction'; break; case MULTIANSWER: $name = 'textInteraction'; break; default: $name = 'textInteraction'; } return $name; } /** * returns the given array, shuffled * * * @param array $things * @return array */ function shuffle_things($things) { $things = swapshuffle_assoc($things); $oldthings = $things; $things = array(); foreach ($oldthings as $key=>$value) { $things[] = $value; // This loses the index key, but doesn't matter } return $things; } /** * returns a flattened image name - with all /, \ and : replaced with other characters * * used to convert a file or url to a qti-permissable identifier * * @param string name * @return string */ function flatten_image_name($name) { return str_replace(array('/', '\\', ':'), array ('_','-','.'), $name); } function file_full_path($file, $courseid) { global $CFG; if (substr(strtolower($file), 0, 7) == 'http://') { $url = $file; } else if ($CFG->slasharguments) { // Use this method if possible for better caching $url = "{$CFG->wwwroot}/file.php/$courseid/{$file}"; } else { $url = "{$CFG->wwwroot}/file.php?file=/$courseid/{$file}"; } return $url; } } ?>
ajv/Offline-Caching
question/format/qti_two/format.php
PHP
gpl-2.0
34,848
class Config: db_config = {"user": "root", "password": "root", "host": "localhost", "database": "dita"} table = None @classmethod def get_table(cls): return cls.table @classmethod def set_table(cls, table): cls.table = table
dita-programming/dita-access
model/config.py
Python
gpl-2.0
318
package es.mompes.supermanager.basededatos; import java.util.LinkedList; import java.util.List; import es.mompes.supermanager.util.Contenedor; import android.app.Activity; import android.content.ContentValues; import android.database.Cursor; /** * Tabla de usuarios, contienen sus nicknames y contraseñas. * * @author Juan Mompeán Esteban * */ public class TablaUsuarios { /** * El nombre de la columna que almacena los nombres. */ public static final String KEY_NAME = "Nombre"; /** * El nombre de la columna que almacena las claves. */ public static final String KEY_PASSWORD = "Clave"; /** * Nombre de la tabla en la base de datos. */ public static final String DATABASE_TABLE = "Usuarios"; /** * Comando de creacción de la tabla. */ public static final String CREATE_TABLE = "CREATE TABLE " + DATABASE_TABLE + " (" + KEY_NAME + " TEXT PRIMARY KEY, " + KEY_PASSWORD + " TEXT NOT NULL)"; /** * Inserta una nueva fila en la tabla de usuarios. * * @param nnombre * El nuevo nombre. * @param nclave * La nueva clave. * @return El id de la fila insertada o -1 en caso de error. */ public static final long createEntry(BaseDeDatos bd, final String nnombre, final String nclave) { if (!bd.isOpen()) { bd.open(); } // Almacena los valores a insertar en un objeto ContentValues cv = new ContentValues(); cv.put(KEY_NAME, nnombre); cv.put(KEY_PASSWORD, nclave); // Inserta los nuevos datos en la base de datos long resultado = bd.database.insert(DATABASE_TABLE, null, cv); bd.close(); return resultado; } /** * Devuelve la contraseña del usuario consultado. * * @param nombre * Usuario sobre el que se realiza la consulta. * @return La contraseña del usuario o null si no se encuentra el usuario * indicado. */ public static final String getPassword(BaseDeDatos bd, final String nombre) { if (!bd.isOpen()) { bd.open(); } String resultado = null; String[] columnas = new String[] { KEY_PASSWORD }; Cursor c = bd.database.query(DATABASE_TABLE, columnas, KEY_NAME + "=?", new String[] { nombre }, null, null, null); if (c != null && c.moveToFirst() && !c.isNull(c.getColumnIndex(KEY_PASSWORD))) { resultado = c.getString(c.getColumnIndex(KEY_PASSWORD)); c.close(); } bd.close(); return resultado; } /** * Comprueba si una entrada ya está en la base de datos. * * @param nombre * Nombre a comprobar. * @return True si la entrada ya está y false en caso contrario. */ public static final boolean exists(BaseDeDatos bd, final String nombre) { if (!bd.isOpen()) { bd.open(); } String[] columnas = new String[] { KEY_NAME }; Cursor c = bd.database.query(DATABASE_TABLE, columnas, KEY_NAME + " =?", new String[] { nombre }, null, null, null); boolean resultado = c != null && c.getCount() > 0; c.close(); bd.close(); return resultado; } /** * Actualiza el valor de una entrada de la base de datos. * * @param nnombre * Nombre a actualizar. * @param nclave * Clave a actualizar. */ public static final void updateEntry(BaseDeDatos bd, final String nnombre, final String nclave) { if (!bd.isOpen()) { bd.open(); } ContentValues cv = new ContentValues(); cv.put(KEY_PASSWORD, nclave); bd.database.update(DATABASE_TABLE, cv, KEY_NAME + "=?", new String[] { nnombre }); bd.close(); } /** * Borra una entrada de la base de datos. * * @param nnombre * Nombre de la entrada a borrar. */ public static final void deleteEntry(BaseDeDatos bd, final String nnombre) { if (!bd.isOpen()) { bd.open(); } bd.database.delete(DATABASE_TABLE, KEY_NAME + "=?", new String[] { nnombre }); bd.close(); } /** * Devuelve una lista con los nombres de todos los usuarios en la base de * datos. * * @return Una lista con los nombres de todos los usuarios en la base de * datos. */ public static final List<String> getAll(BaseDeDatos bd) { if (!bd.isOpen()) { bd.open(); } String[] columnas = new String[] { KEY_NAME }; // Recibe todos los datos almacenados en la base de datos Cursor c = bd.database.query(DATABASE_TABLE, columnas, null, null, null, null, null); List<String> lista = new LinkedList<String>(); int index = c.getColumnIndex(KEY_NAME); // Los almacena en una lista for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) { lista.add(c.getString(index)); } c.close(); bd.close(); return lista; } }
mompes/supermanager
src/es/mompes/supermanager/basededatos/TablaUsuarios.java
Java
gpl-2.0
4,569
// Copyright (C) 2016 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the // terms of the GNU General Public License as published by the // Free Software Foundation; either version 3, or (at your option) // any later version. // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License along // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. // { dg-do run { target c++11 } } #include <string> #include <testsuite_hooks.h> template<typename... Args> std::size_t construct(Args&&... args) { return std::wstring( std::forward<Args>(args)... ).length(); } void test01() { bool test __attribute__((unused)) = true; using string = std::wstring; using list = std::initializer_list<string::value_type>; const std::wstring lvalue = L"lvalue"; std::allocator<char> alloc; // test all valid combinations of arguments: VERIFY( construct( ) == 0 ); VERIFY( construct( alloc ) == 0 ); VERIFY( construct( lvalue ) == 6 ); VERIFY( construct( string{L"rvalue"} ) == 6 ); VERIFY( construct( lvalue, 2 ) == 4 ); VERIFY( construct( lvalue, 2, alloc ) == 4 ); VERIFY( construct( lvalue, 2, 3 ) == 3 ); VERIFY( construct( lvalue, 2, 3, alloc ) == 3 ); VERIFY( construct( L"C string", 4 ) == 4 ); VERIFY( construct( L"C string", 4, alloc ) == 4 ); VERIFY( construct( L"C string" ) == 8 ); VERIFY( construct( L"C string and alloc", alloc ) == 18 ); VERIFY( construct( 5, L' ' ) == 5 ); VERIFY( construct( 5, L' ', alloc ) == 5 ); VERIFY( construct( lvalue.begin(), lvalue.end() ) == 6 ); VERIFY( construct( lvalue.begin(), lvalue.end(), alloc ) == 6 ); VERIFY( construct( list{ L'l' , L'i' , L's', L't' } ) == 4 ); VERIFY( construct( list{ L'l', L'i', L's', L't' }, alloc ) == 4 ); #if _GLIBCXX_USE_CXX11_ABI VERIFY( construct( lvalue, alloc ) == 6 ); VERIFY( construct( string{L"rvalue"}, alloc ) == 6 ); #endif } int main() { test01(); }
paranoiacblack/gcc
libstdc++-v3/testsuite/21_strings/basic_string/cons/wchar_t/8.cc
C++
gpl-2.0
2,297
/* * This is the source code of Telegram for Android v. 3.x.x. * It is licensed under GNU GPL v. 2 or later. * You should have received a copy of the license in this archive (see LICENSE). * * Copyright Nikolai Kudashov, 2013-2016. */ package org.telegram.ui.Cells; import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.os.Build; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; import android.text.TextUtils; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; import android.widget.TextView; import org.telegram.messenger.AndroidUtilities; import org.telegram.messenger.ContactsController; import org.telegram.messenger.MessagesController; import com.finalsoft.messenger.R; import org.telegram.tgnet.TLRPC; import org.telegram.ui.Components.AvatarDrawable; import org.telegram.ui.Components.BackupImageView; import org.telegram.ui.Components.LayoutHelper; public class HintDialogCell extends FrameLayout { private BackupImageView imageView; private TextView nameTextView; private AvatarDrawable avatarDrawable = new AvatarDrawable(); private static Drawable countDrawable; private static Drawable countDrawableGrey; private static TextPaint countPaint; private int lastUnreadCount; private int countWidth; private StaticLayout countLayout; private long dialog_id; public HintDialogCell(Context context) { super(context); setBackgroundResource(R.drawable.list_selector); imageView = new BackupImageView(context); imageView.setRoundRadius(AndroidUtilities.dp(27)); addView(imageView, LayoutHelper.createFrame(54, 54, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 7, 0, 0)); nameTextView = new TextView(context); nameTextView.setTextColor(0xff212121); nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12); nameTextView.setMaxLines(2); nameTextView.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL); nameTextView.setLines(2); nameTextView.setEllipsize(TextUtils.TruncateAt.END); addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 6, 64, 6, 0)); if (countDrawable == null) { countDrawable = getResources().getDrawable(R.drawable.dialogs_badge); countDrawableGrey = getResources().getDrawable(R.drawable.dialogs_badge2); countPaint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); countPaint.setColor(0xffffffff); countPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); } countPaint.setTextSize(AndroidUtilities.dp(13)); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(100), MeasureSpec.EXACTLY)); } @Override public boolean onTouchEvent(MotionEvent event) { if (Build.VERSION.SDK_INT >= 21 && getBackground() != null) { if (event.getAction() == MotionEvent.ACTION_DOWN || event.getAction() == MotionEvent.ACTION_MOVE) { getBackground().setHotspot(event.getX(), event.getY()); } } return super.onTouchEvent(event); } public void checkUnreadCounter(int mask) { if (mask != 0 && (mask & MessagesController.UPDATE_MASK_READ_DIALOG_MESSAGE) == 0 && (mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) == 0) { return; } TLRPC.TL_dialog dialog = MessagesController.getInstance().dialogs_dict.get(dialog_id); if (dialog != null && dialog.unread_count != 0) { if (lastUnreadCount != dialog.unread_count) { lastUnreadCount = dialog.unread_count; String countString = String.format("%d", dialog.unread_count); countWidth = Math.max(AndroidUtilities.dp(12), (int) Math.ceil(countPaint.measureText(countString))); countLayout = new StaticLayout(countString, countPaint, countWidth, Layout.Alignment.ALIGN_CENTER, 1.0f, 0.0f, false); if (mask != 0) { invalidate(); } } } else if (countLayout != null) { if (mask != 0) { invalidate(); } lastUnreadCount = 0; countLayout = null; } } public void setDialog(int uid, boolean counter, CharSequence name) { dialog_id = uid; TLRPC.FileLocation photo = null; if (uid > 0) { TLRPC.User user = MessagesController.getInstance().getUser(uid); if (name != null) { nameTextView.setText(name); } else if (user != null) { nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name)); } else { nameTextView.setText(""); } avatarDrawable.setInfo(user); if (user != null && user.photo != null) { photo = user.photo.photo_small; } } else { TLRPC.Chat chat = MessagesController.getInstance().getChat(-uid); if (name != null) { nameTextView.setText(name); } else if (chat != null) { nameTextView.setText(chat.title); } else { nameTextView.setText(""); } avatarDrawable.setInfo(chat); if (chat != null && chat.photo != null) { photo = chat.photo.photo_small; } } imageView.setImage(photo, "50_50", avatarDrawable); if (counter) { checkUnreadCounter(0); } else { countLayout = null; } } @Override protected boolean drawChild(Canvas canvas, View child, long drawingTime) { boolean result = super.drawChild(canvas, child, drawingTime); if (child == imageView) { if (countLayout != null) { int top = AndroidUtilities.dp(6); int left = AndroidUtilities.dp(54); int x = left - AndroidUtilities.dp(5.5f); if (MessagesController.getInstance().isDialogMuted(dialog_id)) { countDrawableGrey.setBounds(x, top, x + countWidth + AndroidUtilities.dp(11), top + countDrawableGrey.getIntrinsicHeight()); countDrawableGrey.draw(canvas); } else { countDrawable.setBounds(x, top, x + countWidth + AndroidUtilities.dp(11), top + countDrawable.getIntrinsicHeight()); countDrawable.draw(canvas); } canvas.save(); canvas.translate(left, top + AndroidUtilities.dp(4)); countLayout.draw(canvas); canvas.restore(); } } return result; } }
shazangroup/Mobograph
TMessagesProj/src/main/java/org/telegram/ui/Cells/HintDialogCell.java
Java
gpl-2.0
7,135
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using Ombi.Core; using Ombi.Helpers; using Ombi.Hubs; using Ombi.Notifications.Models; using Ombi.Schedule.Jobs.Plex.Models; using Ombi.Store.Entities; using Ombi.Store.Entities.Requests; using Ombi.Store.Repository; using Ombi.Store.Repository.Requests; using Quartz; namespace Ombi.Schedule.Jobs.Plex { public class PlexAvailabilityChecker : IPlexAvailabilityChecker { public PlexAvailabilityChecker(IPlexContentRepository repo, ITvRequestRepository tvRequest, IMovieRequestRepository movies, INotificationHelper notification, ILogger<PlexAvailabilityChecker> log, IHubContext<NotificationHub> hub) { _tvRepo = tvRequest; _repo = repo; _movieRepo = movies; _notificationService = notification; _log = log; _notification = hub; } private readonly ITvRequestRepository _tvRepo; private readonly IMovieRequestRepository _movieRepo; private readonly IPlexContentRepository _repo; private readonly INotificationHelper _notificationService; private readonly ILogger _log; private readonly IHubContext<NotificationHub> _notification; public async Task Execute(IJobExecutionContext job) { try { await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Plex Availability Check Started"); await ProcessMovies(); await ProcessTv(); } catch (Exception e) { await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Plex Availability Check Failed"); _log.LogError(e, "Exception thrown in Plex availbility checker"); return; } await _notification.Clients.Clients(NotificationHub.AdminConnectionIds) .SendAsync(NotificationHub.NotificationEvent, "Plex Availability Check Finished"); } private async Task ProcessTv() { var tv = await _tvRepo.GetChild().Where(x => !x.Available).ToListAsync(); await ProcessTv(tv); } private async Task ProcessTv(List<ChildRequests> tv) { var plexEpisodes = _repo.GetAllEpisodes().Include(x => x.Series); foreach (var child in tv) { var useImdb = false; var useTvDb = false; if (child.ParentRequest.ImdbId.HasValue()) { useImdb = true; } if (child.ParentRequest.TvDbId.ToString().HasValue()) { useTvDb = true; } var tvDbId = child.ParentRequest.TvDbId; var imdbId = child.ParentRequest.ImdbId; IQueryable<PlexEpisode> seriesEpisodes = null; if (useImdb) { seriesEpisodes = plexEpisodes.Where(x => x.Series.ImdbId == imdbId.ToString()); } if (useTvDb && (seriesEpisodes == null || !seriesEpisodes.Any())) { seriesEpisodes = plexEpisodes.Where(x => x.Series.TvDbId == tvDbId.ToString()); } if (seriesEpisodes == null) { continue; } if (!seriesEpisodes.Any()) { // Let's try and match the series by name seriesEpisodes = plexEpisodes.Where(x => x.Series.Title == child.Title && x.Series.ReleaseYear == child.ParentRequest.ReleaseDate.Year.ToString()); } var availableEpisode = new List<AvailabilityModel>(); foreach (var season in child.SeasonRequests) { foreach (var episode in season.Episodes) { if (episode.Available) { continue; } var foundEp = await seriesEpisodes.AnyAsync( x => x.EpisodeNumber == episode.EpisodeNumber && x.SeasonNumber == episode.Season.SeasonNumber); if (foundEp) { availableEpisode.Add(new AvailabilityModel { Id = episode.Id }); episode.Available = true; } } } //TODO Partial avilability notifications here if (availableEpisode.Any()) { await _tvRepo.Save(); } //foreach(var c in availableEpisode) //{ // await _tvRepo.MarkEpisodeAsAvailable(c.Id); //} // Check to see if all of the episodes in all seasons are available for this request var allAvailable = child.SeasonRequests.All(x => x.Episodes.All(c => c.Available)); if (allAvailable) { child.Available = true; child.MarkedAsAvailable = DateTime.UtcNow; _log.LogInformation("[PAC] - Child request {0} is now available, sending notification", $"{child.Title} - {child.Id}"); // We have ful-fulled this request! await _tvRepo.Save(); await _notificationService.Notify(new NotificationOptions { DateTime = DateTime.Now, NotificationType = NotificationType.RequestAvailable, RequestId = child.Id, RequestType = RequestType.TvShow, Recipient = child.RequestedUser.Email }); } } await _tvRepo.Save(); } private async Task ProcessMovies() { // Get all non available var movies = _movieRepo.GetAll().Include(x => x.RequestedUser).Where(x => !x.Available); var itemsForAvailbility = new List<AvailabilityModel>(); foreach (var movie in movies) { if (movie.Available) { return; } PlexServerContent item = null; if (movie.ImdbId.HasValue()) { item = await _repo.Get(movie.ImdbId, ProviderType.ImdbId); } if (item == null) { if (movie.TheMovieDbId.ToString().HasValue()) { item = await _repo.Get(movie.TheMovieDbId.ToString(), ProviderType.TheMovieDbId); } } if (item == null) { // We don't yet have this continue; } _log.LogInformation("[PAC] - Movie request {0} is now available, sending notification", $"{movie.Title} - {movie.Id}"); movie.Available = true; movie.MarkedAsAvailable = DateTime.UtcNow; itemsForAvailbility.Add(new AvailabilityModel { Id = movie.Id, RequestedUser = movie.RequestedUser != null ? movie.RequestedUser.Email : string.Empty }); } if (itemsForAvailbility.Any()) { await _movieRepo.SaveChangesAsync(); } foreach (var i in itemsForAvailbility) { await _notificationService.Notify(new NotificationOptions { DateTime = DateTime.Now, NotificationType = NotificationType.RequestAvailable, RequestId = i.Id, RequestType = RequestType.Movie, Recipient = i.RequestedUser }); } //await _repo.SaveChangesAsync(); } private bool _disposed; protected virtual void Dispose(bool disposing) { if (_disposed) return; if (disposing) { } _disposed = true; } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } } }
tidusjar/Ombi
src/Ombi.Schedule/Jobs/Plex/PlexAvailabilityChecker.cs
C#
gpl-2.0
9,045
/*PGR-GNU***************************************************************** File: pickDeliver_driver.cpp Generated with Template by: Copyright (c) 2015 pgRouting developers Mail: project@pgrouting.org Function's developer: Copyright (c) 2015 Celia Virginia Vergara Castillo Mail: ------ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ #include "drivers/pickDeliver/pickDeliverEuclidean_driver.h" #include <string.h> #include <sstream> #include <string> #include <deque> #include <vector> #include "vrp/pgr_pickDeliver.h" #include "cpp_common/pgr_assert.h" #include "cpp_common/pgr_alloc.hpp" /************************************************************ customers_sql TEXT, max_vehicles INTEGER, factor FLOAT, capacity FLOAT, max_cycles INTEGER, ***********************************************************/ void do_pgr_pickDeliverEuclidean( PickDeliveryOrders_t *customers_arr, size_t total_customers, Vehicle_t *vehicles_arr, size_t total_vehicles, double factor, int max_cycles, int initial_solution_id, General_vehicle_orders_t **return_tuples, size_t *return_count, char **log_msg, char **notice_msg, char **err_msg) { std::ostringstream log; std::ostringstream notice; std::ostringstream err; try { std::ostringstream tmp_log; *return_tuples = NULL; *return_count = 0; /* * transform to C++ containers */ std::vector<PickDeliveryOrders_t> orders( customers_arr, customers_arr + total_customers); std::vector<Vehicle_t> vehicles( vehicles_arr, vehicles_arr + total_vehicles); log << "Initialize problem\n"; pgrouting::vrp::Pgr_pickDeliver pd_problem( orders, vehicles, factor, max_cycles, initial_solution_id); err << pd_problem.msg.get_error(); if (!err.str().empty()) { log << pd_problem.msg.get_log(); *log_msg = pgr_msg(log.str().c_str()); *err_msg = pgr_msg(err.str().c_str()); return; } log << pd_problem.msg.get_log(); log << "Finish Reading data\n"; try { pd_problem.solve(); } catch (AssertFailedException &except) { log << pd_problem.msg.get_log(); throw except; } catch(...) { log << "Caught unknown exception!"; throw; } log << pd_problem.msg.get_log(); log << "Finish solve\n"; auto solution = pd_problem.get_postgres_result(); log << pd_problem.msg.get_log(); log << "solution size: " << solution.size() << "\n"; if (!solution.empty()) { (*return_tuples) = pgr_alloc(solution.size(), (*return_tuples)); int seq = 0; for (const auto &row : solution) { (*return_tuples)[seq] = row; ++seq; } } (*return_count) = solution.size(); log << pd_problem.msg.get_log(); pgassert(*err_msg == NULL); *log_msg = log.str().empty()? nullptr : pgr_msg(log.str().c_str()); *notice_msg = notice.str().empty()? nullptr : pgr_msg(notice.str().c_str()); } catch (AssertFailedException &except) { if (*return_tuples) free(*return_tuples); (*return_count) = 0; err << except.what(); *err_msg = pgr_msg(err.str().c_str()); *log_msg = pgr_msg(log.str().c_str()); } catch (std::exception& except) { if (*return_tuples) free(*return_tuples); (*return_count) = 0; err << except.what(); *err_msg = pgr_msg(err.str().c_str()); *log_msg = pgr_msg(log.str().c_str()); } catch(...) { if (*return_tuples) free(*return_tuples); (*return_count) = 0; err << "Caught unknown exception!"; *err_msg = pgr_msg(err.str().c_str()); *log_msg = pgr_msg(log.str().c_str()); } }
daas-ankur-shukla/pgrouting
src/pickDeliver/src/pickDeliverEuclidean_driver.cpp
C++
gpl-2.0
4,840
import { Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; import { IMinimumAvailability, IRadarrProfile, IRadarrRootFolder } from "../../interfaces"; import { IRadarrSettings } from "../../interfaces"; import { RadarrService } from "../../services"; import { TesterService } from "../../services"; import { NotificationService } from "../../services"; import { SettingsService } from "../../services"; @Component({ templateUrl: "./radarr.component.html", styleUrls: ["./radarr.component.scss"] }) export class RadarrComponent implements OnInit { public qualities: IRadarrProfile[]; public rootFolders: IRadarrRootFolder[]; public minimumAvailabilityOptions: IMinimumAvailability[]; public profilesRunning: boolean; public rootFoldersRunning: boolean; public form: FormGroup; constructor(private settingsService: SettingsService, private radarrService: RadarrService, private notificationService: NotificationService, private fb: FormBuilder, private testerService: TesterService) { } public ngOnInit() { this.settingsService.getRadarr() .subscribe(x => { this.form = this.fb.group({ enabled: [x.enabled], apiKey: [x.apiKey, [Validators.required]], defaultQualityProfile: [+x.defaultQualityProfile, [Validators.required]], defaultRootPath: [x.defaultRootPath, [Validators.required]], ssl: [x.ssl], subDir: [x.subDir], ip: [x.ip, [Validators.required]], port: [x.port, [Validators.required]], addOnly: [x.addOnly], minimumAvailability: [x.minimumAvailability, [Validators.required]], scanForAvailability: [x.scanForAvailability], v3: [x.v3] }); if (x.defaultQualityProfile) { this.getProfiles(this.form); } if (x.defaultRootPath) { this.getRootFolders(this.form); } }); this.qualities = []; this.qualities.push({ name: "Please Select", id: -1 }); this.rootFolders = []; this.rootFolders.push({ path: "Please Select", id: -1 }); this.minimumAvailabilityOptions = [ { name: "Announced", value: "Announced" }, { name: "In Cinemas", value: "InCinemas" }, { name: "Physical / Web", value: "Released" }, { name: "PreDb", value: "PreDb" }, ]; } public getProfiles(form: FormGroup) { this.profilesRunning = true; this.radarrService.getQualityProfiles(form.value).subscribe(x => { this.qualities = x; this.qualities.unshift({ name: "Please Select", id: -1 }); this.profilesRunning = false; this.notificationService.success("Successfully retrieved the Quality Profiles"); }); } public getRootFolders(form: FormGroup) { this.rootFoldersRunning = true; this.radarrService.getRootFolders(form.value).subscribe(x => { this.rootFolders = x; this.rootFolders.unshift({ path: "Please Select", id: -1 }); this.rootFoldersRunning = false; this.notificationService.success("Successfully retrieved the Root Folders"); }); } public test(form: FormGroup) { if (form.invalid) { this.notificationService.error("Please check your entered values"); return; } const settings = <IRadarrSettings> form.value; this.testerService.radarrTest(settings).subscribe(result => { if (result.isValid) { this.notificationService.success("Successfully connected to Radarr!"); } else if (result.expectedSubDir) { this.notificationService.error("Your Radarr Base URL must be set to " + result.expectedSubDir); } else { this.notificationService.error("We could not connect to Radarr!"); } }); } public onSubmit(form: FormGroup) { if (form.invalid) { this.notificationService.error("Please check your entered values"); return; } if (form.controls.defaultQualityProfile.value === "-1" || form.controls.defaultRootPath.value === "Please Select") { this.notificationService.error("Please check your entered values"); return; } const settings = <IRadarrSettings> form.value; this.settingsService.saveRadarr(settings).subscribe(x => { if (x) { this.notificationService.success("Successfully saved Radarr settings"); } else { this.notificationService.success("There was an error when saving the Radarr settings"); } }); } }
tidusjar/PlexRequests.Net
src/Ombi/ClientApp/src/app/settings/radarr/radarr.component.ts
TypeScript
gpl-2.0
5,080
jQuery(document).ready( function($) { $('.date').datepick(); $('#period_num_prizes').one('keyup', function(event){ $(this).after("<br/><span class='description' style='color: red;'> Após alterar o número de prêmios, salve o período para configurá-los. </span>"); $('#prizes').hide(300); }); });
memuller/benedict-old
wp-content/plugins/benedict_plugin/js/admin/period.js
JavaScript
gpl-2.0
316
package fr.inria.contraintes.biocham.menus; import fr.inria.contraintes.biocham.BiochamDynamicTree; import fr.inria.contraintes.biocham.BiochamMainFrame; import fr.inria.contraintes.biocham.BiochamModel; import fr.inria.contraintes.biocham.WorkbenchActionListener; import fr.inria.contraintes.biocham.utils.BrowserLauncher; import fr.inria.contraintes.biocham.utils.Icons; import fr.inria.contraintes.biocham.utils.Utils; import fr.inria.contraintes.biocham.modelData.AbstractionView; import fr.inria.contraintes.biocham.modelData.CTLView; import fr.inria.contraintes.biocham.modelData.DeclarationsView; import fr.inria.contraintes.biocham.modelData.EventsView; import fr.inria.contraintes.biocham.modelData.InitialStateView; import fr.inria.contraintes.biocham.modelData.InvariantsView; import fr.inria.contraintes.biocham.modelData.LTLView; import fr.inria.contraintes.biocham.modelData.MacrosView; import fr.inria.contraintes.biocham.modelData.MoleculesView; import fr.inria.contraintes.biocham.modelData.ParamTableCTLSpecifications; import fr.inria.contraintes.biocham.modelData.ParamTableDeclarations; import fr.inria.contraintes.biocham.modelData.ParamTableEvents; import fr.inria.contraintes.biocham.modelData.ParamTableLTLSpecifications; import fr.inria.contraintes.biocham.modelData.ParamTableMolecules; import fr.inria.contraintes.biocham.modelData.ParamTableConservationLaws; import fr.inria.contraintes.biocham.modelData.ParamTableInitConc; import fr.inria.contraintes.biocham.modelData.ParamTableParameters; import fr.inria.contraintes.biocham.modelData.ParamTableMacros; import fr.inria.contraintes.biocham.modelData.ParamTableRules; import fr.inria.contraintes.biocham.modelData.ParamTableVolumes; import fr.inria.contraintes.biocham.modelData.ParametersView; import fr.inria.contraintes.biocham.modelData.RulesView; import fr.inria.contraintes.biocham.modelData.SimulationView; import fr.inria.contraintes.biocham.modelData.VolumesView; import java.awt.Dimension; import java.awt.Font; import java.awt.Insets; import java.awt.Point; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import javax.swing.ImageIcon; import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JToolBar; import javax.swing.KeyStroke; /** * * A class representing the main MenuBar of the GUI. It contains the Biocham item, model's item and the Help item. * * @author Dragana Jovanovska * */ public class BiochamMenuBar implements ActionListener{ public static JMenuBar menuBar; public static JToolBar toolBar; public static JMenu helpMenu,commandsMenu; public static JCheckBoxMenuItem checkForUpdatesBox; public static JMenuItem menuItem; public static JMenuItem model; public static ColorMenu modelMenu,abstractionMenu; JMenu rulesMenu,initialMenu,parametersMenu, declarationMenu, invariantsMenu, macrosMenu, volumesMenu,moleculesMenu, eventsMenu; public static ElementMenuModel modelM; public static ElementMenuAbstractions absM; /** * * Build the menu bar with its items and sub-items. * */ public JMenuBar createMenuBar(BiochamDynamicTree tree){ if(menuBar==null){ menuBar=new JMenuBar(); menuBar.setMargin(new Insets(40,0,40,0)); menuBar.setForeground(Utils.foregroundColor); menuBar.setBackground(Utils.backgroundColor); menuBar.setName("workbenchMenuBar"); modelMenu = BiochamMenuBar.createNewMenu("Biocham"); modelMenu.setBackground(Utils.backgroundColor); ImageIcon bwIcon =Icons.icons.get("article-32.png"); menuItem=createMenuItem("New Model",KeyEvent.VK_N,bwIcon); menuItem.setActionCommand("newBCmodel"); menuItem.setToolTipText("Create new Biocham Model..."); menuItem.addActionListener(tree.treeListener); modelMenu.add(menuItem); bwIcon =Icons.icons.get("folderblue.png"); menuItem=createMenuItem("Open Model",KeyEvent.VK_O,bwIcon); menuItem.setToolTipText("Open existing Biocham Model..."); menuItem.setActionCommand("openBCmodel"); menuItem.addActionListener(tree.treeListener); modelMenu.add(menuItem); modelMenu.addSeparator(); bwIcon =Icons.icons.get("explorer-32.png"); checkForUpdatesBox = new JCheckBoxMenuItem(" Check for updates", bwIcon,true); checkForUpdatesBox.setBackground(Utils.backgroundColor); checkForUpdatesBox.setFont(new Font("",Font.BOLD,12)); checkForUpdatesBox.setForeground(Utils.foregroundColor); checkForUpdatesBox.addItemListener(new ItemListener(){ public void itemStateChanged(ItemEvent e) { if(e.getStateChange()==ItemEvent.SELECTED){ BiochamMainFrame.checkForUpdatesBox.setSelected(true); BiochamMainFrame.prefs.putBoolean("checkForUpdates", true); }else{ BiochamMainFrame.checkForUpdatesBox.setSelected(false); checkForUpdatesBox.setSelected(false); BiochamMainFrame.prefs.putBoolean("checkForUpdates", false); } }}); boolean s=BiochamMainFrame.prefs.getBoolean("checkForUpdates", true); checkForUpdatesBox.setSelected(s); modelMenu.add(checkForUpdatesBox); if (System.getProperty("mrj.version") == null) { // not Mac bwIcon =Icons.icons.get("remove3.png"); modelMenu.addSeparator(); menuItem=createMenuItem(" Quit",KeyEvent.VK_Q,bwIcon); menuItem.setToolTipText("Close this application"); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { BiochamMainFrame.quit(); }}); modelMenu.add(menuItem); } else { // Mac OS //System.setProperty("com.apple.macos.useScreenMenuBar", "true"); //System.setProperty("com.apple.mrj.application.growbox.intrudes", // "false"); //System.setProperty("com.apple.mrj.application.apple.menu.about.name", // "Biocham"); } menuBar.add(modelMenu); // modelMenu=tree.modelMenu.getMenu(); modelM=(ElementMenuModel)tree.modelMenu; modelM.getMenu().setEnabled(false); //absM=(ElementMenuAbstractions)tree.abstractionMenu; menuBar.add(modelM.getMenu()); helpMenu = createNewMenu("Help"); bwIcon =Icons.icons.get("computer_48.png" +0.5); menuItem=createMenuItem(" Documentation",KeyEvent.VK_L,bwIcon); menuItem.setToolTipText("Browse (local) Documentation and Tutorials"); WorkbenchActionListener t=new WorkbenchActionListener("documentation"); menuItem.addActionListener(t); helpMenu.add(menuItem); bwIcon =Icons.icons.get("agt_internet-32.png" +0.8); menuItem=createMenuItem(" Biocham Web Page",KeyEvent.VK_W,bwIcon); menuItem.setToolTipText("Browse (online) Tutorial"); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { Thread th=new Thread(new Runnable(){ public void run() { BrowserLauncher.openURL("http://contraintes.inria.fr/BIOCHAM"); } }); th.start(); } }); helpMenu.add(menuItem); if (System.getProperty("mrj.version") == null) { // not Mac helpMenu.addSeparator(); bwIcon =Icons.icons.get("Info_32.png"); menuItem=createMenuItem("About",KeyEvent.VK_A,bwIcon); menuItem.setToolTipText("About Biocham"); menuItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { BiochamMainFrame.aboutNotOSXPlatform(); }}); helpMenu.add(menuItem); bwIcon=null; } menuBar.add(helpMenu); } return menuBar; } /** * * Responds to the events generated by clicking on the menu bar items. * In general, it creates popups of all menu item features. * */ public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("rules")){ if(((ParamTableRules)BiochamDynamicTree.currentModel.getRules().getParamTable()).getRulesModel().getViews().size()==1){ BiochamDynamicTree.currentModel.rulesF.getContentPane().removeAll(); RulesView v=new RulesView(BiochamDynamicTree.currentModel.rulesF,((ParamTableRules)BiochamDynamicTree.currentModel.getRules().getParamTable()).getRulesModel()); JFrame d=BiochamDynamicTree.currentModel.rulesF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(550, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.rulesF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.rulesF.setVisible(true); BiochamDynamicTree.currentModel.rulesF.setFocusable(true); } }else if(e.getActionCommand().equals("molecules")){ if(((ParamTableMolecules)BiochamDynamicTree.currentModel.getMolecules().getParamTable()).getMoleculesModel().getViews().size()==1){ BiochamDynamicTree.currentModel.molsF.getContentPane().removeAll(); MoleculesView v=new MoleculesView(BiochamDynamicTree.currentModel.molsF,((ParamTableMolecules)BiochamDynamicTree.currentModel.getMolecules().getParamTable()).getMoleculesModel()); JFrame d=BiochamDynamicTree.currentModel.molsF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.molsF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.molsF.setVisible(true); BiochamDynamicTree.currentModel.molsF.setFocusable(true); } }else if(e.getActionCommand().equals("volumes")){ if(((ParamTableVolumes)BiochamDynamicTree.currentModel.getVolumes().getParamTable()).getVolumesModel().getViews().size()==1){ BiochamDynamicTree.currentModel.volumeF.getContentPane().removeAll(); VolumesView v=new VolumesView(BiochamDynamicTree.currentModel.volumeF,((ParamTableVolumes)BiochamDynamicTree.currentModel.getVolumes().getParamTable()).getVolumesModel()); JFrame d=BiochamDynamicTree.currentModel.volumeF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.volumeF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.volumeF.setVisible(true); BiochamDynamicTree.currentModel.volumeF.setFocusable(true); } }else if(e.getActionCommand().equals("macros")){ if(((ParamTableMacros)BiochamDynamicTree.currentModel.getMacros().getParamTable()).getMacrosModel().getViews().size()==1){ BiochamDynamicTree.currentModel.macrosF.getContentPane().removeAll(); MacrosView v=new MacrosView(BiochamDynamicTree.currentModel.macrosF,((ParamTableMacros)BiochamDynamicTree.currentModel.getMacros().getParamTable()).getMacrosModel()); JFrame d=BiochamDynamicTree.currentModel.macrosF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.macrosF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.macrosF.setVisible(true); BiochamDynamicTree.currentModel.macrosF.setFocusable(true); } }else if(e.getActionCommand().equals("events")){ if(((ParamTableEvents)BiochamDynamicTree.currentModel.getEvents().getParamTable()).getEventsModel().getViews().size()==1){ BiochamDynamicTree.currentModel.eventsF.getContentPane().removeAll(); EventsView v=new EventsView(BiochamDynamicTree.currentModel.eventsF,((ParamTableEvents)BiochamDynamicTree.currentModel.getEvents().getParamTable()).getEventsModel()); JFrame d=BiochamDynamicTree.currentModel.eventsF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.eventsF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.eventsF.setVisible(true); BiochamDynamicTree.currentModel.eventsF.setFocusable(true); } }else if(e.getActionCommand().equals("invariants")){ if(((ParamTableConservationLaws)BiochamDynamicTree.currentModel.getConservationLaws().getParamTable()).getInvariantsModel().getViews().size()==1){ BiochamDynamicTree.currentModel.conLawsF.getContentPane().removeAll(); InvariantsView v=new InvariantsView(BiochamDynamicTree.currentModel.conLawsF,((ParamTableConservationLaws)BiochamDynamicTree.currentModel.getConservationLaws().getParamTable()).getInvariantsModel()); JFrame d=BiochamDynamicTree.currentModel.conLawsF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.conLawsF.setVisible(true); BiochamDynamicTree.currentModel.conLawsF.setFocusable(true); BiochamDynamicTree.currentModel.conLawsF.setExtendedState(JFrame.NORMAL); } }else if(e.getActionCommand().equals("declarations")){ if(((ParamTableDeclarations)BiochamDynamicTree.currentModel.getDeclarations().getParamTable()).getDeclarationsModel().getViews().size()==1){ BiochamDynamicTree.currentModel.declF.getContentPane().removeAll(); DeclarationsView v=new DeclarationsView(BiochamDynamicTree.currentModel.declF,((ParamTableDeclarations)BiochamDynamicTree.currentModel.getDeclarations().getParamTable()).getDeclarationsModel()); JFrame d=BiochamDynamicTree.currentModel.declF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.declF.setVisible(true); BiochamDynamicTree.currentModel.declF.setFocusable(true); BiochamDynamicTree.currentModel.declF.setExtendedState(JFrame.NORMAL); } }else if(e.getActionCommand().equals("parameters")){ if(((ParamTableParameters)BiochamDynamicTree.currentModel.getParameters().getParamTable()).getParametersModel().getViews().size()==1){ BiochamDynamicTree.currentModel.paramF.getContentPane().removeAll(); ParametersView v=new ParametersView(BiochamDynamicTree.currentModel.paramF,((ParamTableParameters)BiochamDynamicTree.currentModel.getParameters().getParamTable()).getParametersModel()); JFrame d=BiochamDynamicTree.currentModel.paramF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.paramF.setVisible(true); BiochamDynamicTree.currentModel.paramF.setFocusable(true); BiochamDynamicTree.currentModel.paramF.setExtendedState(JFrame.NORMAL); } }else if(e.getActionCommand().equals("initialState")){ if(((ParamTableInitConc)BiochamDynamicTree.currentModel.getInitConditions().getParamTable()).getInitStateModel().getViews().size()==1){ BiochamDynamicTree.currentModel.initConcF.getContentPane().removeAll(); InitialStateView v=new InitialStateView(BiochamDynamicTree.currentModel.initConcF,((ParamTableInitConc)BiochamDynamicTree.currentModel.getInitConditions().getParamTable()).getInitStateModel()); JFrame d=BiochamDynamicTree.currentModel.initConcF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.initConcF.setVisible(true); BiochamDynamicTree.currentModel.initConcF.setFocusable(true); //BiochamDynamicTree.currentModel.initConcF.setLocation(BiochamMainFrame.frame.getLocationOnScreen().x+BiochamMainFrame.frame.getSize().width/2-185,BiochamMainFrame.frame.getLocationOnScreen().y+BiochamMainFrame.frame.getSize().height/2-140); BiochamDynamicTree.currentModel.initConcF.setExtendedState(JFrame.NORMAL); } }else if(e.getActionCommand().contains("Boolean")){ if(((ParamTableCTLSpecifications)BiochamDynamicTree.currentModel.getCtlSpecifications().getParamTable()).getCtlModel().getViews().size()==1){ BiochamDynamicTree.currentModel.booleanTPF.getContentPane().removeAll(); CTLView v=new CTLView(BiochamDynamicTree.currentModel.booleanTPF,((ParamTableCTLSpecifications)BiochamDynamicTree.currentModel.getCtlSpecifications().getParamTable()).getCtlModel()); JFrame d=BiochamDynamicTree.currentModel.booleanTPF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.booleanTPF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.booleanTPF.setVisible(true); BiochamDynamicTree.currentModel.booleanTPF.setFocusable(true); } }else if(e.getActionCommand().contains("Numerical")){ if(((ParamTableLTLSpecifications)BiochamDynamicTree.currentModel.getLtlSpecifications().getParamTable()).getLtlModel().getViews().size()==1){ BiochamDynamicTree.currentModel.numericalTPF.getContentPane().removeAll(); LTLView v=new LTLView(BiochamDynamicTree.currentModel.numericalTPF,((ParamTableLTLSpecifications)BiochamDynamicTree.currentModel.getLtlSpecifications().getParamTable()).getLtlModel()); JFrame d=BiochamDynamicTree.currentModel.numericalTPF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.numericalTPF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.numericalTPF.setVisible(true); BiochamDynamicTree.currentModel.numericalTPF.setFocusable(true); } }else if(e.getActionCommand().contains("Abstractions")){ if(BiochamDynamicTree.currentModel.getAbstractionModel().getViews().size()==1){ BiochamDynamicTree.currentModel.abstractionsF.getContentPane().removeAll(); AbstractionView v=new AbstractionView(BiochamDynamicTree.currentModel.abstractionsF,BiochamDynamicTree.currentModel); JFrame d=BiochamDynamicTree.currentModel.abstractionsF; JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.abstractionsF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.abstractionsF.setVisible(true); BiochamDynamicTree.currentModel.abstractionsF.setFocusable(true); } }else if(e.getActionCommand().equals("Simulations")){ if(BiochamDynamicTree.currentModel.getSimulationModel().getViews().size()==1){ BiochamDynamicTree.currentModel.simulationF.getContentPane().removeAll(); JFrame d=BiochamDynamicTree.currentModel.simulationF; SimulationView v=new SimulationView(d,BiochamDynamicTree.currentModel); JScrollPane p=new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); p.setAutoscrolls(true); p.setViewportView(v); d.getContentPane().add(p); Point pos = BiochamMainFrame.frame.getLocationOnScreen(); d.setLocation(pos.x+BiochamMainFrame.frame.getSize().width/2-185,pos.y+BiochamMainFrame.frame.getSize().height/2-140); d.setResizable(true); d.setSize(new Dimension(480, 580)); d.setLocationRelativeTo(BiochamMainFrame.frame); d.setAlwaysOnTop(false); d.setFocusable(true); d.setVisible(true); }else{ BiochamDynamicTree.currentModel.simulationF.setExtendedState(JFrame.NORMAL); BiochamDynamicTree.currentModel.simulationF.setVisible(true); BiochamDynamicTree.currentModel.simulationF.setFocusable(true); } } } /** * * Refreshes the menus context so that the menu Model gets the name of the currently selected Biocham model. * */ public static void refreshMenusContext(BiochamModel m){ if(m!=null){ modelM.setModelName(m.getModelName()); for(int i=0;i<menuBar.getMenuCount();i++){ menuBar.getMenu(i).setEnabled(true); } } } /** * * Enables the menu Model to be accessible if and only if there is at least one Biocham model opened in the GUI. * */ public static void setMenusEnabled(boolean b){ for(int i=0;i<menuBar.getComponentCount();i++){ menuBar.getComponent(i).setEnabled(b); } menuBar.revalidate(); } /** * * Utility method that creates an instance of a menuItem such that has an icon, name, key, and applies to it common visual properties like font, background and foreground. * */ public static JMenuItem createMenuItem(String name, int key, ImageIcon imageIcon) { JMenuItem menuItem=new JMenuItem(name,imageIcon); menuItem.setMnemonic(key); menuItem.setAccelerator(KeyStroke.getKeyStroke(key,Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); menuItem.setBackground(Utils.backgroundColor); menuItem.setFont(Utils.menuBarFont); menuItem.setForeground(Utils.foregroundColor); return menuItem; } /** * * Utility method that creates an instance of a simple colored menuItem with a given title. * */ public static ColorMenu createNewMenu(String string) { ColorMenu menu2 = new ColorMenu(string); return menu2; } /** * * Utility method that creates an instance of a colored menuItem with a given name and key. * */ public static ColorMenu createNewMenu(String string,int key) { ColorMenu menu2 = new ColorMenu(string); menu2.setMnemonic(key); return menu2; } /** * * Utility method that creates an instance of a popup menu with applied common visual properties like background and foreground color and font. * */ public static JPopupMenu createNewPopupMenu() { JPopupMenu menu = new JPopupMenu(); menu.setFont(Utils.treeExplorerFont); menu.setForeground(Utils.foregroundColor); menu.setBackground(Utils.backgroundColor); return menu; } }
Thomashuet/Biocham
gui/menus/BiochamMenuBar.java
Java
gpl-2.0
28,391
<?php /** * The template for displaying the footer. * * Contains the closing of the id=main div and all content after * * @package WordPress * @subpackage SCS * @since SCS 0.1 */ ?> </div> <!-- #main --> <footer id="colophon" role="contentinfo"> <div class="footer-top-wrapper"> <?php /* A sidebar in the footer? Yep. You can can customize * your footer with three columns of widgets. */ get_sidebar( 'footer' ); ?></div> <div class="footer-bottom-wrapper"> <div class="footer-content"><?php if ( is_active_sidebar( 'copyright-widget' ) ) : ?> <div id="copyright"> <?php dynamic_sidebar( 'copyright-widget' ); ?> </div> <!-- #copyright .widget-area --> <?php endif; ?> <div id="site-generator"> <div class="site-by">Site by <a href="http://squeezecreative.com.au" rel="external">Squeeze Creative</a></div> </div> </div> </div> </footer> <!-- #colophon --> </div> <!-- #page --> <script src="<?php bloginfo( 'template_url' );?>/plugins/uniform/js/jquery.uniform.min.js" type="text/javascript"></script> <!--<script src="<?php bloginfo( 'template_url' );?>/plugins/uniform/js/jquery.multiselect.min.js" type="text/javascript"></script>--> <script src="<?php bloginfo( 'template_url' );?>/plugins/responsive/js/modernizr.custom.js" type="text/javascript"></script> <script src="<?php bloginfo( 'template_url' );?>/plugins/responsive/js/jquery.dlmenu.js" type="text/javascript"></script> <script src="<?php bloginfo( 'template_url' );?>/js/init.js" type="text/javascript"></script> <?php wp_footer(); ?> </body> </html>
thereelists/scs
wp-content/themes/specialist_cosmetic_surgery/footer_old.php
PHP
gpl-2.0
1,582
<?php /** * @version SEBLOD 3.x Core ~ $Id: searchs.php sebastienheraud $ * @package SEBLOD (App Builder & CCK) // SEBLOD nano (Form Builder) * @url https://www.seblod.com * @editor Octopoos - www.octopoos.com * @copyright Copyright (C) 2009 - 2017 SEBLOD. All Rights Reserved. * @license GNU General Public License version 2 or later; see _LICENSE.php **/ defined( '_JEXEC' ) or die; jimport( 'joomla.application.component.modellist' ); // Model class CCKModelSearchs extends JModelList { // __construct public function __construct( $config = array() ) { if ( empty( $config['filter_fields'] ) ) { $config['filter_fields'] = array( 'id', 'a.id', 'title', 'a.title', 'name', 'a.name', 'folder', 'a.folder', 'folder_title', 'published', 'a.published', 'checked_out', 'a.checked_out', 'checked_out_time', 'a.checked_out_time', ); } parent::__construct( $config ); } // getItems public function getItems() { if ( $items = parent::getItems() ) { $search = JCckDatabase::loadObjectList( 'SELECT a.searchid, COUNT( a.searchid ) AS num FROM #__cck_core_search_field AS a' . ' WHERE a.client = "search" GROUP BY a.searchid', 'searchid' ); $order = JCckDatabase::loadObjectList( 'SELECT a.searchid, COUNT( a.searchid ) AS num FROM #__cck_core_search_field AS a' . ' WHERE a.client = "order" GROUP BY a.searchid', 'searchid' ); $list = JCckDatabase::loadObjectList( 'SELECT a.searchid, COUNT( a.searchid ) AS num FROM #__cck_core_search_field AS a' . ' WHERE a.client = "list" GROUP BY a.searchid', 'searchid' ); $item = JCckDatabase::loadObjectList( 'SELECT a.searchid, COUNT( a.searchid ) AS num FROM #__cck_core_search_field AS a' . ' WHERE a.client = "item" GROUP BY a.searchid', 'searchid' ); $version = JCckDatabase::loadObjectList( 'SELECT a.e_id, COUNT( a.e_id ) AS num FROM #__cck_core_versions AS a' . ' WHERE a.e_type = "search" GROUP BY a.e_id', 'e_id' ); $styles = JCckDatabase::loadObjectList( 'SELECT a.id, a.template FROM #__template_styles AS a', 'id' ); foreach ( $items as $i ) { $i->searchFields = @$search[$i->id]->num ? $search[$i->id]->num : 0; $i->orderFields = @$order[$i->id]->num ? $order[$i->id]->num : 0; $i->listFields = @$list[$i->id]->num ? $list[$i->id]->num : 0; $i->itemFields = @$item[$i->id]->num ? $item[$i->id]->num : 0; $i->searchTemplate = @$styles[$i->template_search]->template; $i->orderTemplate = ''; $i->listTemplate = @$styles[$i->template_list]->template; $i->itemTemplate = @$styles[$i->template_item]->template; $i->versions = @$version[$i->id]->num ? $version[$i->id]->num : 0; } } return $items; } // getListQuery protected function getListQuery() { $app = JFactory::getApplication(); $db = $this->getDbo(); $query = $db->getQuery( true ); // Select $query->select ( $this->getState ( 'list.select', 'a.id as id,' . 'a.title as title,' . 'a.name as name,' . 'a.folder as folder,' . 'a.template_search as template_search,' . 'a.template_filter as template_filter,' . 'a.template_list as template_list,' . 'a.template_item as template_item,' . 'a.published as published,' . 'a.checked_out as checked_out,' . 'a.checked_out_time as checked_out_time' ) ); // From $query->from( '`#__cck_core_searchs` AS a' ); // Join Folder $query->select( 'c.title AS folder_title, c.color AS folder_color, c.introchar AS folder_introchar, c.colorchar AS folder_colorchar' ); $query->join( 'LEFT', '#__cck_core_folders AS c ON c.id = a.folder' ); $query->select( 'd.title AS folder_parent_title, d.id AS folder_parent' ); $query->join( 'LEFT', '#__cck_core_folders AS d ON d.id = c.parent_id' ); // Join User $query->select( 'u.name AS editor' ); $query->join( 'LEFT', '#__users AS u ON u.id = a.checked_out' ); // Filder Folder $folderId = $this->getState( 'filter.folder' ); if ( is_numeric( $folderId ) ) { $folders = Helper_Folder::getBranch( $folderId, ',' ); if ( $folders ) { $query->where( 'a.folder IN ('.$folders.')' ); } } // Filter Type $type = $this->getState( 'filter.type' ); if ( is_string( $type ) && $type != '' ) { $query->where( 'a.storage_location = "'.(string)$type.'"' ); } // Filter Client $client = $this->getState( 'filter.client' ); if ( $client == 'both' ) { $query->where( 'a.location = ""' ); } elseif ( $client ) { if ( strpos( $client, '_both') !== false ) { $query->where( '( a.location = "'.(string)str_replace( '_both', '', $client ).'" OR a.location = "" )' ); } else { $query->where( 'a.location = "'.(string)$client.'"' ); } } // Filter State $published = $this->getState( 'filter.state' ); if ( is_numeric( $published ) && $published >= 0 ) { $query->where( 'a.published = '.(int)$published ); } $query->where( 'a.published != -44' ); // Filter Search if ( ( $folder = $app->input->getInt( 'folder_id', 0 ) ) > 0 ) { $location = 'folder_id'; $search = $folder; $this->setState( 'filter.location', $location ); $this->setState( 'filter.search', $search ); } else { $location = $this->getState( 'filter.location' ); $search = $this->getState( 'filter.search' ); } if ( ! empty( $search ) ) { switch ( $location ) { case 'id': $where = ( strpos( $search, ',' ) !== false ) ? 'a.id IN ('.$search.')' : 'a.id = '.(int)$search; $query->where( $where ); break; case 'folder_id': $where = ( strpos( $search, ',' ) !== false ) ? 'a.folder IN ('.$search.')' : 'a.folder = '.(int)$search; $query->where( $where ); break; case 'field_name': $search = $db->quote( '%'.$db->escape( $search, true ).'%' ); $where = 'f.name LIKE '.$search; $query->join( 'LEFT', '#__cck_core_search_field AS e ON e.searchid = a.id' ); $query->join( 'LEFT', '#__cck_core_fields AS f ON f.id = e.fieldid' ); $query->where( $where ); break; case 'template_name': $search = $db->quote( '%'.$db->escape( $search, true ).'%' ); $query->join( 'LEFT', '#__template_styles AS e ON e.id = a.template_search' ); $query->join( 'LEFT', '#__template_styles AS f ON f.id = a.template_list' ); $query->join( 'LEFT', '#__template_styles AS g ON g.id = a.template_item' ); $where = '( e.template LIKE '.$search.' OR f.template LIKE '.$search.' OR g.template LIKE '.$search. ')'; $query->where( $where ); break; default: $search = $db->quote( '%'.$db->escape( $search, true ).'%' ); $query->where( 'a.'.$location.' LIKE '.$search ); break; } } // Group By $query->group( 'a.id' ); // Order By $query->order( $db->escape( $this->state->get( 'list.ordering', 'title' ).' '.$this->state->get( 'list.direction', 'ASC' ) ) ); return $query; } // getStoreId protected function getStoreId( $id = '' ) { $id .= ':' . $this->getState( 'filter.search' ); $id .= ':' . $this->getState( 'filter.location' ); $id .= ':' . $this->getState( 'filter.type' ); $id .= ':' . $this->getState( 'filter.state' ); $id .= ':' . $this->getState( 'filter.folder' ); $id .= ':' . $this->getState( 'filter.client' ); return parent::getStoreId( $id ); } // getTable public function getTable( $type = 'Search', $prefix = CCK_TABLE, $config = array() ) { return JTable::getInstance( $type, $prefix, $config ); } // populateState protected function populateState( $ordering = null, $direction = null ) { $app = JFactory::getApplication( 'administrator' ); $folder = $app->input->getInt( 'folder_id', 0 ); if ( $folder > 0 ) { $search = $folder; $location = 'folder_id'; } else { $search = $app->getUserStateFromRequest( $this->context.'.filter.search', 'filter_search', '' ); $location = $app->getUserStateFromRequest( $this->context.'.filter.location', 'filter_location', 'title' ); } $this->setState( 'filter.search', $search ); $this->setState( 'filter.location', $location ); $type = $app->getUserStateFromRequest( $this->context.'.filter.type', 'filter_type', '' ); $this->setState( 'filter.type', $type ); $state = $app->getUserStateFromRequest( $this->context.'.filter.state', 'filter_state', '1', 'string' ); $this->setState( 'filter.state', $state ); $folderId = $app->getUserStateFromRequest( $this->context.'.filter.folder', 'filter_folder', '' ); $this->setState( 'filter.folder', $folderId ); $client = $app->getUserStateFromRequest( $this->context.'.filter.client', 'filter_client', '', 'string' ); $this->setState( 'filter.client', $client ); $params = JComponentHelper::getParams( CCK_COM ); $this->setState( 'params', $params ); parent::populateState( 'a.title', 'asc' ); } } ?>
oliviernolbert/SEBLOD
administrator/components/com_cck/models/searchs.php
PHP
gpl-2.0
9,119
<?php /** * Joomla! Content Management System * * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Encrypt; \defined('JPATH_PLATFORM') or die; /** * This class provides an RFC6238-compliant Time-based One Time Passwords, * compatible with Google Authenticator (with PassCodeLength = 6 and TimePeriod = 30). * * @since 4.0.0 */ class Totp { /** * Passcode length * * @var integer */ private $_passCodeLength = 6; /** * Pin modulo * * @var integer */ private $_pinModulo; /** * Secret length * * @var integer */ private $_secretLength = 10; /** * Timestep * * @var integer */ private $_timeStep = 30; /** * Base32 * * @var integer */ private $_base32 = null; /** * Initialises an RFC6238-compatible TOTP generator. Please note that this * class does not implement the constraint in the last paragraph of §5.2 * of RFC6238. It's up to you to ensure that the same user/device does not * retry validation within the same Time Step. * * @param int $timeStep The Time Step (in seconds). Use 30 to be compatible with Google Authenticator. * @param int $passCodeLength The generated passcode length. Default: 6 digits. * @param int $secretLength The length of the secret key. Default: 10 bytes (80 bits). * @param Object $base32 The base32 en/decrypter */ public function __construct($timeStep = 30, $passCodeLength = 6, $secretLength = 10, $base32=null) { $this->_timeStep = $timeStep; $this->_passCodeLength = $passCodeLength; $this->_secretLength = $secretLength; $this->_pinModulo = pow(10, $this->_passCodeLength); if (\is_null($base32)) { $this->_base32 = new Base32; } else { $this->_base32 = $base32; } } /** * Get the time period based on the $time timestamp and the Time Step * defined. If $time is skipped or set to null the current timestamp will * be used. * * @param int|null $time Timestamp * * @return integer The time period since the UNIX Epoch */ public function getPeriod($time = null) { if (\is_null($time)) { $time = time(); } $period = floor($time / $this->_timeStep); return $period; } /** * Check is the given passcode $code is a valid TOTP generated using secret * key $secret * * @param string $secret The Base32-encoded secret key * @param string $code The passcode to check * * @return boolean True if the code is valid */ public function checkCode($secret, $code) { $time = $this->getPeriod(); for ($i = -1; $i <= 1; $i++) { if ($this->getCode($secret, ($time + $i) * $this->_timeStep) == $code) { return true; } } return false; } /** * Gets the TOTP passcode for a given secret key $secret and a given UNIX * timestamp $time * * @param string $secret The Base32-encoded secret key * @param int $time UNIX timestamp * * @return string */ public function getCode($secret, $time = null) { $period = $this->getPeriod($time); $secret = $this->_base32->decode($secret); $time = pack("N", $period); $time = str_pad($time, 8, \chr(0), STR_PAD_LEFT); $hash = hash_hmac('sha1', $time, $secret, true); $offset = \ord(substr($hash, -1)); $offset = $offset & 0xF; $truncatedHash = $this->hashToInt($hash, $offset) & 0x7FFFFFFF; $pinValue = str_pad($truncatedHash % $this->_pinModulo, $this->_passCodeLength, "0", STR_PAD_LEFT); return $pinValue; } /** * Extracts a part of a hash as an integer * * @param string $bytes The hash * @param string $start The char to start from (0 = first char) * * @return string */ protected function hashToInt($bytes, $start) { $input = substr($bytes, $start, \strlen($bytes) - $start); $val2 = unpack("N", substr($input, 0, 4)); return $val2[1]; } /** * Returns a QR code URL for easy setup of TOTP apps like Google Authenticator * * @param string $user User * @param string $hostname Hostname * @param string $secret Secret string * * @return string */ public function getUrl($user, $hostname, $secret) { $url = sprintf("otpauth://totp/%s@%s?secret=%s", $user, $hostname, $secret); $encoder = "https://chart.googleapis.com/chart?chs=200x200&chld=Q|2&cht=qr&chl="; $encoderURL = $encoder . urlencode($url); return $encoderURL; } /** * Generates a (semi-)random Secret Key for TOTP generation * * @return string */ public function generateSecret() { $secret = ""; for ($i = 1; $i <= $this->_secretLength; $i++) { $c = rand(0, 255); $secret .= pack("c", $c); } $base32 = new Base32; return $this->_base32->encode($secret); } }
astridx/joomla-cms
libraries/src/Encrypt/Totp.php
PHP
gpl-2.0
4,866
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LMDb.Db { /** * Series object */ public class Rating : IContentLink { public Rating() { Movies = new List<Movie>(); Series = new List<Series>(); Episodes = new List<Episode>(); } public int RatingID { get; set; } public string Name { get; set; } public virtual ICollection<Movie> Movies { get; set; } public virtual ICollection<Series> Series { get; set; } public virtual ICollection<Episode> Episodes { get; set; } } }
HugoC4/LMDb
LMDb/Db/Rating.cs
C#
gpl-2.0
676
require_relative 'server' require_relative 'stub_server_middleware' require 'httparty' require 'uri' require 'find_a_port' module Shokkenki module Consumer module Stubber class LocalServerStubber attr_reader :port, :host, :scheme, :interactions_path, :server def initialize attributes @port = attributes[:port] @scheme = attributes[:scheme] || :http @host = attributes[:host] || 'localhost' @interactions_path = attributes[:interactions_path] || '/shokkenki/interactions' @unmatched_requests_path = '/shokkenki/requests/unmatched' @unused_interactions_path = '/shokkenki/interactions/unused' end def type :local_server end def stub_interaction interaction response = HTTParty.post(interactions_uri, :body => interaction.to_hash.to_json, :headers => { 'Content-Type' => 'application/json' } ) server.assert_ok! raise "Failed to stub interaction: #{response.inspect}" unless successful?(response.code) end def clear_interaction_stubs response = HTTParty.delete interactions_uri server.assert_ok! raise "Failed to clear interaction stubs: #{response.inspect}" unless successful?(response.code) end def successful? response_code (200 <= response_code) && (response_code < 300) end def session_started # Find a port as late as possible to minimise the # chance that it starts being used in between finding it # and using it. @port = FindAPort.available_port unless @port @server = Server.new( :app => StubServerMiddleware.new, :host => @host, :port => @port ) @server.start end def session_closed @server.shutdown end def unmatched_requests response = HTTParty.get unmatched_requests_uri server.assert_ok! raise "Failed to find unmatched requests: #{response.inspect}" unless successful?(response.code) JSON.parse response.body end def unused_interactions response = HTTParty.get unused_interactions_uri server.assert_ok! raise "Failed to find unused interactions: #{response.inspect}" unless successful?(response.code) JSON.parse response.body end def server_properties { :scheme => @scheme.to_s, :host => @host.to_s, :port => @port } end def interactions_uri URI::Generic.build(server_properties.merge(:path => @interactions_path.to_s)).to_s end def unmatched_requests_uri URI::Generic.build(server_properties.merge(:path => @unmatched_requests_path.to_s)).to_s end def unused_interactions_uri URI::Generic.build(server_properties.merge(:path => @unused_interactions_path.to_s)).to_s end end end end end
brentsnook/shokkenki-consumer
lib/shokkenki/consumer/stubber/local_server_stubber.rb
Ruby
gpl-2.0
3,114
/* * Copyright (c) 2012, Codename One and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Codename One designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Codename One through http://www.codenameone.com/ if you * need additional information or have any questions. */ package com.codename1.social; import android.content.Intent; import com.codename1.impl.android.AndroidNativeUtil; import com.codename1.impl.android.CodenameOneActivity; import com.codename1.impl.android.IntentResultListener; import com.codename1.ui.Display; import com.codename1.util.Callback; import com.facebook.AccessToken; import com.facebook.CallbackManager; import com.facebook.FacebookCallback; import com.facebook.FacebookException; import com.facebook.FacebookSdk; import com.facebook.login.LoginManager; import com.facebook.share.model.AppInviteContent; import com.facebook.share.widget.AppInviteDialog; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.List; import java.util.StringTokenizer; /** * Class implementing the facebook API * * @author Shai Almog */ public class FacebookImpl extends FacebookConnect { private static List<String> permissions; private boolean loginLock = false; private static final List<String> PUBLISH_PERMISSIONS = Arrays.asList("publish_actions"); public static void init() { FacebookConnect.implClass = FacebookImpl.class; permissions = new ArrayList<String>(); String permissionsStr = Display.getInstance().getProperty("facebook_permissions", ""); permissionsStr = permissionsStr.trim(); StringTokenizer token = new StringTokenizer(permissionsStr, ", "); if (token.countTokens() > 0) { try { while (token.hasMoreElements()) { String permission = (String) token.nextToken(); permission = permission.trim(); permissions.add(permission); } } catch (Exception e) { //the pattern is not valid } } FacebookSdk.sdkInitialize(AndroidNativeUtil.getActivity().getApplicationContext()); } @Override public boolean isFacebookSDKSupported() { return true; } @Override public void login() { login(callback); } private void login(final LoginCallback cb) { if (loginLock) { return; } loginLock = true; LoginManager login = LoginManager.getInstance(); final CallbackManager mCallbackManager = CallbackManager.Factory.create(); final CodenameOneActivity activity = (CodenameOneActivity) AndroidNativeUtil.getActivity(); activity.setIntentResultListener(new IntentResultListener() { @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { mCallbackManager.onActivityResult(requestCode, resultCode, data); activity.restoreIntentResultListener(); } }); login.registerCallback(mCallbackManager, new FBCallback(cb)); login.logInWithReadPermissions(activity, permissions); } @Override public boolean isLoggedIn() { AccessToken accessToken = AccessToken.getCurrentAccessToken(); return accessToken != null && !accessToken.isExpired(); } @Override public String getToken() { com.codename1.io.AccessToken t = getAccessToken(); if (t != null) { return t.getToken(); } return null; } @Override public com.codename1.io.AccessToken getAccessToken() { if (isNativeLoginSupported()) { AccessToken fbToken = AccessToken.getCurrentAccessToken(); if (fbToken != null) { String token = fbToken.getToken(); Date ex = fbToken.getExpires(); long diff = ex.getTime() - System.currentTimeMillis(); diff = diff / 1000; com.codename1.io.AccessToken cn1Token = new com.codename1.io.AccessToken(token, "" + diff); return cn1Token; } return null; } else { return super.getAccessToken(); } } @Override public void logout() { LoginManager login = LoginManager.getInstance(); login.logOut(); } public void askPublishPermissions(final LoginCallback cb) { if (loginLock) { return; } loginLock = true; LoginManager login = LoginManager.getInstance(); final CallbackManager mCallbackManager = CallbackManager.Factory.create(); final CodenameOneActivity activity = (CodenameOneActivity) AndroidNativeUtil.getActivity(); activity.setIntentResultListener(new IntentResultListener() { @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { mCallbackManager.onActivityResult(requestCode, resultCode, data); activity.restoreIntentResultListener(); } }); login.registerCallback(mCallbackManager, new FBCallback(cb)); login.logInWithPublishPermissions(activity, PUBLISH_PERMISSIONS); } private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) { for (String string : subset) { if (!superset.contains(string)) { return false; } } return true; } /** * Returns true if the current session already has publish permissions * * @return */ public boolean hasPublishPermissions() { AccessToken fbToken = AccessToken.getCurrentAccessToken(); if (fbToken != null && !fbToken.isExpired()) { return fbToken.getPermissions().contains(PUBLISH_PERMISSIONS); } return false; } @Override public void inviteFriends(String appLinkUrl, String previewImageUrl) { inviteFriends(appLinkUrl, previewImageUrl, null); } @Override public void inviteFriends(String appLinkUrl, String previewImageUrl, final Callback cb) { if (AppInviteDialog.canShow()) { AppInviteContent content = new AppInviteContent.Builder() .setApplinkUrl(appLinkUrl) .setPreviewImageUrl(previewImageUrl) .build(); final CodenameOneActivity activity = (CodenameOneActivity) AndroidNativeUtil.getActivity(); if(cb == null){ AppInviteDialog.show(activity, content); }else{ AppInviteDialog appInviteDialog = new AppInviteDialog(activity); final CallbackManager mCallbackManager = CallbackManager.Factory.create(); activity.setIntentResultListener(new IntentResultListener() { @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { mCallbackManager.onActivityResult(requestCode, resultCode, data); activity.restoreIntentResultListener(); } }); appInviteDialog.registerCallback(mCallbackManager, new FacebookCallback<AppInviteDialog.Result>() { @Override public void onSuccess(AppInviteDialog.Result result) { Display.getInstance().callSerially(new Runnable() { @Override public void run() { cb.onSucess(null); } }); } @Override public void onCancel() { Display.getInstance().callSerially(new Runnable() { @Override public void run() { cb.onError(null, null, -1, "User Cancelled"); } }); } @Override public void onError(final FacebookException e) { Display.getInstance().callSerially(new Runnable() { @Override public void run() { cb.onError(null, e, 0, e.getMessage()); } }); } }); appInviteDialog.show(content); } } } @Override public boolean isInviteFriendsSupported() { return true; } class FBCallback implements FacebookCallback { private LoginCallback cb; public FBCallback(LoginCallback cb) { this.cb = cb; } @Override public void onSuccess(Object result) { cb.loginSuccessful(); loginLock = false; } @Override public void onCancel() { cb.loginFailed("User cancelled"); loginLock = false; } @Override public void onError(FacebookException fe) { cb.loginFailed(fe.getMessage()); loginLock = false; } } }
sannysanoff/CodenameOne
Ports/Android/src/com/codename1/social/FacebookImpl.java
Java
gpl-2.0
10,296
/* 2013 Measuring Broadband America Program Mobile Measurement Android Application Copyright (C) 2012 SamKnows Ltd. The FCC Measuring Broadband America (MBA) Program's Mobile Measurement Effort developed in cooperation with SamKnows Ltd. and diverse stakeholders employs an client-server based anonymized data collection approach to gather broadband performance data in an open and transparent manner with the highest commitment to protecting participants privacy. All data collected is thoroughly analyzed and processed prior to public release to ensure that subscribers’ privacy interests are protected. Data related to the radio characteristics of the handset, information about the handset type and operating system (OS) version, the GPS coordinates available from the handset at the time each test is run, the date and time of the observation, and the results of active test results are recorded on the handset in JSON(JavaScript Object Notation) nested data elements within flat files. These JSON files are then transmitted to storage servers at periodic intervals after the completion of active test measurements. This Android application source code is made available under the GNU GPL2 for testing purposes only and intended for participants in the SamKnows/FCC Measuring Broadband American program. It is not intended for general release and this repository may be disabled at any time. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package com.samknows.measurement.activity.components; import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter; import com.google.android.gms.maps.model.Marker; import com.samknows.measurement.R; import android.view.LayoutInflater; import android.view.View; import android.widget.TextView; public class MapPopup implements InfoWindowAdapter { LayoutInflater inflater=null; public MapPopup(LayoutInflater inflater) { this.inflater=inflater; } @Override public View getInfoWindow(Marker marker) { return(null); } @Override public View getInfoContents(Marker marker) { View popup=inflater.inflate(R.layout.map_popup, null); TextView tv=(TextView)popup.findViewById(R.id.title); tv.setText(marker.getTitle()); tv=(TextView)popup.findViewById(R.id.snippet); tv.setText(marker.getSnippet()); return(popup); } }
yositune/mobile-mba-androidapp
AndroidAppLibrary/src/com/samknows/measurement/activity/components/MapPopup.java
Java
gpl-2.0
3,036
# ruby-nxt Control Mindstorms NXT via Bluetooth Serial Port Connection # Copyright (C) 2006 Matt Zukowski <matt@roughest.net> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # require File.dirname(File.expand_path(__FILE__))+'/sensor' require File.dirname(File.expand_path(__FILE__))+'/../ultrasonic_comm' class UltrasonicSensor < Sensor INCHES_PER_CM = 0.3937008 def initialize(nxt, port = NXTComm::SENSOR_4) super(nxt, port) # The Ultrasonic sensor is digital and unlike the other sensors it # uses the lowspeed communication protocol. set_input_mode(NXTComm::LOWSPEED_9V, NXTComm::RAWMODE) # Read the sensor in case there was some garbage data in the buffer waiting to be read @nxt.ls_read(@port) # Set the sensor to continuously send pings @nxt.ls_write(@port, UltrasonicComm.continuous_measurement_command) end # Return the measured distance in the default units (the default units being centimeters). # A value of 255 is returned when the sensor cannot get an accurate reading (because # the object is out of range, or there is too much interference, etc.) # Note that the sensor's real-world range is at best 175 cm. At larger distances it # will almost certainly just return 255. def get_distance @nxt.ls_write(@port, UltrasonicComm.read_measurement_byte(0)) # Keep checking until we have 1 byte of data to read while @nxt.ls_get_status(@port)[0] < 1 sleep(0.1) @nxt.ls_write(@port, UltrasonicComm.read_measurement_byte(0)) # TODO: implement timeout so we don't get stuck if the expected data never comes end resp = @nxt.ls_read(@port) # TODO: probably need a better error message here... raise "ls_read returned more than one byte!" if resp[:bytes_read] > 1 raise "ls_read did not return any data!" if resp[:bytes_read] < 1 # If the sensor cannot determine the distance, it will return # 0xff (255)... this usually means that the object is out of # sensor range, but it can also mean that there is too much # interference or that the object is too close to the sensor. # I considered returning nil or false under such cases, but # this makes numeric comparison (i.e. greather than/less than) # more difficult d = resp[:data][0] end alias_method :get_distance_in_cm, :get_distance # Return the measured distance in inches. def get_distance_in_inches get_distance.to_f * INCHES_PER_CM end # Same as get_distance, but raises an UnmeasurableDistance # exception when the sensor cannot accurately determine # the distance. def get_distance! d = get_distance if d == 255 raise UnmeasurableDistance else return d end end alias_method :get_distance_in_cm!, :get_distance! def get_distance_in_inches! get_distance!.to_f * INCHES_PER_CM end # Exception thrown by get_distance! and related methods when # the sensor cannot determine the distance. class UnmeasurableDistance < Exception; end end
jaehess/ruby-nxt
lib/sensors/ultrasonic_sensor.rb
Ruby
gpl-2.0
3,630
/*global wc_country_select_params */ jQuery( function( $ ) { // wc_country_select_params is required to continue, ensure the object exists if ( typeof wc_country_select_params === 'undefined' ) { return false; } });
eantz/ShipID
assets/js/country-select.js
JavaScript
gpl-2.0
223
package sys.media; import gui.conference.ConfControl; import javax.sound.sampled.DataLine; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.TargetDataLine; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Mixer; import sys.flow.FlowManager; import sys.flow.FlowReceiver; import sys.flow.FlowSender; public class AudioManager extends Thread { /** * Flag for debugging messages. If true, some messages are dumped to the * console during operation. */ public static AudioManager thisInst; private static boolean DEBUG; private static final int DEFAULT_INTERNAL_BUFSIZ = 40960; private static final int DEFAULT_EXTERNAL_BUFSIZ = 40960; private TargetDataLine m_targetLine; private SourceDataLine m_sourceLine; public boolean running; private int m_nExternalBufferSize; /* * We have to pass an AudioFormat to describe in which * format the audio data should be recorded and played. */ public AudioManager(AudioFormat format, int nInternalBufferSize, int nExternalBufferSize, String strMixerName) throws LineUnavailableException { Mixer mixer = null; if (strMixerName != null) { Mixer.Info mixerInfo = AudioMixer.getMixerInfo(strMixerName); if (DEBUG) { out("AudioLoop.<init>(): mixer info: " + mixerInfo); } mixer = AudioSystem.getMixer(mixerInfo); if (DEBUG) { out("AudioLoop.<init>(): mixer: " + mixer); } } /* * We retrieve and open the recording and the playback line. */ DataLine.Info targetInfo = new DataLine.Info(TargetDataLine.class, format, nInternalBufferSize); DataLine.Info sourceInfo = new DataLine.Info(SourceDataLine.class, format, nInternalBufferSize); if (mixer != null) { m_targetLine = (TargetDataLine) mixer.getLine(targetInfo); m_sourceLine = (SourceDataLine) mixer.getLine(sourceInfo); } else { m_targetLine = (TargetDataLine) AudioSystem.getLine(targetInfo); m_sourceLine = (SourceDataLine) AudioSystem.getLine(sourceInfo); } if (DEBUG) { out("AudioLoop.<init>(): SourceDataLine: " + m_sourceLine); } if (DEBUG) { out("AudioLoop.<init>(): TargetDataLine: " + m_targetLine); } m_targetLine.open(format, nInternalBufferSize); m_sourceLine.open(format, nInternalBufferSize); m_nExternalBufferSize = nExternalBufferSize; } @Override public void start() { m_targetLine.start(); m_sourceLine.start(); // start thread super.start(); } public void stopTransmittingAndPlaying() { m_targetLine.stop(); m_targetLine.close(); m_sourceLine.stop(); m_sourceLine.close(); running = false; } public void run() { byte[] abBuffer = new byte[m_nExternalBufferSize]; int nBufferSize = abBuffer.length; running = true; while (running) { if (DEBUG) { out("Trying to read: " + nBufferSize); } /* * read a block of data from the recording line. */ int nBytesRead = m_targetLine.read(abBuffer, 0, nBufferSize); if (DEBUG) { out("Read: " + nBytesRead); } /* * And now, we write the block to the playback * line. */ FlowManager.fsInst.cutAndSend(abBuffer, FlowSender.AUDIO); byte[] data; if((data = FlowReceiver.sounds.poll()) != null) m_sourceLine.write(data, 0, nBytesRead); } } public static void startTransmittingAndPlaying() { String strMixerName = null; float fFrameRate = 8000.0F; int nInternalBufferSize = DEFAULT_INTERNAL_BUFSIZ; int nExternalBufferSize = DEFAULT_EXTERNAL_BUFSIZ; AudioFormat audioFormat = new AudioFormat(fFrameRate, 16, 1, true, true); if (DEBUG) { out("AudioLoop.main(): audio format: " + audioFormat); } AudioManager audioLoop = null; try { audioLoop = new AudioManager(audioFormat, 500, 500, strMixerName); } catch (LineUnavailableException e) { e.printStackTrace(); System.exit(1); } audioLoop.start(); thisInst = audioLoop; } private static void printUsageAndExit() { out("AudioLoop: usage:"); out("\tjava AudioLoop -h"); out("\tjava AudioLoop -l"); out("\tjava AudioLoop [-D] [-M <mixername>] [-e <buffersize>] [-i <buffersize>]"); System.exit(1); } private static void out(String strMessage) { System.out.println(strMessage); } } /*** AudioManager.java ***/
Exiliot/video-conference
ClientSystem/src/sys/media/AudioManager.java
Java
gpl-2.0
5,120
/* =========================================================================== Copyright (C) 2000 - 2013, Raven Software, Inc. Copyright (C) 2001 - 2013, Activision, Inc. Copyright (C) 2013 - 2015, OpenJK contributors This file is part of the OpenJK source code. OpenJK is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. =========================================================================== */ //NPC_stats.cpp #include "b_local.h" #include "b_public.h" #include "anims.h" #include "ghoul2/G2.h" extern qboolean NPCsPrecached; template< moduleType mod > qboolean WP_SaberParseParms( const char *SaberName, saberInfo_t *saber ); template<moduleType mod> void WP_RemoveSaber( saberInfo_t *sabers, int saberNum ); stringID_table_t TeamTable[] = { ENUM2STRING(NPCTEAM_FREE), // caution, some code checks a team_t via "if (!team_t_varname)" so I guess this should stay as entry 0, great or what? -slc ENUM2STRING(NPCTEAM_PLAYER), ENUM2STRING(NPCTEAM_ENEMY), ENUM2STRING(NPCTEAM_NEUTRAL), // most droids are team_neutral, there are some exceptions like Probe,Seeker,Interrogator {"", -1} }; // this list was made using the model directories, this MUST be in the same order as the CLASS_ enum in teams.h stringID_table_t ClassTable[] = { ENUM2STRING(CLASS_NONE), // hopefully this will never be used by an npc), just covering all bases ENUM2STRING(CLASS_ATST), // technically droid... ENUM2STRING(CLASS_BARTENDER), ENUM2STRING(CLASS_BESPIN_COP), ENUM2STRING(CLASS_CLAW), ENUM2STRING(CLASS_COMMANDO), ENUM2STRING(CLASS_DESANN), ENUM2STRING(CLASS_FISH), ENUM2STRING(CLASS_FLIER2), ENUM2STRING(CLASS_GALAK), ENUM2STRING(CLASS_GLIDER), ENUM2STRING(CLASS_GONK), // droid ENUM2STRING(CLASS_GRAN), ENUM2STRING(CLASS_HOWLER), // ENUM2STRING(CLASS_RANCOR), ENUM2STRING(CLASS_IMPERIAL), ENUM2STRING(CLASS_IMPWORKER), ENUM2STRING(CLASS_INTERROGATOR), // droid ENUM2STRING(CLASS_JAN), ENUM2STRING(CLASS_JEDI), ENUM2STRING(CLASS_KYLE), ENUM2STRING(CLASS_LANDO), ENUM2STRING(CLASS_LIZARD), ENUM2STRING(CLASS_LUKE), ENUM2STRING(CLASS_MARK1), // droid ENUM2STRING(CLASS_MARK2), // droid ENUM2STRING(CLASS_GALAKMECH), // droid ENUM2STRING(CLASS_MINEMONSTER), ENUM2STRING(CLASS_MONMOTHA), ENUM2STRING(CLASS_MORGANKATARN), ENUM2STRING(CLASS_MOUSE), // droid ENUM2STRING(CLASS_MURJJ), ENUM2STRING(CLASS_PRISONER), ENUM2STRING(CLASS_PROBE), // droid ENUM2STRING(CLASS_PROTOCOL), // droid ENUM2STRING(CLASS_R2D2), // droid ENUM2STRING(CLASS_R5D2), // droid ENUM2STRING(CLASS_REBEL), ENUM2STRING(CLASS_REBORN), ENUM2STRING(CLASS_REELO), ENUM2STRING(CLASS_REMOTE), ENUM2STRING(CLASS_RODIAN), ENUM2STRING(CLASS_SEEKER), // droid ENUM2STRING(CLASS_SENTRY), ENUM2STRING(CLASS_SHADOWTROOPER), ENUM2STRING(CLASS_STORMTROOPER), ENUM2STRING(CLASS_SWAMP), ENUM2STRING(CLASS_SWAMPTROOPER), ENUM2STRING(CLASS_TAVION), ENUM2STRING(CLASS_TRANDOSHAN), ENUM2STRING(CLASS_UGNAUGHT), ENUM2STRING(CLASS_JAWA), ENUM2STRING(CLASS_WEEQUAY), ENUM2STRING(CLASS_BOBAFETT), //ENUM2STRING(CLASS_ROCKETTROOPER), //ENUM2STRING(CLASS_PLAYER), ENUM2STRING(CLASS_VEHICLE), ENUM2STRING(CLASS_RANCOR), ENUM2STRING(CLASS_WAMPA), {"", -1} }; extern stringID_table_t BSTable[]; #define stringIDExpand(str, strEnum) {str, strEnum}, ENUM2STRING(strEnum) stringID_table_t BSETTable[] = { ENUM2STRING(BSET_SPAWN),//# script to use when first spawned ENUM2STRING(BSET_USE),//# script to use when used ENUM2STRING(BSET_AWAKE),//# script to use when awoken/startled ENUM2STRING(BSET_ANGER),//# script to use when aquire an enemy ENUM2STRING(BSET_ATTACK),//# script to run when you attack ENUM2STRING(BSET_VICTORY),//# script to run when you kill someone ENUM2STRING(BSET_LOSTENEMY),//# script to run when you can't find your enemy ENUM2STRING(BSET_PAIN),//# script to use when take pain ENUM2STRING(BSET_FLEE),//# script to use when take pain below 50% of health ENUM2STRING(BSET_DEATH),//# script to use when killed ENUM2STRING(BSET_DELAYED),//# script to run when self->delayScriptTime is reached ENUM2STRING(BSET_BLOCKED),//# script to run when blocked by a friendly NPC or player ENUM2STRING(BSET_BUMPED),//# script to run when bumped into a friendly NPC or player (can set bumpRadius) ENUM2STRING(BSET_STUCK),//# script to run when blocked by a wall ENUM2STRING(BSET_FFIRE),//# script to run when player shoots their own teammates ENUM2STRING(BSET_FFDEATH),//# script to run when player kills a teammate stringIDExpand("", BSET_INVALID), {"", -1}, }; extern stringID_table_t WPTable[]; extern stringID_table_t FPTable[]; char *TeamNames[TEAM_NUM_TEAMS] = { "", "player", "enemy", "neutral" }; // this list was made using the model directories, this MUST be in the same order as the CLASS_ enum in teams.h char *ClassNames[CLASS_NUM_CLASSES] = { "", // class none "atst", "bartender", "bespin_cop", "claw", "commando", "desann", "fish", "flier2", "galak", "glider", "gonk", "gran", "howler", "imperial", "impworker", "interrogator", "jan", "jedi", "kyle", "lando", "lizard", "luke", "mark1", "mark2", "galak_mech", "minemonster", "monmotha", "morgankatarn", "mouse", "murjj", "prisoner", "probe", "protocol", "r2d2", "r5d2", "rebel", "reborn", "reelo", "remote", "rodian", "seeker", "sentry", "shadowtrooper", "stormtrooper", "swamp", "swamptrooper", "tavion", "trandoshan", "ugnaught", "weequay", "bobafett", "vehicle", "rancor", "wampa", }; /* NPC_ReactionTime */ //FIXME use grandom in here int NPC_ReactionTime ( void ) { return 200 * ( 6 - NPCS.NPCInfo->stats.reactions ); } // // parse support routines // extern qboolean BG_ParseLiteral( const char **data, const char *string ); // // NPC parameters file : scripts/NPCs.cfg // #define MAX_NPC_DATA_SIZE 0x40000 char NPCParms[MAX_NPC_DATA_SIZE]; /* team_t TranslateTeamName( const char *name ) { int n; for ( n = (NPCTEAM_FREE + 1); n < NPCTEAM_NUM_TEAMS; n++ ) { if ( Q_stricmp( TeamNames[n], name ) == 0 ) { return ((team_t) n); } } return NPCTEAM_FREE; } class_t TranslateClassName( const char *name ) { int n; for ( n = (CLASS_NONE + 1); n < CLASS_NUM_CLASSES; n++ ) { if ( Q_stricmp( ClassNames[n], name ) == 0 ) { return ((class_t) n); } } return CLASS_NONE; // I hope this never happens, maybe print a warning } */ /* static rank_t TranslateRankName( const char *name ) Should be used to determine pip bolt-ons */ static rank_t TranslateRankName( const char *name ) { if ( !Q_stricmp( name, "civilian" ) ) { return RANK_CIVILIAN; } if ( !Q_stricmp( name, "crewman" ) ) { return RANK_CREWMAN; } if ( !Q_stricmp( name, "ensign" ) ) { return RANK_ENSIGN; } if ( !Q_stricmp( name, "ltjg" ) ) { return RANK_LT_JG; } if ( !Q_stricmp( name, "lt" ) ) { return RANK_LT; } if ( !Q_stricmp( name, "ltcomm" ) ) { return RANK_LT_COMM; } if ( !Q_stricmp( name, "commander" ) ) { return RANK_COMMANDER; } if ( !Q_stricmp( name, "captain" ) ) { return RANK_CAPTAIN; } return RANK_CIVILIAN; } extern saber_colors_t TranslateSaberColor( const char *name ); /* static int MethodNameToNumber( const char *name ) { if ( !Q_stricmp( name, "EXPONENTIAL" ) ) { return METHOD_EXPONENTIAL; } if ( !Q_stricmp( name, "LINEAR" ) ) { return METHOD_LINEAR; } if ( !Q_stricmp( name, "LOGRITHMIC" ) ) { return METHOD_LOGRITHMIC; } if ( !Q_stricmp( name, "ALWAYS" ) ) { return METHOD_ALWAYS; } if ( !Q_stricmp( name, "NEVER" ) ) { return METHOD_NEVER; } return -1; } static int ItemNameToNumber( const char *name, int itemType ) { // int n; for ( n = 0; n < bg_numItems; n++ ) { if ( bg_itemlist[n].type != itemType ) { continue; } if ( Q_stricmp( bg_itemlist[n].classname, name ) == 0 ) { return bg_itemlist[n].tag; } } return -1; } */ //rwwFIXMEFIXME: movetypes /* static int MoveTypeNameToEnum( const char *name ) { if(!Q_stricmp("runjump", name)) { return MT_RUNJUMP; } else if(!Q_stricmp("walk", name)) { return MT_WALK; } else if(!Q_stricmp("flyswim", name)) { return MT_FLYSWIM; } else if(!Q_stricmp("static", name)) { return MT_STATIC; } return MT_STATIC; } */ //#define CONVENIENT_ANIMATION_FILE_DEBUG_THING #ifdef CONVENIENT_ANIMATION_FILE_DEBUG_THING void SpewDebugStuffToFile(animation_t *anims) { char BGPAFtext[40000]; fileHandle_t f; int i = 0; g_trap->FS_Open("file_of_debug_stuff_SP.txt", &f, FS_WRITE); if (!f) { return; } BGPAFtext[0] = 0; while (i < MAX_ANIMATIONS) { strcat(BGPAFtext, va("%i %i\n", i, anims[i].frameLerp)); i++; } g_trap->FS_Write(BGPAFtext, strlen(BGPAFtext), f); g_trap->FS_Close(f); } #endif qboolean G_ParseAnimFileSet( const char *filename, const char *animCFG, int *animFileIndex ) { *animFileIndex = BG_ParseAnimationFile< moduleType::game >(filename, NULL, qfalse); //if it's humanoid we should have it cached and return it, if it is not it will be loaded (unless it's also cached already) if (*animFileIndex == -1) { return qfalse; } //I guess this isn't really even needed game-side. //BG_ParseAnimationSndFile(filename, *animFileIndex); return qtrue; } void NPC_PrecacheAnimationCFG( const char *NPC_type ) { #if 0 //rwwFIXMEFIXME: Actually precache stuff here. char filename[MAX_QPATH]; const char *token; const char *value; const char *p; int junk; if ( !Q_stricmp( "random", NPC_type ) ) {//sorry, can't precache a random just yet return; } p = NPCParms; COM_BeginParseSession(NPCFile); // look for the right NPC while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) return; if ( !Q_stricmp( token, NPC_type ) ) { break; } SkipBracedSection( &p, 0 ); } if ( !p ) { return; } if ( BG_ParseLiteral( &p, "{" ) ) { return; } // parse the NPC info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", NPC_type ); return; } if ( !Q_stricmp( token, "}" ) ) { break; } // legsmodel if ( !Q_stricmp( token, "legsmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } //must copy data out of this pointer into a different part of memory because the funcs we're about to call will call COM_ParseExt Q_strncpyz( filename, value, sizeof( filename ) ); G_ParseAnimFileSet( filename, filename, &junk ); return; } // playerModel if ( !Q_stricmp( token, "playerModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } /* char animName[MAX_QPATH]; char *GLAName; char *slash = NULL; char *strippedName; int handle = g_trap->G2API_PrecacheGhoul2Model( va( "models/players/%s/model.glm", value ) ); if ( handle > 0 )//FIXME: isn't 0 a valid handle? { GLAName = g_trap->G2API_GetAnimFileNameIndex( handle ); if ( GLAName ) { Q_strncpyz( animName, GLAName, sizeof( animName ), qtrue ); slash = strrchr( animName, '/' ); if ( slash ) { *slash = 0; } strippedName = COM_SkipPath( animName ); //must copy data out of this pointer into a different part of memory because the funcs we're about to call will call COM_ParseExt Q_strncpyz( filename, value, sizeof( filename ), qtrue ); G_ParseAnimFileSet( value, strippedName, &junk );//qfalse ); //FIXME: still not precaching the animsounds.cfg? return; } } */ //rwwFIXMEFIXME: Do this properly. } } #endif } extern int NPC_WeaponsForTeam( team_t team, int spawnflags, const char *NPC_type ); void NPC_PrecacheWeapons( team_t playerTeam, int spawnflags, char *NPCtype ) { int weapons = NPC_WeaponsForTeam( playerTeam, spawnflags, NPCtype ); int curWeap; for ( curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++ ) { if (weapons & (1 << curWeap)) { RegisterItem(BG_FindItemForWeapon((weapon_t)curWeap)); } } #if 0 //rwwFIXMEFIXME: actually precache weapons here int weapons = NPC_WeaponsForTeam( playerTeam, spawnflags, NPCtype ); gitem_t *item; for ( int curWeap = WP_SABER; curWeap < WP_NUM_WEAPONS; curWeap++ ) { if ( (weapons & ( 1 << curWeap )) ) { item = FindItemForWeapon( ((weapon_t)(curWeap)) ); //precache the weapon CG_RegisterItemSounds( (item-bg_itemlist) ); CG_RegisterItemVisuals( (item-bg_itemlist) ); //precache the in-hand/in-world ghoul2 weapon model char weaponModel[64]; strcpy (weaponModel, weaponData[curWeap].weaponMdl); if (char *spot = strstr(weaponModel, ".md3") ) { *spot = 0; spot = strstr(weaponModel, "_w");//i'm using the in view weapon array instead of scanning the item list, so put the _w back on if (!spot) { strcat (weaponModel, "_w"); } strcat (weaponModel, ".glm"); //and change to ghoul2 } g_trap->G2API_PrecacheGhoul2Model( weaponModel ); // correct way is item->world_model } } #endif } /* void NPC_Precache ( char *NPCName ) Precaches NPC skins, tgas and md3s. */ void NPC_Precache ( gentity_t *spawner ) { npcteam_t playerTeam = NPCTEAM_FREE; const char *token; const char *value; const char *p; char *patch; char sound[MAX_QPATH]; qboolean md3Model = qfalse; char playerModel[MAX_QPATH]; char customSkin[MAX_QPATH]; char sessionName[MAX_QPATH+15]; if ( !Q_stricmp( "random", spawner->NPC_type ) ) {//sorry, can't precache a random just yet return; } strcpy(customSkin,"default"); p = NPCParms; Com_sprintf( sessionName, sizeof(sessionName), "NPC_Precache(%s)", spawner->NPC_type ); COM_BeginParseSession(sessionName); // look for the right NPC while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) return; if ( !Q_stricmp( token, spawner->NPC_type ) ) { break; } SkipBracedSection( &p, 0 ); } if ( !p ) { return; } if ( BG_ParseLiteral( &p, "{" ) ) { return; } // parse the NPC info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", spawner->NPC_type ); return; } if ( !Q_stricmp( token, "}" ) ) { break; } // headmodel if ( !Q_stricmp( token, "headmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { } else { //Q_strncpyz( ri.headModelName, value, sizeof(ri.headModelName), qtrue); } md3Model = qtrue; continue; } // torsomodel if ( !Q_stricmp( token, "torsomodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { } else { //Q_strncpyz( ri.torsoModelName, value, sizeof(ri.torsoModelName), qtrue); } md3Model = qtrue; continue; } // legsmodel if ( !Q_stricmp( token, "legsmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } //Q_strncpyz( ri.legsModelName, value, sizeof(ri.legsModelName), qtrue); md3Model = qtrue; continue; } // playerModel if ( !Q_stricmp( token, "playerModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( playerModel, value, sizeof(playerModel)); md3Model = qfalse; continue; } // customSkin if ( !Q_stricmp( token, "customSkin" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( customSkin, value, sizeof(customSkin)); continue; } // playerTeam if ( !Q_stricmp( token, "playerTeam" ) ) { char tk[4096]; //rww - hackilicious! if ( COM_ParseString( &p, &value ) ) { continue; } //playerTeam = TranslateTeamName(value); Com_sprintf(tk, sizeof(tk), "NPC%s", token); playerTeam = static_cast< npcteam_t >( GetIDForString( TeamTable, tk ) ); continue; } // snd if ( !Q_stricmp( token, "snd" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->r.svFlags&SVF_NO_BASIC_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } spawner->s.csSounds_Std = G_SoundIndex( va("*$%s", sound) ); } continue; } // sndcombat if ( !Q_stricmp( token, "sndcombat" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->r.svFlags&SVF_NO_COMBAT_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } spawner->s.csSounds_Combat = G_SoundIndex( va("*$%s", sound) ); } continue; } // sndextra if ( !Q_stricmp( token, "sndextra" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->r.svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } spawner->s.csSounds_Extra = G_SoundIndex( va("*$%s", sound) ); } continue; } // sndjedi if ( !Q_stricmp( token, "sndjedi" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(spawner->r.svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } spawner->s.csSounds_Jedi = G_SoundIndex( va("*$%s", sound) ); } continue; } if (!Q_stricmp(token, "weapon")) { int curWeap; if (COM_ParseString(&p, &value)) { continue; } curWeap = GetIDForString( WPTable, value ); if (curWeap > WP_NONE && curWeap < WP_NUM_WEAPONS) { RegisterItem(BG_FindItemForWeapon((weapon_t)curWeap)); } continue; } } // If we're not a vehicle, then an error here would be valid... if ( !spawner->client || spawner->client->NPC_class != CLASS_VEHICLE ) { if ( md3Model ) { Com_Printf("MD3 model using NPCs are not supported in MP\n"); } else { //if we have a model/skin then index them so they'll be registered immediately //when the client gets a configstring update. char modelName[MAX_QPATH]; Com_sprintf(modelName, sizeof(modelName), "models/players/%s/model.glm", playerModel); if (customSkin[0]) { //append it after a * strcat( modelName, va("*%s", customSkin) ); } G_ModelIndex(modelName); } } //precache this NPC's possible weapons NPC_PrecacheWeapons( (team_t)playerTeam, spawner->spawnflags, spawner->NPC_type ); // CG_RegisterNPCCustomSounds( &ci ); // CG_RegisterNPCEffects( playerTeam ); //rwwFIXMEFIXME: same //FIXME: Look for a "sounds" directory and precache death, pain, alert sounds } #if 0 void NPC_BuildRandom( gentity_t *NPC ) { int sex, color, head; sex = Q_irand(0, 2); color = Q_irand(0, 2); switch( sex ) { case 0://female head = Q_irand(0, 2); switch( head ) { default: case 0: Q_strncpyz( NPC->client->renderInfo.headModelName, "garren", sizeof(NPC->client->renderInfo.headModelName), qtrue ); break; case 1: Q_strncpyz( NPC->client->renderInfo.headModelName, "garren/salma", sizeof(NPC->client->renderInfo.headModelName), qtrue ); break; case 2: Q_strncpyz( NPC->client->renderInfo.headModelName, "garren/mackey", sizeof(NPC->client->renderInfo.headModelName), qtrue ); color = Q_irand(3, 5);//torso needs to be afam break; } switch( color ) { default: case 0: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewfemale/gold", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; case 1: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewfemale", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; case 2: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewfemale/blue", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; case 3: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewfemale/aframG", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; case 4: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewfemale/aframR", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; case 5: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewfemale/aframB", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; } Q_strncpyz( NPC->client->renderInfo.legsModelName, "crewfemale", sizeof(NPC->client->renderInfo.legsModelName), qtrue ); break; default: case 1://male case 2://male head = Q_irand(0, 4); switch( head ) { default: case 0: Q_strncpyz( NPC->client->renderInfo.headModelName, "chakotay/nelson", sizeof(NPC->client->renderInfo.headModelName), qtrue ); break; case 1: Q_strncpyz( NPC->client->renderInfo.headModelName, "paris/chase", sizeof(NPC->client->renderInfo.headModelName), qtrue ); break; case 2: Q_strncpyz( NPC->client->renderInfo.headModelName, "doctor/pasty", sizeof(NPC->client->renderInfo.headModelName), qtrue ); break; case 3: Q_strncpyz( NPC->client->renderInfo.headModelName, "kim/durk", sizeof(NPC->client->renderInfo.headModelName), qtrue ); break; case 4: Q_strncpyz( NPC->client->renderInfo.headModelName, "paris/kray", sizeof(NPC->client->renderInfo.headModelName), qtrue ); break; } switch( color ) { default: case 0: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewthin/red", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; case 1: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewthin", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; case 2: Q_strncpyz( NPC->client->renderInfo.torsoModelName, "crewthin/blue", sizeof(NPC->client->renderInfo.torsoModelName), qtrue ); break; //NOTE: 3 - 5 should be red, gold & blue, afram hands } Q_strncpyz( NPC->client->renderInfo.legsModelName, "crewthin", sizeof(NPC->client->renderInfo.legsModelName), qtrue ); break; } NPC->s.modelScale[0] = NPC->s.modelScale[1] = NPC->s.modelScale[2] = Q_irand(87, 102)/100.0f; // NPC->client->race = RACE_HUMAN; NPC->NPC->rank = RANK_CREWMAN; NPC->client->playerTeam = NPC->s.teamowner = TEAM_PLAYER; NPC->client->clientInfo.customBasicSoundDir = "kyle";//FIXME: generic default? } #endif extern void SetupGameGhoul2Model(gentity_t *ent, char *modelname, char *skinName); qboolean NPC_ParseParms( const char *NPCName, gentity_t *NPC ) { const char *token; const char *value; const char *p; int n; float f; char *patch; char sound[MAX_QPATH]; char playerModel[MAX_QPATH]; char customSkin[MAX_QPATH]; char sessionName[MAX_QPATH+17]; renderInfo_t *ri = &NPC->client->renderInfo; gNPCstats_t *stats = NULL; qboolean md3Model = qtrue; char surfOff[1024]; char surfOn[1024]; qboolean parsingPlayer = qfalse; vec3_t playerMins; vec3_t playerMaxs; int npcSaber1 = 0; int npcSaber2 = 0; VectorSet(playerMins, -15, -15, DEFAULT_MINS_2); VectorSet(playerMaxs, 15, 15, DEFAULT_MAXS_2); strcpy(customSkin,"default"); if ( !NPCName || !NPCName[0]) { NPCName = "Player"; } if ( !NPC->s.number && NPC->client != NULL ) {//player, only want certain data parsingPlayer = qtrue; } if ( NPC->NPC ) { stats = &NPC->NPC->stats; /* NPC->NPC->allWeaponOrder[0] = WP_BRYAR_PISTOL; NPC->NPC->allWeaponOrder[1] = WP_SABER; NPC->NPC->allWeaponOrder[2] = WP_IMOD; NPC->NPC->allWeaponOrder[3] = WP_SCAVENGER_RIFLE; NPC->NPC->allWeaponOrder[4] = WP_TRICORDER; NPC->NPC->allWeaponOrder[6] = WP_NONE; NPC->NPC->allWeaponOrder[6] = WP_NONE; NPC->NPC->allWeaponOrder[7] = WP_NONE; */ // fill in defaults stats->aggression = 3; stats->aim = 3; stats->earshot = 1024; stats->evasion = 3; stats->hfov = 90; stats->intelligence = 3; stats->move = 3; stats->reactions = 3; stats->vfov = 60; stats->vigilance = 0.1f; stats->visrange = 1024; stats->health = 0; stats->yawSpeed = 90; stats->walkSpeed = 90; stats->runSpeed = 300; stats->acceleration = 15;//Increase/descrease speed this much per frame (20fps) } else { stats = NULL; } //Set defaults //FIXME: should probably put default torso and head models, but what about enemies //that don't have any- like Stasis? //Q_strncpyz( ri->headModelName, DEFAULT_HEADMODEL, sizeof(ri->headModelName), qtrue); //Q_strncpyz( ri->torsoModelName, DEFAULT_TORSOMODEL, sizeof(ri->torsoModelName), qtrue); //Q_strncpyz( ri->legsModelName, DEFAULT_LEGSMODEL, sizeof(ri->legsModelName), qtrue); //FIXME: should we have one for weapon too? memset( (char *)surfOff, 0, sizeof(surfOff) ); memset( (char *)surfOn, 0, sizeof(surfOn) ); /* ri->headYawRangeLeft = 50; ri->headYawRangeRight = 50; ri->headPitchRangeUp = 40; ri->headPitchRangeDown = 50; ri->torsoYawRangeLeft = 60; ri->torsoYawRangeRight = 60; ri->torsoPitchRangeUp = 30; ri->torsoPitchRangeDown = 70; */ ri->headYawRangeLeft = 80; ri->headYawRangeRight = 80; ri->headPitchRangeUp = 45; ri->headPitchRangeDown = 45; ri->torsoYawRangeLeft = 60; ri->torsoYawRangeRight = 60; ri->torsoPitchRangeUp = 30; ri->torsoPitchRangeDown = 50; VectorCopy(playerMins, NPC->r.mins); VectorCopy(playerMaxs, NPC->r.maxs); NPC->client->ps.crouchheight = CROUCH_MAXS_2; NPC->client->ps.standheight = DEFAULT_MAXS_2; //rwwFIXMEFIXME: ... /* NPC->client->moveType = MT_RUNJUMP; NPC->client->dismemberProbHead = 100; NPC->client->dismemberProbArms = 100; NPC->client->dismemberProbHands = 100; NPC->client->dismemberProbWaist = 100; NPC->client->dismemberProbLegs = 100; NPC->s.modelScale[0] = NPC->s.modelScale[1] = NPC->s.modelScale[2] = 1.0f; */ NPC->client->ps.customRGBA[0]=255; NPC->client->ps.customRGBA[1]=255; NPC->client->ps.customRGBA[2]=255; NPC->client->ps.customRGBA[3]=255; if ( !Q_stricmp( "random", NPCName ) ) {//Randomly assemble a starfleet guy //NPC_BuildRandom( NPC ); Com_Printf("RANDOM NPC NOT SUPPORTED IN MP\n"); return qfalse; } else { int fp; p = NPCParms; Com_sprintf( sessionName, sizeof(sessionName), "NPC_ParseParms(%s)", NPCName ); COM_BeginParseSession(sessionName); // look for the right NPC while ( p ) { token = COM_ParseExt( &p, qtrue ); if ( token[0] == 0 ) { return qfalse; } if ( !Q_stricmp( token, NPCName ) ) { break; } SkipBracedSection( &p, 0 ); } if ( !p ) { return qfalse; } if ( BG_ParseLiteral( &p, "{" ) ) { return qfalse; } // parse the NPC info block while ( 1 ) { token = COM_ParseExt( &p, qtrue ); if ( !token[0] ) { Com_Printf( S_COLOR_RED"ERROR: unexpected EOF while parsing '%s'\n", NPCName ); return qfalse; } if ( !Q_stricmp( token, "}" ) ) { break; } //===MODEL PROPERTIES=========================================================== // custom color if ( !Q_stricmp( token, "customRGBA" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !Q_stricmp( value, "random") ) { NPC->client->ps.customRGBA[0]=Q_irand(0,255); NPC->client->ps.customRGBA[1]=Q_irand(0,255); NPC->client->ps.customRGBA[2]=Q_irand(0,255); NPC->client->ps.customRGBA[3]=255; } else if ( !Q_stricmp( value, "random1" ) ) { NPC->client->ps.customRGBA[3] = 255; switch ( Q_irand( 0, 5 ) ) { default: case 0: NPC->client->ps.customRGBA[0] = 127; NPC->client->ps.customRGBA[1] = 153; NPC->client->ps.customRGBA[2] = 255; break; case 1: NPC->client->ps.customRGBA[0] = 177; NPC->client->ps.customRGBA[1] = 29; NPC->client->ps.customRGBA[2] = 13; break; case 2: NPC->client->ps.customRGBA[0] = 47; NPC->client->ps.customRGBA[1] = 90; NPC->client->ps.customRGBA[2] = 40; break; case 3: NPC->client->ps.customRGBA[0] = 181; NPC->client->ps.customRGBA[1] = 207; NPC->client->ps.customRGBA[2] = 255; break; case 4: NPC->client->ps.customRGBA[0] = 138; NPC->client->ps.customRGBA[1] = 83; NPC->client->ps.customRGBA[2] = 0; break; case 5: NPC->client->ps.customRGBA[0] = 254; NPC->client->ps.customRGBA[1] = 199; NPC->client->ps.customRGBA[2] = 14; break; } } else if ( !Q_stricmp( value, "jedi_hf" ) ) { NPC->client->ps.customRGBA[3] = 255; switch ( Q_irand( 0, 7 ) ) { default: case 0://red1 NPC->client->ps.customRGBA[0] = 165; NPC->client->ps.customRGBA[1] = 48; NPC->client->ps.customRGBA[2] = 21; break; case 1://yellow1 NPC->client->ps.customRGBA[0] = 254; NPC->client->ps.customRGBA[1] = 230; NPC->client->ps.customRGBA[2] = 132; break; case 2://bluegray NPC->client->ps.customRGBA[0] = 181; NPC->client->ps.customRGBA[1] = 207; NPC->client->ps.customRGBA[2] = 255; break; case 3://pink NPC->client->ps.customRGBA[0] = 233; NPC->client->ps.customRGBA[1] = 183; NPC->client->ps.customRGBA[2] = 208; break; case 4://lt blue NPC->client->ps.customRGBA[0] = 161; NPC->client->ps.customRGBA[1] = 226; NPC->client->ps.customRGBA[2] = 240; break; case 5://blue NPC->client->ps.customRGBA[0] = 101; NPC->client->ps.customRGBA[1] = 159; NPC->client->ps.customRGBA[2] = 255; break; case 6://orange NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 157; NPC->client->ps.customRGBA[2] = 114; break; case 7://violet NPC->client->ps.customRGBA[0] = 216; NPC->client->ps.customRGBA[1] = 160; NPC->client->ps.customRGBA[2] = 255; break; } } else if ( !Q_stricmp( value, "jedi_hm" ) ) { NPC->client->ps.customRGBA[3] = 255; switch ( Q_irand( 0, 7 ) ) { default: case 0://yellow NPC->client->ps.customRGBA[0] = 252; NPC->client->ps.customRGBA[1] = 243; NPC->client->ps.customRGBA[2] = 180; break; case 1://blue NPC->client->ps.customRGBA[0] = 69; NPC->client->ps.customRGBA[1] = 109; NPC->client->ps.customRGBA[2] = 255; break; case 2://gold NPC->client->ps.customRGBA[0] = 254; NPC->client->ps.customRGBA[1] = 197; NPC->client->ps.customRGBA[2] = 73; break; case 3://orange NPC->client->ps.customRGBA[0] = 178; NPC->client->ps.customRGBA[1] = 78; NPC->client->ps.customRGBA[2] = 18; break; case 4://bluegreen NPC->client->ps.customRGBA[0] = 112; NPC->client->ps.customRGBA[1] = 153; NPC->client->ps.customRGBA[2] = 161; break; case 5://blue2 NPC->client->ps.customRGBA[0] = 123; NPC->client->ps.customRGBA[1] = 182; NPC->client->ps.customRGBA[2] = 255; break; case 6://green2 NPC->client->ps.customRGBA[0] = 0; NPC->client->ps.customRGBA[1] = 88; NPC->client->ps.customRGBA[2] = 105; break; case 7://violet NPC->client->ps.customRGBA[0] = 138; NPC->client->ps.customRGBA[1] = 0; NPC->client->ps.customRGBA[2] = 0; break; } } else if ( !Q_stricmp( value, "jedi_kdm" ) ) { NPC->client->ps.customRGBA[3] = 255; switch ( Q_irand( 0, 8 ) ) { default: case 0://blue NPC->client->ps.customRGBA[0] = 85; NPC->client->ps.customRGBA[1] = 120; NPC->client->ps.customRGBA[2] = 255; break; case 1://violet NPC->client->ps.customRGBA[0] = 173; NPC->client->ps.customRGBA[1] = 142; NPC->client->ps.customRGBA[2] = 219; break; case 2://brown1 NPC->client->ps.customRGBA[0] = 254; NPC->client->ps.customRGBA[1] = 197; NPC->client->ps.customRGBA[2] = 73; break; case 3://orange NPC->client->ps.customRGBA[0] = 138; NPC->client->ps.customRGBA[1] = 83; NPC->client->ps.customRGBA[2] = 0; break; case 4://gold NPC->client->ps.customRGBA[0] = 254; NPC->client->ps.customRGBA[1] = 199; NPC->client->ps.customRGBA[2] = 14; break; case 5://blue2 NPC->client->ps.customRGBA[0] = 68; NPC->client->ps.customRGBA[1] = 194; NPC->client->ps.customRGBA[2] = 217; break; case 6://red1 NPC->client->ps.customRGBA[0] = 170; NPC->client->ps.customRGBA[1] = 3; NPC->client->ps.customRGBA[2] = 30; break; case 7://yellow1 NPC->client->ps.customRGBA[0] = 225; NPC->client->ps.customRGBA[1] = 226; NPC->client->ps.customRGBA[2] = 144; break; case 8://violet2 NPC->client->ps.customRGBA[0] = 167; NPC->client->ps.customRGBA[1] = 202; NPC->client->ps.customRGBA[2] = 255; break; } } else if ( !Q_stricmp( value, "jedi_rm" ) ) { NPC->client->ps.customRGBA[3] = 255; switch ( Q_irand( 0, 8 ) ) { default: case 0://blue NPC->client->ps.customRGBA[0] = 127; NPC->client->ps.customRGBA[1] = 153; NPC->client->ps.customRGBA[2] = 255; break; case 1://green1 NPC->client->ps.customRGBA[0] = 208; NPC->client->ps.customRGBA[1] = 249; NPC->client->ps.customRGBA[2] = 85; break; case 2://blue2 NPC->client->ps.customRGBA[0] = 181; NPC->client->ps.customRGBA[1] = 207; NPC->client->ps.customRGBA[2] = 255; break; case 3://gold NPC->client->ps.customRGBA[0] = 138; NPC->client->ps.customRGBA[1] = 83; NPC->client->ps.customRGBA[2] = 0; break; case 4://gold NPC->client->ps.customRGBA[0] = 224; NPC->client->ps.customRGBA[1] = 171; NPC->client->ps.customRGBA[2] = 44; break; case 5://green2 NPC->client->ps.customRGBA[0] = 49; NPC->client->ps.customRGBA[1] = 155; NPC->client->ps.customRGBA[2] = 131; break; case 6://red1 NPC->client->ps.customRGBA[0] = 163; NPC->client->ps.customRGBA[1] = 79; NPC->client->ps.customRGBA[2] = 17; break; case 7://violet2 NPC->client->ps.customRGBA[0] = 148; NPC->client->ps.customRGBA[1] = 104; NPC->client->ps.customRGBA[2] = 228; break; case 8://green3 NPC->client->ps.customRGBA[0] = 138; NPC->client->ps.customRGBA[1] = 136; NPC->client->ps.customRGBA[2] = 0; break; } } else if ( !Q_stricmp( value, "jedi_tf" ) ) { NPC->client->ps.customRGBA[3] = 255; switch ( Q_irand( 0, 5 ) ) { default: case 0://green1 NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 235; NPC->client->ps.customRGBA[2] = 100; break; case 1://blue1 NPC->client->ps.customRGBA[0] = 62; NPC->client->ps.customRGBA[1] = 155; NPC->client->ps.customRGBA[2] = 255; break; case 2://red1 NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 110; NPC->client->ps.customRGBA[2] = 120; break; case 3://purple NPC->client->ps.customRGBA[0] = 180; NPC->client->ps.customRGBA[1] = 150; NPC->client->ps.customRGBA[2] = 255; break; case 4://flesh NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 200; NPC->client->ps.customRGBA[2] = 212; break; case 5://base NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 255; NPC->client->ps.customRGBA[2] = 255; break; } } else if ( !Q_stricmp( value, "jedi_zf" ) ) { NPC->client->ps.customRGBA[3] = 255; switch ( Q_irand( 0, 7 ) ) { default: case 0://red1 NPC->client->ps.customRGBA[0] = 204; NPC->client->ps.customRGBA[1] = 19; NPC->client->ps.customRGBA[2] = 21; break; case 1://orange1 NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 107; NPC->client->ps.customRGBA[2] = 40; break; case 2://pink1 NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 148; NPC->client->ps.customRGBA[2] = 155; break; case 3://gold NPC->client->ps.customRGBA[0] = 255; NPC->client->ps.customRGBA[1] = 164; NPC->client->ps.customRGBA[2] = 59; break; case 4://violet1 NPC->client->ps.customRGBA[0] = 216; NPC->client->ps.customRGBA[1] = 160; NPC->client->ps.customRGBA[2] = 255; break; case 5://blue1 NPC->client->ps.customRGBA[0] = 101; NPC->client->ps.customRGBA[1] = 159; NPC->client->ps.customRGBA[2] = 255; break; case 6://blue2 NPC->client->ps.customRGBA[0] = 161; NPC->client->ps.customRGBA[1] = 226; NPC->client->ps.customRGBA[2] = 240; break; case 7://blue3 NPC->client->ps.customRGBA[0] = 37; NPC->client->ps.customRGBA[1] = 155; NPC->client->ps.customRGBA[2] = 181; break; } } else { NPC->client->ps.customRGBA[0]=atoi(value); if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->client->ps.customRGBA[1]=n; if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->client->ps.customRGBA[2]=n; if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->client->ps.customRGBA[3]=n; } continue; } // headmodel if ( !Q_stricmp( token, "headmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { //Zero the head clamp range so the torso & legs don't lag behind ri->headYawRangeLeft = ri->headYawRangeRight = ri->headPitchRangeUp = ri->headPitchRangeDown = 0; } continue; } // torsomodel if ( !Q_stricmp( token, "torsomodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if(!Q_stricmp("none", value)) { //Zero the torso clamp range so the legs don't lag behind ri->torsoYawRangeLeft = ri->torsoYawRangeRight = ri->torsoPitchRangeUp = ri->torsoPitchRangeDown = 0; } continue; } // legsmodel if ( !Q_stricmp( token, "legsmodel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } /* Q_strncpyz( ri->legsModelName, value, sizeof(ri->legsModelName), qtrue); //Need to do this here to get the right index G_ParseAnimFileSet( ri->legsModelName, ri->legsModelName, &ci->animFileIndex ); */ continue; } // playerModel if ( !Q_stricmp( token, "playerModel" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( playerModel, value, sizeof(playerModel)); md3Model = qfalse; continue; } // customSkin if ( !Q_stricmp( token, "customSkin" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } Q_strncpyz( customSkin, value, sizeof(customSkin)); continue; } // surfOff if ( !Q_stricmp( token, "surfOff" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( surfOff[0] ) { Q_strcat( (char *)surfOff, sizeof(surfOff), "," ); Q_strcat( (char *)surfOff, sizeof(surfOff), value ); } else { Q_strncpyz( surfOff, value, sizeof(surfOff)); } continue; } // surfOn if ( !Q_stricmp( token, "surfOn" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( surfOn[0] ) { Q_strcat( (char *)surfOn, sizeof(surfOn), "," ); Q_strcat( (char *)surfOn, sizeof(surfOn), value ); } else { Q_strncpyz( surfOn, value, sizeof(surfOn)); } continue; } //headYawRangeLeft if ( !Q_stricmp( token, "headYawRangeLeft" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headYawRangeLeft = n; continue; } //headYawRangeRight if ( !Q_stricmp( token, "headYawRangeRight" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headYawRangeRight = n; continue; } //headPitchRangeUp if ( !Q_stricmp( token, "headPitchRangeUp" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headPitchRangeUp = n; continue; } //headPitchRangeDown if ( !Q_stricmp( token, "headPitchRangeDown" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->headPitchRangeDown = n; continue; } //torsoYawRangeLeft if ( !Q_stricmp( token, "torsoYawRangeLeft" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoYawRangeLeft = n; continue; } //torsoYawRangeRight if ( !Q_stricmp( token, "torsoYawRangeRight" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoYawRangeRight = n; continue; } //torsoPitchRangeUp if ( !Q_stricmp( token, "torsoPitchRangeUp" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoPitchRangeUp = n; continue; } //torsoPitchRangeDown if ( !Q_stricmp( token, "torsoPitchRangeDown" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } ri->torsoPitchRangeDown = n; continue; } // Uniform XYZ scale if ( !Q_stricmp( token, "scale" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { NPC->client->ps.iModelScale = n; //so the client knows if (n >= 1024) { Com_Printf("WARNING: MP does not support scaling up to or over 1024%\n"); n = 1023; } NPC->modelScale[0] = NPC->modelScale[1] = NPC->modelScale[2] = n/100.0f; } continue; } //X scale if ( !Q_stricmp( token, "scaleX" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { Com_Printf("MP doesn't support xyz scaling, use 'scale'.\n"); //NPC->s.modelScale[0] = n/100.0f; } continue; } //Y scale if ( !Q_stricmp( token, "scaleY" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { Com_Printf("MP doesn't support xyz scaling, use 'scale'.\n"); //NPC->s.modelScale[1] = n/100.0f; } continue; } //Z scale if ( !Q_stricmp( token, "scaleZ" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if (n != 100) { Com_Printf("MP doesn't support xyz scaling, use 'scale'.\n"); // NPC->s.modelScale[2] = n/100.0f; } continue; } //===AI STATS===================================================================== if ( !parsingPlayer ) { // aggression if ( !Q_stricmp( token, "aggression" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->aggression = n; } continue; } // aim if ( !Q_stricmp( token, "aim" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->aim = n; } continue; } // earshot if ( !Q_stricmp( token, "earshot" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->earshot = f; } continue; } // evasion if ( !Q_stricmp( token, "evasion" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->evasion = n; } continue; } // hfov if ( !Q_stricmp( token, "hfov" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 30 || n > 180 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->hfov = n;// / 2; //FIXME: Why was this being done?! } continue; } // intelligence if ( !Q_stricmp( token, "intelligence" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->intelligence = n; } continue; } // move if ( !Q_stricmp( token, "move" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->move = n; } continue; } // reactions if ( !Q_stricmp( token, "reactions" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 1 || n > 5 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->reactions = n; } continue; } // shootDistance if ( !Q_stricmp( token, "shootDistance" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->shootDistance = f; } continue; } // vfov if ( !Q_stricmp( token, "vfov" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 30 || n > 180 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->vfov = n / 2; } continue; } // vigilance if ( !Q_stricmp( token, "vigilance" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->vigilance = f; } continue; } // visrange if ( !Q_stricmp( token, "visrange" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } if ( f < 0.0f ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->visrange = f; } continue; } // race // if ( !Q_stricmp( token, "race" ) ) // { // if ( COM_ParseString( &p, &value ) ) // { // continue; // } // NPC->client->race = TranslateRaceName(value); // continue; // } // rank if ( !Q_stricmp( token, "rank" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->NPC ) { NPC->NPC->rank = TranslateRankName(value); } continue; } } // health if ( !Q_stricmp( token, "health" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->health = n; } else if ( parsingPlayer ) { NPC->client->ps.stats[STAT_MAX_HEALTH] = NPC->client->pers.maxHealth = n; } continue; } // fullName if ( !Q_stricmp( token, "fullName" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } NPC->fullName = G_NewString(value); continue; } // playerTeam if ( !Q_stricmp( token, "playerTeam" ) ) { char tk[4096]; //rww - hackilicious! if ( COM_ParseString( &p, &value ) ) { continue; } Com_sprintf(tk, sizeof(tk), "NPC%s", token); NPC->s.teamowner = NPC->client->playerTeam = static_cast< npcteam_t >( GetIDForString( TeamTable, tk ) );//TranslateTeamName(value); continue; } // enemyTeam if ( !Q_stricmp( token, "enemyTeam" ) ) { char tk[4096]; //rww - hackilicious! if ( COM_ParseString( &p, &value ) ) { continue; } Com_sprintf(tk, sizeof(tk), "NPC%s", token); NPC->client->enemyTeam = static_cast< npcteam_t >( GetIDForString( TeamTable, tk ) );//TranslateTeamName(value); continue; } // class if ( !Q_stricmp( token, "class" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } NPC->client->NPC_class = (class_t)GetIDForString( ClassTable, value ); NPC->s.NPC_class = NPC->client->NPC_class; //we actually only need this value now, but at the moment I don't feel like changing the 200+ references to client->NPC_class. // No md3's for vehicles. if ( NPC->client->NPC_class == CLASS_VEHICLE ) { if ( !NPC->m_pVehicle ) {//you didn't spawn this guy right! Com_Printf ( S_COLOR_RED "ERROR: Tried to spawn a vehicle NPC (%s) without using NPC_Vehicle or 'NPC spawn vehicle <vehiclename>'!!! Bad, bad, bad! Shame on you!\n", NPCName ); return qfalse; } md3Model = qfalse; } continue; } // dismemberment probability for head if ( !Q_stricmp( token, "dismemberProbHead" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { // NPC->client->dismemberProbHead = n; //rwwFIXMEFIXME: support for this? } continue; } // dismemberment probability for arms if ( !Q_stricmp( token, "dismemberProbArms" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { // NPC->client->dismemberProbArms = n; } continue; } // dismemberment probability for hands if ( !Q_stricmp( token, "dismemberProbHands" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { // NPC->client->dismemberProbHands = n; } continue; } // dismemberment probability for waist if ( !Q_stricmp( token, "dismemberProbWaist" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { // NPC->client->dismemberProbWaist = n; } continue; } // dismemberment probability for legs if ( !Q_stricmp( token, "dismemberProbLegs" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { // NPC->client->dismemberProbLegs = n; } continue; } //===MOVEMENT STATS============================================================ if ( !Q_stricmp( token, "width" ) ) { if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->r.mins[0] = NPC->r.mins[1] = -n; NPC->r.maxs[0] = NPC->r.maxs[1] = n; continue; } if ( !Q_stricmp( token, "height" ) ) { if ( COM_ParseInt( &p, &n ) ) { continue; } if ( NPC->client->NPC_class == CLASS_VEHICLE && NPC->m_pVehicle && NPC->m_pVehicle->m_pVehicleInfo && NPC->m_pVehicle->m_pVehicleInfo->type == VH_FIGHTER ) {//a flying vehicle's origin must be centered in bbox and it should spawn on the ground //trace_t tr; //vec3_t bottom; //float adjust = 32.0f; NPC->r.maxs[2] = NPC->client->ps.standheight = (n/2.0f); NPC->r.mins[2] = -NPC->r.maxs[2]; NPC->s.origin[2] += (DEFAULT_MINS_2-NPC->r.mins[2])+0.125f; VectorCopy(NPC->s.origin, NPC->client->ps.origin); VectorCopy(NPC->s.origin, NPC->r.currentOrigin); G_SetOrigin( NPC, NPC->s.origin ); g_trap->LinkEntity((sharedEntity_t *)NPC); //now trace down /* VectorCopy( NPC->s.origin, bottom ); bottom[2] -= adjust; g_trap->Trace( &tr, NPC->s.origin, NPC->r.mins, NPC->r.maxs, bottom, NPC->s.number, MASK_NPCSOLID ); if ( !tr.allsolid && !tr.startsolid ) { G_SetOrigin( NPC, tr.endpos ); g_trap->LinkEntity((sharedEntity_t *)NPC); } */ } else { NPC->r.mins[2] = DEFAULT_MINS_2;//Cannot change NPC->r.maxs[2] = NPC->client->ps.standheight = n + DEFAULT_MINS_2; } NPC->radius = n; continue; } if ( !Q_stricmp( token, "crouchheight" ) ) { if ( COM_ParseInt( &p, &n ) ) { continue; } NPC->client->ps.crouchheight = n + DEFAULT_MINS_2; continue; } if ( !parsingPlayer ) { if ( !Q_stricmp( token, "movetype" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( Q_stricmp( "flyswim", value ) == 0 ) { NPC->client->ps.eFlags2 |= EF2_FLYING; } //NPC->client->moveType = (movetype_t)MoveTypeNameToEnum(value); //rwwFIXMEFIXME: support for movetypes continue; } // yawSpeed if ( !Q_stricmp( token, "yawSpeed" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n <= 0) { Com_Printf( "bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->yawSpeed = ((float)(n)); } continue; } // walkSpeed if ( !Q_stricmp( token, "walkSpeed" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->walkSpeed = n; } continue; } //runSpeed if ( !Q_stricmp( token, "runSpeed" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->runSpeed = n; } continue; } //acceleration if ( !Q_stricmp( token, "acceleration" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < 0 ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { stats->acceleration = n; } continue; } //sex - skip in MP if ( !Q_stricmp( token, "sex" ) ) { SkipRestOfLine( &p ); continue; } //===MISC=============================================================================== // default behavior if ( !Q_stricmp( token, "behavior" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( n < BS_DEFAULT || n >= NUM_BSTATES ) { Com_Printf( S_COLOR_YELLOW"WARNING: bad %s in NPC '%s'\n", token, NPCName ); continue; } if ( NPC->NPC ) { NPC->NPC->defaultBehavior = (bState_t)(n); } continue; } } // snd if ( !Q_stricmp( token, "snd" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->r.svFlags&SVF_NO_BASIC_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } // ci->customBasicSoundDir = G_NewString( sound ); //rwwFIXMEFIXME: Hooray for violating client server rules } continue; } // sndcombat if ( !Q_stricmp( token, "sndcombat" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->r.svFlags&SVF_NO_COMBAT_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } // ci->customCombatSoundDir = G_NewString( sound ); } continue; } // sndextra if ( !Q_stricmp( token, "sndextra" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->r.svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } // ci->customExtraSoundDir = G_NewString( sound ); } continue; } // sndjedi if ( !Q_stricmp( token, "sndjedi" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->r.svFlags&SVF_NO_EXTRA_SOUNDS) ) { //FIXME: store this in some sound field or parse in the soundTable like the animTable... Q_strncpyz( sound, value, sizeof( sound ) ); patch = strstr( sound, "/" ); if ( patch ) { *patch = 0; } //ci->customJediSoundDir = G_NewString( sound ); } continue; } //New NPC/jedi stats: //starting weapon if ( !Q_stricmp( token, "weapon" ) ) { int weap; if ( COM_ParseString( &p, &value ) ) { continue; } //FIXME: need to precache the weapon, too? (in above func) weap = GetIDForString( WPTable, value ); if ( weap >= WP_NONE && weap <= WP_NUM_WEAPONS )///*WP_BLASTER_PISTOL*/WP_SABER ) //?! { NPC->client->ps.weapon = weap; NPC->client->ps.stats[STAT_WEAPONS] |= ( 1 << NPC->client->ps.weapon ); if ( weap > WP_NONE ) { // RegisterItem( FindItemForWeapon( (weapon_t)(NPC->client->ps.weapon) ) ); //precache the weapon NPC->client->ps.ammo[weaponData[NPC->client->ps.weapon].ammoIndex] = 100;//FIXME: max ammo! } } continue; } if ( !parsingPlayer ) { //altFire if ( !Q_stricmp( token, "altFire" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } if ( NPC->NPC ) { if ( n != 0 ) { NPC->NPC->scriptFlags |= SCF_ALT_FIRE; } } continue; } //Other unique behaviors/numbers that are currently hardcoded? } //force powers fp = GetIDForString( FPTable, token ); if ( fp >= FP_FIRST && fp < NUM_FORCE_POWERS ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } //FIXME: need to precache the fx, too? (in above func) //cap if ( n > 5 ) { n = 5; } else if ( n < 0 ) { n = 0; } if ( n ) {//set NPC->client->ps.fd.forcePowersKnown |= ( 1 << fp ); } else {//clear NPC->client->ps.fd.forcePowersKnown &= ~( 1 << fp ); } NPC->client->ps.fd.forcePowerLevel[fp] = n; continue; } //max force power if ( !Q_stricmp( token, "forcePowerMax" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } NPC->client->ps.fd.forcePowerMax = n; continue; } //force regen rate - default is 100ms if ( !Q_stricmp( token, "forceRegenRate" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } //NPC->client->ps.forcePowerRegenRate = n; //rwwFIXMEFIXME: support this? continue; } //force regen amount - default is 1 (points per second) if ( !Q_stricmp( token, "forceRegenAmount" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } //NPC->client->ps.forcePowerRegenAmount = n; //rwwFIXMEFIXME: support this? continue; } //have a sabers.cfg and just name your saber in your NPCs.cfg/ICARUS script //saber name if ( !Q_stricmp( token, "saber" ) ) { char *saberName; if ( COM_ParseString( &p, &value ) ) { continue; } saberName = (char *)BG_TempAlloc< moduleType::game >(4096);//G_NewString( value ); strcpy(saberName, value); WP_SaberParseParms< moduleType::game >( saberName, &NPC->client->saber[0] ); npcSaber1 = G_ModelIndex(va("@%s", saberName)); BG_TempFree< moduleType::game >(4096); continue; } //second saber name if ( !Q_stricmp( token, "saber2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( !(NPC->client->saber[0].saberFlags&SFL_TWO_HANDED) ) {//can't use a second saber if first one is a two-handed saber...? char *saberName = (char *)BG_TempAlloc< moduleType::game >(4096);//G_NewString( value ); strcpy(saberName, value); WP_SaberParseParms< moduleType::game >( saberName, &NPC->client->saber[1] ); if ( (NPC->client->saber[1].saberFlags&SFL_TWO_HANDED) ) {//tsk tsk, can't use a twoHanded saber as second saber WP_RemoveSaber< moduleType::game >( NPC->client->saber, 1 ); } else { //NPC->client->ps.dualSabers = qtrue; npcSaber2 = G_ModelIndex(va("@%s", saberName)); } BG_TempFree< moduleType::game >(4096); } continue; } // saberColor if ( !Q_stricmp( token, "saberColor" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { saber_colors_t color = TranslateSaberColor( value ); for ( n = 0; n < MAX_BLADES; n++ ) { NPC->client->saber[0].blade[n].color = color; NPC->s.boltToPlayer = NPC->s.boltToPlayer & 0x38;//(111000) NPC->s.boltToPlayer += (color + 1); } } continue; } if ( !Q_stricmp( token, "saberColor2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[0].blade[1].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saberColor3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[0].blade[2].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saberColor4" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[0].blade[3].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saberColor5" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[0].blade[4].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saberColor6" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[0].blade[5].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saberColor7" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[0].blade[6].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saberColor8" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[0].blade[7].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saber2Color" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { saber_colors_t color = TranslateSaberColor( value ); for ( n = 0; n < MAX_BLADES; n++ ) { NPC->client->saber[1].blade[n].color = color; NPC->s.boltToPlayer = NPC->s.boltToPlayer & 0x7;//(000111) NPC->s.boltToPlayer += ((color + 1) << 3); } } continue; } if ( !Q_stricmp( token, "saber2Color2" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[1].blade[1].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saber2Color3" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[1].blade[2].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saber2Color4" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[1].blade[3].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saber2Color5" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[1].blade[4].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saber2Color6" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[1].blade[5].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saber2Color7" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[1].blade[6].color = TranslateSaberColor( value ); } continue; } if ( !Q_stricmp( token, "saber2Color8" ) ) { if ( COM_ParseString( &p, &value ) ) { continue; } if ( NPC->client ) { NPC->client->saber[1].blade[7].color = TranslateSaberColor( value ); } continue; } //saber length if ( !Q_stricmp( token, "saberLength" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } for ( n = 0; n < MAX_BLADES; n++ ) { NPC->client->saber[0].blade[n].lengthMax = f; } continue; } if ( !Q_stricmp( token, "saberLength2" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[0].blade[1].lengthMax = f; continue; } if ( !Q_stricmp( token, "saberLength3" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[0].blade[2].lengthMax = f; continue; } if ( !Q_stricmp( token, "saberLength4" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[0].blade[3].lengthMax = f; continue; } if ( !Q_stricmp( token, "saberLength5" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[0].blade[4].lengthMax = f; continue; } if ( !Q_stricmp( token, "saberLength6" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[0].blade[5].lengthMax = f; continue; } if ( !Q_stricmp( token, "saberLength7" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[0].blade[6].lengthMax = f; continue; } if ( !Q_stricmp( token, "saberLength8" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[0].blade[7].lengthMax = f; continue; } if ( !Q_stricmp( token, "saber2Length" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } for ( n = 0; n < MAX_BLADES; n++ ) { NPC->client->saber[1].blade[n].lengthMax = f; } continue; } if ( !Q_stricmp( token, "saber2Length2" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[1].blade[1].lengthMax = f; continue; } if ( !Q_stricmp( token, "saber2Length3" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[1].blade[2].lengthMax = f; continue; } if ( !Q_stricmp( token, "saber2Length4" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[1].blade[3].lengthMax = f; continue; } if ( !Q_stricmp( token, "saber2Length5" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[1].blade[4].lengthMax = f; continue; } if ( !Q_stricmp( token, "saber2Length6" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[1].blade[5].lengthMax = f; continue; } if ( !Q_stricmp( token, "saber2Length7" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[1].blade[6].lengthMax = f; continue; } if ( !Q_stricmp( token, "saber2Length8" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 4.0f ) { f = 4.0f; } NPC->client->saber[1].blade[7].lengthMax = f; continue; } //saber radius if ( !Q_stricmp( token, "saberRadius" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } for ( n = 0; n < MAX_BLADES; n++ ) { NPC->client->saber[0].blade[n].radius = f; } continue; } if ( !Q_stricmp( token, "saberRadius2" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[0].blade[1].radius = f; continue; } if ( !Q_stricmp( token, "saberRadius3" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[0].blade[2].radius = f; continue; } if ( !Q_stricmp( token, "saberRadius4" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[0].blade[3].radius = f; continue; } if ( !Q_stricmp( token, "saberRadius5" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[0].blade[4].radius = f; continue; } if ( !Q_stricmp( token, "saberRadius6" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[0].blade[5].radius = f; continue; } if ( !Q_stricmp( token, "saberRadius7" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[0].blade[6].radius = f; continue; } if ( !Q_stricmp( token, "saberRadius8" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[0].blade[7].radius = f; continue; } if ( !Q_stricmp( token, "saber2Radius" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } for ( n = 0; n < MAX_BLADES; n++ ) { NPC->client->saber[1].blade[n].radius = f; } continue; } if ( !Q_stricmp( token, "saber2Radius2" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[1].blade[1].radius = f; continue; } if ( !Q_stricmp( token, "saber2Radius3" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[1].blade[2].radius = f; continue; } if ( !Q_stricmp( token, "saber2Radius4" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[1].blade[3].radius = f; continue; } if ( !Q_stricmp( token, "saber2Radius5" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[1].blade[4].radius = f; continue; } if ( !Q_stricmp( token, "saber2Radius6" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[1].blade[5].radius = f; continue; } if ( !Q_stricmp( token, "saber2Radius7" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[1].blade[6].radius = f; continue; } if ( !Q_stricmp( token, "saber2Radius8" ) ) { if ( COM_ParseFloat( &p, &f ) ) { SkipRestOfLine( &p ); continue; } //cap if ( f < 0.25f ) { f = 0.25f; } NPC->client->saber[1].blade[7].radius = f; continue; } //ADD: //saber sounds (on, off, loop) //loop sound (like Vader's breathing or droid bleeps, etc.) //starting saber style if ( !Q_stricmp( token, "saberStyle" ) ) { if ( COM_ParseInt( &p, &n ) ) { SkipRestOfLine( &p ); continue; } //cap if ( n < 0 ) { n = 0; } else if ( n > 5 ) { n = 5; } NPC->client->ps.fd.saberAnimLevel = n; /* if ( parsingPlayer ) { cg.saberAnimLevelPending = n; } */ continue; } if ( !parsingPlayer ) { Com_Printf( "WARNING: unknown keyword '%s' while parsing '%s'\n", token, NPCName ); } SkipRestOfLine( &p ); } } /* Ghoul2 Insert Start */ if ( !md3Model ) { qboolean setTypeBack = qfalse; if (npcSaber1 == 0) { //use "kyle" for a default then npcSaber1 = G_ModelIndex("@Kyle"); WP_SaberParseParms< moduleType::game >( DEFAULT_SABER, &NPC->client->saber[0] ); } NPC->s.npcSaber1 = npcSaber1; NPC->s.npcSaber2 = npcSaber2; if (!customSkin[0]) { strcpy(customSkin, "default"); } if ( NPC->client && NPC->client->NPC_class == CLASS_VEHICLE ) { //vehicles want their names fed in as models //we put the $ in front to indicate a name and not a model strcpy(playerModel, va("$%s", NPCName)); } SetupGameGhoul2Model(NPC, playerModel, customSkin); if (!NPC->NPC_type) { //just do this for now so NPC_Precache can see the name. NPC->NPC_type = (char *)NPCName; setTypeBack = qtrue; } NPC_Precache(NPC); //this will just soundindex some values for sounds on the client, if (setTypeBack) { //don't want this being set if we aren't ready yet. NPC->NPC_type = NULL; } } else { Com_Printf("MD3 MODEL NPC'S ARE NOT SUPPORTED IN MP!\n"); return qfalse; } /* Ghoul2 Insert End */ /* if( NPCsPrecached ) {//Spawning in after initial precache, our models are precached, we just need to set our clientInfo CG_RegisterClientModels( NPC->s.number ); CG_RegisterNPCCustomSounds( ci ); CG_RegisterNPCEffects( NPC->client->playerTeam ); } */ //rwwFIXMEFIXME: Do something here I guess to properly precache stuff. return qtrue; } char npcParseBuffer[MAX_NPC_DATA_SIZE]; void NPC_LoadParms( void ) { int len, totallen, npcExtFNLen, fileCnt, i; // const char *filename = "ext_data/NPC2.cfg"; char /**buffer,*/ *holdChar, *marker; char npcExtensionListBuf[2048]; // The list of file names read in fileHandle_t f; len = 0; //remember where to store the next one totallen = len; marker = NPCParms+totallen; *marker = 0; //now load in the extra .npc extensions fileCnt = g_trap->FS_GetFileList("ext_data/NPCs", ".npc", npcExtensionListBuf, sizeof(npcExtensionListBuf) ); holdChar = npcExtensionListBuf; for ( i = 0; i < fileCnt; i++, holdChar += npcExtFNLen + 1 ) { npcExtFNLen = strlen( holdChar ); // Com_Printf( "Parsing %s\n", holdChar ); len = g_trap->FS_Open(va( "ext_data/NPCs/%s", holdChar), &f, FS_READ); if ( len == -1 ) { Com_Printf( "error reading file\n" ); } else { if ( totallen + len >= MAX_NPC_DATA_SIZE ) { g_trap->Error( ERR_DROP, "NPC extensions (*.npc) are too large" ); } g_trap->FS_Read(npcParseBuffer, len, f); npcParseBuffer[len] = 0; len = COM_Compress( npcParseBuffer ); strcat( marker, npcParseBuffer ); strcat(marker, "\n"); len++; g_trap->FS_Close(f); totallen += len; marker = NPCParms+totallen; //*marker = 0; //rww - make sure this is null or strcat will not append to the correct place //rww 12/19/02-actually the probelm was npcParseBuffer not being nul-term'd, which could cause issues in the strcat too } } }
mrwonko/Jedi-Academy--Renaissance
codemp/game/NPC_stats.cpp
C++
gpl-2.0
81,149
from termcolor import colored import cherrywasp.logger class CherryAccessPoint: """ An object that represents an Access Point seen in the environment. Inputs: - bssid(str) the MAC address of the device sending beacon frames - file_prefix(str) the file prefix to use when creating the .csv file. Returns: prints to console and .csv file. add_new_essid adds a new ESSID or network name to the list for the particular client. """ def __init__(self, bssid, file_prefix): self.type = "access_point" self.bssid = bssid self.beaconed_essid = set() self.log = cherrywasp.logger.CherryLogger() self.log.file_name_prefix = file_prefix # TODO: Add channel to the output & file. def add_new_beaconed_essid(self, new_essid): if new_essid not in self.beaconed_essid: self.beaconed_essid.add(new_essid) self.log.write_to_file("beacon", self.bssid, new_essid) return "[+] <{0}> is beaconing as {1}".format(colored(self.bssid, 'red'), colored(new_essid, 'green'))
ajackal/cherry-wasp
cherrywasp/accesspoint.py
Python
gpl-2.0
1,136
<?php /** * @author Gasper Kozak * @copyright 2007-2010 This file is part of WideImage. WideImage is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. WideImage is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with WideImage; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * @package Internal/Operations **/ /** * CopyChannelsTrueColor operation class * * Used to perform CopyChannels operation on truecolor images * * @package Internal/Operations */ class WideImage_Operation_CopyChannelsTrueColor { /** * Returns an image with only specified channels copied * * @param WideImage_Image $img * @param array $channels * @return WideImage_Image */ function execute($img, $channels) { $blank = array('red' => 0, 'green' => 0, 'blue' => 0, 'alpha' => 0); $width = $img->getWidth(); $height = $img->getHeight(); $copy = WideImage_TrueColorImage::create($width, $height); if (count($channels) > 0) for ($x = 0; $x < $width; $x++) for ($y = 0; $y < $height; $y++) { $RGBA = $img->getRGBAt($x, $y); $newRGBA = $blank; foreach ($channels as $channel) $newRGBA[$channel] = $RGBA[$channel]; $color = $copy->getExactColorAlpha($newRGBA); if ($color == -1) $color = $copy->allocateColorAlpha($newRGBA); $copy->setColorAt($x, $y, $color); } return $copy; } } ?>
tectronics/amoebacms
components/media/wideimage/Operation/CopyChannelsTrueColor.php
PHP
gpl-2.0
1,880
/* * Stellarium Telescope Control Plug-in * * Copyright (C) 2009 Bogdan Marinov (this file, * reusing code written by Johannes Gajdosik in 2006) * * Johannes Gajdosik wrote in 2006 the original telescope control feature * as a core module of Stellarium. In 2009 it was significantly extended with * GUI features and later split as an external plug-in module by Bogdan Marinov. * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. */ #include "TelescopeClientDirectLx200.hpp" #include "Lx200Connection.hpp" #include "Lx200Command.hpp" #include "common/LogFile.hpp" #include "StelCore.hpp" #include "StelUtils.hpp" #include <QRegularExpression> #include <QStringList> TelescopeClientDirectLx200::TelescopeClientDirectLx200 (const QString &name, const QString &parameters, Equinox eq) : TelescopeClient(name) , time_delay(0) , equinox(eq) , lx200(Q_NULLPTR) , long_format_used(false) , answers_received(false) , last_ra(0) , queue_get_position(true) , next_pos_time(0) { interpolatedPosition.reset(); //Extract parameters //Format: "serial_port_name:time_delay" QRegularExpression paramRx("^([^:]*):(\\d+)$"); QRegularExpressionMatch paramMatch=paramRx.match(parameters); QString serialDeviceName; if (paramMatch.hasMatch()) { // This RegExp only matches valid integers serialDeviceName = paramMatch.captured(1).trimmed(); time_delay = paramMatch.captured(2).toInt(); } else { qWarning() << "ERROR creating TelescopeClientDirectLx200: invalid parameters."; return; } qDebug() << "TelescopeClientDirectLx200 parameters: port, time_delay:" << serialDeviceName << time_delay; //Validation: Time delay if (time_delay <= 0 || time_delay > 10000000) { qWarning() << "ERROR creating TelescopeClientDirectLx200: time_delay not valid (should be less than 10000000)"; return; } //end_of_timeout = -0x8000000000000000LL; #ifdef Q_OS_WIN if(serialDeviceName.right(serialDeviceName.size() - 3).toInt() > 9) serialDeviceName = "\\\\.\\" + serialDeviceName;//"\\.\COMxx", not sure if it will work #endif //Q_OS_WIN //Try to establish a connection to the telescope lx200 = new Lx200Connection(*this, qPrintable(serialDeviceName)); if (lx200->isClosed()) { qWarning() << "ERROR creating TelescopeClientDirectLx200: cannot open serial device" << serialDeviceName; return; } // lx200 will be deleted in the destructor of Server addConnection(lx200); long_format_used = false; // unknown last_ra = 0; queue_get_position = true; next_pos_time = -0x8000000000000000LL; answers_received = false; } //! queues a GOTO command void TelescopeClientDirectLx200::telescopeGoto(const Vec3d &j2000Pos, StelObjectP selectObject) { Q_UNUSED(selectObject) if (!isConnected()) return; Vec3d position = j2000Pos; if (equinox == EquinoxJNow) { const StelCore* core = StelApp::getInstance().getCore(); position = core->j2000ToEquinoxEqu(j2000Pos, StelCore::RefractionOff); } const double ra_signed = atan2(position[1], position[0]); //Workaround for the discrepancy in precision between Windows/Linux/PPC Macs and Intel Macs: const double ra = (ra_signed >= 0) ? ra_signed : (ra_signed + 2.0 * M_PI); const double dec = atan2(position[2], std::sqrt(position[0]*position[0]+position[1]*position[1])); unsigned int ra_int = static_cast<unsigned int>(floor(0.5 + ra*(static_cast<unsigned int>(0x80000000)/M_PI))); int dec_int = static_cast<int>(floor(0.5 + dec*(static_cast<unsigned int>(0x80000000)/M_PI))); gotoReceived(ra_int, dec_int); } void TelescopeClientDirectLx200::telescopeSync(const Vec3d &j2000Pos, StelObjectP selectObject) { Q_UNUSED(selectObject) if (!isConnected()) return; Vec3d position = j2000Pos; if (equinox == EquinoxJNow) { const StelCore* core = StelApp::getInstance().getCore(); position = core->j2000ToEquinoxEqu(j2000Pos, StelCore::RefractionOff); } const double ra_signed = atan2(position[1], position[0]); //Workaround for the discrepancy in precision between Windows/Linux/PPC Macs and Intel Macs: const double ra = (ra_signed >= 0) ? ra_signed : (ra_signed + 2.0 * M_PI); const double dec = atan2(position[2], std::sqrt(position[0]*position[0]+position[1]*position[1])); unsigned int ra_int = static_cast<unsigned int>(floor(0.5 + ra*(static_cast<unsigned int>(0x80000000)/M_PI))); int dec_int = static_cast<int>(floor(0.5 + dec*(static_cast<unsigned int>(0x80000000)/M_PI))); syncReceived(ra_int, dec_int); } void TelescopeClientDirectLx200::gotoReceived(unsigned int ra_int, int dec_int) { lx200->sendGoto(ra_int, dec_int); } void TelescopeClientDirectLx200::syncReceived(unsigned int ra_int, int dec_int) { lx200->sendSync(ra_int, dec_int); } //! estimates where the telescope is by interpolation in the stored //! telescope positions: Vec3d TelescopeClientDirectLx200::getJ2000EquatorialPos(const StelCore*) const { const qint64 now = getNow() - time_delay; return interpolatedPosition.get(now); } bool TelescopeClientDirectLx200::prepareCommunication() { //TODO: Nothing to prepare? return true; } void TelescopeClientDirectLx200::performCommunication() { step(10000); } void TelescopeClientDirectLx200::communicationResetReceived(void) { long_format_used = false; queue_get_position = true; next_pos_time = -0x8000000000000000LL; #ifndef QT_NO_DEBUG *log_file << Now() << "TelescopeClientDirectLx200::communicationResetReceived" << StelUtils::getEndLineChar(); #endif if (answers_received) { closeAcceptedConnections(); answers_received = false; } } //! Called in Lx200CommandGetRa and Lx200CommandGetDec. void TelescopeClientDirectLx200::longFormatUsedReceived(bool long_format) { answers_received = true; if (!long_format_used && !long_format) { lx200->sendCommand(new Lx200CommandToggleFormat(*this)); } long_format_used = true; } //! Called by Lx200CommandGetRa::readAnswerFromBuffer(). void TelescopeClientDirectLx200::raReceived(unsigned int ra_int) { answers_received = true; last_ra = ra_int; #ifndef QT_NO_DEBUG *log_file << Now() << "TelescopeClientDirectLx200::raReceived: " << ra_int << StelUtils::getEndLineChar(); #endif } //! Called by Lx200CommandGetDec::readAnswerFromBuffer(). //! Should be called after raReceived(), as it contains a call to sendPosition(). void TelescopeClientDirectLx200::decReceived(unsigned int dec_int) { answers_received = true; #ifndef QT_NO_DEBUG *log_file << Now() << "TelescopeClientDirectLx200::decReceived: " << dec_int << StelUtils::getEndLineChar(); #endif const int lx200_status = 0; sendPosition(last_ra, static_cast<int>(dec_int), lx200_status); queue_get_position = true; } void TelescopeClientDirectLx200::step(long long int timeout_micros) { long long int now = GetNow(); if (queue_get_position && now >= next_pos_time) { lx200->sendCommand(new Lx200CommandGetRa(*this)); lx200->sendCommand(new Lx200CommandGetDec(*this)); queue_get_position = false; next_pos_time = now + 500000;// 500000; } Server::step(timeout_micros); } bool TelescopeClientDirectLx200::isConnected(void) const { return (!lx200->isClosed());//TODO } bool TelescopeClientDirectLx200::isInitialized(void) const { return (!lx200->isClosed()); } //Merged from Connection::sendPosition() and TelescopeTCP::performReading() void TelescopeClientDirectLx200::sendPosition(unsigned int ra_int, int dec_int, int status) { //Server time is "now", because this class is the server const qint64 server_micros = static_cast<qint64>(getNow()); const double ra = ra_int * (M_PI/0x80000000u); const double dec = dec_int * (M_PI/0x80000000u); const double cdec = cos(dec); Vec3d position(cos(ra)*cdec, sin(ra)*cdec, sin(dec)); Vec3d j2000Position = position; if (equinox == EquinoxJNow) { const StelCore* core = StelApp::getInstance().getCore(); j2000Position = core->equinoxEquToJ2000(position, StelCore::RefractionOff); } interpolatedPosition.add(j2000Position, getNow(), server_micros, status); }
Stellarium/stellarium
plugins/TelescopeControl/src/Lx200/TelescopeClientDirectLx200.cpp
C++
gpl-2.0
8,607